diff --git a/compiler/src/dotty/tools/dotc/core/TypeComparer.scala b/compiler/src/dotty/tools/dotc/core/TypeComparer.scala index 9152d6d38a51..f50d1a9a9896 100644 --- a/compiler/src/dotty/tools/dotc/core/TypeComparer.scala +++ b/compiler/src/dotty/tools/dotc/core/TypeComparer.scala @@ -171,6 +171,8 @@ class TypeComparer(initctx: Context) extends ConstraintHandling[AbsentContext] { derefCount += 1 if (derefCount >= DerefLimit) NoType else try mapOver(t.ref) finally derefCount -= 1 + case tp: TypeVar => + tp case _ => mapOver(t) } diff --git a/tests/pos/i5666.scala b/tests/pos/i5666.scala new file mode 100644 index 000000000000..fb4be4e02da3 --- /dev/null +++ b/tests/pos/i5666.scala @@ -0,0 +1,20 @@ +// This file should still compile if Config.LogPrendingSubtypesthreshold is set to 9. +sealed trait HList +trait HNil extends HList +trait HCons[+H, +T] extends HList + +trait Concat[L1, L2] { type Out } +object Concat { + implicit def i0[L]: + Concat[HNil, L] { type Out = L } = null + + implicit def i1[H, T, L, O] + (implicit c: Concat[T, L] { type Out = O }): + Concat[HCons[H, T], L] { type Out = HCons[H, O] } = null +} + +object Test { + type L1 = HCons[Unit, HNil] + + implicitly[Concat[L1, L1]] +} \ No newline at end of file