@@ -354,9 +354,7 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
354
354
narrowGADTBounds(tp2, tp1, approx, isUpper = false )) &&
355
355
GADTusage (tp2.symbol)
356
356
}
357
- val tryLowerFirst = frozenConstraint || ! isCappable(tp1)
358
- if (tryLowerFirst) isSubType(tp1, lo2, approx.addHigh) || compareGADT || fourthTry
359
- else compareGADT || fourthTry || isSubType(tp1, lo2, approx.addHigh)
357
+ isSubType(tp1, lo2, approx.addHigh) || compareGADT || fourthTry
360
358
361
359
case _ =>
362
360
val cls2 = tp2.symbol
@@ -389,7 +387,7 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
389
387
val alwaysTrue =
390
388
// The following condition is carefully formulated to catch all cases
391
389
// where the subtype relation is true without needing to add a constraint
392
- // It's tricky because we might need to either appriximate tp2 by its
390
+ // It's tricky because we might need to either approximate tp2 by its
393
391
// lower bound or else widen tp1 and check that the result is a subtype of tp2.
394
392
// So if the constraint is not yet frozen, we do the same comparison again
395
393
// with a frozen constraint, which means that we get a chance to do the
@@ -1080,20 +1078,6 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
1080
1078
case _ => proto.isMatchedBy(tp)
1081
1079
}
1082
1080
1083
- /** Can type `tp` be constrained from above, either by adding a constraint to
1084
- * a typevar that it refers to, or by narrowing a GADT bound? In that case we have
1085
- * to be careful not to approximate with the lower bound of a type in `thirdTry`.
1086
- * Instead, we should first unroll `tp1` until we hit the type variable and bind the
1087
- * type variable with (the corresponding type in) `tp2` instead. Or, in the
1088
- * case of a GADT bounded typeref, we should narrow with `tp2` instead of its lower bound.
1089
- */
1090
- private def isCappable (tp : Type ): Boolean = tp match {
1091
- case tp : TypeParamRef => constraint contains tp
1092
- case tp : TypeProxy => isCappable(tp.underlying)
1093
- case tp : AndOrType => isCappable(tp.tp1) || isCappable(tp.tp2)
1094
- case _ => false
1095
- }
1096
-
1097
1081
/** Narrow gadt.bounds for the type parameter referenced by `tr` to include
1098
1082
* `bound` as an upper or lower bound (which depends on `isUpper`).
1099
1083
* Test that the resulting bounds are still satisfiable.
0 commit comments