From 9570c6e6f4ae2f4d2c7d90c8441cc6b36bb063b6 Mon Sep 17 00:00:00 2001 From: Daniil Yarancev <21169548+Yardanico@users.noreply.github.com> Date: Mon, 16 Oct 2017 14:04:36 +0300 Subject: [PATCH] Add a test-case for #1641 --- tests/closure/t1641.nim | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 tests/closure/t1641.nim diff --git a/tests/closure/t1641.nim b/tests/closure/t1641.nim new file mode 100644 index 0000000000..a3e4da367c --- /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()