scala-3-migration-guide
scala-3-migration-guide copied to clipboard
Import * now means wildcard
trafficstars
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
This is crazy! :smile:
The fact that this is crashing is a bug right? I would expect a compilation error on println(*(2, 3))?
I think it is crashing because of the NotImplementedException in Operations.println