Skip to content

Commit aa328a9

Browse files
committed
Add missing case in TypeComparer
We previously always failed for a situation like [X] => T <:< C unless the lhs was an eta-expansion.
1 parent 6997fc4 commit aa328a9

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -574,8 +574,15 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
574574
isNewSubType(tp1.parent, tp2)
575575
case tp1 @ HKApply(tycon1, args1) =>
576576
compareHkApply1(tp1, tycon1, args1, tp2)
577-
case EtaExpansion(tycon1) =>
578-
isSubType(tycon1, tp2)
577+
case tp1: HKTypeLambda =>
578+
def compareHKLambda = tp1 match {
579+
case EtaExpansion(tycon1) => isSubType(tycon1, tp2)
580+
case _ => tp2 match {
581+
case tp2: HKTypeLambda => false // this case was covered in thirdTry
582+
case _ => tp2.isHK && isSubType(tp1.resultType, tp2.appliedTo(tp1.paramRefs))
583+
}
584+
}
585+
compareHKLambda
579586
case AndType(tp11, tp12) =>
580587
// Rewrite (T111 | T112) & T12 <: T2 to (T111 & T12) <: T2 and (T112 | T12) <: T2
581588
// and analogously for T11 & (T121 | T122) & T12 <: T2

0 commit comments

Comments
 (0)