Skip to content

Commit

Permalink
Normalize types in compareAtoms
Browse files Browse the repository at this point in the history
  • Loading branch information
mbovel committed Jun 1, 2023
1 parent 3a49d59 commit 446240b
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions compiler/src/dotty/tools/dotc/core/TypeComparer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1579,21 +1579,17 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
finally canCompareAtoms = true
result

tp2.atoms match
tp2.normalized.atoms match
case Atoms.Range(lo2, hi2) if canCompareAtoms && canCompare(hi2) =>
tp1.atoms match
tp1.normalized.atoms match
case Atoms.Range(lo1, hi1) =>
if hi1.subsetOf(lo2) || knownSingletons && hi2.size == 1 && hi1 == hi2 then
Some(verified(true))
else if !lo1.subsetOf(hi2) then
Some(verified(false))
else
None
case Atoms.Unknown =>
if knownSingletons then
Some(verified(recur(tp1, NothingType)))
else
None
case _ => Some(verified(recur(tp1, NothingType)))
case _ => None

/** Subtype test for corresponding arguments in `args1`, `args2` according to
Expand Down

0 comments on commit 446240b

Please sign in to comment.