Nim/tests/discard/tillegaldiscardtypes.nim
ringabout fc7385bfda
fixes #21360; discarding empty seqs/arrays now raises errors (#21374)
* discarding empty seqs now raises errors

* the same goes for sets
2023-02-16 10:23:35 +08:00

14 lines
No EOL
361 B
Nim

discard """
cmd: "nim check $file"
errormsg: "statement returns no value that can be discarded"
nimout: '''
tillegaldiscardtypes.nim(11, 3) Error: statement returns no value that can be discarded
tillegaldiscardtypes.nim(12, 3) Error: statement returns no value that can be discarded
'''
"""
proc b(v: int) = # bug #21360
discard @[]
discard []
b(0)