From 63af8ae53ca8e1ffd61a2c2d55d09c5fe30310e1 Mon Sep 17 00:00:00 2001 From: Andreas Rumpf Date: Mon, 9 Mar 2020 15:32:38 +0100 Subject: fixes #13596 (#13612) --- compiler/transf.nim | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'compiler/transf.nim') 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: -- cgit 1.4.1-2-gfad0