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:
parent
418aa52510
commit
7340824cbc
3 changed files with 16 additions and 18 deletions
|
|
@ -8,4 +8,5 @@ fn main() {
|
|||
assert(f(5) == 6);
|
||||
assert(g(8) == 9);
|
||||
assert(h(0x1badd00d) == 0x1badd00e);
|
||||
assert((@add1)(42) == 43);
|
||||
}
|
||||
|
|
|
|||
11
src/test/run-pass/call-autoderef-tag.rs
Normal file
11
src/test/run-pass/call-autoderef-tag.rs
Normal 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);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue