aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/Decorators.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2013-11-25 11:31:46 +0100
committerMartin Odersky <odersky@gmail.com>2013-11-25 11:34:04 +0100
commit45ea511ec8ef12e0a192e4f4925923e75ef9ae3a (patch)
treef498f664b8a2b7133c86bc37c481aafccfef99b3 /src/dotty/tools/dotc/core/Decorators.scala
parent92ed954f361ed08ef4821afd530357379956904a (diff)
downloaddotty-45ea511ec8ef12e0a192e4f4925923e75ef9ae3a.tar.gz
dotty-45ea511ec8ef12e0a192e4f4925923e75ef9ae3a.tar.bz2
dotty-45ea511ec8ef12e0a192e4f4925923e75ef9ae3a.zip
Types refactorings
- moving out type applicaton related operations to a decorator: TypeApplications - converting some set operations to list operations to make them replayable. - moving unused operations to Types.overflow
Diffstat (limited to 'src/dotty/tools/dotc/core/Decorators.scala')
-rw-r--r--src/dotty/tools/dotc/core/Decorators.scala6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/dotty/tools/dotc/core/Decorators.scala b/src/dotty/tools/dotc/core/Decorators.scala
index eb287f411..ca601cddf 100644
--- a/src/dotty/tools/dotc/core/Decorators.scala
+++ b/src/dotty/tools/dotc/core/Decorators.scala
@@ -105,6 +105,12 @@ object Decorators {
else ys.nonEmpty && loop(xs.tail, ys.tail)
loop(xs, ys)
}
+
+ /** Union on lists seen as sets */
+ 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 _)
}
implicit class ListOfListDecorator[T](val xss: List[List[T]]) extends AnyVal {