2011-06-15 11:19:50 -07:00
|
|
|
|
2011-04-22 14:23:54 -07:00
|
|
|
use std;
|
2011-05-12 17:24:54 +02:00
|
|
|
import std::option;
|
|
|
|
import std::option::t;
|
|
|
|
import std::option::none;
|
|
|
|
import std::option::some;
|
2011-04-22 14:23:54 -07:00
|
|
|
|
2011-07-27 14:19:39 +02:00
|
|
|
fn foo[T](y: &option::t[T]) {
|
|
|
|
let x: int;
|
|
|
|
let rs: vec[int] = [];
|
2011-07-13 15:44:09 -07:00
|
|
|
/* tests that x doesn't get put in the precondition for the
|
2011-06-15 11:19:50 -07:00
|
|
|
entire if expression */
|
2011-04-22 14:23:54 -07:00
|
|
|
|
2011-07-27 14:19:39 +02:00
|
|
|
if true {
|
|
|
|
} else { alt y { none[T]. { x = 17; } _ { x = 42; } } rs += [x]; }
|
2011-06-15 11:19:50 -07:00
|
|
|
ret;
|
2011-04-22 14:23:54 -07:00
|
|
|
}
|
|
|
|
|
2011-06-15 11:19:50 -07:00
|
|
|
fn main() { log "hello"; foo[int](some[int](5)); }
|