aboutsummaryrefslogtreecommitdiff
path: root/src/test/run-pass/alt-join.rs
blob: 8f45e6ff5ac09ba98868a44ae353d588b40b91b0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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));
}