File tree 1 file changed +8
-11
lines changed
src/dotty/tools/dotc/core
1 file changed +8
-11
lines changed Original file line number Diff line number Diff line change @@ -1106,18 +1106,15 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
1106
1106
NoType
1107
1107
}
1108
1108
1109
- /** Try to distribute `|` inside type, detect and handle conflicts */
1109
+ /** Try to distribute `|` inside type, detect and handle conflicts.
1110
+ * Note that, unlike for `&`, a disjunction cannot be pushed into
1111
+ * a refined or applied type. Example:
1112
+ *
1113
+ * List[T] | List[U] is not the same as List[T | U].
1114
+ *
1115
+ * The rhs is a proper supertype of the lhs.
1116
+ */
1110
1117
private def distributeOr (tp1 : Type , tp2 : Type ): Type = tp1 match {
1111
- case tp1 : RefinedType =>
1112
- tp2 match {
1113
- case tp2 : RefinedType if tp1.refinedName == tp2.refinedName =>
1114
- tp1.derivedRefinedType(
1115
- tp1.parent | tp2.parent,
1116
- tp1.refinedName,
1117
- tp1.refinedInfo | tp2.refinedInfo.substRefinedThis(tp2, RefinedThis (tp1)))
1118
- case _ =>
1119
- NoType
1120
- }
1121
1118
case tp1 : TypeBounds =>
1122
1119
tp2 match {
1123
1120
case tp2 : TypeBounds => tp1 | tp2
You can’t perform that action at this time.
0 commit comments