Skip to content

Commit 040379e

Browse files
committed
Annotate error in test not revealed before prev commit
1 parent e73397f commit 040379e

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/dotty/tools/dotc/typer/Namer.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -348,10 +348,10 @@ class Namer { typer: Typer =>
348348
if ((existing is Package) && (pkgOwner eq existing.owner)) existing
349349
else {
350350
/** If there's already an existing type, then the package is a dup of this type */
351-
val existingTpe = pkgOwner.info.decls.lookup(pid.name.toTypeName)
352-
if (existingTpe != NoSymbol) {
353-
ctx.error(PkgDuplicateSymbol(existingTpe), pid.pos)
354-
ctx.newCompletePackageSymbol(pkgOwner, (pid.name ++ "$termDup").toTermName).entered
351+
val existingType = pkgOwner.info.decls.lookup(pid.name.toTypeName)
352+
if (existingType.exists) {
353+
ctx.error(PkgDuplicateSymbol(existingType), pid.pos)
354+
ctx.newCompletePackageSymbol(pkgOwner, (pid.name ++ "$_error_").toTermName).entered
355355
}
356356
else ctx.newCompletePackageSymbol(pkgOwner, pid.name.asTermName).entered
357357
}

tests/neg/i1643.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
trait T extends Array {
1+
trait T extends Array { // error
22
def t1(as: String*): Array[String] = { varargs1(as: _*) } // error
33
def t2(as: String*): Array[String] = { super.varargs1(as: _*) } // error
44
}

0 commit comments

Comments
 (0)