summary refs log tree commit diff stats
path: root/tests/closure
diff options
context:
space:
mode:
authorLemonBoy <LemonBoy@users.noreply.github.com>2018-08-12 20:41:48 +0200
committerAndreas Rumpf <rumpf_a@web.de>2018-08-12 20:41:48 +0200
commitba7c874a7df6e96dee2d7647a3f554d7476d3ae6 (patch)
tree707a56f3ee9141f0de6976e494294d42438dce46 /tests/closure
parent089529c16aa45926eb64395e27b8e56b46f4aa92 (diff)
downloadNim-ba7c874a7df6e96dee2d7647a3f554d7476d3ae6.tar.gz
Mysterious fix for #8550 (#8561)
Replacing the `for` body with a nkEmpty node is not the right thing to
do.
Diffstat (limited to 'tests/closure')
-rw-r--r--tests/closure/t8550.nim12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/closure/t8550.nim b/tests/closure/t8550.nim
new file mode 100644
index 000000000..153246f08
--- /dev/null
+++ b/tests/closure/t8550.nim
@@ -0,0 +1,12 @@
+discard """
+  output: "@[\"42\"]"
+"""
+
+proc chk_fail(): seq[string] =
+  iterator x(): int {.closure.} = yield 42
+  proc f(cl: iterator(): int {.closure.}): seq[string] =
+    result = @[]
+    for i in cl(): result.add($i)
+  result = f(x)
+
+echo(chk_fail())