summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorTanguy <tanguy@status.im>2022-06-30 23:19:04 +0200
committerGitHub <noreply@github.com>2022-06-30 23:19:04 +0200
commitce4078acd40bb27de5d05832f486dbc95918a3c9 (patch)
treea35d315cc1961d5b22827c722cd527e45f2599ec /compiler
parent2c0aaac3045a63b5e4a24468341bf9ccfc8820cc (diff)
downloadNim-ce4078acd40bb27de5d05832f486dbc95918a3c9.tar.gz
Allow recursive closure iterators (#19939)
Diffstat (limited to 'compiler')
-rw-r--r--compiler/semexprs.nim3
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim
index ed28d8145..e07a98417 100644
--- a/compiler/semexprs.nim
+++ b/compiler/semexprs.nim
@@ -886,7 +886,8 @@ proc semOverloadedCallAnalyseEffects(c: PContext, n: PNode, nOrig: PNode,
     case callee.kind
     of skMacro, skTemplate: discard
     else:
-      if callee.kind == skIterator and callee.id == c.p.owner.id:
+      if callee.kind == skIterator and callee.id == c.p.owner.id and
+          not isClosureIterator(c.p.owner.typ):
         localError(c.config, n.info, errRecursiveDependencyIteratorX % callee.name.s)
         # error correction, prevents endless for loop elimination in transf.
         # See bug #2051: