fixes #13583; enforce void for nkWhileStmt (#20947)

* fixes #13583; enfore void for nkWhileStmt

* one more case

(cherry picked from commit d4afa53fd5)
This commit is contained in:
ringabout
2022-11-29 13:41:38 +08:00
committed by narimiran
parent 7e7b35b5c0
commit a0eec605ba
2 changed files with 39 additions and 0 deletions

View File

@@ -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