Skip to content

Commit 31ae57b

Browse files
committed
Fix #2429: fix true exhaustivity warnings
1 parent 9f8c089 commit 31ae57b

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
lines changed

compiler/src/dotty/tools/dotc/transform/PatternMatcher.scala

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -351,15 +351,17 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {
351351
/* (Nil, body) means that `body` is the default case
352352
* It's a bit hacky but it simplifies manipulations.
353353
*/
354-
def extractSwitchCase(treeMakers: List[TreeMaker]): (List[Int], BodyTreeMaker) = treeMakers match {
354+
def extractSwitchCase(treeMakers: List[TreeMaker]): (List[Int], BodyTreeMaker) = (treeMakers: @unchecked) match {
355355
// case 5 =>
356356
case List(IntEqualityTestTreeMaker(intValue), body: BodyTreeMaker) =>
357357
(List(intValue), body)
358358

359359
// case 5 | 6 =>
360360
case List(AlternativesTreeMaker(_, alts, _), body: BodyTreeMaker) =>
361-
val intValues = alts.map {
362-
case List(IntEqualityTestTreeMaker(intValue)) => intValue
361+
val intValues = alts.map { alt =>
362+
(alt: @unchecked) match {
363+
case List(IntEqualityTestTreeMaker(intValue)) => intValue
364+
}
363365
}
364366
(intValues, body)
365367

doc-tool/src/dotty/tools/dottydoc/model/comment/BodyEntities.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ final case class Text(text: String) extends Inline
6464
abstract class EntityLink(val title: Inline) extends Inline { def link: LinkTo }
6565
object EntityLink {
6666
def apply(title: Inline, linkTo: LinkTo) = new EntityLink(title) { def link: LinkTo = linkTo }
67-
def unapply(el: EntityLink): Option[(Inline, LinkTo)] = Some((el.title, el.link))
67+
def unapply(el: EntityLink): Some[(Inline, LinkTo)] = Some((el.title, el.link))
6868
}
6969
final case class HtmlTag(data: String) extends Inline {
7070
private val Pattern = """(?ms)\A<(/?)(.*?)[\s>].*\z""".r

doc-tool/src/dotty/tools/dottydoc/staticsite/tags.scala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ object tags {
104104
title
105105

106106
case ConstantReference(title) => title
107+
108+
case _ => // EmptyReference
109+
ctx.docbase.error(s"invalid reference: $ref")
110+
null
107111
}
108112
override def render(tctx: TemplateContext, nodes: LNode*): AnyRef = nodes(0).render(tctx) match {
109113
case map: JMap[String, AnyRef] @unchecked =>

doc-tool/src/dotty/tools/dottydoc/util/MemberLookup.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ trait MemberLookup {
7777
case (x :: xs, _) =>
7878
if (xs.nonEmpty) globalLookup
7979
else lookup(entity, packages, "scala." + query)
80+
case (Nil, _) => ??? // impossible as long as query is not empty
8081
}
8182
}
8283

0 commit comments

Comments
 (0)