E4153

E4153#

Duplicated tag in enum with custom tag value.

For constant enum, where all constructors have no payload, MoonBit supports customizing the integer representation of constructors:

enum Flag {
  A = 1
  B = 2
  C = 3
}

However, the tag of each constructor must be unique, otherwise this error will be reported.

Erroneous example#

enum Bad {
  A = 1
  B // the tag of `B` is `A + 1 = 2`
  C = 2 // duplicates with `B`
}