From 83b90b941b4643cfe55ed3b635177147b2e549ea Mon Sep 17 00:00:00 2001 From: Araq Date: Sun, 23 Sep 2012 09:02:11 +0200 Subject: [PATCH] bugfix: proc bodies as expr --- compiler/semexprs.nim | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim index 89789f2691..a749073847 100755 --- a/compiler/semexprs.nim +++ b/compiler/semexprs.nim @@ -1075,8 +1075,11 @@ proc semProcBody(c: PContext, n: PNode): PNode = if c.p.resultSym != nil and not isEmptyType(result.typ): # transform ``expr`` to ``result = expr``, but not if the expr is already # ``result``: - if result.kind == nkSym and result.sym == c.p.resultSym: + if result.kind == nkSym and result.sym == c.p.resultSym: nil + elif result.kind == nkNilLit: + # ambiguous :-( + result.typ = nil else: var a = newNodeI(nkAsgn, n.info, 2) a.sons[0] = newSymNode(c.p.resultSym)