Fixed yield in nnkChckRange (#12160)

This commit is contained in:
Yuriy Glukhov 2019-09-10 08:54:06 +03:00 • committed by Andreas Rumpf
commit 60911304b4
2 changed files with 16 additions and 2 deletions

View file

@ -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"