@@ -2460,8 +2460,7 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
2460
2460
2461
2461
/** If the range `tp1..tp2` consist of a single type, that type, otherwise NoType`.
2462
2462
* This is the case if `tp1 =:= tp2`, but also if `tp1 <:< tp2`, `tp1` is a singleton type,
2463
- * and `tp2` derives from `scala.Singleton` and `sourceVersion.enablesDistributeAnd` (or vice-versa).
2464
- * Examples of the latter case:
2463
+ * and `tp2` derives from `scala.Singleton` (or vice-versa). Examples of the latter case:
2465
2464
*
2466
2465
* "name".type .. Singleton
2467
2466
* "name".type .. String & Singleton
@@ -2474,10 +2473,8 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
2474
2473
def isSingletonBounds (lo : Type , hi : Type ) =
2475
2474
lo.isSingleton && hi.derivesFrom(defn.SingletonClass ) && isSubTypeWhenFrozen(lo, hi)
2476
2475
if (isSameTypeWhenFrozen(tp1, tp2)) tp1
2477
- else if sourceVersion.enablesDistributeAnd then
2478
- if (isSingletonBounds(tp1, tp2)) tp1
2479
- else if (isSingletonBounds(tp2, tp1)) tp2
2480
- else NoType
2476
+ else if (isSingletonBounds(tp1, tp2)) tp1
2477
+ else if (isSingletonBounds(tp2, tp1)) tp2
2481
2478
else NoType
2482
2479
}
2483
2480
@@ -2774,7 +2771,7 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
2774
2771
* @pre !(tp1 <: tp2) && !(tp2 <:< tp1) -- these cases were handled before
2775
2772
*/
2776
2773
private def distributeAnd (tp1 : Type , tp2 : Type ): Type = tp1 match {
2777
- case tp1 @ AppliedType (tycon1, args1) if sourceVersion.enablesDistributeAnd =>
2774
+ case tp1 @ AppliedType (tycon1, args1) =>
2778
2775
tp2 match {
2779
2776
case AppliedType (tycon2, args2)
2780
2777
if tycon1.typeSymbol == tycon2.typeSymbol && tycon1 =:= tycon2 =>
@@ -2822,7 +2819,8 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
2822
2819
}
2823
2820
2824
2821
/** Try to distribute `|` inside type, detect and handle conflicts
2825
- * Note that a disjunction cannot be pushed into a refined or applied type. Example:
2822
+ * Note that, unlike for `&`, a disjunction cannot be pushed into
2823
+ * a refined or applied type. Example:
2826
2824
*
2827
2825
* List[T] | List[U] is not the same as List[T | U].
2828
2826
*
0 commit comments