diff options
-rw-r--r-- | compiler/transf.nim | 2 | ||||
-rw-r--r-- | tests/destructor/tdestructor3.nim | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/compiler/transf.nim b/compiler/transf.nim index ff790306b..dd8dd1519 100644 --- a/compiler/transf.nim +++ b/compiler/transf.nim @@ -735,6 +735,8 @@ proc transform(c: PTransf, n: PNode): PTransNode = var s = n.sons[namePos].sym if n.typ != nil and s.typ.callConv == ccClosure: result = transformSym(c, n.sons[namePos]) + # use the same node as before if still a symbol: + if result.PNode.kind == nkSym: result = PTransNode(n) else: result = PTransNode(n) of nkMacroDef: diff --git a/tests/destructor/tdestructor3.nim b/tests/destructor/tdestructor3.nim index 0968f1fd7..d0c53c7bd 100644 --- a/tests/destructor/tdestructor3.nim +++ b/tests/destructor/tdestructor3.nim @@ -19,10 +19,11 @@ proc `=`(lhs: var T, rhs: T) = proc `=destroy`(v: var T) = echo "destroy" -block: +proc usedToBeBlock = var v1 : T var v2 : T = v1 +usedToBeBlock() # bug #1632 |