Skip to content

Commit

Permalink
Fix #1458 (allow paren'd exprs to be the operator in a do)
Browse files Browse the repository at this point in the history
Closes #1458
  • Loading branch information
catamorphism committed Oct 30, 2012
1 parent 165ce14 commit 4e5865f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/libsyntax/parse/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1576,7 +1576,7 @@ impl Parser {
@{node: expr_call(f, args, true),
.. *e}
}
expr_path(*) | expr_field(*) | expr_call(*) => {
expr_path(*) | expr_field(*) | expr_call(*) | expr_paren(*) => {
let block = self.parse_lambda_block_expr();
let last_arg = self.mk_expr(block.span.lo, block.span.hi,
ctor(block));
Expand Down
12 changes: 12 additions & 0 deletions src/test/run-pass/issue-1458.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
fn plus_one(f: fn() -> int) -> int {
return f() + 1;
}

fn ret_plus_one() -> fn(fn() -> int) -> int {
return plus_one;
}

fn main() {
let z = do (ret_plus_one()) || { 2 };
assert z == 3;
}

0 comments on commit 4e5865f

Please sign in to comment.