summary refs log tree commit diff stats
path: root/tests/iter
diff options
context:
space:
mode:
authorYuriy Glukhov <yglukhov@users.noreply.github.com>2018-11-19 00:09:33 +0200
committerAndreas Rumpf <rumpf_a@web.de>2018-11-18 23:09:33 +0100
commit5a2290f788ebc160b3490a9f81d0478c0fad3aaf (patch)
treef89647ae53135258608550c674e893109adf4661 /tests/iter
parent5dfcc4e91ca38362e417b29becfa5c0e638c3d78 (diff)
downloadNim-5a2290f788ebc160b3490a9f81d0478c0fad3aaf.tar.gz
Fixed yield in nkObjConstr. Fixes #9694 [backport] (#9744)
* Fixed yield in nkObjConstr. Fixes #9694
* Separate expr lowering from state splitting, introduce a clear lowering internal error
Diffstat (limited to 'tests/iter')
-rw-r--r--tests/iter/tyieldintry.nim15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/iter/tyieldintry.nim b/tests/iter/tyieldintry.nim
index 6d24417a6..ee2790e54 100644
--- a/tests/iter/tyieldintry.nim
+++ b/tests/iter/tyieldintry.nim
@@ -440,4 +440,19 @@ block:
 
   test(it, 1, 2, 5)
 
+block: #9694 - yield in ObjConstr
+  type Foo = object
+    a, b: int
+
+  template yieldAndNum: int =
+    yield 1
+    2
+
+  iterator it(): int {.closure.} =
+    let a = Foo(a: 5, b: yieldAndNum())
+    checkpoint(a.b)
+
+  test(it, 1, 2)
+
 echo "ok"
+