@@ -830,9 +830,9 @@ class TypeComparer(initctx: Context) extends ConstraintHandling {
830
830
* tp1 <:< tp2 using fourthTry (this might instantiate params in tp1)
831
831
* tp1 <:< app2 using isSubType (this might instantiate params in tp2)
832
832
*/
833
- def compareLower (tycon2bounds : TypeBounds , followSuperType : Boolean ): Boolean =
833
+ def compareLower (tycon2bounds : TypeBounds , tyconIsTypeRef : Boolean ): Boolean =
834
834
if ((tycon2bounds.lo `eq` tycon2bounds.hi) && ! tycon2bounds.isInstanceOf [MatchAlias ])
835
- if (followSuperType ) recur(tp1, tp2.superType)
835
+ if (tyconIsTypeRef ) recur(tp1, tp2.superType)
836
836
else isSubApproxHi(tp1, tycon2bounds.lo.applyIfParameterized(args2))
837
837
else
838
838
fallback(tycon2bounds.lo)
@@ -841,15 +841,13 @@ class TypeComparer(initctx: Context) extends ConstraintHandling {
841
841
case param2 : TypeParamRef =>
842
842
isMatchingApply(tp1) ||
843
843
canConstrain(param2) && canInstantiate(param2) ||
844
- compareLower(bounds(param2), followSuperType = false )
844
+ compareLower(bounds(param2), tyconIsTypeRef = false )
845
845
case tycon2 : TypeRef =>
846
846
isMatchingApply(tp1) ||
847
847
defn.isTypelevel_S(tycon2.symbol) && compareS(tp2, tp1, fromBelow = true ) || {
848
848
tycon2.info match {
849
849
case info2 : TypeBounds =>
850
- val gbounds2 = ctx.gadt.bounds(tycon2.symbol)
851
- if (gbounds2 == null ) compareLower(info2, followSuperType = true )
852
- else compareLower(gbounds2 & info2, followSuperType = false )
850
+ compareLower(info2, tyconIsTypeRef = true )
853
851
case info2 : ClassInfo =>
854
852
tycon2.name.toString.startsWith(" Tuple" ) &&
855
853
defn.isTupleType(tp2) && isSubType(tp1, tp2.toNestedPairs) ||
@@ -885,11 +883,8 @@ class TypeComparer(initctx: Context) extends ConstraintHandling {
885
883
case tycon1 : TypeRef =>
886
884
val sym = tycon1.symbol
887
885
! sym.isClass && (
888
- defn.isTypelevel_S(sym) && compareS(tp1, tp2, fromBelow = false ) || {
889
- val gbounds1 = ctx.gadt.bounds(tycon1.symbol)
890
- if (gbounds1 == null ) recur(tp1.superType, tp2)
891
- else recur((gbounds1.hi & tycon1.info.bounds.hi).applyIfParameterized(args1), tp2)
892
- })
886
+ defn.isTypelevel_S(sym) && compareS(tp1, tp2, fromBelow = false ) ||
887
+ recur(tp1.superType, tp2))
893
888
case tycon1 : TypeProxy =>
894
889
recur(tp1.superType, tp2)
895
890
case _ =>
0 commit comments