diff options
author | Martin Odersky <odersky@gmail.com> | 2014-10-17 18:17:40 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2014-10-26 16:24:00 +0100 |
commit | 979fa47ccdbdfc1f495c62b25b95ace9a637a674 (patch) | |
tree | a6e6eb1ff9da8cc5202ce1ef08d1ce60dbe76c8e | |
parent | 3fea9472c0d068bc08ae764429ca6b4bca95bcd8 (diff) | |
download | dotty-979fa47ccdbdfc1f495c62b25b95ace9a637a674.tar.gz dotty-979fa47ccdbdfc1f495c62b25b95ace9a637a674.tar.bz2 dotty-979fa47ccdbdfc1f495c62b25b95ace9a637a674.zip |
More assertions in TreeChecker.
Flushed out a caching bug in Scopes.
-rw-r--r-- | src/dotty/tools/dotc/core/Scopes.scala | 1 | ||||
-rw-r--r-- | src/dotty/tools/dotc/transform/TreeChecker.scala | 12 |
2 files changed, 8 insertions, 5 deletions
diff --git a/src/dotty/tools/dotc/core/Scopes.scala b/src/dotty/tools/dotc/core/Scopes.scala index 3f7a4cb2c..494a26f7e 100644 --- a/src/dotty/tools/dotc/core/Scopes.scala +++ b/src/dotty/tools/dotc/core/Scopes.scala @@ -278,6 +278,7 @@ object Scopes { if (e.sym == prev) e.sym = replacement e = lookupNextEntry(e) } + elemsCache = null } /** Lookup a symbol entry matching given name. diff --git a/src/dotty/tools/dotc/transform/TreeChecker.scala b/src/dotty/tools/dotc/transform/TreeChecker.scala index 1b5cc7c07..1448e8bf9 100644 --- a/src/dotty/tools/dotc/transform/TreeChecker.scala +++ b/src/dotty/tools/dotc/transform/TreeChecker.scala @@ -101,15 +101,17 @@ class TreeChecker { def ownerMatches(symOwner: Symbol, ctxOwner: Symbol): Boolean = symOwner == ctxOwner || ctxOwner.isWeakOwner && ownerMatches(symOwner, ctxOwner.owner) - if(!ownerMatches(tree.symbol.owner, ctx.owner)) { - assert(ownerMatches(tree.symbol.owner, ctx.owner), - i"bad owner; ${tree.symbol} has owner ${tree.symbol.owner}, expected was ${ctx.owner}\n" + - i"owner chain = ${tree.symbol.ownersIterator.toList}%, %, ctxOwners = ${ctx.outersIterator.map(_.owner).toList}%, %") - } + assert(ownerMatches(tree.symbol.owner, ctx.owner), + i"bad owner; ${tree.symbol} has owner ${tree.symbol.owner}, expected was ${ctx.owner}\n" + + i"owner chain = ${tree.symbol.ownersIterator.toList}%, %, ctxOwners = ${ctx.outersIterator.map(_.owner).toList}%, %") } override def typedClassDef(cdef: untpd.TypeDef, cls: ClassSymbol)(implicit ctx: Context) = { val TypeDef(_, _, impl @ Template(constr, _, _, _)) = cdef + assert(cdef.symbol == cls) + assert(impl.symbol.owner == cls) + assert(constr.symbol.owner == cls) + assert(cls.primaryConstructor == constr.symbol, i"mismatch, primary constructor ${cls.primaryConstructor}, in tree = ${constr.symbol}") checkOwner(impl) checkOwner(impl.constr) super.typedClassDef(cdef, cls) |