summaryrefslogtreecommitdiff
path: root/test/c/foreach_none.sail
diff options
context:
space:
mode:
authorAlasdair Armstrong2018-07-03 19:06:03 +0100
committerAlasdair Armstrong2018-07-03 19:08:08 +0100
commit53959905b8e4bfd4877c1e052195391d89bdb0d6 (patch)
tree7f1717e5d584c9bf384f7d8244b386f2f6599154 /test/c/foreach_none.sail
parentc1c51761101cd9313df3b111accb6237e558f0d2 (diff)
Fix a bug in foreach loops
We should test before the first iteration in case 'to' starts out as less than 'from'.
Diffstat (limited to 'test/c/foreach_none.sail')
-rw-r--r--test/c/foreach_none.sail11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/c/foreach_none.sail b/test/c/foreach_none.sail
new file mode 100644
index 00000000..bc960b85
--- /dev/null
+++ b/test/c/foreach_none.sail
@@ -0,0 +1,11 @@
+
+val "print" : string -> unit
+
+val main : unit -> unit
+
+function main() = {
+ foreach (i from 0 to -1 by 1 in inc) {
+ print("unreachable\n");
+ };
+ print("ok\n")
+} \ No newline at end of file