Skip to content

Commit e71f261

Browse files
committed
Exercise self-calls and overriding together a bit more.
1 parent fefeebc commit e71f261

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,16 @@ fn main() {
2222

2323
assert (my_b.baz() == 2);
2424

25+
auto my_c = obj {
26+
fn foo() -> int {
27+
ret 3;
28+
}
29+
fn baz() -> int {
30+
ret self.foo();
31+
}
32+
with my_a
33+
};
34+
35+
assert (my_c.baz() == 3);
36+
assert (my_c.bar() == 3);
2537
}

0 commit comments

Comments
 (0)