summary refs log tree commit diff stats
path: root/tests/discard/tdiscardable.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/discard/tdiscardable.nim')
-rw-r--r--tests/discard/tdiscardable.nim34
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
+
/a> 28 29 30 31 32 33