diff options
| author | Tim Chevalier <[email protected]> | 2011-04-22 14:23:54 -0700 |
|---|---|---|
| committer | Graydon Hoare <[email protected]> | 2011-04-28 13:26:19 -0700 |
| commit | 25694582d994add42972b068209aa0b29fe8dcf1 (patch) | |
| tree | 502feb0de8330390ab9aa9edee885578d38e1aea /src/test | |
| parent | Fixed bug in typeck that wasn't filling in anns for stmts (diff) | |
| download | rust-25694582d994add42972b068209aa0b29fe8dcf1.tar.xz rust-25694582d994add42972b068209aa0b29fe8dcf1.zip | |
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.rs | 34 |
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 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 |