@@ -605,7 +605,7 @@ class TypeComparer(initctx: Context) extends ConstraintHandling[AbsentContext] w
605
605
if (tparams1.nonEmpty)
606
606
return recur(tp1.EtaExpand (tparams1), tp2) || fourthTry
607
607
tp2 match {
608
- case EtaExpansion (tycon2) if tycon2.symbol.isClass =>
608
+ case EtaExpansion (tycon2) if tycon2.symbol.isClass && tycon2.symbol.is( JavaDefined ) =>
609
609
return recur(tp1, tycon2)
610
610
case _ =>
611
611
}
@@ -773,7 +773,8 @@ class TypeComparer(initctx: Context) extends ConstraintHandling[AbsentContext] w
773
773
isNewSubType(tp1.parent)
774
774
case tp1 : HKTypeLambda =>
775
775
def compareHKLambda = tp1 match {
776
- case EtaExpansion (tycon1) => recur(tycon1, tp2)
776
+ case EtaExpansion (tycon1) if tycon1.symbol.isClass && tycon1.symbol.is(JavaDefined ) =>
777
+ recur(tycon1, tp2)
777
778
case _ => tp2 match {
778
779
case tp2 : HKTypeLambda => false // this case was covered in thirdTry
779
780
case _ => tp2.typeParams.hasSameLengthAs(tp1.paramRefs) && isSubType(tp1.resultType, tp2.appliedTo(tp1.paramRefs))
@@ -2591,7 +2592,11 @@ class ExplainingTypeComparer(initctx: Context) extends TypeComparer(initctx) {
2591
2592
}
2592
2593
2593
2594
override def isSubType (tp1 : Type , tp2 : Type , approx : ApproxState ): Boolean =
2594
- traceIndented(s " ${show(tp1)} <:< ${show(tp2)}${if (Config .verboseExplainSubtype) s " ${tp1.getClass} ${tp2.getClass}" else " " } $approx ${if (frozenConstraint) " frozen" else " " }" ) {
2595
+ def moreInfo =
2596
+ if Config .verboseExplainSubtype || ctx.settings.verbose.value
2597
+ then s " ${tp1.getClass} ${tp2.getClass}"
2598
+ else " "
2599
+ traceIndented(s " ${show(tp1)} <:< ${show(tp2)}$moreInfo $approx ${if (frozenConstraint) " frozen" else " " }" ) {
2595
2600
super .isSubType(tp1, tp2, approx)
2596
2601
}
2597
2602
0 commit comments