summary refs log tree commit diff stats
path: root/compiler/transf.nim
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2020-07-31 12:13:33 +0200
committerGitHub <noreply@github.com>2020-07-31 12:13:33 +0200
commitd23ae4953510287c64e5bbbfb8c0e1eea23822f6 (patch)
tree18aed53f9799015b2e97dfcb0208665da45c680d /compiler/transf.nim
parentf1971243d3e162889b10b46caab8ba6e98afa92d (diff)
downloadNim-d23ae4953510287c64e5bbbfb8c0e1eea23822f6.tar.gz
fixes #15071 [backport] (#15131)
Diffstat (limited to 'compiler/transf.nim')
-rw-r--r--compiler/transf.nim6
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/transf.nim b/compiler/transf.nim
index 7aa18bf52..29344e7a1 100644
--- a/compiler/transf.nim
+++ b/compiler/transf.nim
@@ -1109,15 +1109,15 @@ proc liftDeferAux(n: PNode) =
         if n[i].kind == nkDefer:
           let deferPart = newNodeI(nkFinally, n[i].info)
           deferPart.add n[i][0]
-          var tryStmt = newNodeI(nkTryStmt, n[i].info)
-          var body = newNodeI(n.kind, n[i].info)
+          var tryStmt = newNodeIT(nkTryStmt, n[i].info, n.typ)
+          var body = newNodeIT(n.kind, n[i].info, n.typ)
           if i < last:
             body.sons = n.sons[(i+1)..last]
           tryStmt.add body
           tryStmt.add deferPart
           n[i] = tryStmt
           n.sons.setLen(i+1)
-          n.typ = n[i].typ
+          n.typ = tryStmt.typ
           goOn = true
           break
   for i in 0..n.safeLen-1: