From bbf777a729e5b6e8c8a75466c42004d3ff4c5d32 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Sat, 9 Aug 2014 18:17:59 +0200 Subject: 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. --- src/dotty/tools/dotc/core/Scopes.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/dotty/tools/dotc/core/Scopes.scala') 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 -- cgit v1.2.3