diff --git a/src/test/run-pass/anon-obj-with-self-call-2.rs b/src/test/run-pass/anon-obj-with-self-call-2.rs new file mode 100644 index 0000000000000..88dbbca8b5c6c --- /dev/null +++ b/src/test/run-pass/anon-obj-with-self-call-2.rs @@ -0,0 +1,22 @@ +//xfail-stage0 +//xfail-stage1 +//xfail-stage2 + +// Reduced test case for issue #540. +fn main() { + obj a() { + fn foo() -> int { + ret 2; + } + } + + auto my_a = a(); + auto my_b = obj { + fn baz() -> int { + ret self.foo(); + } + with my_a + }; + + assert (my_b.baz() == 2); +}