@@ -605,7 +605,7 @@ class TypeComparer(initctx: Context) extends ConstraintHandling[AbsentContext] w
605605 if (tparams1.nonEmpty)
606606 return recur(tp1.EtaExpand (tparams1), tp2) || fourthTry
607607 tp2 match {
608- case EtaExpansion (tycon2) if tycon2.symbol.isClass =>
608+ case EtaExpansion (tycon2) if tycon2.symbol.isClass && tycon2.symbol.is( JavaDefined ) =>
609609 return recur(tp1, tycon2)
610610 case _ =>
611611 }
@@ -773,7 +773,8 @@ class TypeComparer(initctx: Context) extends ConstraintHandling[AbsentContext] w
773773 isNewSubType(tp1.parent)
774774 case tp1 : HKTypeLambda =>
775775 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)
777778 case _ => tp2 match {
778779 case tp2 : HKTypeLambda => false // this case was covered in thirdTry
779780 case _ => tp2.typeParams.hasSameLengthAs(tp1.paramRefs) && isSubType(tp1.resultType, tp2.appliedTo(tp1.paramRefs))
@@ -2591,7 +2592,11 @@ class ExplainingTypeComparer(initctx: Context) extends TypeComparer(initctx) {
25912592 }
25922593
25932594 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 " " }" ) {
25952600 super .isSubType(tp1, tp2, approx)
25962601 }
25972602
0 commit comments