Skip to content

Commit cd2e68d

Browse files
committed
treat synthetic extractors as exhaustive
1 parent ced4aa5 commit cd2e68d

File tree

1 file changed

+4
-3
lines changed
  • compiler/src/dotty/tools/dotc/transform/patmat

1 file changed

+4
-3
lines changed

compiler/src/dotty/tools/dotc/transform/patmat/Space.scala

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -370,8 +370,9 @@ class SpaceEngine(implicit ctx: Context) extends SpaceLogic {
370370
}
371371

372372
/* Whether the extractor method type is irrefutable */
373-
def irrefutable(mt: Type): Boolean = {
374-
mt.resultType.isRef(scalaSomeClass) // TODO: optionless patmat
373+
def irrefutable(unapp: tpd.Tree): Boolean = {
374+
// TODO: optionless patmat
375+
unapp.tpe.resultType.isRef(scalaSomeClass) || (unapp.symbol.is(allOf(Synthetic, Case)))
375376
}
376377

377378
/** Return the space that represents the pattern `pat`
@@ -391,7 +392,7 @@ class SpaceEngine(implicit ctx: Context) extends SpaceLogic {
391392
if (fun.symbol.name == nme.unapplySeq)
392393
projectSeq(pats)
393394
else
394-
Prod(pat.tpe.stripAnnots, fun.tpe, fun.symbol, pats.map(pat => project(pat)), irrefutable(fun.tpe))
395+
Prod(pat.tpe.stripAnnots, fun.tpe, fun.symbol, pats.map(pat => project(pat)), irrefutable(fun))
395396
case Typed(pat @ UnApply(_, _, _), _) => project(pat)
396397
case Typed(expr, _) => Typ(expr.tpe.stripAnnots, true)
397398
case _ =>

0 commit comments

Comments
 (0)