You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Don't use a special representation for Java enum values
In Java, annotation arguments must be constants, so enum values are
treated specially. In Scala, annotation arguments can be whatever tree
we want, so we don't really need to represent them as
`Literal(Constant(enumValueSymbol))` and can just use a `TermRef` to the
enum value instead.
This commit implements this change, this has several advantages compared
to the status quo:
- The handling of Java enum values and Scala enum values is now less
different.
- We can drop the handling of symbols in `Constant`
- ... and therefore remove one tag from Tasty.
- In turn, this means we don't have to worry about how to expose
this in tasty-reflect.
This commit breaks the Tasty format and therefore bump its major version
to 24.
if (skip) NoneelseSome(lit(Constant(pool.getType(index))))
527
526
caseENUM_TAG=>
528
-
valt= pool.getType(index)
529
-
valn= pool.getName(in.nextChar)
530
-
valmodule= t.typeSymbol.companionModule
531
-
vals= module.info.decls.lookup(n)
527
+
valenumClassTp= pool.getType(index)
528
+
valenumCaseName= pool.getName(in.nextChar)
532
529
if (skip)
533
530
None
534
-
elseif (s !=NoSymbol)
535
-
Some(lit(Constant(s)))
536
531
else {
537
-
report.warning(s"""While parsing annotations in ${in.file}, could not find $n in enum $module.\nThis is likely due to an implementation restriction: an annotation argument cannot refer to a member of the annotated class (SI-7014).""")
0 commit comments