@@ -428,9 +428,9 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
428
428
compareRec
429
429
case tp2 @ HKApply (tycon2, args2) =>
430
430
compareHkApply2(tp1, tp2, tycon2, args2)
431
- case tp2 @ PolyType (tparams2, body2) =>/*###*/
432
- def compareHkLambda : Boolean = tp1.stripTypeVar match {
433
- case tp1 @ PolyType (tparams1, body1) =>/*###*/
431
+ case tp2 : TypeLambda =>
432
+ def compareTypeLambda : Boolean = tp1.stripTypeVar match {
433
+ case tp1 : TypeLambda if tp1. isInstanceOf [ PolyType ] == tp2. isInstanceOf [ PolyType ] =>
434
434
/* Don't compare bounds of lambdas under language:Scala2, or t2994 will fail
435
435
* The issue is that, logically, bounds should compare contravariantly,
436
436
* but that would invalidate a pattern exploited in t2994:
@@ -446,15 +446,15 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
446
446
*/
447
447
def boundsOK =
448
448
ctx.scala2Mode ||
449
- tparams1. corresponds(tparams2 )((tparam1, tparam2) =>
449
+ tp1.typeParams. corresponds(tp2.typeParams )((tparam1, tparam2) =>
450
450
isSubType(tparam2.paramInfo.subst(tp2, tp1), tparam1.paramInfo))
451
451
val saved = comparedTypeLambdas
452
452
comparedTypeLambdas += tp1
453
453
comparedTypeLambdas += tp2
454
454
try
455
- variancesConform(tparams1, tparams2 ) &&
455
+ variancesConform(tp1.typeParams, tp2.typeParams ) &&
456
456
boundsOK &&
457
- isSubType(body1, body2 .subst(tp2, tp1))
457
+ isSubType(tp1.resType, tp2.resType .subst(tp2, tp1))
458
458
finally comparedTypeLambdas = saved
459
459
case _ =>
460
460
if (! tp1.isHK) {
@@ -466,7 +466,7 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
466
466
}
467
467
fourthTry(tp1, tp2)
468
468
}
469
- compareHkLambda
469
+ compareTypeLambda
470
470
case OrType (tp21, tp22) =>
471
471
// Rewrite T1 <: (T211 & T212) | T22 to T1 <: (T211 | T22) and T1 <: (T212 | T22)
472
472
// and analogously for T1 <: T21 | (T221 & T222)
0 commit comments