Permalink
Browse files

Fix #1458 (allow paren'd exprs to be the operator in a `do`)

Closes #1458
  • Loading branch information...
1 parent 165ce14 commit 4e5865f2ad13c4efe12a4c02f134ff761d16b26b @catamorphism catamorphism committed Oct 30, 2012
Showing with 13 additions and 1 deletion.
  1. +1 −1 src/libsyntax/parse/parser.rs
  2. +12 −0 src/test/run-pass/issue-1458.rs
@@ -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));
@@ -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.