rust/src/test/run-pass/alt-join.rs
Brian Anderson 518dc52f85 Reformat
This changes the indexing syntax from .() to [], the vector syntax from ~[] to
[] and the extension syntax from #fmt() to #fmt[]
2011-08-20 11:04:00 -07:00

20 lines
426 B
Rust

use std;
import std::option;
import std::option::t;
import std::option::none;
import std::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() { log "hello"; foo::<int>(some::<int>(5)); }