* discarding empty seqs now raises errors * the same goes for sets
This commit is contained in:
parent
c91ef1a09f
commit
fc7385bfda
3 changed files with 25 additions and 9 deletions
14
tests/discard/tillegaldiscardtypes.nim
Normal file
14
tests/discard/tillegaldiscardtypes.nim
Normal file
|
|
@ -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)
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
discard """
|
||||
errormsg: "internal error: invalid kind for lastOrd(tyEmpty)"
|
||||
errormsg: "statement returns no value that can be discarded"
|
||||
"""
|
||||
var q = false
|
||||
discard (if q: {} else: {})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue