@@ -1427,12 +1427,13 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
1427
1427
private def liftIfHK (tp1 : Type , tp2 : Type , op : (Type , Type ) => Type , original : (Type , Type ) => Type ) = {
1428
1428
val tparams1 = tp1.typeParams
1429
1429
val tparams2 = tp2.typeParams
1430
+ def applied (tp : Type ) = tp.appliedTo(tp.typeParams.map(_.paramInfoAsSeenFrom(tp)))
1430
1431
if (tparams1.isEmpty)
1431
1432
if (tparams2.isEmpty) op(tp1, tp2)
1432
- else original(tp1, tp2.appliedTo (tp2.typeParams.map(_.paramInfoAsSeenFrom(tp2)) ))
1433
+ else original(tp1, applied (tp2))
1433
1434
else if (tparams2.isEmpty)
1434
- original(tp1.appliedTo (tp1.typeParams.map(_.paramInfoAsSeenFrom(tp1)) ), tp2)
1435
- else
1435
+ original(applied (tp1), tp2)
1436
+ else if (tparams1.hasSameLengthAs(tparams2))
1436
1437
HKTypeLambda (
1437
1438
paramNames = (HKTypeLambda .syntheticParamNames(tparams1.length), tparams1, tparams2)
1438
1439
.zipped.map((pname, tparam1, tparam2) =>
@@ -1442,6 +1443,7 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
1442
1443
tl.integrate(tparams2, tparam2.paramInfoAsSeenFrom(tp2)).bounds),
1443
1444
resultTypeExp = tl =>
1444
1445
original(tp1.appliedTo(tl.paramRefs), tp2.appliedTo(tl.paramRefs)))
1446
+ else original(applied(tp1), applied(tp2))
1445
1447
}
1446
1448
1447
1449
/** Try to distribute `&` inside type, detect and handle conflicts
0 commit comments