Skip to content

Instantly share code, notes, and snippets.

@nikomatsakis
Created March 15, 2012 23:26
Show Gist options
  • Save nikomatsakis/2047634 to your computer and use it in GitHub Desktop.
Save nikomatsakis/2047634 to your computer and use it in GitHub Desktop.
iface i { fn foo() -> self<>; }
fn foo<T:i>(v: T) -> T {
ret v.foo();
}
impl of i for uint {
fn foo() -> uint { ret self; }
}
fn main() {
let x: i = 3u as i;
let y = foo(x); // y has type i, but is in fact a uint
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment