summary refs log tree commit diff
path: root/src/test/run-pass/alt-join.rs
blob: a7b6bd98ecd8e085db14e1cc9acb3a80e57ed4f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

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 */

    if true {
    } else { alt y { none::<T> { x = 17; } _ { x = 42; } } rs += ~[x]; }
    ret;
}

fn main() { #debug("hello"); foo::<int>(some::<int>(5)); }