diff options
author | Martin Odersky <odersky@gmail.com> | 2014-10-24 18:32:48 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2014-10-26 16:24:02 +0100 |
commit | 3a250720a0833d42ed6b23b5837de64b6ce34aed (patch) | |
tree | 008c0b58a9f598da559286deb3fd9f8ab94a2d55 /src/dotty/tools/dotc/core/Decorators.scala | |
parent | 4d370b6073bec9706d427f82c4a6a40fa22fe6d0 (diff) | |
download | dotty-3a250720a0833d42ed6b23b5837de64b6ce34aed.tar.gz dotty-3a250720a0833d42ed6b23b5837de64b6ce34aed.tar.bz2 dotty-3a250720a0833d42ed6b23b5837de64b6ce34aed.zip |
Add missing and double symbol checking to TreeChecker
TreeChecker now tests that a symbol does not have two definitions that define it,
and that every reference to a symbol owner by a term is in the scope of a definition
of that symbol.
Both tests fail on several files for pattern matcher.
Diffstat (limited to 'src/dotty/tools/dotc/core/Decorators.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/Decorators.scala | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/dotty/tools/dotc/core/Decorators.scala b/src/dotty/tools/dotc/core/Decorators.scala index 99af4d0cb..e0d7fae33 100644 --- a/src/dotty/tools/dotc/core/Decorators.scala +++ b/src/dotty/tools/dotc/core/Decorators.scala @@ -100,6 +100,11 @@ object Decorators { else x1 :: xs1 } + def foldRightBN[U](z: => U)(op: (T, => U) => U): U = xs match { + case Nil => z + case x :: xs1 => op(x, xs1.foldRightBN(z)(op)) + } + final def hasSameLengthAs[U](ys: List[U]): Boolean = { @tailrec def loop(xs: List[T], ys: List[U]): Boolean = if (xs.isEmpty) ys.isEmpty |