This commit is contained in:
Araq
2013-06-04 07:48:46 +02:00
parent b487ebaaba
commit 2f5d5e3ba7
2 changed files with 15 additions and 1 deletions

View File

@@ -146,7 +146,9 @@ proc discardCheck(result: PNode) =
if result.typ.kind == tyNil:
fixNilType(result)
else:
localError(result.info, errDiscardValue)
var n = result
while n.kind in skipForDiscardable: n = n.lastSon
localError(n.info, errDiscardValue)
proc semIf(c: PContext, n: PNode): PNode =
result = n

View File

@@ -0,0 +1,12 @@
discard """
line: 10
errormsg: "value returned by statement has to be discarded"
"""
proc p =
var f: TFile
echo "hi"
open(f, "arg.txt")
p()