Skip to content

Commit 144d554

Browse files
committed
Document why we test for Java eta expansions in TypeComparer
1 parent 6614628 commit 144d554

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -606,10 +606,10 @@ class TypeComparer(initctx: Context) extends ConstraintHandling[AbsentContext] w
606606
return recur(tp1.EtaExpand(tparams1), tp2) || fourthTry
607607
tp2 match {
608608
case EtaExpansion(tycon2) if tycon2.symbol.isClass && tycon2.symbol.is(JavaDefined) =>
609-
return recur(tp1, tycon2)
609+
recur(tp1, tycon2) || fourthTry
610610
case _ =>
611+
fourthTry
611612
}
612-
fourthTry
613613
}
614614
compareTypeLambda
615615
case OrType(tp21, tp22) =>
@@ -774,6 +774,8 @@ class TypeComparer(initctx: Context) extends ConstraintHandling[AbsentContext] w
774774
case tp1: HKTypeLambda =>
775775
def compareHKLambda = tp1 match {
776776
case EtaExpansion(tycon1) if tycon1.symbol.isClass && tycon1.symbol.is(JavaDefined) =>
777+
// It's a raw type that was mistakenly eta-expanded to a hk-type.
778+
// This can happen because we do not cook types coming from Java sources
777779
recur(tycon1, tp2)
778780
case _ => tp2 match {
779781
case tp2: HKTypeLambda => false // this case was covered in thirdTry

0 commit comments

Comments
 (0)