rust/src/test/run-pass/generic-obj.rs
Graydon Hoare d08b443fff Revert "Use different syntax for checks that matter to typestate"
This reverts commit aa25f22f19. It broke stage2, not sure why yet.
2011-05-02 17:35:33 -07:00

29 lines
461 B
Rust

obj buf[T](tup(T,T,T) data) {
fn get(int i) -> T {
if (i == 0) {
ret data._0;
} else {
if (i == 1) {
ret data._1;
} else {
ret data._2;
}
}
}
fn take(&T t) {}
fn take2(&T t) {}
}
fn main() {
let buf[int] b = buf[int](tup(1,2,3));
log "constructed object";
log b.get(0);
log b.get(1);
log b.get(2);
check (b.get(0) == 1);
check (b.get(1) == 2);
check (b.get(2) == 3);
b.take2(0);
}