@@ -1427,12 +1427,13 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
14271427 private def liftIfHK (tp1 : Type , tp2 : Type , op : (Type , Type ) => Type , original : (Type , Type ) => Type ) = {
14281428 val tparams1 = tp1.typeParams
14291429 val tparams2 = tp2.typeParams
1430+ def applied (tp : Type ) = tp.appliedTo(tp.typeParams.map(_.paramInfoAsSeenFrom(tp)))
14301431 if (tparams1.isEmpty)
14311432 if (tparams2.isEmpty) op(tp1, tp2)
1432- else original(tp1, tp2.appliedTo (tp2.typeParams.map(_.paramInfoAsSeenFrom(tp2)) ))
1433+ else original(tp1, applied (tp2))
14331434 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))
14361437 HKTypeLambda (
14371438 paramNames = (HKTypeLambda .syntheticParamNames(tparams1.length), tparams1, tparams2)
14381439 .zipped.map((pname, tparam1, tparam2) =>
@@ -1442,6 +1443,7 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
14421443 tl.integrate(tparams2, tparam2.paramInfoAsSeenFrom(tp2)).bounds),
14431444 resultTypeExp = tl =>
14441445 original(tp1.appliedTo(tl.paramRefs), tp2.appliedTo(tl.paramRefs)))
1446+ else original(applied(tp1), applied(tp2))
14451447 }
14461448
14471449 /** Try to distribute `&` inside type, detect and handle conflicts
0 commit comments