diff options
Diffstat (limited to 'tests/discard/tdiscardable.nim')
-rw-r--r-- | tests/discard/tdiscardable.nim | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/discard/tdiscardable.nim b/tests/discard/tdiscardable.nim index 032050139..b13130a13 100644 --- a/tests/discard/tdiscardable.nim +++ b/tests/discard/tdiscardable.nim @@ -65,3 +65,37 @@ proc main2() = main1() main2() + +block: # bug #13583 + block: + proc hello(): int {.discardable.} = 12 + + iterator test(): int {.closure.} = + while true: + hello() + + let t = test + + block: + proc hello(): int {.discardable.} = 12 + + iterator test(): int {.closure.} = + while true: + block: + yield 12 + hello() + + let t = test + doAssert t() == 12 + + block: + proc hello(): int {.discardable.} = 12 + + iterator test(): int {.closure.} = + while true: + yield 12 + hello() + + let t = test + doAssert t() == 12 + |