From 45ea511ec8ef12e0a192e4f4925923e75ef9ae3a Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Mon, 25 Nov 2013 11:31:46 +0100 Subject: 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 --- src/dotty/tools/dotc/core/Decorators.scala | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/dotty/tools/dotc/core/Decorators.scala') 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 { -- cgit v1.2.3