rust/src/test/run-pass/anon-obj-with-self-call-2.rs

17 lines
283 B
Rust
Raw Normal View History

2011-07-19 14:48:06 -05:00
// Reduced test case for issue #540.
fn main() {
obj a() {
2011-07-27 07:19:39 -05:00
fn foo() -> int { ret 2; }
2011-07-19 14:48:06 -05:00
}
2011-07-27 07:19:39 -05:00
let my_a = a();
let my_b =
obj () {
fn baz() -> int { ret self.foo(); }
with
my_a
};
2011-07-19 14:48:06 -05:00
assert (my_b.baz() == 2);
}