Skip to content

Commit bbf777a

Browse files
committed
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.
1 parent 80b866f commit bbf777a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/dotty/tools/dotc/core/Scopes.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,9 @@ object Scopes {
176176

177177
/** enter a symbol in this scope. */
178178
final def enter[T <: Symbol](sym: T)(implicit ctx: Context): T = {
179-
if (sym.isType) {
179+
if (sym.isType && ctx.phaseId <= ctx.typerPhase.id) {
180180
assert(lookup(sym.name) == NoSymbol,
181-
s"duplicate type ${sym.debugString}; previous was ${lookup(sym.name).debugString}") // !!! DEBUG
181+
s"duplicate ${sym.debugString}; previous was ${lookup(sym.name).debugString}") // !!! DEBUG
182182
}
183183
newScopeEntry(sym)
184184
sym

0 commit comments

Comments
 (0)