E4154#
Non-constant enum with custom tag value.
MoonBit supports customizing the integer representation of constructors:
enum Flag {
A = 1
B = 2
C = 3
}
However, only constant enum values (where all constructors have no payload) can have custom tags.
Otherwise this error will be reported.
Erroneous example#
enum Bad {
A = 1
B = 2
C(Int)
}
Suggestion#
Remove the payload, or remove the custom tag values:
pub enum Good {
A = 1
B = 2
C = 3
}
pub fn all() -> (Good, Good, Good) {
(A, B, C)
}