@@ -501,7 +501,7 @@ class TypeComparer(initctx: Context) extends ConstraintHandling[AbsentContext] w
501
501
val base = nonExprBaseType(tp1, cls2)
502
502
if (base.typeSymbol == cls2) return true
503
503
}
504
- else if ( tp1.isLambdaSub && ! tp1.isRef( AnyKindClass ))
504
+ else if tp1.isLambdaSub && ! tp1.isAnyKind then
505
505
return recur(tp1, EtaExpansion (cls2.typeRef))
506
506
fourthTry
507
507
}
@@ -734,7 +734,7 @@ class TypeComparer(initctx: Context) extends ConstraintHandling[AbsentContext] w
734
734
(gbounds1 != null ) &&
735
735
(isSubTypeWhenFrozen(gbounds1.hi, tp2) ||
736
736
narrowGADTBounds(tp1, tp2, approx, isUpper = true )) &&
737
- { tp2.isRef( AnyClass ) || GADTusage (tp1.symbol) }
737
+ { tp2.isAny || GADTusage (tp1.symbol) }
738
738
}
739
739
isSubType(hi1, tp2, approx.addLow) || compareGADT || tryLiftedToThis1
740
740
case _ =>
@@ -816,7 +816,7 @@ class TypeComparer(initctx: Context) extends ConstraintHandling[AbsentContext] w
816
816
case JavaArrayType (elem1) =>
817
817
def compareJavaArray = tp2 match {
818
818
case JavaArrayType (elem2) => isSubType(elem1, elem2)
819
- case _ => tp2 isRef ObjectClass
819
+ case _ => tp2.isAnyRef
820
820
}
821
821
compareJavaArray
822
822
case tp1 : ExprType if ctx.phase.id > ctx.gettersPhase.id =>
@@ -1629,20 +1629,21 @@ class TypeComparer(initctx: Context) extends ConstraintHandling[AbsentContext] w
1629
1629
// 'Object|Null', depending on whether explicit nulls are enabled.
1630
1630
def formal1IsObject =
1631
1631
if (ctx.explicitNulls) formal1 match {
1632
- case OrNull (formal1b) => formal1b.isRef( ObjectClass )
1632
+ case OrNull (formal1b) => formal1b.isAnyRef
1633
1633
case _ => false
1634
1634
}
1635
- else formal1.isRef( ObjectClass )
1635
+ else formal1.isAnyRef
1636
1636
def formal2IsObject =
1637
1637
if (ctx.explicitNulls) formal2 match {
1638
- case OrNull (formal2b) => formal2b.isRef( ObjectClass )
1638
+ case OrNull (formal2b) => formal2b.isAnyRef
1639
1639
case _ => false
1640
1640
}
1641
- else formal2.isRef( ObjectClass )
1641
+ else formal2.isAnyRef
1642
1642
(isSameTypeWhenFrozen(formal1, formal2a)
1643
- || tp1.isJavaMethod && formal2IsObject && (formal1 isRef AnyClass )
1644
- || tp2.isJavaMethod && formal1IsObject && (formal2 isRef AnyClass )) &&
1645
- loop(rest1, rest2)
1643
+ || tp1.isJavaMethod && formal2IsObject && formal1.isAny
1644
+ || tp2.isJavaMethod && formal1IsObject && formal2.isAny
1645
+ )
1646
+ && loop(rest1, rest2)
1646
1647
case nil =>
1647
1648
false
1648
1649
}
@@ -1723,8 +1724,8 @@ class TypeComparer(initctx: Context) extends ConstraintHandling[AbsentContext] w
1723
1724
if (tp1 eq tp2) tp1
1724
1725
else if (! tp1.exists) tp2
1725
1726
else if (! tp2.exists) tp1
1726
- else if (( tp1 isRef AnyClass ) && ! tp2.isLambdaSub || ( tp1 isRef AnyKindClass ) || ( tp2 isRef NothingClass )) tp2
1727
- else if (( tp2 isRef AnyClass ) && ! tp1.isLambdaSub || ( tp2 isRef AnyKindClass ) || ( tp1 isRef NothingClass )) tp1
1727
+ else if tp1.isAny && ! tp2.isLambdaSub || tp1.isAnyKind || tp2. isRef( NothingClass ) then tp2
1728
+ else if tp2.isAny && ! tp1.isLambdaSub || tp2.isAnyKind || tp1. isRef( NothingClass ) then tp1
1728
1729
else tp2 match { // normalize to disjunctive normal form if possible.
1729
1730
case OrType (tp21, tp22) =>
1730
1731
tp1 & tp21 | tp1 & tp22
@@ -1770,11 +1771,12 @@ class TypeComparer(initctx: Context) extends ConstraintHandling[AbsentContext] w
1770
1771
* @note We do not admit singleton types in or-types as lubs.
1771
1772
*/
1772
1773
def lub (tp1 : Type , tp2 : Type , canConstrain : Boolean = false ): Type = /* >|>*/ trace(s " lub( ${tp1.show}, ${tp2.show}, canConstrain= $canConstrain) " , subtyping, show = true ) /* <|<*/ {
1774
+
1773
1775
if (tp1 eq tp2) tp1
1774
1776
else if (! tp1.exists) tp1
1775
1777
else if (! tp2.exists) tp2
1776
- else if (( tp1 isRef AnyClass ) || ( tp1 isRef AnyKindClass ) || ( tp2 isRef NothingClass )) tp1
1777
- else if (( tp2 isRef AnyClass ) || ( tp2 isRef AnyKindClass ) || ( tp1 isRef NothingClass )) tp2
1778
+ else if tp1.isAny && ! tp2.isLambdaSub || tp1.isAnyKind || tp2. isRef( NothingClass ) then tp1
1779
+ else if tp2.isAny && ! tp1.isLambdaSub || tp2.isAnyKind || tp1. isRef( NothingClass ) then tp2
1778
1780
else {
1779
1781
def mergedLub : Type = {
1780
1782
val atoms1 = tp1.atoms
0 commit comments