summary refs log tree commit diff stats
path: root/tests/accept/run/titervaropenarray.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/accept/run/titervaropenarray.nim')
-rwxr-xr-xtests/accept/run/titervaropenarray.nim16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/accept/run/titervaropenarray.nim b/tests/accept/run/titervaropenarray.nim
new file mode 100755
index 000000000..1e70ce247
--- /dev/null
+++ b/tests/accept/run/titervaropenarray.nim
@@ -0,0 +1,16 @@
+discard """
+  file: "titer2.nim"
+  output: "123"
+"""
+# Try to break the transformation pass:
+iterator iterAndZero(a: var openArray[int]): int =
+  for i in 0..len(a)-1:
+    yield a[i]
+    a[i] = 0
+
+var x = [[1, 2, 3], [4, 5, 6]]
+for y in iterAndZero(x[0]): write(stdout, $y)
+#OUT 123
+
+
+