summary refs log tree commit diff stats
path: root/tests/closure/t8550.nim
blob: a07f45cdc90994eea9b007c14bee1442b59bf456 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
discard """
  targets: "c js"
  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())