@@ -97,7 +97,7 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling wi
9797 try {
9898 recCount = recCount + 1
9999 val result =
100- if (recCount < LogPendingSubTypesThreshold ) firstTry(tp1, tp2)
100+ if (recCount < Config . LogPendingSubTypesThreshold ) firstTry(tp1, tp2)
101101 else monitoredIsSubType(tp1, tp2)
102102 recCount = recCount - 1
103103 if (! result) constraint = saved
@@ -345,7 +345,7 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling wi
345345 || fourthTry(tp1, tp2)
346346 )
347347 normalPath ||
348- needsEtaLift(tp1, tp2) && tp1.testLifted(tp2.typeParams, isSubType(_, tp2))
348+ needsEtaLift(tp1, tp2) && tp1.testLifted(tp2.typeParams, isSubType(_, tp2), classBounds(tp2) )
349349 }
350350 else // fast path, in particular for refinements resulting from parameterization.
351351 isSubType(tp1, skipped2) &&
@@ -453,7 +453,7 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling wi
453453 isNewSubType(tp1.underlying.widenExpr, tp2) || comparePaths
454454 case tp1 : RefinedType =>
455455 isNewSubType(tp1.parent, tp2) ||
456- needsEtaLift(tp2, tp1) && tp2.testLifted(tp1.typeParams, isSubType(tp1, _))
456+ needsEtaLift(tp2, tp1) && tp2.testLifted(tp1.typeParams, isSubType(tp1, _), Nil )
457457 case AndType (tp11, tp12) =>
458458 eitherIsSubType(tp11, tp2, tp12, tp2)
459459 case JavaArrayType (elem1) =>
@@ -475,9 +475,13 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling wi
475475 val lambda = projection.prefix.LambdaClass (forcing = true )
476476 lambda.exists && ! other.isLambda &&
477477 other.testLifted(lambda.typeParams,
478- if (inOrder) isSubType(projection.prefix, _) else isSubType(_, projection.prefix))
478+ if (inOrder) isSubType(projection.prefix, _) else isSubType(_, projection.prefix),
479+ if (inOrder) Nil else classBounds(projection.prefix))
479480 }
480481
482+ /** The class symbols bounding the type of the `Apply` member of `tp` */
483+ private def classBounds (tp : Type ) = tp.member(tpnme.Apply ).info.classSymbols
484+
481485 /** Returns true iff either `tp11 <:< tp21` or `tp12 <:< tp22`, trying at the same time
482486 * to keep the constraint as wide as possible. Specifically, if
483487 *
@@ -1141,13 +1145,13 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling wi
11411145 }
11421146
11431147 /** Show subtype goal that led to an assertion failure */
1144- def showGoal (tp1 : Type , tp2 : Type ) = {
1145- println(disambiguated(implicit ctx => s " assertion failure for ${tp1.show} <:< ${tp2.show}, frozen = $frozenConstraint" ))
1148+ def showGoal (tp1 : Type , tp2 : Type )( implicit ctx : Context ) = {
1149+ ctx. println(disambiguated(implicit ctx => s " assertion failure for ${tp1.show} <:< ${tp2.show}, frozen = $frozenConstraint" ))
11461150 def explainPoly (tp : Type ) = tp match {
1147- case tp : PolyParam => println(s " polyparam ${tp.show} found in ${tp.binder.show}" )
1148- case tp : TypeRef if tp.symbol.exists => println(s " typeref ${tp.show} found in ${tp.symbol.owner.show}" )
1149- case tp : TypeVar => println(s " typevar ${tp.show}, origin = ${tp.origin}" )
1150- case _ => println(s " ${tp.show} is a ${tp.getClass}" )
1151+ case tp : PolyParam => ctx. println(s " polyparam ${tp.show} found in ${tp.binder.show}" )
1152+ case tp : TypeRef if tp.symbol.exists => ctx. println(s " typeref ${tp.show} found in ${tp.symbol.owner.show}" )
1153+ case tp : TypeVar => ctx. println(s " typevar ${tp.show}, origin = ${tp.origin}" )
1154+ case _ => ctx. println(s " ${tp.show} is a ${tp.getClass}" )
11511155 }
11521156 explainPoly(tp1)
11531157 explainPoly(tp2)
0 commit comments