diff options
author | ringabout <43030857+ringabout@users.noreply.github.com> | 2022-11-29 13:41:38 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-29 06:41:38 +0100 |
commit | d4afa53fd5fca70e4a09bb19bf34523b522ce309 (patch) | |
tree | e841916d374ea7e0e2ab76625a0118ce63271c66 /tests/discard | |
parent | b5a008bac8780098682b50874b81265e53569781 (diff) | |
download | Nim-d4afa53fd5fca70e4a09bb19bf34523b522ce309.tar.gz |
fixes #13583; enforce void for `nkWhileStmt` (#20947)
* fixes #13583; enfore void for nkWhileStmt * one more case
Diffstat (limited to 'tests/discard')
-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 + |