Skip to content

Ambiguity error reports wrong import sources #9803

Closed
@b-studios

Description

@b-studios

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions