diff options
author | ringabout <43030857+ringabout@users.noreply.github.com> | 2023-07-22 12:37:27 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-22 06:37:27 +0200 |
commit | b02c1dd6ca96548b47d978f96278c67bf59e9d9e (patch) | |
tree | 6c4d0c54248ec928adce49f530029f6af4a24f9b /tests/closure/tclosure.nim | |
parent | 993fcf5bdac32964237b29e279ecf839095ac609 (diff) | |
download | Nim-b02c1dd6ca96548b47d978f96278c67bf59e9d9e.tar.gz |
fixes #22297; return in the finally in the closure iterators (#22300)
ref #22297; return in the finally in the closure iterators
Diffstat (limited to 'tests/closure/tclosure.nim')
-rw-r--r-- | tests/closure/tclosure.nim | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/closure/tclosure.nim b/tests/closure/tclosure.nim index fa1f79ffe..401a71d40 100644 --- a/tests/closure/tclosure.nim +++ b/tests/closure/tclosure.nim @@ -491,3 +491,14 @@ block tnoclosure: row = zip(row & @[0], @[0] & row).mapIt(it[0] + it[1]) echo row pascal(10) + +block: # bug #22297 + iterator f: int {.closure.} = + try: + yield 12 + finally: + return 14 + + let s = f + doAssert s() == 12 + doAssert s() == 14 |