Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ambiguity error reports wrong import sources #9803

Closed
b-studios opened this issue Sep 16, 2020 · 0 comments
Closed

Ambiguity error reports wrong import sources #9803

b-studios opened this issue Sep 16, 2020 · 0 comments

Comments

@b-studios
Copy link
Contributor

Minimized code

package bugs.shadowing

object x {
  def f421() = 1
}

object y {
  def f421() = true
}

import x.f421
import y.f421

object test {
  println(f421())
}

Output

[error] 15 |  println(f421())
[error]    |          ^^^^
[error]    |       Reference to f421 is ambiguous,
[error]    |       it is both imported by name by import dotty.DottyPredef.{...}
[error]    |       and imported by name subsequently by import bugs.shadowing.y.f421
[error] one error found

Expectation

[error] 15 |  println(f421())
[error]    |          ^^^^
[error]    |       Reference to f421 is ambiguous,
[error]    |       it is both imported by name by import import bugs.shadowing.x.f421
[error]    |       and imported by name subsequently by import bugs.shadowing.y.f421
[error] one error found
odersky added a commit that referenced this issue Sep 22, 2020
Fix #9803: Use right context for reporting ambiguous references
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant