Open noresttherein opened 2 months ago
It's a long-standing behavior that explicitly importing from a "root context module" turns off the "default root import" from that module.
That behavior is honored under -Yimports
where the module is arbitrary and not only scala.Predef
.
I'm surprised to see that it's not in the spec, apparently. Root contexts are described in chapter 2, so "excluding import" should also be specified there. The exclusion applies to objects but not to packages.
Oh, I'm sorry then. I kind of get an idea why, although in the era of IDEs being smart, but not enough, occasionally IntelliJ decides to import something moronic even though I wasn't even using implicitly
. Not Scala's fault, of course, just that it wasn't me being dliberately stupid or malicious.
Another reason to update the spec is that scalac tries to "detect" the import, but in general the import may be nested; not sure if dotty requires the import to be top-level and at the top of the file.
Yes, importing it locally in the object doesn't produce the behaviour even in 2.13.
Hi! It's been a while.
Reproduction steps
Scala version: 2.13.14
Problem