@@ -578,13 +578,13 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
578
578
579
579
def isMatchingApply (tp1 : Type ): Boolean = tp1 match {
580
580
case HKApply (tycon1, args1) =>
581
- tycon1 match {
581
+ tycon1.dealias match {
582
582
case tycon1 : PolyParam =>
583
583
(tycon1 == tycon2 ||
584
584
canConstrain(tycon1) && tryInstantiate(tycon1, tycon2)) &&
585
585
isSubArgs(args1, args2, tparams)
586
586
case tycon1 : TypeRef =>
587
- tycon2 match {
587
+ tycon2.dealias match {
588
588
case tycon2 : TypeRef if tycon1.symbol == tycon2.symbol =>
589
589
isSubType(tycon1.prefix, tycon2.prefix) &&
590
590
isSubArgs(args1, args2, tparams)
@@ -685,7 +685,7 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
685
685
canConstrain(param1) && canInstantiate ||
686
686
isSubType(bounds(param1).hi.applyIfParameterized(args1), tp2)
687
687
case tycon1 : TypeProxy =>
688
- isSubType(tycon1.underlying.applyIfParameterized(args1), tp2)
688
+ isSubType(tycon1.underlying.bounds.hi. applyIfParameterized(args1), tp2)
689
689
case _ =>
690
690
false
691
691
}
@@ -1327,16 +1327,9 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
1327
1327
if (! Config .newHK && tparams1.isEmpty || tparams2.isEmpty) op(tp1, tp2)
1328
1328
else if (Config .newHK && tparams1.isEmpty)
1329
1329
if (tparams2.isEmpty) op(tp1, tp2)
1330
- else tp2 match {
1331
- case EtaExpansion (tycon2) if tycon2.symbol.isClass => original(tp1, tycon2) // TODO: Roll isClass into EtaExpansion?
1332
- case _ => mergeConflict(tp1, tp2)
1333
- }
1334
- else if (Config .newHK && tparams2.isEmpty) {
1335
- tp1 match {
1336
- case EtaExpansion (tycon1) if tycon1.symbol.isClass => original(tycon1, tp2)
1337
- case _ => mergeConflict(tp1, tp2)
1338
- }
1339
- }
1330
+ else original(tp1, tp2.appliedTo(tp2.typeParams.map(_.memberBoundsAsSeenFrom(tp2))))
1331
+ else if (Config .newHK && tparams2.isEmpty)
1332
+ original(tp1.appliedTo(tp1.typeParams.map(_.memberBoundsAsSeenFrom(tp1))), tp2)
1340
1333
else if (! Config .newHK && (tparams1.isEmpty || tparams2.isEmpty)) op(tp1, tp2)
1341
1334
else if (! Config .newHK && tparams1.length != tparams2.length) mergeConflict(tp1, tp2)
1342
1335
else if (Config .newHK) {
@@ -1493,7 +1486,8 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
1493
1486
case bounds : TypeBounds => i " type bounds $bounds"
1494
1487
case _ => tp.show
1495
1488
}
1496
- throw new MergeError (s " cannot merge ${showType(tp1)} with ${showType(tp2)}" , tp1, tp2)
1489
+ if (true ) throw new MergeError (s " cannot merge ${showType(tp1)} with ${showType(tp2)}" , tp1, tp2)
1490
+ else throw new Error (s " cannot merge ${showType(tp1)} with ${showType(tp2)}" )
1497
1491
}
1498
1492
1499
1493
/** Merge two lists of names. If names in corresponding positions match, keep them,
0 commit comments