File tree 2 files changed +5
-2
lines changed
compiler/src/dotty/tools/dotc/transform/patmat
2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -521,7 +521,9 @@ class SpaceEngine(using Context) extends SpaceLogic {
521
521
}
522
522
523
523
def isSameUnapply (tp1 : TermRef , tp2 : TermRef ): Boolean =
524
- tp1.prefix.isStable && tp2.prefix.isStable && tp1 =:= tp2
524
+ // always assume two TypeTest[S, T].unapply are the same if they are equal in types
525
+ (tp1.prefix.isStable && tp2.prefix.isStable || tp1.symbol == defn.TypeTest_unapply )
526
+ && tp1 =:= tp2
525
527
526
528
/** Parameter types of the case class type `tp`. Adapted from `unapplyPlan` in patternMatcher */
527
529
def signature (unapp : TermRef , scrutineeTp : Type , argLen : Int ): List [Type ] = {
@@ -590,7 +592,7 @@ class SpaceEngine(using Context) extends SpaceLogic {
590
592
/** Whether the extractor covers the given type */
591
593
def covers (unapp : TermRef , scrutineeTp : Type ): Boolean =
592
594
SpaceEngine .isIrrefutable(unapp) || unapp.symbol == defn.TypeTest_unapply && {
593
- val AppliedType (_, _ :: tp :: Nil ) = unapp.prefix.widen
595
+ val AppliedType (_, _ :: tp :: Nil ) = unapp.prefix.widen.dealias
594
596
scrutineeTp <:< tp
595
597
}
596
598
Original file line number Diff line number Diff line change
1
+ 19: Pattern Match Exhaustivity: _: TypeDef
You can’t perform that action at this time.
0 commit comments