diff options
author | Martin Odersky <odersky@gmail.com> | 2014-08-09 18:17:59 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2014-08-10 18:06:29 +0200 |
commit | bbf777a729e5b6e8c8a75466c42004d3ff4c5d32 (patch) | |
tree | be54839464e9bbc04a1cd9cd391aea35ea790cf7 /src/dotty | |
parent | 80b866f37014b9f6cfbb61e36231df037570fb95 (diff) | |
download | dotty-bbf777a729e5b6e8c8a75466c42004d3ff4c5d32.tar.gz dotty-bbf777a729e5b6e8c8a75466c42004d3ff4c5d32.tar.bz2 dotty-bbf777a729e5b6e8c8a75466c42004d3ff4c5d32.zip |
Narrow assertion for Scope#enter
Scopes are also used in overriding pairs, and there multiple types with
the same name can be entered in a scope. So the assert to the contrary
should be limited to typechecking only.
Diffstat (limited to 'src/dotty')
-rw-r--r-- | src/dotty/tools/dotc/core/Scopes.scala | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/core/Scopes.scala b/src/dotty/tools/dotc/core/Scopes.scala index 919e35a7e..426df83bc 100644 --- a/src/dotty/tools/dotc/core/Scopes.scala +++ b/src/dotty/tools/dotc/core/Scopes.scala @@ -176,9 +176,9 @@ object Scopes { /** enter a symbol in this scope. */ final def enter[T <: Symbol](sym: T)(implicit ctx: Context): T = { - if (sym.isType) { + if (sym.isType && ctx.phaseId <= ctx.typerPhase.id) { assert(lookup(sym.name) == NoSymbol, - s"duplicate type ${sym.debugString}; previous was ${lookup(sym.name).debugString}") // !!! DEBUG + s"duplicate ${sym.debugString}; previous was ${lookup(sym.name).debugString}") // !!! DEBUG } newScopeEntry(sym) sym |