Nim icon indicating copy to clipboard operation
Nim copied to clipboard

Invalid `pred` in `when` swallowed

Open arnetheduck opened this issue 2 months ago • 1 comments

Nim Version

2.2.4

Description

type X = enum
  a
  b

when pred(a) == b:
  echo "a"
else:
  echo "b"

pred(a) is not well-defined - this should fail to compile

Current Output

Compiles

Expected Output

Compile-time error

Known Workarounds

No response

Additional Information

No response

arnetheduck avatar Nov 03 '25 12:11 arnetheduck

It seems that an extra VM opcode needs to be introduced for rangecheck

ringabout avatar Nov 06 '25 11:11 ringabout