summary refs log tree commit diff stats
path: root/tests/closure
diff options
context:
space:
mode:
authorDaniil Yarancev <21169548+Yardanico@users.noreply.github.com>2017-10-16 14:04:36 +0300
committerGitHub <noreply@github.com>2017-10-16 14:04:36 +0300
commit9570c6e6f4ae2f4d2c7d90c8441cc6b36bb063b6 (patch)
tree21d83f4aa58fe744cfa2d68d3930b6c549504776 /tests/closure
parentb219fc74ad057a02a7455f0b83fa4239dbfe5979 (diff)
downloadNim-9570c6e6f4ae2f4d2c7d90c8441cc6b36bb063b6.tar.gz
Add a test-case for #1641
Diffstat (limited to 'tests/closure')
-rw-r--r--tests/closure/t1641.nim20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/closure/t1641.nim b/tests/closure/t1641.nim
new file mode 100644
index 000000000..a3e4da367
--- /dev/null
+++ b/tests/closure/t1641.nim
@@ -0,0 +1,20 @@
+discard """
+  output: '''foo 0
+bar 0
+baz'''
+"""
+
+# bug #1641
+proc baz() =
+  echo "baz"
+
+proc bar(x: int, p: proc()) =
+  echo "bar ", x
+  p()
+
+proc foo(x: int, p: proc(x: int)) =
+  echo "foo ", x
+  p(x)
+
+let x = 0
+x.foo do(x: int): x.bar do(): baz()