@@ -2144,7 +2144,7 @@ class TypeComparer(initctx: Context) extends ConstraintHandling[AbsentContext] w
2144
2144
def provablyEmpty (tp : Type ): Boolean =
2145
2145
tp.dealias match {
2146
2146
case tp if tp.isBottomType => true
2147
- case AndType (tp1, tp2) => disjoint (tp1, tp2)
2147
+ case AndType (tp1, tp2) => provablyDisjoint (tp1, tp2)
2148
2148
case OrType (tp1, tp2) => provablyEmpty(tp1) && provablyEmpty(tp2)
2149
2149
case at @ AppliedType (tycon, args) =>
2150
2150
args.lazyZip(tycon.typeParams).exists { (arg, tparam) =>
@@ -2163,7 +2163,7 @@ class TypeComparer(initctx: Context) extends ConstraintHandling[AbsentContext] w
2163
2163
}
2164
2164
2165
2165
2166
- /** Are `tp1` and `tp2` disjoint types?
2166
+ /** Are `tp1` and `tp2` provablyDisjoint types?
2167
2167
*
2168
2168
* `true` implies that we found a proof; uncertainty default to `false`.
2169
2169
*
@@ -2178,8 +2178,8 @@ class TypeComparer(initctx: Context) extends ConstraintHandling[AbsentContext] w
2178
2178
* property that in all possible contexts, a same match type expression
2179
2179
* is either stuck or reduces to the same case.
2180
2180
*/
2181
- def disjoint (tp1 : Type , tp2 : Type )(implicit ctx : Context ): Boolean = {
2182
- // println(s"disjoint (${tp1.show}, ${tp2.show})")
2181
+ def provablyDisjoint (tp1 : Type , tp2 : Type )(implicit ctx : Context ): Boolean = {
2182
+ // println(s"provablyDisjoint (${tp1.show}, ${tp2.show})")
2183
2183
/** Can we enumerate all instantiations of this type? */
2184
2184
def isClosedSum (tp : Symbol ): Boolean =
2185
2185
tp.is(Sealed ) && tp.isOneOf(AbstractOrTrait ) && ! tp.hasAnonymousChild
@@ -2212,9 +2212,9 @@ class TypeComparer(initctx: Context) extends ConstraintHandling[AbsentContext] w
2212
2212
// of classes.
2213
2213
true
2214
2214
else if (isClosedSum(cls1))
2215
- decompose(cls1, tp1).forall(x => disjoint (x, tp2))
2215
+ decompose(cls1, tp1).forall(x => provablyDisjoint (x, tp2))
2216
2216
else if (isClosedSum(cls2))
2217
- decompose(cls2, tp2).forall(x => disjoint (x, tp1))
2217
+ decompose(cls2, tp2).forall(x => provablyDisjoint (x, tp1))
2218
2218
else
2219
2219
false
2220
2220
case (AppliedType (tycon1, args1), AppliedType (tycon2, args2)) if tycon1 == tycon2 =>
@@ -2224,7 +2224,7 @@ class TypeComparer(initctx: Context) extends ConstraintHandling[AbsentContext] w
2224
2224
// (Type parameter disjointness is not enought by itself as it could
2225
2225
// lead to incorrect conclusions for phantom type parameters).
2226
2226
def covariantDisjoint (tp1 : Type , tp2 : Type , tparam : TypeParamInfo ): Boolean =
2227
- disjoint (tp1, tp2) && productSelectorTypes(tycon1, null ).exists {
2227
+ provablyDisjoint (tp1, tp2) && productSelectorTypes(tycon1, null ).exists {
2228
2228
case tp : TypeRef =>
2229
2229
(tp.designator: Any ) == tparam // Bingo!
2230
2230
case _ =>
@@ -2258,29 +2258,29 @@ class TypeComparer(initctx: Context) extends ConstraintHandling[AbsentContext] w
2258
2258
}
2259
2259
}
2260
2260
case (tp1 : HKLambda , tp2 : HKLambda ) =>
2261
- disjoint (tp1.resType, tp2.resType)
2261
+ provablyDisjoint (tp1.resType, tp2.resType)
2262
2262
case (_ : HKLambda , _) =>
2263
- // The intersection of these two types would be ill kinded, they are therefore disjoint .
2263
+ // The intersection of these two types would be ill kinded, they are therefore provablyDisjoint .
2264
2264
true
2265
2265
case (_, _ : HKLambda ) =>
2266
2266
true
2267
2267
case (tp1 : OrType , _) =>
2268
- disjoint (tp1.tp1, tp2) && disjoint (tp1.tp2, tp2)
2268
+ provablyDisjoint (tp1.tp1, tp2) && provablyDisjoint (tp1.tp2, tp2)
2269
2269
case (_, tp2 : OrType ) =>
2270
- disjoint (tp1, tp2.tp1) && disjoint (tp1, tp2.tp2)
2270
+ provablyDisjoint (tp1, tp2.tp1) && provablyDisjoint (tp1, tp2.tp2)
2271
2271
case (tp1 : AndType , tp2 : AndType ) =>
2272
- (disjoint (tp1.tp1, tp2.tp1) || disjoint (tp1.tp2, tp2.tp2)) &&
2273
- (disjoint (tp1.tp1, tp2.tp2) || disjoint (tp1.tp2, tp2.tp1))
2272
+ (provablyDisjoint (tp1.tp1, tp2.tp1) || provablyDisjoint (tp1.tp2, tp2.tp2)) &&
2273
+ (provablyDisjoint (tp1.tp1, tp2.tp2) || provablyDisjoint (tp1.tp2, tp2.tp1))
2274
2274
case (tp1 : AndType , _) =>
2275
- disjoint (tp1.tp2, tp2) || disjoint (tp1.tp1, tp2)
2275
+ provablyDisjoint (tp1.tp2, tp2) || provablyDisjoint (tp1.tp1, tp2)
2276
2276
case (_, tp2 : AndType ) =>
2277
- disjoint (tp1, tp2.tp2) || disjoint (tp1, tp2.tp1)
2277
+ provablyDisjoint (tp1, tp2.tp2) || provablyDisjoint (tp1, tp2.tp1)
2278
2278
case (tp1 : TypeProxy , tp2 : TypeProxy ) =>
2279
- disjoint (tp1.underlying, tp2) || disjoint (tp1, tp2.underlying)
2279
+ provablyDisjoint (tp1.underlying, tp2) || provablyDisjoint (tp1, tp2.underlying)
2280
2280
case (tp1 : TypeProxy , _) =>
2281
- disjoint (tp1.underlying, tp2)
2281
+ provablyDisjoint (tp1.underlying, tp2)
2282
2282
case (_, tp2 : TypeProxy ) =>
2283
- disjoint (tp1, tp2.underlying)
2283
+ provablyDisjoint (tp1, tp2.underlying)
2284
2284
case _ =>
2285
2285
false
2286
2286
}
@@ -2455,7 +2455,7 @@ class TrackingTypeComparer(initctx: Context) extends TypeComparer(initctx) {
2455
2455
}
2456
2456
else if (isSubType(widenAbstractTypes(scrut), widenAbstractTypes(pat)))
2457
2457
Some (NoType )
2458
- else if (disjoint (scrut, pat))
2458
+ else if (provablyDisjoint (scrut, pat))
2459
2459
// We found a proof that `scrut` and `pat` are incompatible.
2460
2460
// The search continues.
2461
2461
None
@@ -2481,7 +2481,7 @@ class TrackingTypeComparer(initctx: Context) extends TypeComparer(initctx) {
2481
2481
// `!provablyNonEmpty` instead of `provablyEmpty`, that would be
2482
2482
// obviously sound, but quite restrictive. With the current formulation,
2483
2483
// we need to be careful that `provablyEmpty` covers all the conditions
2484
- // used to conclude disjointness in `disjoint `.
2484
+ // used to conclude disjointness in `provablyDisjoint `.
2485
2485
if (provablyEmpty(scrut))
2486
2486
NoType
2487
2487
else
0 commit comments