diff --git a/src/test/run-pass/generic-object.rs b/src/test/run-pass/generic-object.rs new file mode 100644 index 00000000000..7adeb55f8cc --- /dev/null +++ b/src/test/run-pass/generic-object.rs @@ -0,0 +1,20 @@ +trait Foo { + fn get() -> T; +} + +struct S { + x: int +} + +impl S : Foo { + fn get() -> int { + self.x + } +} + +fn main() { + let x = @S { x: 1 }; + let y = x as @Foo; + assert y.get() == 1; +} +