diff options
-rw-r--r-- | src/dotty/tools/dotc/typer/Namer.scala | 8 | ||||
-rw-r--r-- | tests/neg/i1643.scala | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/src/dotty/tools/dotc/typer/Namer.scala b/src/dotty/tools/dotc/typer/Namer.scala index 51d7605c9..78f0da1f0 100644 --- a/src/dotty/tools/dotc/typer/Namer.scala +++ b/src/dotty/tools/dotc/typer/Namer.scala @@ -348,10 +348,10 @@ class Namer { typer: Typer => if ((existing is Package) && (pkgOwner eq existing.owner)) existing else { /** If there's already an existing type, then the package is a dup of this type */ - val existingTpe = pkgOwner.info.decls.lookup(pid.name.toTypeName) - if (existingTpe != NoSymbol) { - ctx.error(PkgDuplicateSymbol(existingTpe), pid.pos) - ctx.newCompletePackageSymbol(pkgOwner, (pid.name ++ "$termDup").toTermName).entered + val existingType = pkgOwner.info.decls.lookup(pid.name.toTypeName) + if (existingType.exists) { + ctx.error(PkgDuplicateSymbol(existingType), pid.pos) + ctx.newCompletePackageSymbol(pkgOwner, (pid.name ++ "$_error_").toTermName).entered } else ctx.newCompletePackageSymbol(pkgOwner, pid.name.asTermName).entered } diff --git a/tests/neg/i1643.scala b/tests/neg/i1643.scala index d836a4255..889233b3a 100644 --- a/tests/neg/i1643.scala +++ b/tests/neg/i1643.scala @@ -1,4 +1,4 @@ -trait T extends Array { +trait T extends Array { // error def t1(as: String*): Array[String] = { varargs1(as: _*) } // error def t2(as: String*): Array[String] = { super.varargs1(as: _*) } // error } |