@@ -2152,7 +2152,7 @@ class TypeComparer(initctx: Context) extends ConstraintHandling[AbsentContext] w
21522152 def provablyEmpty (tp : Type ): Boolean =
21532153 tp.dealias match {
21542154 case tp if tp.isBottomType => true
2155- case AndType (tp1, tp2) => disjoint (tp1, tp2)
2155+ case AndType (tp1, tp2) => provablyDisjoint (tp1, tp2)
21562156 case OrType (tp1, tp2) => provablyEmpty(tp1) && provablyEmpty(tp2)
21572157 case at @ AppliedType (tycon, args) =>
21582158 args.lazyZip(tycon.typeParams).exists { (arg, tparam) =>
@@ -2166,7 +2166,7 @@ class TypeComparer(initctx: Context) extends ConstraintHandling[AbsentContext] w
21662166 }
21672167
21682168
2169- /** Are `tp1` and `tp2` disjoint types?
2169+ /** Are `tp1` and `tp2` provablyDisjoint types?
21702170 *
21712171 * `true` implies that we found a proof; uncertainty default to `false`.
21722172 *
@@ -2181,8 +2181,8 @@ class TypeComparer(initctx: Context) extends ConstraintHandling[AbsentContext] w
21812181 * property that in all possible contexts, a same match type expression
21822182 * is either stuck or reduces to the same case.
21832183 */
2184- def disjoint (tp1 : Type , tp2 : Type )(implicit ctx : Context ): Boolean = {
2185- // println(s"disjoint (${tp1.show}, ${tp2.show})")
2184+ def provablyDisjoint (tp1 : Type , tp2 : Type )(implicit ctx : Context ): Boolean = {
2185+ // println(s"provablyDisjoint (${tp1.show}, ${tp2.show})")
21862186 /** Can we enumerate all instantiations of this type? */
21872187 def isClosedSum (tp : Symbol ): Boolean =
21882188 tp.is(Sealed ) && tp.isOneOf(AbstractOrTrait ) && ! tp.hasAnonymousChild
@@ -2215,9 +2215,9 @@ class TypeComparer(initctx: Context) extends ConstraintHandling[AbsentContext] w
22152215 // of classes.
22162216 true
22172217 else if (isClosedSum(cls1))
2218- decompose(cls1, tp1).forall(x => disjoint (x, tp2))
2218+ decompose(cls1, tp1).forall(x => provablyDisjoint (x, tp2))
22192219 else if (isClosedSum(cls2))
2220- decompose(cls2, tp2).forall(x => disjoint (x, tp1))
2220+ decompose(cls2, tp2).forall(x => provablyDisjoint (x, tp1))
22212221 else
22222222 false
22232223 case (AppliedType (tycon1, args1), AppliedType (tycon2, args2)) if tycon1 == tycon2 =>
@@ -2227,7 +2227,7 @@ class TypeComparer(initctx: Context) extends ConstraintHandling[AbsentContext] w
22272227 // (Type parameter disjointness is not enough by itself as it could
22282228 // lead to incorrect conclusions for phantom type parameters).
22292229 def covariantDisjoint (tp1 : Type , tp2 : Type , tparam : TypeParamInfo ): Boolean =
2230- disjoint (tp1, tp2) && typeparamCorrespondsToField(tycon1, tparam)
2230+ provablyDisjoint (tp1, tp2) && typeparamCorrespondsToField(tycon1, tparam)
22312231
22322232 args1.lazyZip(args2).lazyZip(tycon1.typeParams).exists {
22332233 (arg1, arg2, tparam) =>
@@ -2256,29 +2256,29 @@ class TypeComparer(initctx: Context) extends ConstraintHandling[AbsentContext] w
22562256 }
22572257 }
22582258 case (tp1 : HKLambda , tp2 : HKLambda ) =>
2259- disjoint (tp1.resType, tp2.resType)
2259+ provablyDisjoint (tp1.resType, tp2.resType)
22602260 case (_ : HKLambda , _) =>
2261- // The intersection of these two types would be ill kinded, they are therefore disjoint .
2261+ // The intersection of these two types would be ill kinded, they are therefore provablyDisjoint .
22622262 true
22632263 case (_, _ : HKLambda ) =>
22642264 true
22652265 case (tp1 : OrType , _) =>
2266- disjoint (tp1.tp1, tp2) && disjoint (tp1.tp2, tp2)
2266+ provablyDisjoint (tp1.tp1, tp2) && provablyDisjoint (tp1.tp2, tp2)
22672267 case (_, tp2 : OrType ) =>
2268- disjoint (tp1, tp2.tp1) && disjoint (tp1, tp2.tp2)
2268+ provablyDisjoint (tp1, tp2.tp1) && provablyDisjoint (tp1, tp2.tp2)
22692269 case (tp1 : AndType , tp2 : AndType ) =>
2270- (disjoint (tp1.tp1, tp2.tp1) || disjoint (tp1.tp2, tp2.tp2)) &&
2271- (disjoint (tp1.tp1, tp2.tp2) || disjoint (tp1.tp2, tp2.tp1))
2270+ (provablyDisjoint (tp1.tp1, tp2.tp1) || provablyDisjoint (tp1.tp2, tp2.tp2)) &&
2271+ (provablyDisjoint (tp1.tp1, tp2.tp2) || provablyDisjoint (tp1.tp2, tp2.tp1))
22722272 case (tp1 : AndType , _) =>
2273- disjoint (tp1.tp2, tp2) || disjoint (tp1.tp1, tp2)
2273+ provablyDisjoint (tp1.tp2, tp2) || provablyDisjoint (tp1.tp1, tp2)
22742274 case (_, tp2 : AndType ) =>
2275- disjoint (tp1, tp2.tp2) || disjoint (tp1, tp2.tp1)
2275+ provablyDisjoint (tp1, tp2.tp2) || provablyDisjoint (tp1, tp2.tp1)
22762276 case (tp1 : TypeProxy , tp2 : TypeProxy ) =>
2277- disjoint (tp1.underlying, tp2) || disjoint (tp1, tp2.underlying)
2277+ provablyDisjoint (tp1.underlying, tp2) || provablyDisjoint (tp1, tp2.underlying)
22782278 case (tp1 : TypeProxy , _) =>
2279- disjoint (tp1.underlying, tp2)
2279+ provablyDisjoint (tp1.underlying, tp2)
22802280 case (_, tp2 : TypeProxy ) =>
2281- disjoint (tp1, tp2.underlying)
2281+ provablyDisjoint (tp1, tp2.underlying)
22822282 case _ =>
22832283 false
22842284 }
@@ -2453,7 +2453,7 @@ class TrackingTypeComparer(initctx: Context) extends TypeComparer(initctx) {
24532453 }
24542454 else if (isSubType(widenAbstractTypes(scrut), widenAbstractTypes(pat)))
24552455 Some (NoType )
2456- else if (disjoint (scrut, pat))
2456+ else if (provablyDisjoint (scrut, pat))
24572457 // We found a proof that `scrut` and `pat` are incompatible.
24582458 // The search continues.
24592459 None
@@ -2479,7 +2479,7 @@ class TrackingTypeComparer(initctx: Context) extends TypeComparer(initctx) {
24792479 // `!provablyNonEmpty` instead of `provablyEmpty`, that would be
24802480 // obviously sound, but quite restrictive. With the current formulation,
24812481 // we need to be careful that `provablyEmpty` covers all the conditions
2482- // used to conclude disjointness in `disjoint `.
2482+ // used to conclude disjointness in `provablyDisjoint `.
24832483 if (provablyEmpty(scrut))
24842484 NoType
24852485 else
0 commit comments