diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/dotty/tools/dotc/typer/Namer.scala | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/typer/Namer.scala b/src/dotty/tools/dotc/typer/Namer.scala index 9eefec624..4ea87bb7b 100644 --- a/src/dotty/tools/dotc/typer/Namer.scala +++ b/src/dotty/tools/dotc/typer/Namer.scala @@ -185,11 +185,14 @@ class Namer { typer: Typer => def enterSymbol(sym: Symbol)(implicit ctx: Context) = { if (sym.exists) { println(s"entered: $sym in ${ctx.owner} and ${ctx.effectiveScope}") + def preExisting = ctx.effectiveScope.lookup(sym.name) if (sym.owner is PackageClass) { - val preExisting = sym.owner.decls.lookup(sym.name) if (preExisting.isDefinedInCurrentRun) ctx.error(s"${sym.showLocated} is compiled twice", sym.pos) } + else if (!sym.owner.isClass && preExisting.exists) { + ctx.error(i"${sym.name} is already defined as $preExisting") + } ctx.enter(sym) } sym |