File tree Expand file tree Collapse file tree 2 files changed +5
-2
lines changed
compiler/src/dotty/tools/dotc/transform/patmat Expand file tree Collapse file tree 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 {
521521 }
522522
523523 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
525527
526528 /** Parameter types of the case class type `tp`. Adapted from `unapplyPlan` in patternMatcher */
527529 def signature (unapp : TermRef , scrutineeTp : Type , argLen : Int ): List [Type ] = {
@@ -590,7 +592,7 @@ class SpaceEngine(using Context) extends SpaceLogic {
590592 /** Whether the extractor covers the given type */
591593 def covers (unapp : TermRef , scrutineeTp : Type ): Boolean =
592594 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
594596 scrutineeTp <:< tp
595597 }
596598
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