about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorTim Chevalier <chevalier@alum.wellesley.edu>2011-04-22 14:23:54 -0700
committerGraydon Hoare <graydon@mozilla.com>2011-04-28 13:26:19 -0700
commit25694582d994add42972b068209aa0b29fe8dcf1 (patch)
tree502feb0de8330390ab9aa9edee885578d38e1aea /src/test
parent707cd0281da28596f6f4b5e9cdf0af4f17bf50f0 (diff)
Fix bug in handling of expr_alt (postcond for alts was being intersected with postcond for scrutinee)
Diffstat (limited to 'src/test')
-rw-r--r--src/test/run-pass/alt-join.rs34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/test/run-pass/alt-join.rs b/src/test/run-pass/alt-join.rs
new file mode 100644
index 00000000000..152fac5d7bc
--- /dev/null
+++ b/src/test/run-pass/alt-join.rs
@@ -0,0 +1,34 @@
+use std;
+import std.option;
+import std.option.t;
+import std.option.none;
+import std.option.some;
+
+fn foo[T](&option.t[T] y) {
+  let int x;
+  
+  let vec[int] res = vec();
+  
+  /* tests that x doesn't get put in the precondition for the 
+     entire if expression */
+  if (true) {
+  }
+  else {
+    alt (y) {
+      case (none[T]) {
+        x = 17;
+      }
+      case (_) {
+        x = 42;
+      }
+    }
+    res += vec(x);
+  }
+
+  ret;
+}
+
+fn main() {
+  log("hello");
+  foo[int](some[int](5));
+}
\ No newline at end of file