parent
7c31b6a47b
commit
8a344cb25b
1 changed files with 55 additions and 0 deletions
55
tests/closure/t11042.nim
Normal file
55
tests/closure/t11042.nim
Normal file
|
|
@ -0,0 +1,55 @@
|
||||||
|
discard """
|
||||||
|
output:'''
|
||||||
|
foo: 1
|
||||||
|
foo: 2
|
||||||
|
bar: 1
|
||||||
|
bar: 2
|
||||||
|
foo: 1
|
||||||
|
foo: 2
|
||||||
|
bar: 1
|
||||||
|
bar: 2
|
||||||
|
bar: 3
|
||||||
|
bar: 4
|
||||||
|
bar: 5
|
||||||
|
bar: 6
|
||||||
|
bar: 7
|
||||||
|
bar: 8
|
||||||
|
bar: 9
|
||||||
|
'''
|
||||||
|
"""
|
||||||
|
|
||||||
|
# bug #11042
|
||||||
|
block:
|
||||||
|
iterator foo: int =
|
||||||
|
for x in 1..2:
|
||||||
|
echo "foo: ", x
|
||||||
|
for y in 1..2:
|
||||||
|
discard
|
||||||
|
|
||||||
|
for x in foo(): discard
|
||||||
|
|
||||||
|
let bar = iterator: int =
|
||||||
|
for x in 1..2:
|
||||||
|
echo "bar: ", x
|
||||||
|
for y in 1..2:
|
||||||
|
discard
|
||||||
|
|
||||||
|
for x in bar(): discard
|
||||||
|
|
||||||
|
|
||||||
|
block:
|
||||||
|
iterator foo: int =
|
||||||
|
for x in 1..2:
|
||||||
|
echo "foo: ", x
|
||||||
|
for y in 1..2:
|
||||||
|
discard
|
||||||
|
|
||||||
|
for x in foo(): discard
|
||||||
|
|
||||||
|
let bar = iterator: int =
|
||||||
|
for x in 1..9:
|
||||||
|
echo "bar: ", x
|
||||||
|
for y in 1..2:
|
||||||
|
discard
|
||||||
|
|
||||||
|
for x in bar(): discard
|
||||||
Loading…
Add table
Add a link
Reference in a new issue