@@ -501,7 +501,7 @@ class TypeComparer(initctx: Context) extends ConstraintHandling[AbsentContext] w
501501 val base = nonExprBaseType(tp1, cls2)
502502 if (base.typeSymbol == cls2) return true
503503 }
504- else if ( tp1.isLambdaSub && ! tp1.isRef( AnyKindClass ))
504+ else if tp1.isLambdaSub && ! tp1.isAnyKind then
505505 return recur(tp1, EtaExpansion (cls2.typeRef))
506506 fourthTry
507507 }
@@ -734,7 +734,7 @@ class TypeComparer(initctx: Context) extends ConstraintHandling[AbsentContext] w
734734 (gbounds1 != null ) &&
735735 (isSubTypeWhenFrozen(gbounds1.hi, tp2) ||
736736 narrowGADTBounds(tp1, tp2, approx, isUpper = true )) &&
737- { tp2.isRef( AnyClass ) || GADTusage (tp1.symbol) }
737+ { tp2.isAny || GADTusage (tp1.symbol) }
738738 }
739739 isSubType(hi1, tp2, approx.addLow) || compareGADT || tryLiftedToThis1
740740 case _ =>
@@ -816,7 +816,7 @@ class TypeComparer(initctx: Context) extends ConstraintHandling[AbsentContext] w
816816 case JavaArrayType (elem1) =>
817817 def compareJavaArray = tp2 match {
818818 case JavaArrayType (elem2) => isSubType(elem1, elem2)
819- case _ => tp2 isRef ObjectClass
819+ case _ => tp2.isAnyRef
820820 }
821821 compareJavaArray
822822 case tp1 : ExprType if ctx.phase.id > ctx.gettersPhase.id =>
@@ -1629,20 +1629,21 @@ class TypeComparer(initctx: Context) extends ConstraintHandling[AbsentContext] w
16291629 // 'Object|Null', depending on whether explicit nulls are enabled.
16301630 def formal1IsObject =
16311631 if (ctx.explicitNulls) formal1 match {
1632- case OrNull (formal1b) => formal1b.isRef( ObjectClass )
1632+ case OrNull (formal1b) => formal1b.isAnyRef
16331633 case _ => false
16341634 }
1635- else formal1.isRef( ObjectClass )
1635+ else formal1.isAnyRef
16361636 def formal2IsObject =
16371637 if (ctx.explicitNulls) formal2 match {
1638- case OrNull (formal2b) => formal2b.isRef( ObjectClass )
1638+ case OrNull (formal2b) => formal2b.isAnyRef
16391639 case _ => false
16401640 }
1641- else formal2.isRef( ObjectClass )
1641+ else formal2.isAnyRef
16421642 (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)
16461647 case nil =>
16471648 false
16481649 }
@@ -1723,8 +1724,8 @@ class TypeComparer(initctx: Context) extends ConstraintHandling[AbsentContext] w
17231724 if (tp1 eq tp2) tp1
17241725 else if (! tp1.exists) tp2
17251726 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
17281729 else tp2 match { // normalize to disjunctive normal form if possible.
17291730 case OrType (tp21, tp22) =>
17301731 tp1 & tp21 | tp1 & tp22
@@ -1770,11 +1771,12 @@ class TypeComparer(initctx: Context) extends ConstraintHandling[AbsentContext] w
17701771 * @note We do not admit singleton types in or-types as lubs.
17711772 */
17721773 def lub (tp1 : Type , tp2 : Type , canConstrain : Boolean = false ): Type = /* >|>*/ trace(s " lub( ${tp1.show}, ${tp2.show}, canConstrain= $canConstrain) " , subtyping, show = true ) /* <|<*/ {
1774+
17731775 if (tp1 eq tp2) tp1
17741776 else if (! tp1.exists) tp1
17751777 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
17781780 else {
17791781 def mergedLub : Type = {
17801782 val atoms1 = tp1.atoms
0 commit comments