diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2020-03-09 15:32:38 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-09 15:32:38 +0100 |
commit | 63af8ae53ca8e1ffd61a2c2d55d09c5fe30310e1 (patch) | |
tree | 64f73cf00505159f9720aa6113e07ad1dcdf6857 /compiler/transf.nim | |
parent | 4aecc6b3465411d99dbd94e89c1bb3eb371d6fa6 (diff) | |
download | Nim-63af8ae53ca8e1ffd61a2c2d55d09c5fe30310e1.tar.gz |
fixes #13596 (#13612)
Diffstat (limited to 'compiler/transf.nim')
-rw-r--r-- | compiler/transf.nim | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/compiler/transf.nim b/compiler/transf.nim index 68ef464c4..cd5eaa100 100644 --- a/compiler/transf.nim +++ b/compiler/transf.nim @@ -128,6 +128,19 @@ proc transformSymAux(c: PTransf, n: PNode): PNode = b = s.getBody if b.kind != nkSym: internalError(c.graph.config, n.info, "wrong AST for borrowed symbol") b = newSymNode(b.sym, n.info) + elif c.inlining > 0: + # see bug #13596: we use ref-based equality in the DFA for destruction + # injections so we need to ensure unique nodes after iterator inlining + # which can lead to duplicated for loop bodies! Consider: + #[ + while remaining > 0: + if ending == nil: + yield ms + break + ... + yield ms + ]# + b = newSymNode(n.sym, n.info) else: b = n while tc != nil: |