rust/src/test/run-pass/alt-join.rs

17 lines
359 B
Rust
Raw Normal View History

use std;
import option;
fn foo<T>(y: option<T>) {
let mut x: int;
let mut rs: ~[int] = ~[];
/* tests that x doesn't get put in the precondition for the
entire if expression */
2011-07-27 12:19:39 +00:00
if true {
} else { alt y { none::<T> { x = 17; } _ { x = 42; } } rs += ~[x]; }
2012-08-02 00:30:05 +00:00
return;
}
fn main() { debug!{"hello"}; foo::<int>(some::<int>(5)); }