@@ -338,25 +338,23 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
338
338
isSubType(tp1, tp2.parent) &&
339
339
(name2 == nme.WILDCARD || hasMatchingMember(name2, tp1, tp2))
340
340
}
341
+ def etaExpandedSubType (tp1 : Type ) =
342
+ isSubType(tp1.typeConstructor.EtaExpand (tp2.typeParams), tp2)
341
343
def compareRefined : Boolean = {
342
344
val tp1w = tp1.widen
343
345
val skipped2 = skipMatching(tp1w, tp2)
344
- if ((skipped2 eq tp2) || ! Config .fastPathForRefinedSubtype) {
345
- val normalPath = tp1 match {
346
+ if ((skipped2 eq tp2) || ! Config .fastPathForRefinedSubtype)
347
+ tp1 match {
346
348
case tp1 : AndType =>
347
349
// Delay calling `compareRefinedSlow` because looking up a member
348
350
// of an `AndType` can lead to a cascade of subtyping checks
349
351
// This twist is needed to make collection/generic/ParFactory.scala compile
350
352
fourthTry(tp1, tp2) || compareRefinedSlow
351
353
case _ =>
352
- compareRefinedSlow || fourthTry(tp1, tp2)
354
+ compareRefinedSlow ||
355
+ fourthTry(tp1, tp2) ||
356
+ needsEtaLift(tp1, tp2) && testLifted(tp1, tp2, tp2.typeParams, etaExpandedSubType)
353
357
}
354
- def etaExpandedSubType (tp1 : Type ) =
355
- isSubType(tp1.typeConstructor.EtaExpand (tp2.typeParams), tp2)
356
- normalPath ||
357
- needsEtaLift(tp1, tp2) &&
358
- testLifted(tp1, tp2, tp2.typeParams, etaExpandedSubType)
359
- }
360
358
else // fast path, in particular for refinements resulting from parameterization.
361
359
isSubType(tp1, skipped2) &&
362
360
isSubRefinements(tp1w.asInstanceOf [RefinedType ], tp2, skipped2)
0 commit comments