Skip to content

Commit 58f46fe

Browse files
committed
Add missing case to TypeComparer
The missing case was for hk-type ref <:< hk type lambda E.g. type Y[X] Foo[Y] <:< Foo[[T] => Y[T]]
1 parent e1d2d56 commit 58f46fe

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

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

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -475,12 +475,17 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
475475
isSubType(tp1.resType, tp2.resType.subst(tp2, tp1))
476476
finally comparedTypeLambdas = saved
477477
case _ =>
478-
if (!tp1.isHK) {
479-
tp2 match {
480-
case EtaExpansion(tycon2) if tycon2.symbol.isClass =>
481-
return isSubType(tp1, tycon2)
482-
case _ =>
483-
}
478+
if (tp1.isHK) {
479+
val tparams1 = tp1.typeParams
480+
return isSubType(
481+
HKTypeLambda.fromParams(tparams1, tp1.appliedTo(tparams1.map(_.paramRef))),
482+
tp2
483+
)
484+
}
485+
else tp2 match {
486+
case EtaExpansion(tycon2) if tycon2.symbol.isClass =>
487+
return isSubType(tp1, tycon2)
488+
case _ =>
484489
}
485490
fourthTry(tp1, tp2)
486491
}

0 commit comments

Comments
 (0)