@@ -905,20 +905,21 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
905
905
|| widenAbstractOKFor(tp2)
906
906
|| tp1.widen.underlyingClassRef(refinementOK = true ).exists)
907
907
then
908
- if isSubType(base, tp2, if tp1.isRef(cls2) then approx else approx.addLow) then
909
- recordGadtUsageIf { MatchType .thatReducesUsingGadt(tp1) }
910
- else if tp1.widenDealias.isInstanceOf [AndType ] || base.isInstanceOf [OrType ] then
908
+ def checkBase =
909
+ isSubType(base, tp2, if tp1.isRef(cls2) then approx else approx.addLow)
910
+ && recordGadtUsageIf { MatchType .thatReducesUsingGadt(tp1) }
911
+ if tp1.widenDealias.isInstanceOf [AndType ] || base.isInstanceOf [OrType ] then
911
912
// If tp1 is a intersection, it could be that one of the original
912
913
// branches of the AndType tp1 conforms to tp2, but its base type does
913
914
// not, or else that its base type for cls2 does not exist, in which case
914
915
// it would not show up in `base`. In either case, we need to also fall back
915
- // to fourthTry. Test case is i18226a.scala.
916
+ // to fourthTry. Test cases are i18266.scala and i18226a.scala.
916
917
// If base is a disjunction, this might have come from a tp1 type that
917
918
// expands to a match type. In this case, we should try to reduce the type
918
919
// and compare the redux. This is done in fourthTry
919
- fourthTry
920
+ either(checkBase, fourthTry)
920
921
else
921
- false
922
+ checkBase
922
923
else fourthTry
923
924
924
925
def fourthTry : Boolean = tp1 match {
0 commit comments