Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/dotty/tools/dotc/typer/Typer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,8 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
}
}
val curImport = ctx.importInfo
if (curImport != null && curImport.isRootImport && previous.exists) return previous
if (ctx.owner.is(Package) && curImport != null && curImport.isRootImport && previous.exists)
return previous // no more conflicts possible in this case
// would import of kind `prec` be not shadowed by a nested higher-precedence definition?
def isPossibleImport(prec: Int) =
prevPrec < prec || prevPrec == prec && (prevCtx.scope eq ctx.scope)
Expand Down
11 changes: 11 additions & 0 deletions tests/neg/i1145.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
object A {
def x = 3

def y = {
import B._
x // error: ambiguous
}
}
object B {
def x = 3
}