Fixed yield in nnkChckRange (#12160)
This commit is contained in:
parent
ed1d41c51e
commit
60911304b4
2 changed files with 16 additions and 2 deletions
|
|
@ -467,5 +467,19 @@ block: #9716
|
|||
doAssert(b == "hello")
|
||||
test(it, 1, 1, 1)
|
||||
|
||||
block: # nnkChckRange
|
||||
type Foo = distinct uint64
|
||||
template yieldDistinct: Foo =
|
||||
yield 2
|
||||
Foo(0)
|
||||
|
||||
iterator it(): int {.closure.} =
|
||||
yield 1
|
||||
var a: int
|
||||
a = int(yieldDistinct())
|
||||
yield 3
|
||||
|
||||
test(it, 1, 2, 3)
|
||||
|
||||
echo "ok"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue