File tree Expand file tree Collapse file tree 3 files changed +25
-1
lines changed
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 3 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -188,7 +188,7 @@ class Typer extends Namer
188
188
*/
189
189
def recurAndCheckNewOrShadowed (previous : Type , prevPrec : BindingPrec , prevCtx : Context )(using Context ): Type =
190
190
val found = findRefRecur(previous, prevPrec, prevCtx)
191
- if found eq previous then checkNewOrShadowed(found, prevPrec)
191
+ if found eq previous then checkNewOrShadowed(found, prevPrec)( using prevCtx)
192
192
else found
193
193
194
194
def selection (imp : ImportInfo , name : Name , checkBounds : Boolean ): Type =
Original file line number Diff line number Diff line change
1
+ -- [E049] Reference Error: tests/neg/i9803.scala:15:10 -----------------------------------------------------------------
2
+ 15 | println(f421()) // error
3
+ | ^^^^
4
+ | Reference to f421 is ambiguous,
5
+ | it is both imported by name by import bugs.shadowing.x.f421
6
+ | and imported by name subsequently by import bugs.shadowing.y.f421
7
+
8
+ longer explanation available when compiling with `-explain`
Original file line number Diff line number Diff line change
1
+ package bugs .shadowing
2
+
3
+ object x {
4
+ def f421 () = 1
5
+ }
6
+
7
+ object y {
8
+ def f421 () = true
9
+ }
10
+
11
+ import x .f421
12
+ import y .f421
13
+
14
+ object test {
15
+ println(f421()) // error
16
+ }
You can’t perform that action at this time.
0 commit comments