Files
Nim/tests/enum/tenum_invalid.nim
Jake Leahy 8cad6ac048 Don't try and get enum value if its invalid (#22997)
Currently running `nimsuggest`/`check` on this code causes the compiler
to raise an exception

```nim
type
  Test = enum
    A = 9.0 
```

```
assertions.nim(34)       raiseAssert
Error: unhandled exception: int128.nim(69, 11) `arg.sdata(3) == 0` out of range [AssertionDefect]
```

Issue was the compiler still trying to get the ordinal value even if it
wasn't an ordinal
2023-11-28 09:38:10 +01:00

9 lines
130 B
Nim

discard """
cmd: "nim check $file"
"""
type
Test = enum
A = 9.0 #[tt.Error
^ ordinal type expected; given: float]#