From 25694582d994add42972b068209aa0b29fe8dcf1 Mon Sep 17 00:00:00 2001 From: Tim Chevalier Date: Fri, 22 Apr 2011 14:23:54 -0700 Subject: Fix bug in handling of expr_alt (postcond for alts was being intersected with postcond for scrutinee) --- src/test/run-pass/alt-join.rs | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 src/test/run-pass/alt-join.rs (limited to 'src/test') diff --git a/src/test/run-pass/alt-join.rs b/src/test/run-pass/alt-join.rs new file mode 100644 index 00000000..152fac5d --- /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 -- cgit v1.2.3