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

use std;
import option;
import option::t;
import option::none;
import option::some;

fn foo<T>(y: option::t<T>) {
    let x: int;
    let 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)); }