Skip to content

Commit a47a547

Browse files
mboveldwijnand
andcommitted
Widen skolem in scrutinee when reducing or comparing match types
Co-Authored-By: Dale Wijnand <dale.wijnand@gmail.com>
1 parent 0258dc3 commit a47a547

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

compiler/src/dotty/tools/dotc/core/TypeComparer.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1007,7 +1007,7 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
10071007
case tp1: MatchType =>
10081008
def compareMatch = tp2 match {
10091009
case tp2: MatchType =>
1010-
isSameType(tp1.scrutinee, tp2.scrutinee) &&
1010+
isSameType(tp1.scrutinee.widenSkolem, tp2.scrutinee.widenSkolem) &&
10111011
tp1.cases.corresponds(tp2.cases)(isSubType)
10121012
case _ => false
10131013
}

compiler/src/dotty/tools/dotc/core/Types.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4954,7 +4954,7 @@ object Types {
49544954
trace(i"reduce match type $this $hashCode", matchTypes, show = true) {
49554955
def matchCases(cmp: TrackingTypeComparer): Type =
49564956
val saved = ctx.typerState.snapshot()
4957-
try cmp.matchCases(scrutinee.normalized, cases)
4957+
try cmp.matchCases(scrutinee.normalized.widenSkolem, cases)
49584958
catch case ex: Throwable =>
49594959
handleRecursive("reduce type ", i"$scrutinee match ...", ex)
49604960
finally

0 commit comments

Comments
 (0)