summary refs log tree commit diff stats
path: root/tests/closure/tdeeplynested.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/closure/tdeeplynested.nim')
-rw-r--r--tests/closure/tdeeplynested.nim20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/closure/tdeeplynested.nim b/tests/closure/tdeeplynested.nim
new file mode 100644
index 000000000..ddf4fa6a4
--- /dev/null
+++ b/tests/closure/tdeeplynested.nim
@@ -0,0 +1,20 @@
+discard """
+  output: '''int: 108'''
+"""
+
+# bug #4070
+
+proc id(f: (proc())): auto =
+  return f
+
+proc foo(myinteger: int): (iterator(): int) =
+  return iterator(): int {.closure.} =
+           proc bar() =
+             proc kk() =
+               echo "int: ", myinteger
+
+             kk()
+
+           id(bar)()
+
+discard foo(108)()