Skip to content

Commit 4ff6b6f

Browse files
committed
Test cases for issue #822.
1 parent f1cec57 commit 4ff6b6f

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

src/test/run-pass/anon-obj-no-inner-obj.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
//xfail-stage3
44
use std;
55

6-
// Should we support this? See issue #812.
6+
// This is failing not because it's an anonymous object from nothing
7+
// -- that park seems to work fine -- but, rather, because methods
8+
// that are added to an object at the same time can't refer to each
9+
// other (issue #822).
710

811
fn main() {
912

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
//xfail-stage1
2+
//xfail-stage2
3+
//xfail-stage3
4+
5+
// Test case for issue #822.
6+
fn main() {
7+
obj a() {
8+
fn foo() -> int {
9+
ret 2;
10+
}
11+
}
12+
13+
let my_a = a();
14+
15+
let my_b = obj() {
16+
fn bar() -> int {
17+
ret self.baz();
18+
}
19+
fn baz() -> int {
20+
ret 3;
21+
}
22+
with my_a
23+
};
24+
}

0 commit comments

Comments
 (0)