XO0428: two variants of a valued enum have the same value
A valued enum maps each variant to a value, and E.from(v) and the JSON decoder go back from the value to the variant, so the values of one enum are unique. A variant without a value takes the previous variant’s value plus one for Int, so A = 1, B = 1 and A = 1, B = 0, C (C is 1) both repeat a value. See core 2.3.
Example
enum Weekday: Int { Mon = 1, Tue = 1 }Fix
enum Weekday: Int { Mon = 1, Tue = 2 }Run xo explain XO0428 for this text in a terminal, or see
section 10.6 of the specification.