rust/src/test/run-pass/anon-obj-overriding-reduced.rs

19 lines
276 B
Rust
Raw Normal View History

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