diff options
Diffstat (limited to 'src/test/run-pass/anon-objs.rs')
| -rw-r--r-- | src/test/run-pass/anon-objs.rs | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/test/run-pass/anon-objs.rs b/src/test/run-pass/anon-objs.rs new file mode 100644 index 00000000..14279db2 --- /dev/null +++ b/src/test/run-pass/anon-objs.rs @@ -0,0 +1,33 @@ +// xfail-boot +// xfail-stage0 +// xfail-stage1 +use std; + +fn main() { + + obj a() { + fn foo() -> int { + ret 2; + } + fn bar() -> int { + ret self.foo(); + } + } + + auto my_a = a(); + + // Extending an object with a new method + auto my_b = obj { + fn baz() -> int { + ret self.foo(); + } + with my_a + }; + + // Extending an object with a new field + auto my_c = obj(int quux) { with my_a } ; + + // Should this be legal? + auto my_d = obj() { with my_a } ; + +} |