summary refs log tree commit diff stats
path: root/tests/closure/t8550.nim
blob: 153246f085e640a3eb7ca7aaa4facc9e61d9847e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
discard """
  output: "@[\"42\"]"
"""

proc chk_fail(): seq[string] =
  iterator x(): int {.closure.} = yield 42
  proc f(cl: iterator(): int {.closure.}): seq[string] =
    result = @[]
    for i in cl(): result.add($i)
  result = f(x)

echo(chk_fail())