mirror of
https://github.com/nim-lang/Nim.git
synced 2026-05-02 20:14:44 +00:00
ref #22297; return in the finally in the closure iterators
(cherry picked from commit b02c1dd6ca)
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user