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

17 lines
283 B
Rust
Raw Normal View History

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