From 446240b19baba3ca85c20ad2df2aa6b5221c9867 Mon Sep 17 00:00:00 2001 From: Matt Bovel Date: Thu, 1 Jun 2023 13:44:27 +0200 Subject: [PATCH] Normalize types in compareAtoms --- compiler/src/dotty/tools/dotc/core/TypeComparer.scala | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/core/TypeComparer.scala b/compiler/src/dotty/tools/dotc/core/TypeComparer.scala index 7a2722547531..7cae7a905ad5 100644 --- a/compiler/src/dotty/tools/dotc/core/TypeComparer.scala +++ b/compiler/src/dotty/tools/dotc/core/TypeComparer.scala @@ -1579,9 +1579,9 @@ 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)) @@ -1589,11 +1589,7 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling 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