Skip to content

Commit 27154fa

Browse files
committed
Compare RecTypes earlier
We need to align RecTypes before comparing any wrapped CapturingTypes
1 parent 7987429 commit 27154fa

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,14 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
367367
case tp2: LazyRef =>
368368
isBottom(tp1)
369369
|| !tp2.evaluating && recur(tp1, tp2.ref)
370+
case tp2: RecType =>
371+
def compareRec = tp1.safeDealias match
372+
case tp1: RecType =>
373+
val rthis1 = tp1.recThis
374+
recur(tp1.parent, tp2.parent.substRecThis(tp2, rthis1))
375+
case _ =>
376+
secondTry
377+
compareRec
370378
case CapturingType(_, _) =>
371379
secondTry
372380
case tp2: AnnotatedType if !tp2.isRefining =>
@@ -719,7 +727,7 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
719727
compareRefined
720728
case tp2: RecType =>
721729
def compareRec = tp1.safeDealias match {
722-
case tp1: RecType =>
730+
case tp1: RecType => // TODO this is now also in firstTry, needed here?
723731
val rthis1 = tp1.recThis
724732
recur(tp1.parent, tp2.parent.substRecThis(tp2, rthis1))
725733
case NoType => false

0 commit comments

Comments
 (0)