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

19 lines
290 B
Rust
Raw Normal View History

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