File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed
compiler/src/dotty/tools/dotc/core Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -1007,10 +1007,18 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
10071007 case tp1 : MatchType =>
10081008 def compareMatch = tp2 match {
10091009 case tp2 : MatchType =>
1010- val scrutinee1 = tp1.scrutinee match
1011- case tp : TermRef if tp.symbol.is(InlineProxy ) => tp.info
1012- case tp => tp.widenSkolem
1013- isSameType(scrutinee1, tp2.scrutinee) &&
1010+ // we allow a small number of scrutinee types to be widened:
1011+ // * skolems, which may appear from type avoidance, but are widened in the inferred result type
1012+ // * inline proxies, which is inlining's solution to the same problem
1013+ def widenScrutinee (scrutinee1 : Type ) = scrutinee1 match
1014+ case tp : TermRef if tp.symbol.is(InlineProxy ) => tp.info
1015+ case tp => tp.widenSkolem
1016+ def checkScrutinee (scrutinee1 : Type ): Boolean =
1017+ isSameType(scrutinee1, tp2.scrutinee) || {
1018+ val widenScrutinee1 = widenScrutinee(scrutinee1)
1019+ (widenScrutinee1 ne scrutinee1) && checkScrutinee(widenScrutinee1)
1020+ }
1021+ checkScrutinee(tp1.scrutinee) &&
10141022 tp1.cases.corresponds(tp2.cases)(isSubType)
10151023 case _ => false
10161024 }
You can’t perform that action at this time.
0 commit comments