summaryrefslogtreecommitdiff
path: root/test/subrangefor.myr
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2014-01-04 14:02:01 -0500
committerOri Bernstein <ori@eigenstate.org>2014-01-04 14:02:01 -0500
commit92e25d24edc4cd7c954ecb2b0bd88956566cbe22 (patch)
tree85d2deda69582f5aa1c799c551667afad2f8c121 /test/subrangefor.myr
parentb194f947b512b1791e614a5941ebc785cdd28730 (diff)
downloadmc-92e25d24edc4cd7c954ecb2b0bd88956566cbe22.tar.gz
Fix bug preventing complex exprs on 'for in' loops
'for in' loops had a bug where we would try to evaluate the sequence for the loop every time, instead of doing it once. This also caused the side effect of expecting lvalues instead of rvalues for the index expressions. This change fixes it.
Diffstat (limited to 'test/subrangefor.myr')
-rw-r--r--test/subrangefor.myr8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/subrangefor.myr b/test/subrangefor.myr
new file mode 100644
index 0000000..0a3acc4
--- /dev/null
+++ b/test/subrangefor.myr
@@ -0,0 +1,8 @@
+use std
+
+const main = {
+ for i in [1,2,3,4][:2]
+ std.put("%i", i)
+ ;;
+ std.put("\n")
+}