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

Import * now means wildcard #210

Open
bishabosha opened this issue May 18, 2021 · 3 comments
Open

Import * now means wildcard #210

bishabosha opened this issue May 18, 2021 · 3 comments

Comments

@bishabosha
Copy link
Member

bishabosha commented May 18, 2021

There is probably a creative example where someone previously only wanted to import a * operation and now they import every operation, and importing everything now shadows some other definition.

class Operations {
  def *(i: Int, j: Int) = i * j
  def println(any: Any): Unit = ???
}

object Main extends App {
  val ops = new Operations()
  import ops.*
  println(*(2, 3))
}

Edit: on Scala 3 running Main will eval ??? in Operations.println, but Scala 2.13 will use Predef.println and print 6

@adpi2
Copy link
Member

adpi2 commented May 25, 2021

This is crazy! 😄

@julienrf
Copy link
Contributor

The fact that this is crashing is a bug right? I would expect a compilation error on println(*(2, 3))?

@adpi2
Copy link
Member

adpi2 commented May 25, 2021

I think it is crashing because of the NotImplementedException in Operations.println

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants