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 @@ -235,7 +235,8 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
235
235
}
236
236
}
237
237
val curImport = ctx.importInfo
238
- if (curImport != null && curImport.isRootImport && previous.exists) return previous
238
+ if (ctx.owner.is(Package ) && curImport != null && curImport.isRootImport && previous.exists)
239
+ return previous // no more conflicts possible in this case
239
240
// would import of kind `prec` be not shadowed by a nested higher-precedence definition?
240
241
def isPossibleImport (prec : Int ) =
241
242
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