@@ -2152,7 +2152,7 @@ class TypeComparer(initctx: Context) extends ConstraintHandling[AbsentContext] w
2152
2152
def provablyEmpty (tp : Type ): Boolean =
2153
2153
tp.dealias match {
2154
2154
case tp if tp.isBottomType => true
2155
- case AndType (tp1, tp2) => disjoint (tp1, tp2)
2155
+ case AndType (tp1, tp2) => provablyDisjoint (tp1, tp2)
2156
2156
case OrType (tp1, tp2) => provablyEmpty(tp1) && provablyEmpty(tp2)
2157
2157
case at @ AppliedType (tycon, args) =>
2158
2158
args.lazyZip(tycon.typeParams).exists { (arg, tparam) =>
@@ -2166,7 +2166,7 @@ class TypeComparer(initctx: Context) extends ConstraintHandling[AbsentContext] w
2166
2166
}
2167
2167
2168
2168
2169
- /** Are `tp1` and `tp2` disjoint types?
2169
+ /** Are `tp1` and `tp2` provablyDisjoint types?
2170
2170
*
2171
2171
* `true` implies that we found a proof; uncertainty default to `false`.
2172
2172
*
@@ -2181,8 +2181,8 @@ class TypeComparer(initctx: Context) extends ConstraintHandling[AbsentContext] w
2181
2181
* property that in all possible contexts, a same match type expression
2182
2182
* is either stuck or reduces to the same case.
2183
2183
*/
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})")
2186
2186
/** Can we enumerate all instantiations of this type? */
2187
2187
def isClosedSum (tp : Symbol ): Boolean =
2188
2188
tp.is(Sealed ) && tp.isOneOf(AbstractOrTrait ) && ! tp.hasAnonymousChild
@@ -2215,9 +2215,9 @@ class TypeComparer(initctx: Context) extends ConstraintHandling[AbsentContext] w
2215
2215
// of classes.
2216
2216
true
2217
2217
else if (isClosedSum(cls1))
2218
- decompose(cls1, tp1).forall(x => disjoint (x, tp2))
2218
+ decompose(cls1, tp1).forall(x => provablyDisjoint (x, tp2))
2219
2219
else if (isClosedSum(cls2))
2220
- decompose(cls2, tp2).forall(x => disjoint (x, tp1))
2220
+ decompose(cls2, tp2).forall(x => provablyDisjoint (x, tp1))
2221
2221
else
2222
2222
false
2223
2223
case (AppliedType (tycon1, args1), AppliedType (tycon2, args2)) if tycon1 == tycon2 =>
@@ -2227,7 +2227,7 @@ class TypeComparer(initctx: Context) extends ConstraintHandling[AbsentContext] w
2227
2227
// (Type parameter disjointness is not enough by itself as it could
2228
2228
// lead to incorrect conclusions for phantom type parameters).
2229
2229
def covariantDisjoint (tp1 : Type , tp2 : Type , tparam : TypeParamInfo ): Boolean =
2230
- disjoint (tp1, tp2) && typeparamCorrespondsToField(tycon1, tparam)
2230
+ provablyDisjoint (tp1, tp2) && typeparamCorrespondsToField(tycon1, tparam)
2231
2231
2232
2232
args1.lazyZip(args2).lazyZip(tycon1.typeParams).exists {
2233
2233
(arg1, arg2, tparam) =>
@@ -2256,29 +2256,29 @@ class TypeComparer(initctx: Context) extends ConstraintHandling[AbsentContext] w
2256
2256
}
2257
2257
}
2258
2258
case (tp1 : HKLambda , tp2 : HKLambda ) =>
2259
- disjoint (tp1.resType, tp2.resType)
2259
+ provablyDisjoint (tp1.resType, tp2.resType)
2260
2260
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 .
2262
2262
true
2263
2263
case (_, _ : HKLambda ) =>
2264
2264
true
2265
2265
case (tp1 : OrType , _) =>
2266
- disjoint (tp1.tp1, tp2) && disjoint (tp1.tp2, tp2)
2266
+ provablyDisjoint (tp1.tp1, tp2) && provablyDisjoint (tp1.tp2, tp2)
2267
2267
case (_, tp2 : OrType ) =>
2268
- disjoint (tp1, tp2.tp1) && disjoint (tp1, tp2.tp2)
2268
+ provablyDisjoint (tp1, tp2.tp1) && provablyDisjoint (tp1, tp2.tp2)
2269
2269
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))
2272
2272
case (tp1 : AndType , _) =>
2273
- disjoint (tp1.tp2, tp2) || disjoint (tp1.tp1, tp2)
2273
+ provablyDisjoint (tp1.tp2, tp2) || provablyDisjoint (tp1.tp1, tp2)
2274
2274
case (_, tp2 : AndType ) =>
2275
- disjoint (tp1, tp2.tp2) || disjoint (tp1, tp2.tp1)
2275
+ provablyDisjoint (tp1, tp2.tp2) || provablyDisjoint (tp1, tp2.tp1)
2276
2276
case (tp1 : TypeProxy , tp2 : TypeProxy ) =>
2277
- disjoint (tp1.underlying, tp2) || disjoint (tp1, tp2.underlying)
2277
+ provablyDisjoint (tp1.underlying, tp2) || provablyDisjoint (tp1, tp2.underlying)
2278
2278
case (tp1 : TypeProxy , _) =>
2279
- disjoint (tp1.underlying, tp2)
2279
+ provablyDisjoint (tp1.underlying, tp2)
2280
2280
case (_, tp2 : TypeProxy ) =>
2281
- disjoint (tp1, tp2.underlying)
2281
+ provablyDisjoint (tp1, tp2.underlying)
2282
2282
case _ =>
2283
2283
false
2284
2284
}
@@ -2453,7 +2453,7 @@ class TrackingTypeComparer(initctx: Context) extends TypeComparer(initctx) {
2453
2453
}
2454
2454
else if (isSubType(widenAbstractTypes(scrut), widenAbstractTypes(pat)))
2455
2455
Some (NoType )
2456
- else if (disjoint (scrut, pat))
2456
+ else if (provablyDisjoint (scrut, pat))
2457
2457
// We found a proof that `scrut` and `pat` are incompatible.
2458
2458
// The search continues.
2459
2459
None
@@ -2479,7 +2479,7 @@ class TrackingTypeComparer(initctx: Context) extends TypeComparer(initctx) {
2479
2479
// `!provablyNonEmpty` instead of `provablyEmpty`, that would be
2480
2480
// obviously sound, but quite restrictive. With the current formulation,
2481
2481
// 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 `.
2483
2483
if (provablyEmpty(scrut))
2484
2484
NoType
2485
2485
else
0 commit comments