-
Notifications
You must be signed in to change notification settings - Fork 1.1k
-Vprint shows spurious root-level empty package #13113
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
Comments
It's exactly the same in Scala 2, so I don't see how this is a problem:
Especially given the comments in #7891. |
The problem part is that "empty package" is a special construct, not just a sloppy notion of "root package". A Scala 2 bug falls under the two wrongs not making a right rule. It might matter in Scala 3 where reasoning about top-level scoping is more tricky, if there are file-based rules. Here are two files, it's pretty obvious that different nomenclature is needed for "two packages in a file". I chose "nestle" for the pun on the Swiss food giant. Maybe the point is that after typer, file scope doesn't matter any more. Visibility is a done deal.
|
I'm not sure what fix you're vouching for? A change to the printing to hide away that they're actually bundled in an "empty" package? Or are you saying that parsing should, perhaps, return a |
Nvm, this is desired: #13520 (comment) |
Compiler version
Scala compiler version 3.0.3-RC1-bin-SNAPSHOT-git-7899462 -- Copyright 2002-2021, LAMP/EPFL
Minimized code
Output
It shows an enclosing
<empty>
package.Expectation
No such enclosure. Neither Scala 2 nor Java use "empty package" to mean "nameless root thing".
Top-level definitions without packaging belong in empty package:
Taking them as nested packages justifies definitions in the empty package available to named packages in the current file.
Cf #7891
The text was updated successfully, but these errors were encountered: