A transformer that check that requirements of Static fields\methods are implemented:
1. Only objects can have members annotated with @static
2. The fields annotated with @static
should preceed any non-@static
fields.
This ensures that we do not introduce surprises for users in initialization order.
3. If a member foo
of an object C
is annotated with @static
,
the companion class C
is not allowed to define term members with name foo
.
4. If a member foo
of an object C
is annotated with @static
, the companion class C
is not allowed to inherit classes that define a term member with name foo
.
5. Only @static
methods and vals are supported in companions of traits.
Java8 supports those, but not vars, and JavaScript does not have interfaces at all.
6. @static
Lazy vals are currently unsupported.
Constructors
Members
A name given to the Phase
that can be used to debug the compiler. For
instance, it is possible to print trees after a given phase using:
A name given to the Phase
that can be used to debug the compiler. For
instance, it is possible to print trees after a given phase using:
$ ./bin/dotc -Xprint:<phaseNameHere> sourceFile.scala