From fb70d44a08c722511ea22817a84d702114a48f76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Santos?= <68588265+joaosantos99@users.noreply.github.com> Date: Wed, 1 Feb 2023 17:46:01 +0000 Subject: [PATCH] fix/52457: remove extra the from TS(2809) (#52541) --- src/compiler/diagnosticMessages.json | 2 +- src/compiler/parser.ts | 2 +- .../reference/assignmentLHSIsValue.errors.txt | 12 ++++++------ .../reference/destructionAssignmentError.errors.txt | 8 ++++---- .../unicodeEscapesInNames02(target=es5).errors.txt | 8 ++++---- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 43b2fed2d9a..838c4fd0afc 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -3495,7 +3495,7 @@ "category": "Error", "code": 2808 }, - "Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the the whole assignment in parentheses.": { + "Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the whole assignment in parentheses.": { "category": "Error", "code": 2809 }, diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 766aac9e595..0baf8b65bc4 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -6621,7 +6621,7 @@ namespace Parser { parseExpectedMatchingBrackets(SyntaxKind.OpenBraceToken, SyntaxKind.CloseBraceToken, openBraceParsed, openBracePosition); const result = withJSDoc(finishNode(factory.createBlock(statements, multiLine), pos), hasJSDoc); if (token() === SyntaxKind.EqualsToken) { - parseErrorAtCurrentToken(Diagnostics.Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_destructuring_assignment_you_might_need_to_wrap_the_the_whole_assignment_in_parentheses); + parseErrorAtCurrentToken(Diagnostics.Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_destructuring_assignment_you_might_need_to_wrap_the_whole_assignment_in_parentheses); nextToken(); } diff --git a/tests/baselines/reference/assignmentLHSIsValue.errors.txt b/tests/baselines/reference/assignmentLHSIsValue.errors.txt index 71809b4605f..241cf54a0f6 100644 --- a/tests/baselines/reference/assignmentLHSIsValue.errors.txt +++ b/tests/baselines/reference/assignmentLHSIsValue.errors.txt @@ -13,14 +13,14 @@ tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(2 tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(30,1): error TS2364: The left-hand side of an assignment expression must be a variable or a property access. tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(31,1): error TS2364: The left-hand side of an assignment expression must be a variable or a property access. tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(32,1): error TS2364: The left-hand side of an assignment expression must be a variable or a property access. -tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(35,9): error TS2809: Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the the whole assignment in parentheses. +tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(35,9): error TS2809: Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the whole assignment in parentheses. tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(38,2): error TS2364: The left-hand side of an assignment expression must be a variable or a property access. tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(38,6): error TS2364: The left-hand side of an assignment expression must be a variable or a property access. tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(42,36): error TS1034: 'super' must be followed by an argument list or member access. tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(44,19): error TS1034: 'super' must be followed by an argument list or member access. tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(46,27): error TS1034: 'super' must be followed by an argument list or member access. -tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(50,20): error TS2809: Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the the whole assignment in parentheses. -tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(51,11): error TS2809: Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the the whole assignment in parentheses. +tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(50,20): error TS2809: Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the whole assignment in parentheses. +tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(51,11): error TS2809: Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the whole assignment in parentheses. tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(51,13): error TS1005: ';' expected. tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(54,1): error TS2364: The left-hand side of an assignment expression must be a variable or a property access. tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(57,1): error TS2364: The left-hand side of an assignment expression must be a variable or a property access. @@ -106,7 +106,7 @@ tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(7 // object literals { a: 0} = value; ~ -!!! error TS2809: Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the the whole assignment in parentheses. +!!! error TS2809: Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the whole assignment in parentheses. // array literals ['', ''] = value; @@ -133,10 +133,10 @@ tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(7 // function expression function bar() { } = value; ~ -!!! error TS2809: Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the the whole assignment in parentheses. +!!! error TS2809: Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the whole assignment in parentheses. () => { } = value; ~ -!!! error TS2809: Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the the whole assignment in parentheses. +!!! error TS2809: Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the whole assignment in parentheses. ~~~~~ !!! error TS1005: ';' expected. diff --git a/tests/baselines/reference/destructionAssignmentError.errors.txt b/tests/baselines/reference/destructionAssignmentError.errors.txt index 831f9a5fc6c..0853acb8689 100644 --- a/tests/baselines/reference/destructionAssignmentError.errors.txt +++ b/tests/baselines/reference/destructionAssignmentError.errors.txt @@ -1,7 +1,7 @@ tests/cases/compiler/destructionAssignmentError.ts(6,3): error TS2695: Left side of comma operator is unused and has no side effects. -tests/cases/compiler/destructionAssignmentError.ts(6,10): error TS2809: Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the the whole assignment in parentheses. +tests/cases/compiler/destructionAssignmentError.ts(6,10): error TS2809: Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the whole assignment in parentheses. tests/cases/compiler/destructionAssignmentError.ts(11,3): error TS2695: Left side of comma operator is unused and has no side effects. -tests/cases/compiler/destructionAssignmentError.ts(12,1): error TS2809: Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the the whole assignment in parentheses. +tests/cases/compiler/destructionAssignmentError.ts(12,1): error TS2809: Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the whole assignment in parentheses. ==== tests/cases/compiler/destructionAssignmentError.ts (4 errors) ==== @@ -14,7 +14,7 @@ tests/cases/compiler/destructionAssignmentError.ts(12,1): error TS2809: Declarat ~ !!! error TS2695: Left side of comma operator is unused and has no side effects. ~ -!!! error TS2809: Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the the whole assignment in parentheses. +!!! error TS2809: Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the whole assignment in parentheses. ({ a, b } = fn()); @@ -24,4 +24,4 @@ tests/cases/compiler/destructionAssignmentError.ts(12,1): error TS2809: Declarat !!! error TS2695: Left side of comma operator is unused and has no side effects. = fn(); ~ -!!! error TS2809: Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the the whole assignment in parentheses. \ No newline at end of file +!!! error TS2809: Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the whole assignment in parentheses. \ No newline at end of file diff --git a/tests/baselines/reference/unicodeEscapesInNames02(target=es5).errors.txt b/tests/baselines/reference/unicodeEscapesInNames02(target=es5).errors.txt index 3bebdc1f719..b482191f9ba 100644 --- a/tests/baselines/reference/unicodeEscapesInNames02(target=es5).errors.txt +++ b/tests/baselines/reference/unicodeEscapesInNames02(target=es5).errors.txt @@ -14,7 +14,7 @@ tests/cases/compiler/extendedEscapesForAstralsInVarsAndClasses.ts(9,8): error TS tests/cases/compiler/extendedEscapesForAstralsInVarsAndClasses.ts(12,5): error TS1127: Invalid character. tests/cases/compiler/extendedEscapesForAstralsInVarsAndClasses.ts(12,6): error TS1434: Unexpected keyword or identifier. tests/cases/compiler/extendedEscapesForAstralsInVarsAndClasses.ts(12,11): error TS1351: An identifier or keyword cannot immediately follow a numeric literal. -tests/cases/compiler/extendedEscapesForAstralsInVarsAndClasses.ts(12,15): error TS2809: Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the the whole assignment in parentheses. +tests/cases/compiler/extendedEscapesForAstralsInVarsAndClasses.ts(12,15): error TS2809: Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the whole assignment in parentheses. tests/cases/compiler/extendedEscapesForAstralsInVarsAndClasses.ts(16,5): error TS1127: Invalid character. tests/cases/compiler/extendedEscapesForAstralsInVarsAndClasses.ts(16,6): error TS1434: Unexpected keyword or identifier. tests/cases/compiler/extendedEscapesForAstralsInVarsAndClasses.ts(16,7): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. @@ -26,7 +26,7 @@ tests/cases/compiler/extendedEscapesForAstralsInVarsAndClasses.ts(18,9): error T tests/cases/compiler/extendedEscapesForAstralsInVarsAndClasses.ts(18,14): error TS1127: Invalid character. tests/cases/compiler/extendedEscapesForAstralsInVarsAndClasses.ts(18,15): error TS1434: Unexpected keyword or identifier. tests/cases/compiler/extendedEscapesForAstralsInVarsAndClasses.ts(18,20): error TS1351: An identifier or keyword cannot immediately follow a numeric literal. -tests/cases/compiler/extendedEscapesForAstralsInVarsAndClasses.ts(18,24): error TS2809: Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the the whole assignment in parentheses. +tests/cases/compiler/extendedEscapesForAstralsInVarsAndClasses.ts(18,24): error TS2809: Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the whole assignment in parentheses. tests/cases/compiler/extendedEscapesForAstralsInVarsAndClasses.ts(20,5): error TS2304: Cannot find name 'methodA'. tests/cases/compiler/extendedEscapesForAstralsInVarsAndClasses.ts(20,15): error TS1005: ';' expected. tests/cases/compiler/extendedEscapesForAstralsInVarsAndClasses.ts(21,21): error TS1127: Invalid character. @@ -78,7 +78,7 @@ tests/cases/compiler/extendedEscapesForAstralsInVarsAndClasses.ts(27,12): error ~~ !!! error TS1351: An identifier or keyword cannot immediately follow a numeric literal. ~ -!!! error TS2809: Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the the whole assignment in parentheses. +!!! error TS2809: Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the whole assignment in parentheses. } class Foo { @@ -108,7 +108,7 @@ tests/cases/compiler/extendedEscapesForAstralsInVarsAndClasses.ts(27,12): error ~~ !!! error TS1351: An identifier or keyword cannot immediately follow a numeric literal. ~ -!!! error TS2809: Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the the whole assignment in parentheses. +!!! error TS2809: Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the whole assignment in parentheses. } methodA() { ~~~~~~~