diff options
author | ringabout <43030857+ringabout@users.noreply.github.com> | 2023-02-16 10:23:35 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-16 10:23:35 +0800 |
commit | fc7385bfda7b3af93aa57c5cf446a90b470de348 (patch) | |
tree | 9c28d07b361475d28b1a1a3f17c8992db27e6530 /tests/discard | |
parent | c91ef1a09f3284315e9e66c32532f5a8e3ba9297 (diff) | |
download | Nim-fc7385bfda7b3af93aa57c5cf446a90b470de348.tar.gz |
fixes #21360; discarding empty seqs/arrays now raises errors (#21374)
* discarding empty seqs now raises errors * the same goes for sets
Diffstat (limited to 'tests/discard')
-rw-r--r-- | tests/discard/tillegaldiscardtypes.nim | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/discard/tillegaldiscardtypes.nim b/tests/discard/tillegaldiscardtypes.nim new file mode 100644 index 000000000..b7877bcd2 --- /dev/null +++ b/tests/discard/tillegaldiscardtypes.nim @@ -0,0 +1,14 @@ +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) \ No newline at end of file |