class Zero {}
type Succ<T> = (Zero, 'T);
fn<T> succ(n: 'T) -> Succ<'T> {
return (Zero(), *n);
}
fn to_int(n: @Zero) -> Int {
return 0;
}
fn<T> to_int(n: @Succ<'T>) -> Int {
return get_1(n).to_int() + 1;
}
let n = succ(succ(succ(succ(Zero()))));
if to_int(n) != 4 {
panic("Invalid conversion");
}