Test case showing that issue 324 is resolved.

This commit is contained in:
Lindsey Kuper 2011-05-27 12:43:23 -07:00
parent 0cbcf92749
commit 867e9fb030
1 changed files with 39 additions and 0 deletions

View File

@ -0,0 +1,39 @@
// xfail-boot
fn main() {
obj foo(mutable int i) {
fn inc_by(int incr) -> int {
i += incr;
ret i;
}
fn inc_by_5() -> int {
ret self.inc_by(5);
}
// A test case showing that issue #324 is resolved. (It used to
// be that commenting out this (unused!) function produced a
// type error.)
// fn wrapper(int incr) -> int {
// ret self.inc_by(incr);
// }
fn get() -> int {
ret i;
}
}
let int res;
auto o = foo(5);
res = o.get();
assert (res == 5);
res = o.inc_by(3);
assert (res == 8);
res = o.get();
assert (res == 8);
}