File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
src/dotty/tools/dotc/typer Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -232,7 +232,8 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
232
232
}
233
233
}
234
234
val curImport = ctx.importInfo
235
- if (curImport != null && curImport.isRootImport && previous.exists) return previous
235
+ if (ctx.owner.is(Package ) && curImport != null && curImport.isRootImport && previous.exists)
236
+ return previous // no more conflicts possible in this case
236
237
// would import of kind `prec` be not shadowed by a nested higher-precedence definition?
237
238
def isPossibleImport (prec : Int ) =
238
239
prevPrec < prec || prevPrec == prec && (prevCtx.scope eq ctx.scope)
Original file line number Diff line number Diff line change
1
+ object A {
2
+ def x = 3
3
+
4
+ def y = {
5
+ import B ._
6
+ x // error: ambiguous
7
+ }
8
+ }
9
+ object B {
10
+ def x = 3
11
+ }
You can’t perform that action at this time.
0 commit comments