diff --git a/src/quick-lint-js/fe/parse.h b/src/quick-lint-js/fe/parse.h index 69d55e4f1c..09bd512b17 100644 --- a/src/quick-lint-js/fe/parse.h +++ b/src/quick-lint-js/fe/parse.h @@ -1172,7 +1172,7 @@ void Parser::parse_and_visit_parenthesized_expression( const Char8 *expression_begin = this->peek().begin; - Expression *ast = this->parse_expression(v); + Expression *ast = this->parse_expression(v, {.trailing_identifiers = true}); this->visit_expression(ast, v, Variable_Context::rhs); if constexpr (check_for_sketchy_conditions) { diff --git a/test/test-parse.cpp b/test/test-parse.cpp index 474815828e..2f9dbff235 100644 --- a/test/test-parse.cpp +++ b/test/test-parse.cpp @@ -320,8 +320,9 @@ TEST_F(Test_Parse, utter_garbage) { assert_diagnostics( p.code, p.errors, { - u8" ^ Diag_Expected_Parentheses_Around_If_Condition"_diag, // - u8" ^ Diag_Unexpected_Token"_diag, + u8" ^ Diag_Unexpected_Token"_diag, // + u8" ^^^^^^^^ Diag_Unexpected_Identifier_In_Expression"_diag, // + u8" ^^^^^^^^^^^ Diag_Expected_Parentheses_Around_If_Condition"_diag, }); } }