diff --git a/crates/oxc_parser/src/js/arrow.rs b/crates/oxc_parser/src/js/arrow.rs index 494b350d7c660..61a23d0e56d01 100644 --- a/crates/oxc_parser/src/js/arrow.rs +++ b/crates/oxc_parser/src/js/arrow.rs @@ -13,21 +13,28 @@ struct ArrowFunctionHead<'a> { return_type: Option>>, r#async: bool, span: Span, + has_return_colon: bool, } impl<'a> ParserImpl<'a> { pub(super) fn try_parse_parenthesized_arrow_function_expression( &mut self, + allow_return_type_in_arrow_function: bool, ) -> Result>> { match self.is_parenthesized_arrow_function_expression() { Tristate::False => Ok(None), - Tristate::True => self.parse_parenthesized_arrow_function(), - Tristate::Maybe => self.parse_possible_parenthesized_arrow_function_expression(), + Tristate::True => self.parse_parenthesized_arrow_function_expression( + /* allow_return_type_in_arrow_function */ true, + ), + Tristate::Maybe => self.parse_possible_parenthesized_arrow_function_expression( + allow_return_type_in_arrow_function, + ), } } pub(super) fn try_parse_async_simple_arrow_function_expression( &mut self, + allow_return_type_in_arrow_function: bool, ) -> Result>> { if self.at(Kind::Async) && self.is_un_parenthesized_async_arrow_function_worker() == Tristate::True @@ -36,7 +43,12 @@ impl<'a> ParserImpl<'a> { self.bump_any(); // bump `async` let expr = self.parse_binary_expression_or_higher(Precedence::Comma)?; return self - .parse_simple_arrow_function_expression(span, expr, /* async */ true) + .parse_simple_arrow_function_expression( + span, + expr, + /* async */ true, + allow_return_type_in_arrow_function, + ) .map(Some); } Ok(None) @@ -204,6 +216,7 @@ impl<'a> ParserImpl<'a> { span: Span, ident: Expression<'a>, r#async: bool, + allow_return_type_in_arrow_function: bool, ) -> Result> { let has_await = self.ctx.has_await(); self.ctx = self.ctx.union_await_if(r#async); @@ -236,13 +249,17 @@ impl<'a> ParserImpl<'a> { self.expect(Kind::Arrow)?; - self.parse_arrow_function_body(ArrowFunctionHead { - type_parameters: None, - params, - return_type: None, - r#async, - span, - }) + self.parse_arrow_function_expression_body( + ArrowFunctionHead { + type_parameters: None, + params, + return_type: None, + r#async, + span, + has_return_colon: false, + }, + allow_return_type_in_arrow_function, + ) } fn parse_parenthesized_arrow_function_head(&mut self) -> Result> { @@ -262,6 +279,7 @@ impl<'a> ParserImpl<'a> { self.error(diagnostics::ts_arrow_function_this_parameter(this_param.span)); } + let has_return_colon = self.is_ts && self.at(Kind::Colon); let return_type = self.parse_ts_return_type_annotation(Kind::Arrow, false)?; self.ctx = self.ctx.and_await(has_await); @@ -272,7 +290,14 @@ impl<'a> ParserImpl<'a> { self.expect(Kind::Arrow)?; - Ok(ArrowFunctionHead { type_parameters, params, return_type, r#async, span }) + Ok(ArrowFunctionHead { + type_parameters, + params, + return_type, + r#async, + span, + has_return_colon, + }) } /// [ConciseBody](https://tc39.es/ecma262/#prod-ConciseBody) @@ -280,11 +305,12 @@ impl<'a> ParserImpl<'a> { /// { `FunctionBody`[~Yield, ~Await] } /// `ExpressionBody`[In, Await] : /// `AssignmentExpression`[?In, ~Yield, ?Await] - fn parse_arrow_function_body( + fn parse_arrow_function_expression_body( &mut self, arrow_function_head: ArrowFunctionHead<'a>, + allow_return_type_in_arrow_function: bool, ) -> Result> { - let ArrowFunctionHead { type_parameters, params, return_type, r#async, span } = + let ArrowFunctionHead { type_parameters, params, return_type, r#async, span, .. } = arrow_function_head; let has_await = self.ctx.has_await(); let has_yield = self.ctx.has_yield(); @@ -292,7 +318,8 @@ impl<'a> ParserImpl<'a> { let expression = !self.at(Kind::LCurly); let body = if expression { - let expr = self.parse_assignment_expression_or_higher()?; + let expr = self + .parse_assignment_expression_or_higher_impl(allow_return_type_in_arrow_function)?; let span = expr.span(); let expr_stmt = self.ast.statement_expression(span, expr); self.ast.alloc_function_body(span, self.ast.vec(), self.ast.vec1(expr_stmt)) @@ -316,22 +343,66 @@ impl<'a> ParserImpl<'a> { /// Section [Arrow Function](https://tc39.es/ecma262/#sec-arrow-function-definitions) /// `ArrowFunction`[In, Yield, Await] : /// `ArrowParameters`[?Yield, ?Await] [no `LineTerminator` here] => `ConciseBody`[?In] - fn parse_parenthesized_arrow_function(&mut self) -> Result>> { + fn parse_parenthesized_arrow_function_expression( + &mut self, + allow_return_type_in_arrow_function: bool, + ) -> Result>> { let head = self.parse_parenthesized_arrow_function_head()?; - self.parse_arrow_function_body(head).map(Some) + self.parse_arrow_function_expression_body(head, allow_return_type_in_arrow_function) + .map(Some) } fn parse_possible_parenthesized_arrow_function_expression( &mut self, + allow_return_type_in_arrow_function: bool, ) -> Result>> { let pos = self.cur_token().start; if self.state.not_parenthesized_arrow.contains(&pos) { return Ok(None); } - if let Some(head) = self.try_parse(ParserImpl::parse_parenthesized_arrow_function_head) { - return self.parse_arrow_function_body(head).map(Some); + + let checkpoint = self.checkpoint(); + + let Ok(head) = self.parse_parenthesized_arrow_function_head() else { + self.state.not_parenthesized_arrow.insert(pos); + self.rewind(checkpoint); + return Ok(None); + }; + + let has_return_colon = head.has_return_colon; + + let body = + self.parse_arrow_function_expression_body(head, allow_return_type_in_arrow_function)?; + + // Given: + // x ? y => ({ y }) : z => ({ z }) + // We try to parse the body of the first arrow function by looking at: + // ({ y }) : z => ({ z }) + // This is a valid arrow function with "z" as the return type. + // + // But, if we're in the true side of a conditional expression, this colon + // terminates the expression, so we cannot allow a return type if we aren't + // certain whether or not the preceding text was parsed as a parameter list. + // + // For example, + // a() ? (b: number, c?: string): void => d() : e + // is determined by isParenthesizedArrowFunctionExpression to unambiguously + // be an arrow expression, so we allow a return type. + if !allow_return_type_in_arrow_function && has_return_colon { + // However, if the arrow function we were able to parse is followed by another colon + // as in: + // a ? (x): string => x : null + // Then allow the arrow function, and treat the second colon as terminating + // the conditional expression. It's okay to do this because this code would + // be a syntax error in JavaScript (as the second colon shouldn't be there). + + if !self.at(Kind::Colon) { + self.state.not_parenthesized_arrow.insert(pos); + self.rewind(checkpoint); + return Ok(None); + } } - self.state.not_parenthesized_arrow.insert(pos); - Ok(None) + + Ok(Some(body)) } } diff --git a/crates/oxc_parser/src/js/expression.rs b/crates/oxc_parser/src/js/expression.rs index c1f6bed51599c..99795601852e4 100644 --- a/crates/oxc_parser/src/js/expression.rs +++ b/crates/oxc_parser/src/js/expression.rs @@ -1076,32 +1076,47 @@ impl<'a> ParserImpl<'a> { &mut self, lhs_span: Span, lhs: Expression<'a>, + allow_return_type_in_arrow_function: bool, ) -> Result> { if !self.eat(Kind::Question) { return Ok(lhs); } - let consequent = self.context( - Context::In, - Context::empty(), - Self::parse_assignment_expression_or_higher, - )?; + let consequent = self.context(Context::In, Context::empty(), |p| { + p.parse_assignment_expression_or_higher_impl( + /* allow_return_type_in_arrow_function */ false, + ) + })?; self.expect(Kind::Colon)?; - let alternate = self.parse_assignment_expression_or_higher()?; + let alternate = + self.parse_assignment_expression_or_higher_impl(allow_return_type_in_arrow_function)?; Ok(self.ast.expression_conditional(self.end_span(lhs_span), lhs, consequent, alternate)) } /// `AssignmentExpression`[In, Yield, Await] : pub(crate) fn parse_assignment_expression_or_higher(&mut self) -> Result> { + self.parse_assignment_expression_or_higher_impl( + /* allow_return_type_in_arrow_function */ true, + ) + } + + pub(crate) fn parse_assignment_expression_or_higher_impl( + &mut self, + allow_return_type_in_arrow_function: bool, + ) -> Result> { // [+Yield] YieldExpression if self.is_yield_expression() { return self.parse_yield_expression(); } - // `(x) => {}` - if let Some(arrow_expr) = self.try_parse_parenthesized_arrow_function_expression()? { + // `() => {}`, `(x) => {}` + if let Some(arrow_expr) = self.try_parse_parenthesized_arrow_function_expression( + allow_return_type_in_arrow_function, + )? { return Ok(arrow_expr); } // `async x => {}` - if let Some(arrow_expr) = self.try_parse_async_simple_arrow_function_expression()? { + if let Some(arrow_expr) = self + .try_parse_async_simple_arrow_function_expression(allow_return_type_in_arrow_function)? + { return Ok(arrow_expr); } @@ -1111,20 +1126,30 @@ impl<'a> ParserImpl<'a> { // `x => {}` if lhs.is_identifier_reference() && kind == Kind::Arrow { - return self.parse_simple_arrow_function_expression(span, lhs, /* async */ false); + return self.parse_simple_arrow_function_expression( + span, + lhs, + /* async */ false, + allow_return_type_in_arrow_function, + ); } if kind.is_assignment_operator() { - return self.parse_assignment_expression_recursive(span, lhs); + return self.parse_assignment_expression_recursive( + span, + lhs, + allow_return_type_in_arrow_function, + ); } - self.parse_conditional_expression_rest(span, lhs) + self.parse_conditional_expression_rest(span, lhs, allow_return_type_in_arrow_function) } fn parse_assignment_expression_recursive( &mut self, span: Span, lhs: Expression<'a>, + allow_return_type_in_arrow_function: bool, ) -> Result> { let operator = map_assignment_operator(self.cur_kind()); // 13.15.5 Destructuring Assignment @@ -1135,7 +1160,8 @@ impl<'a> ParserImpl<'a> { // ArrayAssignmentPattern let left = AssignmentTarget::cover(lhs, self)?; self.bump_any(); - let right = self.parse_assignment_expression_or_higher()?; + let right = + self.parse_assignment_expression_or_higher_impl(allow_return_type_in_arrow_function)?; Ok(self.ast.expression_assignment(self.end_span(span), operator, left, right)) } diff --git a/tasks/coverage/misc/pass/oxc-9215.ts b/tasks/coverage/misc/pass/oxc-9215.ts new file mode 100644 index 0000000000000..4e670befd56e9 --- /dev/null +++ b/tasks/coverage/misc/pass/oxc-9215.ts @@ -0,0 +1 @@ +a ? b ? (c = 0) : d => 1 : (e = 2) : f => 3; diff --git a/tasks/coverage/snapshots/codegen_misc.snap b/tasks/coverage/snapshots/codegen_misc.snap index 743760e5cd4d2..0f3d4714a974b 100644 --- a/tasks/coverage/snapshots/codegen_misc.snap +++ b/tasks/coverage/snapshots/codegen_misc.snap @@ -1,3 +1,3 @@ codegen_misc Summary: -AST Parsed : 31/31 (100.00%) -Positive Passed: 31/31 (100.00%) +AST Parsed : 32/32 (100.00%) +Positive Passed: 32/32 (100.00%) diff --git a/tasks/coverage/snapshots/parser_babel.snap b/tasks/coverage/snapshots/parser_babel.snap index d0d0487596016..c7184ea3c96e0 100644 --- a/tasks/coverage/snapshots/parser_babel.snap +++ b/tasks/coverage/snapshots/parser_babel.snap @@ -1,9 +1,9 @@ commit: acbc09a8 parser_babel Summary: -AST Parsed : 2277/2292 (99.35%) -Positive Passed: 2256/2292 (98.43%) -Negative Passed: 1542/1662 (92.78%) +AST Parsed : 2274/2292 (99.21%) +Positive Passed: 2253/2292 (98.30%) +Negative Passed: 1541/1662 (92.72%) Expect Syntax Error: tasks/coverage/babel/packages/babel-parser/test/fixtures/annex-b/enabled/3.1-sloppy-labeled-functions-if-body/input.js Expect Syntax Error: tasks/coverage/babel/packages/babel-parser/test/fixtures/core/categorized/invalid-fn-decl-labeled-inside-if/input.js Expect Syntax Error: tasks/coverage/babel/packages/babel-parser/test/fixtures/core/categorized/invalid-fn-decl-labeled-inside-loop/input.js @@ -39,6 +39,7 @@ Expect Syntax Error: tasks/coverage/babel/packages/babel-parser/test/fixtures/js Expect Syntax Error: tasks/coverage/babel/packages/babel-parser/test/fixtures/jsx/errors/_no-plugin-jsx-expression/input.js Expect Syntax Error: tasks/coverage/babel/packages/babel-parser/test/fixtures/jsx/errors/_no_plugin/input.js Expect Syntax Error: tasks/coverage/babel/packages/babel-parser/test/fixtures/jsx/errors/_no_plugin-non-BMP-identifier/input.js +Expect Syntax Error: tasks/coverage/babel/packages/babel-parser/test/fixtures/typescript/arrow-function/arrow-like-in-conditional-2/input.ts Expect Syntax Error: tasks/coverage/babel/packages/babel-parser/test/fixtures/typescript/cast/satisfies-const-error/input.ts Expect Syntax Error: tasks/coverage/babel/packages/babel-parser/test/fixtures/typescript/cast/unparenthesized-assert-and-assign/input.ts Expect Syntax Error: tasks/coverage/babel/packages/babel-parser/test/fixtures/typescript/cast/unparenthesized-type-assertion-and-assign/input.ts @@ -141,14 +142,20 @@ Expect to Parse: tasks/coverage/babel/packages/babel-parser/test/fixtures/core/o · ────────── ╰──── help: new.target is only allowed in constructors and functions invoked using thew `new` operator +Expect to Parse: tasks/coverage/babel/packages/babel-parser/test/fixtures/es2022/class-private-properties/await-identifier-in-property-in-arguments-of-async-call/input.js + + × Unexpected token + ╭─[babel/packages/babel-parser/test/fixtures/es2022/class-private-properties/await-identifier-in-property-in-arguments-of-async-call/input.js:1:31] + 1 │ async( x = class { #x = await }); + · ─ + ╰──── Expect to Parse: tasks/coverage/babel/packages/babel-parser/test/fixtures/es2022/class-private-properties/await-in-private-property-in-params-of-async-arrow/input.js - × Expected a semicolon or an implicit semicolon after a statement, but found none - ╭─[babel/packages/babel-parser/test/fixtures/es2022/class-private-properties/await-in-private-property-in-params-of-async-arrow/input.js:1:33] + × Unexpected token + ╭─[babel/packages/babel-parser/test/fixtures/es2022/class-private-properties/await-in-private-property-in-params-of-async-arrow/input.js:1:31] 1 │ async( x = class { #x = await }) => {} - · ▲ + · ─ ╰──── - help: Try insert a semicolon here Expect to Parse: tasks/coverage/babel/packages/babel-parser/test/fixtures/es2022/class-properties/arguments-in-key/input.js × 'arguments' is not allowed in class field initializer @@ -158,14 +165,27 @@ Expect to Parse: tasks/coverage/babel/packages/babel-parser/test/fixtures/es2022 · ───────── 4 │ } ╰──── +Expect to Parse: tasks/coverage/babel/packages/babel-parser/test/fixtures/es2022/class-properties/await-identifier-in-computed-property-in-arguments-of-async-call/input.js + + × Unexpected token + ╭─[babel/packages/babel-parser/test/fixtures/es2022/class-properties/await-identifier-in-computed-property-in-arguments-of-async-call/input.js:1:26] + 1 │ async( x = class { [await] = x }) + · ─ + ╰──── +Expect to Parse: tasks/coverage/babel/packages/babel-parser/test/fixtures/es2022/class-properties/await-identifier-in-property-in-arguments-of-async-call/input.js + + × Unexpected token + ╭─[babel/packages/babel-parser/test/fixtures/es2022/class-properties/await-identifier-in-property-in-arguments-of-async-call/input.js:1:30] + 1 │ async( x = class { x = await }); + · ─ + ╰──── Expect to Parse: tasks/coverage/babel/packages/babel-parser/test/fixtures/es2022/class-properties/await-in-property-in-params-of-async-arrow/input.js - × Expected a semicolon or an implicit semicolon after a statement, but found none - ╭─[babel/packages/babel-parser/test/fixtures/es2022/class-properties/await-in-property-in-params-of-async-arrow/input.js:1:32] + × Unexpected token + ╭─[babel/packages/babel-parser/test/fixtures/es2022/class-properties/await-in-property-in-params-of-async-arrow/input.js:1:30] 1 │ async( x = class { x = await }) => {} - · ▲ + · ─ ╰──── - help: Try insert a semicolon here Expect to Parse: tasks/coverage/babel/packages/babel-parser/test/fixtures/es2022/class-properties/new-target/input.js × Unexpected new.target expression @@ -5474,26 +5494,11 @@ Expect to Parse: tasks/coverage/babel/packages/babel-parser/test/fixtures/typesc ╰──── help: Try insert a semicolon here - × Expected a semicolon or an implicit semicolon after a statement, but found none - ╭─[babel/packages/babel-parser/test/fixtures/es2017/async-functions/multiple-await-in-async-arrow-params/input.js:1:41] - 1 │ async ({ x = [ await ], y = { await } }) => {} - · ▲ - ╰──── - help: Try insert a semicolon here - - × Invalid assignment in object literal - ╭─[babel/packages/babel-parser/test/fixtures/es2017/async-functions/multiple-await-in-async-arrow-params/input.js:1:10] - 1 │ async ({ x = [ await ], y = { await } }) => {} - · ───────────── - ╰──── - help: Did you mean to use a ':'? An '=' can only follow a property name when the containing object literal is part of a destructuring pattern. - - × Invalid assignment in object literal - ╭─[babel/packages/babel-parser/test/fixtures/es2017/async-functions/multiple-await-in-async-arrow-params/input.js:1:25] + × Unexpected token + ╭─[babel/packages/babel-parser/test/fixtures/es2017/async-functions/multiple-await-in-async-arrow-params/input.js:1:22] 1 │ async ({ x = [ await ], y = { await } }) => {} - · ───────────── + · ─ ╰──── - help: Did you mean to use a ':'? An '=' can only follow a property name when the containing object literal is part of a destructuring pattern. × Line terminator not permitted before arrow ╭─[babel/packages/babel-parser/test/fixtures/es2017/async-functions/newline-before-arrow/input.js:2:1] @@ -8209,12 +8214,11 @@ Expect to Parse: tasks/coverage/babel/packages/babel-parser/test/fixtures/typesc ╰──── help: Try insert a semicolon here - × Expected a semicolon or an implicit semicolon after a statement, but found none - ╭─[babel/packages/babel-parser/test/fixtures/es2022/class-properties/await-in-computed-property-in-params-of-async-arrow/input.js:1:34] + × Unexpected token + ╭─[babel/packages/babel-parser/test/fixtures/es2022/class-properties/await-in-computed-property-in-params-of-async-arrow/input.js:1:26] 1 │ async( x = class { [await] = x }) => {} - · ▲ + · ─ ╰──── - help: Try insert a semicolon here × Unexpected new.target expression ╭─[babel/packages/babel-parser/test/fixtures/es2022/class-properties/new-target-invalid/input.js:1:9] @@ -11456,13 +11460,6 @@ Expect to Parse: tasks/coverage/babel/packages/babel-parser/test/fixtures/typesc · ───── ╰──── - × Expected `:` but found `;` - ╭─[babel/packages/babel-parser/test/fixtures/typescript/arrow-function/arrow-like-in-conditional-2/input.ts:1:28] - 1 │ 0 ? v => (sum = v) : v => 0; - · ┬ - · ╰── `:` expected - ╰──── - × Expected a semicolon or an implicit semicolon after a statement, but found none ╭─[babel/packages/babel-parser/test/fixtures/typescript/arrow-function/async-arrow-function-after-binary-operator/input.ts:1:20] 1 │ 4 + async() => 2 diff --git a/tasks/coverage/snapshots/parser_misc.snap b/tasks/coverage/snapshots/parser_misc.snap index 043138c0b643f..051d57113359c 100644 --- a/tasks/coverage/snapshots/parser_misc.snap +++ b/tasks/coverage/snapshots/parser_misc.snap @@ -1,6 +1,6 @@ parser_misc Summary: -AST Parsed : 31/31 (100.00%) -Positive Passed: 31/31 (100.00%) +AST Parsed : 32/32 (100.00%) +Positive Passed: 32/32 (100.00%) Negative Passed: 26/26 (100.00%) × Unexpected token diff --git a/tasks/coverage/snapshots/parser_test262.snap b/tasks/coverage/snapshots/parser_test262.snap index 086eea7afa4b7..7b905d85bada0 100644 --- a/tasks/coverage/snapshots/parser_test262.snap +++ b/tasks/coverage/snapshots/parser_test262.snap @@ -6675,13 +6675,12 @@ Negative Passed: 4519/4519 (100.00%) 18 │ ╰──── - × Expected a semicolon or an implicit semicolon after a statement, but found none - ╭─[test262/test/language/expressions/async-arrow-function/early-errors-arrow-await-in-formals-default.js:15:17] + × Unexpected token + ╭─[test262/test/language/expressions/async-arrow-function/early-errors-arrow-await-in-formals-default.js:15:16] 14 │ $DONOTEVALUATE(); 15 │ async(x = await) => { } - · ▲ + · ─ ╰──── - help: Try insert a semicolon here × Cannot use `await` as an identifier in an async context ╭─[test262/test/language/expressions/async-arrow-function/early-errors-arrow-await-in-formals.js:15:7] diff --git a/tasks/coverage/snapshots/parser_typescript.snap b/tasks/coverage/snapshots/parser_typescript.snap index d9d92bee93a0a..b62a8800a0439 100644 --- a/tasks/coverage/snapshots/parser_typescript.snap +++ b/tasks/coverage/snapshots/parser_typescript.snap @@ -13785,13 +13785,12 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/salsa/private 2 │ } ╰──── - × Expected a semicolon or an implicit semicolon after a statement, but found none - ╭─[typescript/tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunction6_es2017.ts:1:28] + × Unexpected token + ╭─[typescript/tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunction6_es2017.ts:1:27] 1 │ var foo = async (a = await): Promise => { - · ▲ + · ─ 2 │ } ╰──── - help: Try insert a semicolon here × Unexpected token ╭─[typescript/tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunction7_es2017.ts:3:29] @@ -13874,13 +13873,12 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/salsa/private 2 │ } ╰──── - × Expected a semicolon or an implicit semicolon after a statement, but found none - ╭─[typescript/tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunction6_es5.ts:1:28] + × Unexpected token + ╭─[typescript/tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunction6_es5.ts:1:27] 1 │ var foo = async (a = await): Promise => { - · ▲ + · ─ 2 │ } ╰──── - help: Try insert a semicolon here × Unexpected token ╭─[typescript/tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunction7_es5.ts:3:29] @@ -14016,13 +14014,12 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/salsa/private 2 │ } ╰──── - × Expected a semicolon or an implicit semicolon after a statement, but found none - ╭─[typescript/tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction6_es6.ts:1:28] + × Unexpected token + ╭─[typescript/tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction6_es6.ts:1:27] 1 │ var foo = async (a = await): Promise => { - · ▲ + · ─ 2 │ } ╰──── - help: Try insert a semicolon here × Unexpected token ╭─[typescript/tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction7_es6.ts:3:29] diff --git a/tasks/coverage/snapshots/semantic_babel.snap b/tasks/coverage/snapshots/semantic_babel.snap index 0acee792d6e0f..444ae4bd28f22 100644 --- a/tasks/coverage/snapshots/semantic_babel.snap +++ b/tasks/coverage/snapshots/semantic_babel.snap @@ -2,7 +2,7 @@ commit: acbc09a8 semantic_babel Summary: AST Parsed : 2292/2292 (100.00%) -Positive Passed: 1909/2292 (83.29%) +Positive Passed: 1906/2292 (83.16%) tasks/coverage/babel/packages/babel-parser/test/fixtures/annex-b/enabled/3.3-function-in-if-body/input.js semantic error: Symbol scope ID mismatch for "f": after transform: SymbolId(0): ScopeId(4294967294) @@ -45,12 +45,18 @@ Scope flags mismatch: after transform: ScopeId(5): ScopeFlags(StrictMode) rebuilt : ScopeId(7): ScopeFlags(0x0) +tasks/coverage/babel/packages/babel-parser/test/fixtures/es2022/class-private-properties/await-identifier-in-property-in-arguments-of-async-call/input.js +semantic error: Unexpected token + tasks/coverage/babel/packages/babel-parser/test/fixtures/es2022/class-private-properties/await-in-private-property-in-params-of-async-arrow/input.js -semantic error: Expected a semicolon or an implicit semicolon after a statement, but found none +semantic error: Unexpected token tasks/coverage/babel/packages/babel-parser/test/fixtures/es2022/class-properties/arguments-in-key/input.js semantic error: 'arguments' is not allowed in class field initializer +tasks/coverage/babel/packages/babel-parser/test/fixtures/es2022/class-properties/await-identifier-in-computed-property-in-arguments-of-async-call/input.js +semantic error: Unexpected token + tasks/coverage/babel/packages/babel-parser/test/fixtures/es2022/class-properties/await-identifier-in-computed-property-inside-params-of-function-inside-params-of-async-function/input.js semantic error: Bindings mismatch: after transform: ScopeId(0): ["_asyncToGenerator", "_defineProperty"] @@ -62,8 +68,11 @@ Symbol scope ID mismatch for "_await": after transform: SymbolId(3): ScopeId(2) rebuilt : SymbolId(2): ScopeId(0) +tasks/coverage/babel/packages/babel-parser/test/fixtures/es2022/class-properties/await-identifier-in-property-in-arguments-of-async-call/input.js +semantic error: Unexpected token + tasks/coverage/babel/packages/babel-parser/test/fixtures/es2022/class-properties/await-in-property-in-params-of-async-arrow/input.js -semantic error: Expected a semicolon or an implicit semicolon after a statement, but found none +semantic error: Unexpected token tasks/coverage/babel/packages/babel-parser/test/fixtures/es2022/class-properties/new-target/input.js semantic error: Unexpected new.target expression diff --git a/tasks/coverage/snapshots/semantic_misc.snap b/tasks/coverage/snapshots/semantic_misc.snap index 519b4ba84010c..0ccd49b5d774e 100644 --- a/tasks/coverage/snapshots/semantic_misc.snap +++ b/tasks/coverage/snapshots/semantic_misc.snap @@ -1,6 +1,6 @@ semantic_misc Summary: -AST Parsed : 31/31 (100.00%) -Positive Passed: 19/31 (61.29%) +AST Parsed : 32/32 (100.00%) +Positive Passed: 19/32 (59.38%) tasks/coverage/misc/pass/oxc-1288.ts semantic error: Bindings mismatch: after transform: ScopeId(0): ["from"] @@ -178,3 +178,8 @@ Symbol flags mismatch for "A": after transform: SymbolId(0): SymbolFlags(ConstEnum) rebuilt : SymbolId(0): SymbolFlags(FunctionScopedVariable) +tasks/coverage/misc/pass/oxc-9215.ts +semantic error: Unresolved references mismatch: +after transform: ["a", "b", "d", "e"] +rebuilt : ["a", "b", "e"] + diff --git a/tasks/coverage/snapshots/transformer_misc.snap b/tasks/coverage/snapshots/transformer_misc.snap index df584875df17e..ec56234210c6e 100644 --- a/tasks/coverage/snapshots/transformer_misc.snap +++ b/tasks/coverage/snapshots/transformer_misc.snap @@ -1,3 +1,3 @@ transformer_misc Summary: -AST Parsed : 31/31 (100.00%) -Positive Passed: 31/31 (100.00%) +AST Parsed : 32/32 (100.00%) +Positive Passed: 32/32 (100.00%)