adds a test case

This commit is contained in:
ringabout
2026-04-09 14:57:45 +08:00
parent 8f2978b9c6
commit 77a991d019

View File

@@ -7,6 +7,7 @@ discard """
1.0
2.0
55
@[1, 2]
'''
"""
@@ -79,3 +80,14 @@ let x = compute:
echo x
# Crash: bridge.nim(206, 5) `allowEmpty` unexpected nkEmpty [AssertionDefect]
# Bare closure iterator type alias
type IntIter = iterator(): int {.closure.}
proc run(it: IntIter): seq[int] =
result = @[]
for x in it():
result.add(x)
let gen: IntIter = iterator(): int {.closure.} =
yield 1
yield 2
echo run(gen)