v0.13.7
errors and warnings / classes

errors and warnings / classes / E3010

E3010 error

Enum mixes numeric and string values

area
classes (x3xxx)
fails the build
yes

An enum's values are mixed or not constant. An enum is either all numbers or all strings; members without a value are numbered after the previous one, so in a string enum every member needs its own value. Values must be number or string constants.

Example

× failswowlua
enum Size { Small = 1, Large = "large" }print(Size.Small)
✓ compileswowlua
enum Size { Small = "small", Large = "large" }print(Size.Small)

The compiler reports it like this:

error[E3010]: enum `Size` mixes numeric and string values
  ┌─ src/main.wowlua:1:24
  │
1 │ enum Size { Small = 1, Large = "large" }
  │                        ^^^^^ here
codemessage
E3011Duplicate enum value

Offline

terminal
$ wowlua explain E3010
E3010 (error): Enum mixes numeric and string values

source on GitHub ↗