Skip to content

Commit

Permalink
Widen skolem in scrutinee when reducing or comparing match types
Browse files Browse the repository at this point in the history
Co-Authored-By: Dale Wijnand <[email protected]>
  • Loading branch information
mbovel and dwijnand committed Jun 21, 2023
1 parent 0258dc3 commit a47a547
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/core/TypeComparer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1007,7 +1007,7 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
case tp1: MatchType =>
def compareMatch = tp2 match {
case tp2: MatchType =>
isSameType(tp1.scrutinee, tp2.scrutinee) &&
isSameType(tp1.scrutinee.widenSkolem, tp2.scrutinee.widenSkolem) &&
tp1.cases.corresponds(tp2.cases)(isSubType)
case _ => false
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/core/Types.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4954,7 +4954,7 @@ object Types {
trace(i"reduce match type $this $hashCode", matchTypes, show = true) {
def matchCases(cmp: TrackingTypeComparer): Type =
val saved = ctx.typerState.snapshot()
try cmp.matchCases(scrutinee.normalized, cases)
try cmp.matchCases(scrutinee.normalized.widenSkolem, cases)
catch case ex: Throwable =>
handleRecursive("reduce type ", i"$scrutinee match ...", ex)
finally
Expand Down

0 comments on commit a47a547

Please sign in to comment.