Preserve singleton types for final val aliases to Java enum constants#24980
Preserve singleton types for final val aliases to Java enum constants#24980zielinsky merged 3 commits intoscala:mainfrom
Conversation
|
I mentioned on the ticket that they can't be used in annotations. I tried one approach that was too clever, rewriting them as Edit: I guess the singleton type will be visible in the back end, at least, which is currently widened! |
@som-snytt now they can! Look at 7fee34d !:> Used exactly your insight - the singleton type is visible in backend. Should I mark this as fixing #21881? |
|
@zielinsky that's amazing, thanks. I took a look yesterday and didn't formulate it correctly. Yes, I think this is sufficient for the use case in #21881. Edit: I just deleted my local branch |
|
FSR I get the complement in the warn test. I was about to inspect the back end fix. Clean build (?) has similar warning in Edit: the difference is bootstrapped. |
| av.visitEnum(name, edesc, evalue) | ||
| // Handle final val aliases to Java enum values. | ||
| // Check if the symbol's pre-erasure type was a singleton of a Java enum value. | ||
| case t: tpd.RefTree if atPhase(erasurePhase) { |
There was a problem hiding this comment.
I wonder if there is a reason to prefer atPhaseBeforeTransforms or conversely to avoid it.
I see to my chagrin that braceless colon syntax does not work, atPhaseBeforeTransforms:.
…scala#24980) Fixes scala#24750 Fixes scala#21881 [Cherry-picked 2f8bbdc][modified]
Fixes #24750
Fixes #21881