From d5cd29d3646a57940385960fd40fc27bfcb28f51 Mon Sep 17 00:00:00 2001 From: Boshen <1430279+Boshen@users.noreply.github.com> Date: Thu, 8 May 2025 05:56:10 +0000 Subject: [PATCH] refactor(parser): refactor parse member expression (#10880) closes #10615 --- crates/oxc_parser/src/diagnostics.rs | 11 + crates/oxc_parser/src/js/expression.rs | 160 +++++--- .../snapshots/codegen_typescript.snap | 4 +- .../coverage/snapshots/estree_typescript.snap | 4 +- tasks/coverage/snapshots/parser_babel.snap | 142 ++----- .../coverage/snapshots/parser_typescript.snap | 91 ++++- .../snapshots/semantic_typescript.snap | 386 +----------------- .../snapshots/transformer_typescript.snap | 4 +- tasks/coverage/src/typescript/meta.rs | 12 + 9 files changed, 227 insertions(+), 587 deletions(-) diff --git a/crates/oxc_parser/src/diagnostics.rs b/crates/oxc_parser/src/diagnostics.rs index c592355df8c74..9d0c336b552eb 100644 --- a/crates/oxc_parser/src/diagnostics.rs +++ b/crates/oxc_parser/src/diagnostics.rs @@ -252,6 +252,17 @@ pub fn new_optional_chain(span: Span) -> OxcDiagnostic { .with_label(span) } +#[cold] +pub fn invalid_new_optional_chain(span: Span) -> OxcDiagnostic { + OxcDiagnostic::error("Invalid optional chain from new expression.").with_label(span) +} + +#[cold] +pub fn decorator_optional(span: Span) -> OxcDiagnostic { + OxcDiagnostic::error("Expression must be enclosed in parentheses to be used as a decorator.") + .with_label(span) +} + #[cold] pub fn for_loop_async_of(span: Span) -> OxcDiagnostic { OxcDiagnostic::error("The left-hand side of a `for...of` statement may not be `async`") diff --git a/crates/oxc_parser/src/js/expression.rs b/crates/oxc_parser/src/js/expression.rs index 0e49a028552b2..26df454c71dae 100644 --- a/crates/oxc_parser/src/js/expression.rs +++ b/crates/oxc_parser/src/js/expression.rs @@ -655,6 +655,9 @@ impl<'a> ParserImpl<'a> { if !in_optional_chain { return lhs; } + if self.ctx.has_decorator() { + self.error(diagnostics::decorator_optional(lhs.span())); + } // Add `ChainExpression` to `a?.c?.b`; if let Expression::TSInstantiationExpression(mut expr) = lhs { expr.expression = self.map_to_chain_expression( @@ -691,7 +694,12 @@ impl<'a> ParserImpl<'a> { ) -> Expression<'a> { let span = self.start_span(); let lhs = self.parse_primary_expression(); - self.parse_member_expression_rest(span, lhs, in_optional_chain) + self.parse_member_expression_rest( + span, + lhs, + in_optional_chain, + /* allow_optional_chain */ true, + ) } /// Section 13.3 Super Call @@ -719,60 +727,60 @@ impl<'a> ParserImpl<'a> { lhs_span: u32, lhs: Expression<'a>, in_optional_chain: &mut bool, + allow_optional_chain: bool, ) -> Expression<'a> { let mut lhs = lhs; loop { if self.fatal_error.is_some() { return lhs; } - lhs = match self.cur_kind() { - Kind::Dot => self.parse_static_member_expression(lhs_span, lhs, false), - Kind::QuestionDot => { - *in_optional_chain = true; - match self.peek_kind() { - Kind::LBrack if !self.ctx.has_decorator() => { - self.bump_any(); // bump `?.` - self.parse_computed_member_expression(lhs_span, lhs, true) - } - Kind::PrivateIdentifier => { - self.parse_static_member_expression(lhs_span, lhs, true) - } - kind if kind.is_identifier_name() => { - self.parse_static_member_expression(lhs_span, lhs, true) - } - Kind::Bang - | Kind::LAngle - | Kind::LParen - | Kind::NoSubstitutionTemplate - | Kind::ShiftLeft - | Kind::TemplateHead - | Kind::LBrack => break, - _ => { - return self.unexpected(); - } - } - } - // computed member expression is not allowed in decorator - // class C { @dec ["1"]() { } } - // ^ - Kind::LBrack if !self.ctx.has_decorator() => { - self.parse_computed_member_expression(lhs_span, lhs, false) - } - Kind::Bang if !self.cur_token().is_on_new_line && self.is_ts => { + + let mut question_dot = false; + let is_property_access = if allow_optional_chain && self.at(Kind::QuestionDot) && { + let peek_kind = self.peek_kind(); + peek_kind == Kind::LBrack + || peek_kind.is_identifier_or_keyword() + || peek_kind.is_template_start_of_tagged_template() + } { + self.bump_any(); + *in_optional_chain = true; + question_dot = true; + self.cur_kind().is_identifier_or_keyword() + } else { + self.eat(Kind::Dot) + }; + + if is_property_access { + lhs = self.parse_static_member_expression(lhs_span, lhs, question_dot); + continue; + } + + if (question_dot || !self.ctx.has_decorator()) && self.at(Kind::LBrack) { + lhs = self.parse_computed_member_expression(lhs_span, lhs, question_dot); + continue; + } + + if self.cur_kind().is_template_start_of_tagged_template() { + let (expr, type_parameters) = + if let Expression::TSInstantiationExpression(instantiation_expr) = lhs { + let expr = instantiation_expr.unbox(); + (expr.expression, Some(expr.type_arguments)) + } else { + (lhs, None) + }; + lhs = + self.parse_tagged_template(lhs_span, expr, *in_optional_chain, type_parameters); + continue; + } + + if !question_dot { + if self.at(Kind::Bang) && !self.cur_token().is_on_new_line && self.is_ts { self.bump_any(); - self.ast.expression_ts_non_null(self.end_span(lhs_span), lhs) - } - kind if kind.is_template_start_of_tagged_template() => { - let (expr, type_parameters) = - if let Expression::TSInstantiationExpression(instantiation_expr) = lhs { - let expr = instantiation_expr.unbox(); - (expr.expression, Some(expr.type_arguments)) - } else { - (lhs, None) - }; - self.parse_tagged_template(lhs_span, expr, *in_optional_chain, type_parameters) + lhs = self.ast.expression_ts_non_null(self.end_span(lhs_span), lhs); + continue; } - Kind::LAngle | Kind::ShiftLeft => { + + if matches!(self.cur_kind(), Kind::LAngle | Kind::ShiftLeft) { if let Some(Some(arguments)) = self.try_parse(Self::parse_type_arguments_in_expression) { @@ -783,12 +791,11 @@ impl<'a> ParserImpl<'a> { ); continue; } - break; } - _ => break, - }; + } + + return lhs; } - lhs } /// Section 13.3 `MemberExpression` @@ -799,7 +806,6 @@ impl<'a> ParserImpl<'a> { lhs: Expression<'a>, optional: bool, ) -> Expression<'a> { - self.bump_any(); // advance `.` or `?.` Expression::from(if self.cur_kind() == Kind::PrivateIdentifier { let private_ident = self.parse_private_identifier(); self.ast.member_expression_private_field_expression( @@ -843,10 +849,18 @@ impl<'a> ParserImpl<'a> { self.fatal_error(diagnostics::new_target(self.end_span(span))) }; } - let rhs_span = self.start_span(); + let rhs_span = self.start_span(); let mut optional = false; - let mut callee = self.parse_member_expression_or_higher(&mut optional); + let mut callee = { + let lhs = self.parse_primary_expression(); + self.parse_member_expression_rest( + rhs_span, + lhs, + &mut optional, + /* allow_optional_chain */ false, + ) + }; let mut type_arguments = None; if let Expression::TSInstantiationExpression(instantiation_expr) = callee { @@ -855,6 +869,11 @@ impl<'a> ParserImpl<'a> { callee = instantiation_expr.expression; } + if self.at(Kind::QuestionDot) { + let error = diagnostics::invalid_new_optional_chain(self.cur_token().span()); + return self.fatal_error(error); + } + // parse `new ident` without arguments let arguments = if self.eat(Kind::LParen) { // ArgumentList[Yield, Await] : @@ -895,23 +914,32 @@ impl<'a> ParserImpl<'a> { ) -> Expression<'a> { let mut lhs = lhs; while self.fatal_error.is_none() { - let mut type_arguments = None; - lhs = self.parse_member_expression_rest(lhs_span, lhs, in_optional_chain); - let optional_call = self.eat(Kind::QuestionDot); - *in_optional_chain = if optional_call { true } else { *in_optional_chain }; + lhs = self.parse_member_expression_rest( + lhs_span, + lhs, + in_optional_chain, + /* allow_optional_chain */ true, + ); + let question_dot_span = self.at(Kind::QuestionDot).then(|| self.cur_token().span()); + let question_dot = question_dot_span.is_some(); + if question_dot { + self.bump_any(); + *in_optional_chain = true; + } - if optional_call { + let mut type_arguments = None; + if question_dot { if let Some(Some(args)) = self.try_parse(Self::parse_type_arguments_in_expression) { type_arguments = Some(args); } if self.cur_kind().is_template_start_of_tagged_template() { - lhs = self.parse_tagged_template(lhs_span, lhs, optional_call, type_arguments); + lhs = self.parse_tagged_template(lhs_span, lhs, question_dot, type_arguments); continue; } } if type_arguments.is_some() || self.at(Kind::LParen) { - if !optional_call { + if !question_dot { if let Expression::TSInstantiationExpression(expr) = lhs { let expr = expr.unbox(); type_arguments.replace(expr.type_arguments); @@ -919,10 +947,16 @@ impl<'a> ParserImpl<'a> { } } - lhs = - self.parse_call_arguments(lhs_span, lhs, optional_call, type_arguments.take()); + lhs = self.parse_call_arguments(lhs_span, lhs, question_dot, type_arguments.take()); continue; } + + if let Some(span) = question_dot_span { + // We parsed `?.` but then failed to parse anything, so report a missing identifier here. + let error = diagnostics::unexpected_token(span); + return self.fatal_error(error); + } + break; } diff --git a/tasks/coverage/snapshots/codegen_typescript.snap b/tasks/coverage/snapshots/codegen_typescript.snap index b544271a4c89a..44fc70262c92f 100644 --- a/tasks/coverage/snapshots/codegen_typescript.snap +++ b/tasks/coverage/snapshots/codegen_typescript.snap @@ -1,5 +1,5 @@ commit: 15392346 codegen_typescript Summary: -AST Parsed : 6531/6531 (100.00%) -Positive Passed: 6531/6531 (100.00%) +AST Parsed : 6528/6528 (100.00%) +Positive Passed: 6528/6528 (100.00%) diff --git a/tasks/coverage/snapshots/estree_typescript.snap b/tasks/coverage/snapshots/estree_typescript.snap index 02457688d2415..6c1674eac09b7 100644 --- a/tasks/coverage/snapshots/estree_typescript.snap +++ b/tasks/coverage/snapshots/estree_typescript.snap @@ -1,8 +1,8 @@ commit: 15392346 estree_typescript Summary: -AST Parsed : 6481/6481 (100.00%) -Positive Passed: 6478/6481 (99.95%) +AST Parsed : 6480/6480 (100.00%) +Positive Passed: 6477/6480 (99.95%) Mismatch: tasks/coverage/typescript/tests/cases/conformance/jsx/jsxReactTestSuite.tsx Mismatch: tasks/coverage/typescript/tests/cases/conformance/jsx/tsxReactEmitEntities.tsx diff --git a/tasks/coverage/snapshots/parser_babel.snap b/tasks/coverage/snapshots/parser_babel.snap index c289f81bfd592..7cf023352dab7 100644 --- a/tasks/coverage/snapshots/parser_babel.snap +++ b/tasks/coverage/snapshots/parser_babel.snap @@ -3,7 +3,7 @@ commit: 578ac4df parser_babel Summary: AST Parsed : 2309/2322 (99.44%) Positive Passed: 2288/2322 (98.54%) -Negative Passed: 1559/1673 (93.19%) +Negative Passed: 1560/1673 (93.25%) Expect Syntax Error: tasks/coverage/babel/packages/babel-parser/test/fixtures/core/categorized/invalid-startindex-and-startline-specified-without-startcolumn/input.js Expect Syntax Error: tasks/coverage/babel/packages/babel-parser/test/fixtures/core/categorized/startline-and-startcolumn-specified/input.js @@ -178,8 +178,6 @@ Expect Syntax Error: tasks/coverage/babel/packages/babel-parser/test/fixtures/ty Expect Syntax Error: tasks/coverage/babel/packages/babel-parser/test/fixtures/typescript/static-blocks/invalid-static-blocks-with-modifier-readonly-01/input.ts -Expect Syntax Error: tasks/coverage/babel/packages/babel-parser/test/fixtures/typescript/type-arguments/call-optional-chain-invalid/input.ts - Expect Syntax Error: tasks/coverage/babel/packages/babel-parser/test/fixtures/typescript/type-arguments/empty-function/input.ts Expect Syntax Error: tasks/coverage/babel/packages/babel-parser/test/fixtures/typescript/type-arguments/empty-function-babel-7/input.ts @@ -6151,140 +6149,44 @@ Expect to Parse: tasks/coverage/babel/packages/babel-parser/test/fixtures/typesc ╰──── help: Wrap either expression by parentheses - × Optional chaining cannot appear in the callee of new expressions - ╭─[babel/packages/babel-parser/test/fixtures/es2020/optional-chaining/class-contructor-call/input.js:1:1] + × Invalid optional chain from new expression. + ╭─[babel/packages/babel-parser/test/fixtures/es2020/optional-chaining/class-contructor-call/input.js:1:6] 1 │ new C?.b.d() - · ──────────── - ╰──── - - × Optional chaining cannot appear in the callee of new expressions - ╭─[babel/packages/babel-parser/test/fixtures/es2020/optional-chaining/new-createParenthesizedExpressions-false/input.js:1:1] - 1 │ new foo?.bar(); - · ────────────── - 2 │ new foo.bar?.(); - ╰──── - - × Optional chaining cannot appear in the callee of new expressions - ╭─[babel/packages/babel-parser/test/fixtures/es2020/optional-chaining/new-createParenthesizedExpressions-false/input.js:2:1] - 1 │ new foo?.bar(); - 2 │ new foo.bar?.(); - · ─────────── - 3 │ new foo?.[0]; - ╰──── - - × Optional chaining cannot appear in the callee of new expressions - ╭─[babel/packages/babel-parser/test/fixtures/es2020/optional-chaining/new-createParenthesizedExpressions-false/input.js:3:1] - 2 │ new foo.bar?.(); - 3 │ new foo?.[0]; - · ──────────── - 4 │ - ╰──── - - × Optional chaining cannot appear in the callee of new expressions - ╭─[babel/packages/babel-parser/test/fixtures/es2020/optional-chaining/new-createParenthesizedExpressions-true/input.js:1:1] - 1 │ new foo?.bar(); - · ────────────── - 2 │ new foo.bar?.(); - ╰──── - - × Optional chaining cannot appear in the callee of new expressions - ╭─[babel/packages/babel-parser/test/fixtures/es2020/optional-chaining/new-createParenthesizedExpressions-true/input.js:2:1] - 1 │ new foo?.bar(); - 2 │ new foo.bar?.(); - · ─────────── - 3 │ new foo?.[0]; - ╰──── - - × Optional chaining cannot appear in the callee of new expressions - ╭─[babel/packages/babel-parser/test/fixtures/es2020/optional-chaining/new-createParenthesizedExpressions-true/input.js:3:1] - 2 │ new foo.bar?.(); - 3 │ new foo?.[0]; - · ──────────── - 4 │ + · ── ╰──── - × Optional chaining cannot appear in the callee of new expressions - ╭─[babel/packages/babel-parser/test/fixtures/es2020/optional-chaining/new-ts-createParenthesizedExpressions-false/input.ts:1:1] + × Invalid optional chain from new expression. + ╭─[babel/packages/babel-parser/test/fixtures/es2020/optional-chaining/new-createParenthesizedExpressions-false/input.js:1:8] 1 │ new foo?.bar(); - · ────────────── + · ── 2 │ new foo.bar?.(); ╰──── - × Optional chaining cannot appear in the callee of new expressions - ╭─[babel/packages/babel-parser/test/fixtures/es2020/optional-chaining/new-ts-createParenthesizedExpressions-false/input.ts:2:1] + × Invalid optional chain from new expression. + ╭─[babel/packages/babel-parser/test/fixtures/es2020/optional-chaining/new-createParenthesizedExpressions-true/input.js:1:8] 1 │ new foo?.bar(); + · ── 2 │ new foo.bar?.(); - · ─────────── - 3 │ new foo?.bar!() - ╰──── - - × Optional chaining cannot appear in the callee of new expressions - ╭─[babel/packages/babel-parser/test/fixtures/es2020/optional-chaining/new-ts-createParenthesizedExpressions-false/input.ts:3:1] - 2 │ new foo.bar?.(); - 3 │ new foo?.bar!() - · ─────────────── - 4 │ new foo?.[0]; - ╰──── - - × Optional chaining cannot appear in the callee of new expressions - ╭─[babel/packages/babel-parser/test/fixtures/es2020/optional-chaining/new-ts-createParenthesizedExpressions-false/input.ts:4:1] - 3 │ new foo?.bar!() - 4 │ new foo?.[0]; - · ──────────── - 5 │ new foo?.bar![0]; ╰──── - × Optional chaining cannot appear in the callee of new expressions - ╭─[babel/packages/babel-parser/test/fixtures/es2020/optional-chaining/new-ts-createParenthesizedExpressions-false/input.ts:5:1] - 4 │ new foo?.[0]; - 5 │ new foo?.bar![0]; - · ──────────────── - 6 │ - ╰──── - - × Optional chaining cannot appear in the callee of new expressions - ╭─[babel/packages/babel-parser/test/fixtures/es2020/optional-chaining/new-ts-createParenthesizedExpressions-true copy/input.ts:1:1] + × Invalid optional chain from new expression. + ╭─[babel/packages/babel-parser/test/fixtures/es2020/optional-chaining/new-ts-createParenthesizedExpressions-false/input.ts:1:8] 1 │ new foo?.bar(); - · ────────────── + · ── 2 │ new foo.bar?.(); ╰──── - × Optional chaining cannot appear in the callee of new expressions - ╭─[babel/packages/babel-parser/test/fixtures/es2020/optional-chaining/new-ts-createParenthesizedExpressions-true copy/input.ts:2:1] + × Invalid optional chain from new expression. + ╭─[babel/packages/babel-parser/test/fixtures/es2020/optional-chaining/new-ts-createParenthesizedExpressions-true copy/input.ts:1:8] 1 │ new foo?.bar(); + · ── 2 │ new foo.bar?.(); - · ─────────── - 3 │ new foo?.bar!() - ╰──── - - × Optional chaining cannot appear in the callee of new expressions - ╭─[babel/packages/babel-parser/test/fixtures/es2020/optional-chaining/new-ts-createParenthesizedExpressions-true copy/input.ts:3:1] - 2 │ new foo.bar?.(); - 3 │ new foo?.bar!() - · ─────────────── - 4 │ new foo?.[0]; - ╰──── - - × Optional chaining cannot appear in the callee of new expressions - ╭─[babel/packages/babel-parser/test/fixtures/es2020/optional-chaining/new-ts-createParenthesizedExpressions-true copy/input.ts:4:1] - 3 │ new foo?.bar!() - 4 │ new foo?.[0]; - · ──────────── - 5 │ new foo?.bar![0]; - ╰──── - - × Optional chaining cannot appear in the callee of new expressions - ╭─[babel/packages/babel-parser/test/fixtures/es2020/optional-chaining/new-ts-createParenthesizedExpressions-true copy/input.ts:5:1] - 4 │ new foo?.[0]; - 5 │ new foo?.bar![0]; - · ──────────────── - 6 │ ╰──── - × Optional chaining cannot appear in the callee of new expressions - ╭─[babel/packages/babel-parser/test/fixtures/es2020/optional-chaining/optional-constructor/input.js:1:1] + × Invalid optional chain from new expression. + ╭─[babel/packages/babel-parser/test/fixtures/es2020/optional-chaining/optional-constructor/input.js:1:6] 1 │ new a?.(); - · ───── + · ── ╰──── × 'super' can only be used with function calls or in property accesses @@ -13072,6 +12974,12 @@ Expect to Parse: tasks/coverage/babel/packages/babel-parser/test/fixtures/typesc ╰──── help: Try insert a semicolon here + × Unexpected token + ╭─[babel/packages/babel-parser/test/fixtures/typescript/type-arguments/call-optional-chain-invalid/input.ts:1:2] + 1 │ f?.[1]; + · ── + ╰──── + × Expected a semicolon or an implicit semicolon after a statement, but found none ╭─[babel/packages/babel-parser/test/fixtures/typescript/type-arguments/new-without-arguments-missing-semicolon/input.ts:1:9] 1 │ new A if (0); diff --git a/tasks/coverage/snapshots/parser_typescript.snap b/tasks/coverage/snapshots/parser_typescript.snap index 0343db03648ff..46bdf1d654ecc 100644 --- a/tasks/coverage/snapshots/parser_typescript.snap +++ b/tasks/coverage/snapshots/parser_typescript.snap @@ -1,9 +1,9 @@ commit: 15392346 parser_typescript Summary: -AST Parsed : 6523/6531 (99.88%) -Positive Passed: 6511/6531 (99.69%) -Negative Passed: 1314/5754 (22.84%) +AST Parsed : 6521/6528 (99.89%) +Positive Passed: 6509/6528 (99.71%) +Negative Passed: 1315/5757 (22.84%) Expect Syntax Error: tasks/coverage/typescript/tests/cases/compiler/ClassDeclaration24.ts Expect Syntax Error: tasks/coverage/typescript/tests/cases/compiler/ExportAssignment7.ts @@ -4476,6 +4476,8 @@ Expect Syntax Error: tasks/coverage/typescript/tests/cases/compiler/unusedVariab Expect Syntax Error: tasks/coverage/typescript/tests/cases/compiler/useBeforeDeclaration_classDecorators.1.ts +Expect Syntax Error: tasks/coverage/typescript/tests/cases/compiler/useBeforeDeclaration_classDecorators.2.ts + Expect Syntax Error: tasks/coverage/typescript/tests/cases/compiler/useBeforeDeclaration_destructuring.ts Expect Syntax Error: tasks/coverage/typescript/tests/cases/compiler/useBeforeDeclaration_jsx.tsx @@ -5968,6 +5970,8 @@ Expect Syntax Error: tasks/coverage/typescript/tests/cases/conformance/esDecorat Expect Syntax Error: tasks/coverage/typescript/tests/cases/conformance/esDecorators/esDecorators-arguments.ts +Expect Syntax Error: tasks/coverage/typescript/tests/cases/conformance/esDecorators/esDecorators-decoratorExpression.3.ts + Expect Syntax Error: tasks/coverage/typescript/tests/cases/conformance/esDecorators/esDecorators-emitDecoratorMetadata.ts Expect Syntax Error: tasks/coverage/typescript/tests/cases/conformance/expressions/arrayLiterals/arrayLiterals.ts @@ -9160,17 +9164,6 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/es6/moduleExp 65 │ var y = _; ╰──── -Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/esDecorators/esDecorators-decoratorExpression.1.ts - - × Expected a semicolon or an implicit semicolon after a statement, but found none - ╭─[typescript/tests/cases/conformance/esDecorators/esDecorators-decoratorExpression.1.ts:13:12] - 12 │ - 13 │ { @x?.["y"] class C {} } - · ▲ - 14 │ - ╰──── - help: Try insert a semicolon here - Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/moduleResolution/untypedModuleImport.ts × Expected a semicolon or an implicit semicolon after a statement, but found none @@ -13131,11 +13124,11 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/salsa/private 6 │ ╰──── - × Optional chaining cannot appear in the callee of new expressions - ╭─[typescript/tests/cases/compiler/invalidOptionalChainFromNewExpression.ts:5:1] + × Invalid optional chain from new expression. + ╭─[typescript/tests/cases/compiler/invalidOptionalChainFromNewExpression.ts:5:6] 4 │ 5 │ new A?.b() // error - · ────────── + · ── 6 │ new A()?.b() // ok ╰──── @@ -23723,6 +23716,70 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/salsa/private 3 │ } ╰──── + × Expression must be enclosed in parentheses to be used as a decorator. + ╭─[typescript/tests/cases/conformance/esDecorators/esDecorators-decoratorExpression.1.ts:9:4] + 8 │ + 9 │ { @x?.y class C {} } + · ──── + 10 │ + ╰──── + + × Expression must be enclosed in parentheses to be used as a decorator. + ╭─[typescript/tests/cases/conformance/esDecorators/esDecorators-decoratorExpression.1.ts:11:4] + 10 │ + 11 │ { @x?.y() class C {} } + · ────── + 12 │ + ╰──── + + × Expression must be enclosed in parentheses to be used as a decorator. + ╭─[typescript/tests/cases/conformance/esDecorators/esDecorators-decoratorExpression.1.ts:13:4] + 12 │ + 13 │ { @x?.["y"] class C {} } + · ──────── + 14 │ + ╰──── + + × Expression must be enclosed in parentheses to be used as a decorator. + ╭─[typescript/tests/cases/conformance/esDecorators/esDecorators-decoratorExpression.1.ts:15:4] + 14 │ + 15 │ { @x?.() class C {} } + · ───── + 16 │ + ╰──── + + × Expression must be enclosed in parentheses to be used as a decorator. + ╭─[typescript/tests/cases/conformance/esDecorators/esDecorators-decoratorExpression.1.ts:31:14] + 30 │ + 31 │ { class C { @x?.y m() {} } } + · ──── + 32 │ + ╰──── + + × Expression must be enclosed in parentheses to be used as a decorator. + ╭─[typescript/tests/cases/conformance/esDecorators/esDecorators-decoratorExpression.1.ts:33:14] + 32 │ + 33 │ { class C { @x?.y() m() {} } } + · ────── + 34 │ + ╰──── + + × Expression must be enclosed in parentheses to be used as a decorator. + ╭─[typescript/tests/cases/conformance/esDecorators/esDecorators-decoratorExpression.1.ts:35:14] + 34 │ + 35 │ { class C { @x?.["y"] m() {} } } + · ──────── + 36 │ + ╰──── + + × Expression must be enclosed in parentheses to be used as a decorator. + ╭─[typescript/tests/cases/conformance/esDecorators/esDecorators-decoratorExpression.1.ts:37:14] + 36 │ + 37 │ { class C { @x?.() m() {} } } + · ───── + 38 │ + ╰──── + × Private identifier '#foo' is not allowed outside class bodies ╭─[typescript/tests/cases/conformance/esDecorators/esDecorators-privateFieldAccess.ts:3:13] 2 │ diff --git a/tasks/coverage/snapshots/semantic_typescript.snap b/tasks/coverage/snapshots/semantic_typescript.snap index f0177b5c72ea4..4c582aae1e0ae 100644 --- a/tasks/coverage/snapshots/semantic_typescript.snap +++ b/tasks/coverage/snapshots/semantic_typescript.snap @@ -1,8 +1,8 @@ commit: 15392346 semantic_typescript Summary: -AST Parsed : 6531/6531 (100.00%) -Positive Passed: 2843/6531 (43.53%) +AST Parsed : 6528/6528 (100.00%) +Positive Passed: 2843/6528 (43.55%) semantic Error: tasks/coverage/typescript/tests/cases/compiler/2dArrays.ts Symbol reference IDs mismatch for "Cell": after transform: SymbolId(0): [ReferenceId(1)] @@ -32102,368 +32102,6 @@ Symbol span mismatch for "ts": after transform: SymbolId(0): Span { start: 10, end: 12 } rebuilt : SymbolId(0): Span { start: 0, end: 0 } -semantic Error: tasks/coverage/typescript/tests/cases/compiler/useBeforeDeclaration_classDecorators.2.ts -Bindings mismatch: -after transform: ScopeId(0): ["C1", "C2", "C3", "C4", "C5", "C6", "_C", "_C2", "_C3", "_decorate", "_decorateMetadata", "_decorateParam", "_defineProperty", "dec"] -rebuilt : ScopeId(0): ["C1", "C2", "C3", "C4", "C5", "C6", "_C", "_C2", "_C3", "_decorate", "_decorateMetadata", "_decorateParam", "_defineProperty"] -Scope children mismatch: -after transform: ScopeId(0): [ScopeId(1), ScopeId(2), ScopeId(3), ScopeId(4), ScopeId(5), ScopeId(6), ScopeId(29), ScopeId(39)] -rebuilt : ScopeId(0): [ScopeId(1), ScopeId(2), ScopeId(3), ScopeId(4), ScopeId(5), ScopeId(6), ScopeId(16), ScopeId(17), ScopeId(18), ScopeId(19), ScopeId(20), ScopeId(21), ScopeId(22), ScopeId(23), ScopeId(24), ScopeId(25), ScopeId(26), ScopeId(27), ScopeId(28), ScopeId(29), ScopeId(39), ScopeId(49), ScopeId(50), ScopeId(51), ScopeId(52), ScopeId(53), ScopeId(54), ScopeId(55), ScopeId(56), ScopeId(57), ScopeId(58), ScopeId(59), ScopeId(60), ScopeId(61)] -Scope children mismatch: -after transform: ScopeId(6): [ScopeId(7), ScopeId(8), ScopeId(9), ScopeId(10), ScopeId(11), ScopeId(12), ScopeId(13), ScopeId(14), ScopeId(15), ScopeId(16), ScopeId(17), ScopeId(18), ScopeId(19), ScopeId(20), ScopeId(21), ScopeId(22), ScopeId(23), ScopeId(25), ScopeId(27)] -rebuilt : ScopeId(6): [ScopeId(7), ScopeId(8), ScopeId(9), ScopeId(10), ScopeId(11), ScopeId(12), ScopeId(13), ScopeId(14), ScopeId(15)] -Scope children mismatch: -after transform: ScopeId(23): [ScopeId(24)] -rebuilt : ScopeId(13): [] -Scope children mismatch: -after transform: ScopeId(25): [ScopeId(26)] -rebuilt : ScopeId(14): [] -Scope children mismatch: -after transform: ScopeId(27): [ScopeId(28)] -rebuilt : ScopeId(15): [] -Scope flags mismatch: -after transform: ScopeId(7): ScopeFlags(StrictMode | Function | Arrow) -rebuilt : ScopeId(16): ScopeFlags(Function | Arrow) -Scope parent mismatch: -after transform: ScopeId(7): Some(ScopeId(6)) -rebuilt : ScopeId(16): Some(ScopeId(0)) -Scope flags mismatch: -after transform: ScopeId(9): ScopeFlags(StrictMode | Function | Arrow) -rebuilt : ScopeId(17): ScopeFlags(Function | Arrow) -Scope parent mismatch: -after transform: ScopeId(9): Some(ScopeId(6)) -rebuilt : ScopeId(17): Some(ScopeId(0)) -Scope flags mismatch: -after transform: ScopeId(11): ScopeFlags(StrictMode | Function | Arrow) -rebuilt : ScopeId(18): ScopeFlags(Function | Arrow) -Scope parent mismatch: -after transform: ScopeId(11): Some(ScopeId(6)) -rebuilt : ScopeId(18): Some(ScopeId(0)) -Scope flags mismatch: -after transform: ScopeId(13): ScopeFlags(StrictMode | Function | Arrow) -rebuilt : ScopeId(19): ScopeFlags(Function | Arrow) -Scope parent mismatch: -after transform: ScopeId(13): Some(ScopeId(6)) -rebuilt : ScopeId(19): Some(ScopeId(0)) -Scope flags mismatch: -after transform: ScopeId(14): ScopeFlags(StrictMode | Function | Arrow) -rebuilt : ScopeId(20): ScopeFlags(Function | Arrow) -Scope parent mismatch: -after transform: ScopeId(14): Some(ScopeId(6)) -rebuilt : ScopeId(20): Some(ScopeId(0)) -Scope flags mismatch: -after transform: ScopeId(15): ScopeFlags(StrictMode | Function | Arrow) -rebuilt : ScopeId(21): ScopeFlags(Function | Arrow) -Scope parent mismatch: -after transform: ScopeId(15): Some(ScopeId(6)) -rebuilt : ScopeId(21): Some(ScopeId(0)) -Scope flags mismatch: -after transform: ScopeId(17): ScopeFlags(StrictMode | Function | Arrow) -rebuilt : ScopeId(22): ScopeFlags(Function | Arrow) -Scope parent mismatch: -after transform: ScopeId(17): Some(ScopeId(6)) -rebuilt : ScopeId(22): Some(ScopeId(0)) -Scope flags mismatch: -after transform: ScopeId(19): ScopeFlags(StrictMode | Function | Arrow) -rebuilt : ScopeId(23): ScopeFlags(Function | Arrow) -Scope parent mismatch: -after transform: ScopeId(19): Some(ScopeId(6)) -rebuilt : ScopeId(23): Some(ScopeId(0)) -Scope flags mismatch: -after transform: ScopeId(21): ScopeFlags(StrictMode | Function | Arrow) -rebuilt : ScopeId(24): ScopeFlags(Function | Arrow) -Scope parent mismatch: -after transform: ScopeId(21): Some(ScopeId(6)) -rebuilt : ScopeId(24): Some(ScopeId(0)) -Scope flags mismatch: -after transform: ScopeId(22): ScopeFlags(StrictMode | Function | Arrow) -rebuilt : ScopeId(25): ScopeFlags(Function | Arrow) -Scope parent mismatch: -after transform: ScopeId(22): Some(ScopeId(6)) -rebuilt : ScopeId(25): Some(ScopeId(0)) -Scope flags mismatch: -after transform: ScopeId(26): ScopeFlags(StrictMode | Function | Arrow) -rebuilt : ScopeId(26): ScopeFlags(Function | Arrow) -Scope parent mismatch: -after transform: ScopeId(26): Some(ScopeId(25)) -rebuilt : ScopeId(26): Some(ScopeId(0)) -Scope flags mismatch: -after transform: ScopeId(28): ScopeFlags(StrictMode | Function | Arrow) -rebuilt : ScopeId(27): ScopeFlags(Function | Arrow) -Scope parent mismatch: -after transform: ScopeId(28): Some(ScopeId(27)) -rebuilt : ScopeId(27): Some(ScopeId(0)) -Scope flags mismatch: -after transform: ScopeId(24): ScopeFlags(StrictMode | Function | Arrow) -rebuilt : ScopeId(28): ScopeFlags(Function | Arrow) -Scope parent mismatch: -after transform: ScopeId(24): Some(ScopeId(23)) -rebuilt : ScopeId(28): Some(ScopeId(0)) -Scope children mismatch: -after transform: ScopeId(39): [ScopeId(40), ScopeId(41), ScopeId(42), ScopeId(43), ScopeId(44), ScopeId(45), ScopeId(46), ScopeId(47), ScopeId(48), ScopeId(49), ScopeId(50), ScopeId(51), ScopeId(52), ScopeId(53), ScopeId(54), ScopeId(55), ScopeId(56), ScopeId(58), ScopeId(60)] -rebuilt : ScopeId(39): [ScopeId(40), ScopeId(41), ScopeId(42), ScopeId(43), ScopeId(44), ScopeId(45), ScopeId(46), ScopeId(47), ScopeId(48)] -Scope children mismatch: -after transform: ScopeId(56): [ScopeId(57)] -rebuilt : ScopeId(46): [] -Scope children mismatch: -after transform: ScopeId(58): [ScopeId(59)] -rebuilt : ScopeId(47): [] -Scope children mismatch: -after transform: ScopeId(60): [ScopeId(61)] -rebuilt : ScopeId(48): [] -Scope flags mismatch: -after transform: ScopeId(40): ScopeFlags(StrictMode | Function | Arrow) -rebuilt : ScopeId(49): ScopeFlags(Function | Arrow) -Scope parent mismatch: -after transform: ScopeId(40): Some(ScopeId(39)) -rebuilt : ScopeId(49): Some(ScopeId(0)) -Scope flags mismatch: -after transform: ScopeId(42): ScopeFlags(StrictMode | Function | Arrow) -rebuilt : ScopeId(50): ScopeFlags(Function | Arrow) -Scope parent mismatch: -after transform: ScopeId(42): Some(ScopeId(39)) -rebuilt : ScopeId(50): Some(ScopeId(0)) -Scope flags mismatch: -after transform: ScopeId(44): ScopeFlags(StrictMode | Function | Arrow) -rebuilt : ScopeId(51): ScopeFlags(Function | Arrow) -Scope parent mismatch: -after transform: ScopeId(44): Some(ScopeId(39)) -rebuilt : ScopeId(51): Some(ScopeId(0)) -Scope flags mismatch: -after transform: ScopeId(46): ScopeFlags(StrictMode | Function | Arrow) -rebuilt : ScopeId(52): ScopeFlags(Function | Arrow) -Scope parent mismatch: -after transform: ScopeId(46): Some(ScopeId(39)) -rebuilt : ScopeId(52): Some(ScopeId(0)) -Scope flags mismatch: -after transform: ScopeId(47): ScopeFlags(StrictMode | Function | Arrow) -rebuilt : ScopeId(53): ScopeFlags(Function | Arrow) -Scope parent mismatch: -after transform: ScopeId(47): Some(ScopeId(39)) -rebuilt : ScopeId(53): Some(ScopeId(0)) -Scope flags mismatch: -after transform: ScopeId(48): ScopeFlags(StrictMode | Function | Arrow) -rebuilt : ScopeId(54): ScopeFlags(Function | Arrow) -Scope parent mismatch: -after transform: ScopeId(48): Some(ScopeId(39)) -rebuilt : ScopeId(54): Some(ScopeId(0)) -Scope flags mismatch: -after transform: ScopeId(50): ScopeFlags(StrictMode | Function | Arrow) -rebuilt : ScopeId(55): ScopeFlags(Function | Arrow) -Scope parent mismatch: -after transform: ScopeId(50): Some(ScopeId(39)) -rebuilt : ScopeId(55): Some(ScopeId(0)) -Scope flags mismatch: -after transform: ScopeId(52): ScopeFlags(StrictMode | Function | Arrow) -rebuilt : ScopeId(56): ScopeFlags(Function | Arrow) -Scope parent mismatch: -after transform: ScopeId(52): Some(ScopeId(39)) -rebuilt : ScopeId(56): Some(ScopeId(0)) -Scope flags mismatch: -after transform: ScopeId(54): ScopeFlags(StrictMode | Function | Arrow) -rebuilt : ScopeId(57): ScopeFlags(Function | Arrow) -Scope parent mismatch: -after transform: ScopeId(54): Some(ScopeId(39)) -rebuilt : ScopeId(57): Some(ScopeId(0)) -Scope flags mismatch: -after transform: ScopeId(55): ScopeFlags(StrictMode | Function | Arrow) -rebuilt : ScopeId(58): ScopeFlags(Function | Arrow) -Scope parent mismatch: -after transform: ScopeId(55): Some(ScopeId(39)) -rebuilt : ScopeId(58): Some(ScopeId(0)) -Scope flags mismatch: -after transform: ScopeId(59): ScopeFlags(StrictMode | Function | Arrow) -rebuilt : ScopeId(59): ScopeFlags(Function | Arrow) -Scope parent mismatch: -after transform: ScopeId(59): Some(ScopeId(58)) -rebuilt : ScopeId(59): Some(ScopeId(0)) -Scope flags mismatch: -after transform: ScopeId(61): ScopeFlags(StrictMode | Function | Arrow) -rebuilt : ScopeId(60): ScopeFlags(Function | Arrow) -Scope parent mismatch: -after transform: ScopeId(61): Some(ScopeId(60)) -rebuilt : ScopeId(60): Some(ScopeId(0)) -Scope flags mismatch: -after transform: ScopeId(57): ScopeFlags(StrictMode | Function | Arrow) -rebuilt : ScopeId(61): ScopeFlags(Function | Arrow) -Scope parent mismatch: -after transform: ScopeId(57): Some(ScopeId(56)) -rebuilt : ScopeId(61): Some(ScopeId(0)) -Symbol span mismatch for "C1": -after transform: SymbolId(1): Span { start: 52, end: 54 } -rebuilt : SymbolId(7): Span { start: 0, end: 0 } -Symbol span mismatch for "C1": -after transform: SymbolId(22): Span { start: 0, end: 0 } -rebuilt : SymbolId(8): Span { start: 52, end: 54 } -Symbol span mismatch for "C2": -after transform: SymbolId(2): Span { start: 84, end: 86 } -rebuilt : SymbolId(9): Span { start: 0, end: 0 } -Symbol span mismatch for "C2": -after transform: SymbolId(24): Span { start: 0, end: 0 } -rebuilt : SymbolId(10): Span { start: 84, end: 86 } -Symbol span mismatch for "C3": -after transform: SymbolId(3): Span { start: 126, end: 128 } -rebuilt : SymbolId(11): Span { start: 0, end: 0 } -Symbol span mismatch for "C3": -after transform: SymbolId(25): Span { start: 0, end: 0 } -rebuilt : SymbolId(12): Span { start: 126, end: 128 } -Symbol span mismatch for "C4": -after transform: SymbolId(4): Span { start: 146, end: 148 } -rebuilt : SymbolId(13): Span { start: 0, end: 0 } -Symbol reference IDs mismatch for "C4": -after transform: SymbolId(4): [ReferenceId(7), ReferenceId(9), ReferenceId(11), ReferenceId(13), ReferenceId(15), ReferenceId(17), ReferenceId(19), ReferenceId(21), ReferenceId(23), ReferenceId(25), ReferenceId(27), ReferenceId(29), ReferenceId(31), ReferenceId(154), ReferenceId(156), ReferenceId(158), ReferenceId(160), ReferenceId(162), ReferenceId(164), ReferenceId(166), ReferenceId(168), ReferenceId(170), ReferenceId(172), ReferenceId(174), ReferenceId(176), ReferenceId(179), ReferenceId(182), ReferenceId(184)] -rebuilt : SymbolId(13): [ReferenceId(22), ReferenceId(30), ReferenceId(38), ReferenceId(47), ReferenceId(53), ReferenceId(59), ReferenceId(67), ReferenceId(75), ReferenceId(84), ReferenceId(90), ReferenceId(96), ReferenceId(106), ReferenceId(116), ReferenceId(117), ReferenceId(125)] -Symbol span mismatch for "C4": -after transform: SymbolId(28): Span { start: 0, end: 0 } -rebuilt : SymbolId(14): Span { start: 146, end: 148 } -Symbol span mismatch for "C5": -after transform: SymbolId(10): Span { start: 683, end: 685 } -rebuilt : SymbolId(20): Span { start: 0, end: 0 } -Symbol reference IDs mismatch for "C5": -after transform: SymbolId(10): [ReferenceId(33), ReferenceId(35), ReferenceId(37), ReferenceId(39), ReferenceId(41), ReferenceId(43), ReferenceId(45), ReferenceId(47), ReferenceId(49), ReferenceId(51), ReferenceId(53), ReferenceId(55), ReferenceId(57), ReferenceId(248), ReferenceId(250), ReferenceId(252), ReferenceId(254), ReferenceId(256), ReferenceId(258), ReferenceId(260), ReferenceId(262), ReferenceId(264), ReferenceId(266), ReferenceId(268), ReferenceId(270), ReferenceId(273), ReferenceId(276), ReferenceId(278)] -rebuilt : SymbolId(20): [ReferenceId(129), ReferenceId(137), ReferenceId(145), ReferenceId(154), ReferenceId(160), ReferenceId(166), ReferenceId(174), ReferenceId(182), ReferenceId(191), ReferenceId(197), ReferenceId(203), ReferenceId(213), ReferenceId(223), ReferenceId(224), ReferenceId(232)] -Symbol span mismatch for "C5": -after transform: SymbolId(31): Span { start: 0, end: 0 } -rebuilt : SymbolId(21): Span { start: 683, end: 685 } -Symbol span mismatch for "C6": -after transform: SymbolId(16): Span { start: 1143, end: 1145 } -rebuilt : SymbolId(27): Span { start: 0, end: 0 } -Symbol reference IDs mismatch for "C6": -after transform: SymbolId(16): [ReferenceId(59), ReferenceId(61), ReferenceId(63), ReferenceId(65), ReferenceId(67), ReferenceId(69), ReferenceId(71), ReferenceId(73), ReferenceId(75), ReferenceId(77), ReferenceId(79), ReferenceId(81), ReferenceId(83), ReferenceId(342), ReferenceId(344), ReferenceId(346), ReferenceId(348), ReferenceId(350), ReferenceId(352), ReferenceId(354), ReferenceId(356), ReferenceId(358), ReferenceId(360), ReferenceId(362), ReferenceId(364), ReferenceId(367), ReferenceId(370), ReferenceId(372)] -rebuilt : SymbolId(27): [ReferenceId(236), ReferenceId(244), ReferenceId(252), ReferenceId(261), ReferenceId(267), ReferenceId(273), ReferenceId(281), ReferenceId(289), ReferenceId(298), ReferenceId(304), ReferenceId(310), ReferenceId(320), ReferenceId(330), ReferenceId(331), ReferenceId(339)] -Symbol span mismatch for "C6": -after transform: SymbolId(33): Span { start: 0, end: 0 } -rebuilt : SymbolId(28): Span { start: 1143, end: 1145 } -Reference symbol mismatch for "dec": -after transform: SymbolId(0) "dec" -rebuilt : -Reference symbol mismatch for "dec": -after transform: SymbolId(0) "dec" -rebuilt : -Reference symbol mismatch for "dec": -after transform: SymbolId(0) "dec" -rebuilt : -Reference symbol mismatch for "dec": -after transform: SymbolId(0) "dec" -rebuilt : -Reference symbol mismatch for "dec": -after transform: SymbolId(0) "dec" -rebuilt : -Reference symbol mismatch for "dec": -after transform: SymbolId(0) "dec" -rebuilt : -Reference symbol mismatch for "dec": -after transform: SymbolId(0) "dec" -rebuilt : -Reference symbol mismatch for "dec": -after transform: SymbolId(0) "dec" -rebuilt : -Reference symbol mismatch for "dec": -after transform: SymbolId(0) "dec" -rebuilt : -Reference symbol mismatch for "dec": -after transform: SymbolId(0) "dec" -rebuilt : -Reference symbol mismatch for "dec": -after transform: SymbolId(0) "dec" -rebuilt : -Reference symbol mismatch for "dec": -after transform: SymbolId(0) "dec" -rebuilt : -Reference symbol mismatch for "dec": -after transform: SymbolId(0) "dec" -rebuilt : -Reference symbol mismatch for "dec": -after transform: SymbolId(0) "dec" -rebuilt : -Reference symbol mismatch for "dec": -after transform: SymbolId(0) "dec" -rebuilt : -Reference symbol mismatch for "dec": -after transform: SymbolId(0) "dec" -rebuilt : -Reference symbol mismatch for "dec": -after transform: SymbolId(0) "dec" -rebuilt : -Reference symbol mismatch for "dec": -after transform: SymbolId(0) "dec" -rebuilt : -Reference symbol mismatch for "dec": -after transform: SymbolId(0) "dec" -rebuilt : -Reference symbol mismatch for "dec": -after transform: SymbolId(0) "dec" -rebuilt : -Reference symbol mismatch for "dec": -after transform: SymbolId(0) "dec" -rebuilt : -Reference symbol mismatch for "dec": -after transform: SymbolId(0) "dec" -rebuilt : -Reference symbol mismatch for "dec": -after transform: SymbolId(0) "dec" -rebuilt : -Reference symbol mismatch for "dec": -after transform: SymbolId(0) "dec" -rebuilt : -Reference symbol mismatch for "dec": -after transform: SymbolId(0) "dec" -rebuilt : -Reference symbol mismatch for "dec": -after transform: SymbolId(0) "dec" -rebuilt : -Reference symbol mismatch for "dec": -after transform: SymbolId(0) "dec" -rebuilt : -Reference symbol mismatch for "dec": -after transform: SymbolId(0) "dec" -rebuilt : -Reference symbol mismatch for "dec": -after transform: SymbolId(0) "dec" -rebuilt : -Reference symbol mismatch for "dec": -after transform: SymbolId(0) "dec" -rebuilt : -Reference symbol mismatch for "dec": -after transform: SymbolId(0) "dec" -rebuilt : -Reference symbol mismatch for "dec": -after transform: SymbolId(0) "dec" -rebuilt : -Reference symbol mismatch for "dec": -after transform: SymbolId(0) "dec" -rebuilt : -Reference symbol mismatch for "dec": -after transform: SymbolId(0) "dec" -rebuilt : -Reference symbol mismatch for "dec": -after transform: SymbolId(0) "dec" -rebuilt : -Reference symbol mismatch for "dec": -after transform: SymbolId(0) "dec" -rebuilt : -Reference symbol mismatch for "dec": -after transform: SymbolId(0) "dec" -rebuilt : -Reference symbol mismatch for "dec": -after transform: SymbolId(0) "dec" -rebuilt : -Reference symbol mismatch for "dec": -after transform: SymbolId(0) "dec" -rebuilt : -Reference symbol mismatch for "dec": -after transform: SymbolId(0) "dec" -rebuilt : -Reference symbol mismatch for "dec": -after transform: SymbolId(0) "dec" -rebuilt : -Reference symbol mismatch for "dec": -after transform: SymbolId(0) "dec" -rebuilt : -Unresolved references mismatch: -after transform: ["Function", "Object", "require"] -rebuilt : ["Function", "Object", "dec", "require"] - semantic Error: tasks/coverage/typescript/tests/cases/compiler/usingModuleWithExportImportInValuePosition.ts Namespaces exporting non-const are not supported by Babel. Change to const or see: https://babeljs.io/docs/en/babel-plugin-transform-typescript @@ -40899,9 +40537,6 @@ Symbol span mismatch for "C": after transform: SymbolId(60): Span { start: 0, end: 0 } rebuilt : SymbolId(8): Span { start: 23, end: 24 } -semantic Error: tasks/coverage/typescript/tests/cases/conformance/esDecorators/esDecorators-decoratorExpression.1.ts -Expected a semicolon or an implicit semicolon after a statement, but found none - semantic Error: tasks/coverage/typescript/tests/cases/conformance/esDecorators/esDecorators-decoratorExpression.2.ts Bindings mismatch: after transform: ScopeId(0): ["_decorate", "_decorateMetadata", "g", "h", "x"] @@ -41093,23 +40728,6 @@ Unresolved references mismatch: after transform: ["Function", "require"] rebuilt : ["Function", "g", "h", "require", "x"] -semantic Error: tasks/coverage/typescript/tests/cases/conformance/esDecorators/esDecorators-decoratorExpression.3.ts -Bindings mismatch: -after transform: ScopeId(0): ["g"] -rebuilt : ScopeId(0): [] -Scope children mismatch: -after transform: ScopeId(0): [ScopeId(1), ScopeId(2), ScopeId(4)] -rebuilt : ScopeId(0): [ScopeId(1), ScopeId(3)] -Reference symbol mismatch for "g": -after transform: SymbolId(0) "g" -rebuilt : -Reference symbol mismatch for "g": -after transform: SymbolId(0) "g" -rebuilt : -Unresolved references mismatch: -after transform: [] -rebuilt : ["g"] - semantic Error: tasks/coverage/typescript/tests/cases/conformance/esDecorators/esDecorators-preservesThis.ts Bindings mismatch: after transform: ScopeId(0): ["C", "D", "DecoratorProvider", "_decorate", "_decorateMetadata", "instance"] diff --git a/tasks/coverage/snapshots/transformer_typescript.snap b/tasks/coverage/snapshots/transformer_typescript.snap index 844bff5ec8bfe..ec719d14518aa 100644 --- a/tasks/coverage/snapshots/transformer_typescript.snap +++ b/tasks/coverage/snapshots/transformer_typescript.snap @@ -1,8 +1,8 @@ commit: 15392346 transformer_typescript Summary: -AST Parsed : 6531/6531 (100.00%) -Positive Passed: 6526/6531 (99.92%) +AST Parsed : 6528/6528 (100.00%) +Positive Passed: 6523/6528 (99.92%) Mismatch: tasks/coverage/typescript/tests/cases/compiler/esDecoratorsClassFieldsCrash.ts Mismatch: tasks/coverage/typescript/tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor2.ts diff --git a/tasks/coverage/src/typescript/meta.rs b/tasks/coverage/src/typescript/meta.rs index 065099298defd..fb72b370828c3 100644 --- a/tasks/coverage/src/typescript/meta.rs +++ b/tasks/coverage/src/typescript/meta.rs @@ -34,6 +34,7 @@ pub struct CompilerSettings { pub allow_unreachable_code: bool, pub allow_unused_labels: bool, pub no_fallthrough_cases_in_switch: bool, + pub experimental_decorators: Vec, } impl CompilerSettings { @@ -58,6 +59,11 @@ impl CompilerSettings { options.get("nofallthroughcasesinswitch"), false, ), + experimental_decorators: options + .get("experimentaldecorators") + .filter(|&v| v == "*") + .map(|_| vec![true, false]) + .unwrap_or_default(), } } @@ -175,6 +181,12 @@ impl TestCaseContent { suffixes.extend(options.modules.iter().map(|module| format!("(module={module})"))); suffixes.extend(options.targets.iter().map(|target| format!("(target={target})"))); suffixes.extend(options.jsx.iter().map(|jsx| format!("(jsx={jsx})"))); + suffixes.extend( + options + .experimental_decorators + .iter() + .map(|&b| format!("(experimentaldecorators={})", if b { "true" } else { "false" })), + ); let mut error_files = vec![]; for suffix in suffixes { let error_path = root.join(format!("{file_name}{suffix}.errors.txt"));