mirror of
https://github.com/nim-lang/Nim.git
synced 2026-08-16 11:58:20 +00:00
adds a test case
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user