From d6abe0af4ad7a9b701b0591c47fc62b74a972e93 Mon Sep 17 00:00:00 2001 From: Allan Renucci Date: Mon, 10 Dec 2018 11:21:52 +0100 Subject: [PATCH] Remove erroneous usages of `List::union` `union` on `List` is concatenation. Duplicates are not removed. Also `union` is deprecated in 2.13. --- compiler/src/dotty/tools/dotc/core/Decorators.scala | 2 +- compiler/src/dotty/tools/dotc/core/OrderingConstraint.scala | 2 +- compiler/src/dotty/tools/dotc/core/Types.scala | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/core/Decorators.scala b/compiler/src/dotty/tools/dotc/core/Decorators.scala index 95b55ac14632..601665468bbe 100644 --- a/compiler/src/dotty/tools/dotc/core/Decorators.scala +++ b/compiler/src/dotty/tools/dotc/core/Decorators.scala @@ -131,7 +131,7 @@ object Decorators { } /** Union on lists seen as sets */ - def | (ys: List[T]): List[T] = xs ++ (ys filterNot (xs contains _)) + def | (ys: List[T]): List[T] = xs ::: (ys filterNot (xs contains _)) /** Intersection on lists seen as sets */ def & (ys: List[T]): List[T] = xs filter (ys contains _) diff --git a/compiler/src/dotty/tools/dotc/core/OrderingConstraint.scala b/compiler/src/dotty/tools/dotc/core/OrderingConstraint.scala index f128f4e2022b..a987e3e43745 100644 --- a/compiler/src/dotty/tools/dotc/core/OrderingConstraint.scala +++ b/compiler/src/dotty/tools/dotc/core/OrderingConstraint.scala @@ -221,7 +221,7 @@ class OrderingConstraint(private val boundsMap: ParamBounds, def dependentParams(tp: Type, isUpper: Boolean): List[TypeParamRef] = tp match { case param: TypeParamRef if contains(param) => param :: (if (isUpper) upper(param) else lower(param)) - case tp: AndType => dependentParams(tp.tp1, isUpper).union (dependentParams(tp.tp2, isUpper)) + case tp: AndType => dependentParams(tp.tp1, isUpper) | (dependentParams(tp.tp2, isUpper)) case tp: OrType => dependentParams(tp.tp1, isUpper).intersect(dependentParams(tp.tp2, isUpper)) case _ => Nil diff --git a/compiler/src/dotty/tools/dotc/core/Types.scala b/compiler/src/dotty/tools/dotc/core/Types.scala index 6f793c5f1171..1b0aa00474f9 100644 --- a/compiler/src/dotty/tools/dotc/core/Types.scala +++ b/compiler/src/dotty/tools/dotc/core/Types.scala @@ -441,7 +441,7 @@ object Types { case tp: TypeProxy => tp.underlying.classSymbols case AndType(l, r) => - l.classSymbols union r.classSymbols + l.classSymbols | r.classSymbols case OrType(l, r) => l.classSymbols intersect r.classSymbols // TODO does not conform to spec case _ =>