2011-06-16 19:33:31 -05:00
|
|
|
//xfail-stage1
|
2011-06-28 19:36:51 -05:00
|
|
|
//xfail-stage2
|
2011-07-20 21:37:09 -05:00
|
|
|
//xfail-stage3
|
2011-06-16 19:33:31 -05:00
|
|
|
use std;
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
|
|
|
|
obj a() {
|
2011-07-27 07:19:39 -05:00
|
|
|
fn foo() -> int { ret 2; }
|
|
|
|
fn bar() -> int { ret self.foo(); }
|
2011-06-16 19:33:31 -05:00
|
|
|
}
|
|
|
|
|
2011-07-27 07:19:39 -05:00
|
|
|
let my_a = a();
|
2011-06-16 19:33:31 -05:00
|
|
|
|
|
|
|
// Extending an object with a new field. Adding support for this
|
|
|
|
// is issue #538.
|
2011-06-21 18:32:27 -05:00
|
|
|
|
|
|
|
// Right now, this fails with "unresolved name: quux".
|
2011-07-27 07:19:39 -05:00
|
|
|
let my_c =
|
|
|
|
obj (quux: int = 3) {
|
|
|
|
fn baz() -> int { ret quux + 4; }
|
|
|
|
with
|
|
|
|
my_a
|
|
|
|
};
|
2011-06-16 19:33:31 -05:00
|
|
|
|
|
|
|
assert (my_c.baz() == 7);
|
|
|
|
|
2011-07-27 07:19:39 -05:00
|
|
|
}
|