Fixes #17849 (#18055) [backport:1.2]

* Fixes #17849
* Update compiler/closureiters.nim

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
This commit is contained in:
Yuriy Glukhov 2021-05-30 23:38:33 +03:00 • committed by GitHub
commit a6bd6c7ed8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 1 deletions

View file

@ -483,5 +483,19 @@ block: # nnkChckRange
test(it, 1, 2, 3)
echo "ok"
block: #17849 - yield in case subject
template yieldInCase: int =
yield 2
3
iterator it(): int {.closure.} =
yield 1
case yieldInCase()
of 1: checkpoint(11)
of 3: checkpoint(13)
else: checkpoint(14)
yield 5
test(it, 1, 2, 13, 5)
echo "ok"