mirror of
https://github.com/nim-lang/Nim.git
synced 2026-02-11 22:08:54 +00:00
Add a test-case for #1641
This commit is contained in:
20
tests/closure/t1641.nim
Normal file
20
tests/closure/t1641.nim
Normal file
@@ -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()
|
||||
Reference in New Issue
Block a user