@@ -363,7 +363,7 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
363
363
narrowGADTBounds(tp2, tp1, approx, isUpper = false )) &&
364
364
GADTusage (tp2.symbol)
365
365
}
366
- isSubType (tp1, lo2, approx.addHigh ) || compareGADT || fourthTry
366
+ isSubApproxHi (tp1, lo2) || compareGADT || fourthTry
367
367
368
368
case _ =>
369
369
val cls2 = tp2.symbol
@@ -750,7 +750,7 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
750
750
* @param tyconLo The type constructor's lower approximation.
751
751
*/
752
752
def fallback (tyconLo : Type ) =
753
- either(fourthTry, isSubType (tp1, tyconLo.applyIfParameterized(args2), approx.addHigh ))
753
+ either(fourthTry, isSubApproxHi (tp1, tyconLo.applyIfParameterized(args2)))
754
754
755
755
/** Let `tycon2bounds` be the bounds of the RHS type constructor `tycon2`.
756
756
* Let `app2 = tp2` where the type constructor of `tp2` is replaced by
@@ -764,7 +764,7 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
764
764
def compareLower (tycon2bounds : TypeBounds , tyconIsTypeRef : Boolean ): Boolean =
765
765
if (tycon2bounds.lo eq tycon2bounds.hi)
766
766
if (tyconIsTypeRef) recur(tp1, tp2.superType)
767
- else isSubType (tp1, tycon2bounds.lo.applyIfParameterized(args2), approx.addHigh )
767
+ else isSubApproxHi (tp1, tycon2bounds.lo.applyIfParameterized(args2))
768
768
else
769
769
fallback(tycon2bounds.lo)
770
770
@@ -826,6 +826,9 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
826
826
false
827
827
} else isSubType(tp1, tp2, approx.addLow)
828
828
829
+ def isSubApproxHi (tp1 : Type , tp2 : Type ): Boolean =
830
+ (tp2 ne NothingType ) && isSubType(tp1, tp2, approx.addHigh)
831
+
829
832
// begin recur
830
833
if (tp2 eq NoType ) false
831
834
else if (tp1 eq tp2) true
0 commit comments