Skip to content

Commit f3292bb

Browse files
committed
---
yaml --- r: 2819 b: refs/heads/master c: 867e9fb h: refs/heads/master i: 2817: b77bdc5 2815: 73ae07d v: v3
1 parent f530b93 commit f3292bb

File tree

2 files changed

+40
-1
lines changed

2 files changed

+40
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 0cbcf9274933af28998c2141e82f30246e380dc3
2+
refs/heads/master: 867e9fb03099274229a4fd7031541d7e1f9b0dc9

trunk/src/test/run-pass/obj-self-4.rs

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// xfail-boot
2+
fn main() {
3+
4+
obj foo(mutable int i) {
5+
fn inc_by(int incr) -> int {
6+
i += incr;
7+
ret i;
8+
}
9+
10+
fn inc_by_5() -> int {
11+
ret self.inc_by(5);
12+
}
13+
14+
// A test case showing that issue #324 is resolved. (It used to
15+
// be that commenting out this (unused!) function produced a
16+
// type error.)
17+
// fn wrapper(int incr) -> int {
18+
// ret self.inc_by(incr);
19+
// }
20+
21+
fn get() -> int {
22+
ret i;
23+
}
24+
}
25+
26+
let int res;
27+
auto o = foo(5);
28+
29+
res = o.get();
30+
assert (res == 5);
31+
32+
res = o.inc_by(3);
33+
assert (res == 8);
34+
35+
res = o.get();
36+
assert (res == 8);
37+
38+
}
39+

0 commit comments

Comments
 (0)