Skip to content

Commit 6ba4e34

Browse files
committed
Reduced test case for current backwarding bug.
Still working on getting backwarding to play nicely with self and overriding. Currently can't fix issue #702 without breaking how self and overriding interact.
1 parent a34f7c8 commit 6ba4e34

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
//xfail-stage0
2+
//xfail-stage1
3+
//xfail-stage2
4+
//xfail-stage3
5+
use std;
6+
7+
fn main() {
8+
9+
obj a() {
10+
fn foo() -> int { ret 2; }
11+
fn bar() -> int { ret self.foo(); }
12+
}
13+
14+
let my_a = a();
15+
16+
let my_b = obj () {
17+
fn baz() -> int { ret self.foo(); }
18+
with my_a
19+
};
20+
21+
// These should all be 2.
22+
log_err my_a.foo();
23+
log_err my_a.bar();
24+
log_err my_b.foo();
25+
26+
// This works fine. It sends us to foo on my_b, which forwards to
27+
// foo on my_a.
28+
log_err my_b.baz();
29+
30+
// Currently segfaults. It forwards us to bar on my_a, which
31+
// backwards us to foo on my_b, which forwards us to foo on my_a
32+
// -- or, at least, that's how it should work.
33+
log_err my_b.bar();
34+
35+
}

0 commit comments

Comments
 (0)