-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-frontendArea: Compiler frontend (errors, parsing and HIR)Area: Compiler frontend (errors, parsing and HIR)
Description
Currently tags always use 0 ... N, where N is the number of tag variants, as the discriminant values.
This makes them useless for modeling C enums, which they are the natural analogue of. We should support a form of variant-declarator that provides a discriminant value, as (say) an uint const expression or something.
Ideal sort of example:
tag color {
red = 0xff;
blue = 0xfe;
}
It'd also be nice to be able to cast back and forth against uint values, and similar "like in C" enum tricks. But one thing at a time.
Metadata
Metadata
Assignees
Labels
A-frontendArea: Compiler frontend (errors, parsing and HIR)Area: Compiler frontend (errors, parsing and HIR)