blob: a785f91d3b449951bf0ea8cf428d2cd98442431c (
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));
}
|