Fix autoderef of function calls when the function is not an lval.

As it turns out, the correct way to handle this is much simpler than what I
did originally.
Also add more tests.
This commit is contained in:
Michael Sullivan 2011-07-11 13:12:44 -05:00 committed by Brian Anderson
parent 418aa52510
commit 7340824cbc
3 changed files with 16 additions and 18 deletions

View file

@ -8,4 +8,5 @@ fn main() {
assert(f(5) == 6);
assert(g(8) == 9);
assert(h(0x1badd00d) == 0x1badd00e);
assert((@add1)(42) == 43);
}

View file

@ -0,0 +1,11 @@
// xfail-stage0
tag int_fn { f(fn(int) -> int); }
tag int_box_fn { fb(@fn(int) -> int); }
fn add1(int i) -> int { ret i+1; }
fn main() {
auto g = f(add1);
assert(g(4) == 5);
assert((f(add1))(5) == 6);
assert((@(f(add1)))(5) == 6);
assert((fb(@add1))(7) == 8);
}