Commit ab257d6
committed
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.1 parent 94970a0 commit ab257d6
File tree
11 files changed
+35
-66
lines changed- compiler/src/dotty/tools
- backend
- jvm
- sjs
- dotc
- ast
- core
- classfile
- tasty
- unpickleScala2
- printing
- tasty/src/dotty/tools/tasty
11 files changed
+35
-66
lines changedLines changed: 1 addition & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
488 | 488 | | |
489 | 489 | | |
490 | 490 | | |
491 | | - | |
| 491 | + | |
492 | 492 | | |
493 | 493 | | |
494 | 494 | | |
| |||
527 | 527 | | |
528 | 528 | | |
529 | 529 | | |
530 | | - | |
531 | | - | |
532 | | - | |
533 | | - | |
534 | | - | |
535 | | - | |
536 | | - | |
537 | | - | |
538 | | - | |
539 | | - | |
540 | | - | |
541 | | - | |
542 | | - | |
543 | | - | |
544 | | - | |
545 | | - | |
546 | 530 | | |
547 | 531 | | |
548 | 532 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
377 | 377 | | |
378 | 378 | | |
379 | 379 | | |
380 | | - | |
381 | | - | |
382 | | - | |
383 | | - | |
384 | 380 | | |
385 | 381 | | |
386 | 382 | | |
387 | | - | |
| 383 | + | |
388 | 384 | | |
389 | 385 | | |
390 | 386 | | |
| |||
454 | 450 | | |
455 | 451 | | |
456 | 452 | | |
457 | | - | |
| 453 | + | |
458 | 454 | | |
459 | 455 | | |
460 | 456 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1223 | 1223 | | |
1224 | 1224 | | |
1225 | 1225 | | |
1226 | | - | |
1227 | | - | |
1228 | 1226 | | |
1229 | 1227 | | |
1230 | 1228 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
460 | 460 | | |
461 | 461 | | |
462 | 462 | | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
463 | 466 | | |
464 | 467 | | |
465 | 468 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
24 | | - | |
25 | 23 | | |
26 | 24 | | |
27 | 25 | | |
| |||
50 | 48 | | |
51 | 49 | | |
52 | 50 | | |
53 | | - | |
54 | 51 | | |
55 | 52 | | |
56 | 53 | | |
| |||
190 | 187 | | |
191 | 188 | | |
192 | 189 | | |
193 | | - | |
194 | 190 | | |
195 | 191 | | |
196 | 192 | | |
| |||
237 | 233 | | |
238 | 234 | | |
239 | 235 | | |
240 | | - | |
241 | 236 | | |
242 | 237 | | |
243 | 238 | | |
| |||
253 | 248 | | |
254 | 249 | | |
255 | 250 | | |
256 | | - | |
257 | 251 | | |
258 | 252 | | |
259 | 253 | | |
| |||
Lines changed: 4 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
282 | 282 | | |
283 | 283 | | |
284 | 284 | | |
285 | | - | |
286 | 285 | | |
287 | 286 | | |
288 | 287 | | |
| |||
525 | 524 | | |
526 | 525 | | |
527 | 526 | | |
528 | | - | |
529 | | - | |
530 | | - | |
531 | | - | |
| 527 | + | |
| 528 | + | |
532 | 529 | | |
533 | 530 | | |
534 | | - | |
535 | | - | |
536 | 531 | | |
537 | | - | |
538 | | - | |
| 532 | + | |
| 533 | + | |
539 | 534 | | |
540 | 535 | | |
541 | 536 | | |
| |||
Lines changed: 0 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
152 | 152 | | |
153 | 153 | | |
154 | 154 | | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | 155 | | |
159 | 156 | | |
160 | 157 | | |
| |||
Lines changed: 0 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
286 | 286 | | |
287 | 287 | | |
288 | 288 | | |
289 | | - | |
290 | | - | |
291 | 289 | | |
292 | 290 | | |
293 | 291 | | |
| |||
Lines changed: 14 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
735 | 735 | | |
736 | 736 | | |
737 | 737 | | |
738 | | - | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
739 | 741 | | |
740 | 742 | | |
741 | 743 | | |
| |||
822 | 824 | | |
823 | 825 | | |
824 | 826 | | |
825 | | - | |
| 827 | + | |
826 | 828 | | |
827 | 829 | | |
828 | 830 | | |
| |||
838 | 840 | | |
839 | 841 | | |
840 | 842 | | |
841 | | - | |
| 843 | + | |
842 | 844 | | |
843 | 845 | | |
844 | 846 | | |
| |||
881 | 883 | | |
882 | 884 | | |
883 | 885 | | |
884 | | - | |
| 886 | + | |
885 | 887 | | |
886 | 888 | | |
887 | 889 | | |
| |||
896 | 898 | | |
897 | 899 | | |
898 | 900 | | |
899 | | - | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
900 | 906 | | |
901 | 907 | | |
902 | 908 | | |
| |||
1208 | 1214 | | |
1209 | 1215 | | |
1210 | 1216 | | |
1211 | | - | |
| 1217 | + | |
| 1218 | + | |
| 1219 | + | |
1212 | 1220 | | |
1213 | 1221 | | |
1214 | 1222 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
528 | 528 | | |
529 | 529 | | |
530 | 530 | | |
531 | | - | |
532 | 531 | | |
533 | 532 | | |
534 | 533 | | |
| |||
0 commit comments