Skip to content

Given instance shadowing #17221

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

Open
epifab opened this issue Apr 10, 2023 · 1 comment
Open

Given instance shadowing #17221

epifab opened this issue Apr 10, 2023 · 1 comment
Labels
area:reporting Error reporting including formatting, implicit suggestions, etc itype:enhancement

Comments

@epifab
Copy link

epifab commented Apr 10, 2023

Compiler version

Scala 2 and 3

Minimized code

object Instances1:
  given one: Int = 1

object Instances2:
  given one: Int = 2

import Instances1.one
import Instances2.one

println(summon[Int])

Output

Prints 2

Expectation

I'd like the code above to throw an error like:

Reference to one is ambiguous.
it is both imported by name by import Instances1.one
and imported by name subsequently by import Instances2.one
@epifab epifab added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels Apr 10, 2023
@som-snytt
Copy link
Contributor

There is a request for documentation #17808

The comments include pointing out that ambiguity for name binding (one is ambiguous) has nothing to do with contextual implicits, although that may seem strange.

@mbovel mbovel added area:reporting Error reporting including formatting, implicit suggestions, etc itype:enhancement and removed stat:needs triage Every issue needs to have an "area" and "itype" label itype:bug labels May 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:reporting Error reporting including formatting, implicit suggestions, etc itype:enhancement
Projects
None yet
Development

No branches or pull requests

3 participants