Skip to content

Commit

Permalink
fix(fe): don't report missing else for bad if expression
Browse files Browse the repository at this point in the history
  • Loading branch information
arieldon committed Oct 29, 2023
1 parent 640b5e7 commit 9a706ea
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/quick-lint-js/fe/parse.h
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
5 changes: 3 additions & 2 deletions test/test-parse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
}
}
Expand Down

0 comments on commit 9a706ea

Please sign in to comment.