From 29db57a804e03ac4d9d943ac7cf3966777fa5c8d Mon Sep 17 00:00:00 2001 From: Araq Date: Sat, 30 Dec 2017 00:29:53 +0100 Subject: [PATCH] fixes reported 'proc foo(): int = result' codegen problem --- compiler/semexprs.nim | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim index a0f519820b..51e75e91fb 100644 --- a/compiler/semexprs.nim +++ b/compiler/semexprs.nim @@ -1425,11 +1425,7 @@ proc semProcBody(c: PContext, n: PNode): PNode = openScope(c) result = semExpr(c, n) 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: - discard - elif result.kind == nkNilLit: + if result.kind == nkNilLit: # or ImplicitlyDiscardable(result): # new semantic: 'result = x' triggers the void context result.typ = nil