-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Description
Currently, the phase MoveStatic has two functionality:
- Move
@staticmembers from the companion objectAto the classA - Create static constructor for static fields of the class
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 splitting MoveStatic into two phases:
- one phase that performs the moving (can be merged with
CheckStatic) - one phase
StaticConstructorsthat synthesize the static constructor for static fields.
The phase CompleteJavaEnums will benefit from the refactoring #8008.