Files
Nim/tests/iter/titer11.nim
cooldome 613ea6e85e fixes #12747 [backport] (#13651)
* fixes #12747
* fix tests
* improve code style

Co-authored-by: cooldome <ariabushenko@bk.ru>
2020-03-16 13:40:40 +01:00

39 lines
628 B
Nim

discard """
output: '''
[
1
2
3
]
'''
"""
proc represent(i: int): iterator(): string =
result = iterator(): string =
yield $i
proc represent(s: seq[int]): iterator(): string =
result = iterator(): string =
yield "["
for i in s:
var events = represent(i)
for event in events():
yield event
yield "]"
let s = @[1, 2, 3]
var output = represent(s)
for item in output():
echo item
#------------------------------------------------------------------------------
# Issue #12747
type
ABC = ref object
arr: array[0x40000, pointer]
let a = ABC()
for a in a.arr:
assert a == nil