Skip to content

Commit 9ed0524

Browse files
authored
Merge pull request #5585 from dotty-staging/fix-union
Remove erroneous usages of `List::union`
2 parents 67c8678 + d6abe0a commit 9ed0524

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

compiler/src/dotty/tools/dotc/core/Decorators.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ object Decorators {
131131
}
132132

133133
/** Union on lists seen as sets */
134-
def | (ys: List[T]): List[T] = xs ++ (ys filterNot (xs contains _))
134+
def | (ys: List[T]): List[T] = xs ::: (ys filterNot (xs contains _))
135135

136136
/** Intersection on lists seen as sets */
137137
def & (ys: List[T]): List[T] = xs filter (ys contains _)

compiler/src/dotty/tools/dotc/core/OrderingConstraint.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ class OrderingConstraint(private val boundsMap: ParamBounds,
221221
def dependentParams(tp: Type, isUpper: Boolean): List[TypeParamRef] = tp match {
222222
case param: TypeParamRef if contains(param) =>
223223
param :: (if (isUpper) upper(param) else lower(param))
224-
case tp: AndType => dependentParams(tp.tp1, isUpper).union (dependentParams(tp.tp2, isUpper))
224+
case tp: AndType => dependentParams(tp.tp1, isUpper) | (dependentParams(tp.tp2, isUpper))
225225
case tp: OrType => dependentParams(tp.tp1, isUpper).intersect(dependentParams(tp.tp2, isUpper))
226226
case _ =>
227227
Nil

compiler/src/dotty/tools/dotc/core/Types.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ object Types {
441441
case tp: TypeProxy =>
442442
tp.underlying.classSymbols
443443
case AndType(l, r) =>
444-
l.classSymbols union r.classSymbols
444+
l.classSymbols | r.classSymbols
445445
case OrType(l, r) =>
446446
l.classSymbols intersect r.classSymbols // TODO does not conform to spec
447447
case _ =>

0 commit comments

Comments
 (0)