rust/src/test/run-pass/anon-objs-with-fields.rs
Brian Anderson c53402846e Remove all xfail-stage0 directives
While it is still technically possible to test stage 0, it is not part of any
of the main testing rules and maintaining xfail-stage0 is a chore. Nobody
should worry about how tests fare in stage0.
2011-08-03 10:55:59 -07:00

28 lines
510 B
Rust

//xfail-stage1
//xfail-stage2
//xfail-stage3
use std;
fn main() {
obj a() {
fn foo() -> int { ret 2; }
fn bar() -> int { ret self.foo(); }
}
let my_a = a();
// Extending an object with a new field. Adding support for this
// is issue #538.
// Right now, this fails with "unresolved name: quux".
let my_c =
obj (quux: int = 3) {
fn baz() -> int { ret quux + 4; }
with
my_a
};
assert (my_c.baz() == 7);
}