-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Refactor MoveStatic
#8022
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
I think we should just forbid user-code from using |
Then we can change |
I would not be so rash throwing out @static. It solves real pain points of interop and getting the last drop of performance. It could need some attention to spec what it does and change the implementation to be more explicit when @static cannot be implemented correctly. |
We still keep two phases, but the code is simplified. We cannot merge MoveStatics with CheckStatic because the early phases are not able to handle static calls, thus it has to be at the end of the pipeline. Meanwhile, we want checks to happen as early as possible, thus CheckStatic has to be in the beginning of the pipeline.
Uh oh!
There was an error while loading. Please reload this page.
Currently, the phase
MoveStatic
has two functionality:@static
members from the companion objectA
to the classA
A
In an earlier phase,
CheckStatic
checks that@static
members only locate in the companion object A. This restriction is just for semantic-correctness of user-written programs (to avoid changing the typer). For code that is synthesized from compiler phases, this restriction is annoying.We can make
@static
a general mechanism in the compiler by splittingMoveStatic
into two phases:CheckStatic
)StaticConstructors
that synthesize the static constructor for static fields.The phase
CompleteJavaEnums
will benefit from the refactoring #8008.The text was updated successfully, but these errors were encountered: