From 3cb457a4a928e17251fa4dc70d776438acba8224 Mon Sep 17 00:00:00 2001 From: Jesse Trinity Date: Thu, 27 May 2021 12:59:18 -0700 Subject: [PATCH 1/7] Revert "Revert #43460 and #40884 (#44175)" This reverts commit 57704348914d046e6db8907f6e44e7937b3bcb5b. --- src/compiler/diagnosticMessages.json | 2 +- src/compiler/parser.ts | 72 ++++++++++--------- ...torWithIncompleteTypeAnnotation.errors.txt | 1 + ...thDotFollowedByNamespaceKeyword.errors.txt | 3 +- .../missingCloseBracketInArray.errors.txt | 8 +++ .../reference/missingCloseBracketInArray.js | 5 ++ .../missingCloseBracketInArray.symbols | 5 ++ .../missingCloseBracketInArray.types | 11 +++ .../missingCloseParenStatements.errors.txt | 32 +++++++++ .../reference/missingCloseParenStatements.js | 28 ++++++++ .../missingCloseParenStatements.symbols | 37 ++++++++++ .../missingCloseParenStatements.types | 67 +++++++++++++++++ .../nestedClassDeclaration.errors.txt | 1 - .../objectLiteralWithSemicolons4.errors.txt | 3 +- .../objectSpreadNegativeParse.errors.txt | 1 - .../parseErrorIncorrectReturnToken.errors.txt | 1 - ...parserErrorRecoveryIfStatement2.errors.txt | 1 + ...parserErrorRecoveryIfStatement3.errors.txt | 1 + .../reference/parserFuzz1.errors.txt | 3 +- .../reference/reservedWords2.errors.txt | 2 + .../syntax-errors-with-incremental.js | 10 --- .../initial-build/syntax-errors.js | 10 --- ...mit-any-files-on-error-with-incremental.js | 10 --- .../does-not-emit-any-files-on-error.js | 10 --- .../with-noEmitOnError-syntax-errors.js | 10 --- .../with-noEmitOnError-with-incremental.js | 10 --- .../with-noEmitOnError.js | 10 --- .../with-noEmitOnError-with-incremental.js | 10 --- .../with-noEmitOnError.js | 10 --- .../with-noEmitOnError-with-incremental.js | 10 --- .../default/with-noEmitOnError.js | 10 --- .../with-noEmitOnError-with-incremental.js | 10 --- .../defaultAndD/with-noEmitOnError.js | 10 --- .../with-noEmitOnError-with-incremental.js | 10 --- .../with-noEmitOnError.js | 10 --- .../with-noEmitOnError-with-incremental.js | 10 --- .../with-noEmitOnError.js | 10 --- .../with-noEmitOnError-with-incremental.js | 10 --- .../incremental/default/with-noEmitOnError.js | 10 --- .../with-noEmitOnError-with-incremental.js | 10 --- .../defaultAndD/with-noEmitOnError.js | 10 --- .../with-noEmitOnError-with-incremental.js | 10 --- .../isolatedModules/with-noEmitOnError.js | 10 --- .../with-noEmitOnError-with-incremental.js | 10 --- .../isolatedModulesAndD/with-noEmitOnError.js | 10 --- .../with-noEmitOnError-with-incremental.js | 10 --- .../isolatedModules/with-noEmitOnError.js | 10 --- .../with-noEmitOnError-with-incremental.js | 10 --- .../isolatedModulesAndD/with-noEmitOnError.js | 10 --- .../reference/typeAssertions.errors.txt | 2 + .../compiler/missingCloseBracketInArray.ts | 1 + .../compiler/missingCloseParenStatements.ts | 13 ++++ ...serErrorRecoveryArrayLiteralExpression3.ts | 1 - 53 files changed, 255 insertions(+), 336 deletions(-) create mode 100644 tests/baselines/reference/missingCloseBracketInArray.errors.txt create mode 100644 tests/baselines/reference/missingCloseBracketInArray.js create mode 100644 tests/baselines/reference/missingCloseBracketInArray.symbols create mode 100644 tests/baselines/reference/missingCloseBracketInArray.types create mode 100644 tests/baselines/reference/missingCloseParenStatements.errors.txt create mode 100644 tests/baselines/reference/missingCloseParenStatements.js create mode 100644 tests/baselines/reference/missingCloseParenStatements.symbols create mode 100644 tests/baselines/reference/missingCloseParenStatements.types create mode 100644 tests/cases/compiler/missingCloseBracketInArray.ts create mode 100644 tests/cases/compiler/missingCloseParenStatements.ts diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index c71967b2eaffe..5d7062f84b051 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -15,7 +15,7 @@ "category": "Error", "code": 1006 }, - "The parser expected to find a '}' to match the '{' token here.": { + "The parser expected to find a '{1}' to match the '{0}' token here.": { "category": "Error", "code": 1007 }, diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index ed68dc053c240..80bea252a5e07 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -1341,24 +1341,27 @@ namespace ts { return inContext(NodeFlags.AwaitContext); } - function parseErrorAtCurrentToken(message: DiagnosticMessage, arg0?: any): void { - parseErrorAt(scanner.getTokenPos(), scanner.getTextPos(), message, arg0); + function parseErrorAtCurrentToken(message: DiagnosticMessage, arg0?: any): DiagnosticWithDetachedLocation | undefined { + return parseErrorAt(scanner.getTokenPos(), scanner.getTextPos(), message, arg0); } - function parseErrorAtPosition(start: number, length: number, message: DiagnosticMessage, arg0?: any): void { + function parseErrorAtPosition(start: number, length: number, message: DiagnosticMessage, arg0?: any): DiagnosticWithDetachedLocation | undefined { // Don't report another error if it would just be at the same position as the last error. const lastError = lastOrUndefined(parseDiagnostics); + let result: DiagnosticWithDetachedLocation | undefined; if (!lastError || start !== lastError.start) { - parseDiagnostics.push(createDetachedDiagnostic(fileName, start, length, message, arg0)); + result = createDetachedDiagnostic(fileName, start, length, message, arg0); + parseDiagnostics.push(result); } // Mark that we've encountered an error. We'll set an appropriate bit on the next // node we finish so that it can't be reused incrementally. parseErrorBeforeNextFinishedNode = true; + return result; } - function parseErrorAt(start: number, end: number, message: DiagnosticMessage, arg0?: any): void { - parseErrorAtPosition(start, end - start, message, arg0); + function parseErrorAt(start: number, end: number, message: DiagnosticMessage, arg0?: any): DiagnosticWithDetachedLocation | undefined { + return parseErrorAtPosition(start, end - start, message, arg0); } function parseErrorAtRange(range: TextRange, message: DiagnosticMessage, arg0?: any): void { @@ -1552,6 +1555,20 @@ namespace ts { return false; } + function parseExpectedMatchingBrackets(openKind: SyntaxKind, closeKind: SyntaxKind, openPosition: number) { + if (token() === closeKind) { + nextToken(); + return; + } + const lastError = parseErrorAtCurrentToken(Diagnostics._0_expected, tokenToString(closeKind)); + if (lastError) { + addRelatedInfo( + lastError, + createDetachedDiagnostic(fileName, openPosition, 1, Diagnostics.The_parser_expected_to_find_a_1_to_match_the_0_token_here, tokenToString(openKind), tokenToString(closeKind)) + ); + } + } + function parseOptional(t: SyntaxKind): boolean { if (token() === t) { nextToken(); @@ -5481,10 +5498,11 @@ namespace ts { function parseArrayLiteralExpression(): ArrayLiteralExpression { const pos = getNodePos(); + const openBracketPosition = scanner.getTokenPos(); parseExpected(SyntaxKind.OpenBracketToken); const multiLine = scanner.hasPrecedingLineBreak(); const elements = parseDelimitedList(ParsingContext.ArrayLiteralMembers, parseArgumentOrArrayLiteralElement); - parseExpected(SyntaxKind.CloseBracketToken); + parseExpectedMatchingBrackets(SyntaxKind.OpenBracketToken, SyntaxKind.CloseBracketToken, openBracketPosition); return finishNode(factory.createArrayLiteralExpression(elements, multiLine), pos); } @@ -5553,15 +5571,7 @@ namespace ts { parseExpected(SyntaxKind.OpenBraceToken); const multiLine = scanner.hasPrecedingLineBreak(); const properties = parseDelimitedList(ParsingContext.ObjectLiteralMembers, parseObjectLiteralElement, /*considerSemicolonAsDelimiter*/ true); - if (!parseExpected(SyntaxKind.CloseBraceToken)) { - const lastError = lastOrUndefined(parseDiagnostics); - if (lastError && lastError.code === Diagnostics._0_expected.code) { - addRelatedInfo( - lastError, - createDetachedDiagnostic(fileName, openBracePosition, 1, Diagnostics.The_parser_expected_to_find_a_to_match_the_token_here) - ); - } - } + parseExpectedMatchingBrackets(SyntaxKind.OpenBraceToken, SyntaxKind.CloseBraceToken, openBracePosition); return finishNode(factory.createObjectLiteralExpression(properties, multiLine), pos); } @@ -5647,15 +5657,7 @@ namespace ts { if (parseExpected(SyntaxKind.OpenBraceToken, diagnosticMessage) || ignoreMissingOpenBrace) { const multiLine = scanner.hasPrecedingLineBreak(); const statements = parseList(ParsingContext.BlockStatements, parseStatement); - if (!parseExpected(SyntaxKind.CloseBraceToken)) { - const lastError = lastOrUndefined(parseDiagnostics); - if (lastError && lastError.code === Diagnostics._0_expected.code) { - addRelatedInfo( - lastError, - createDetachedDiagnostic(fileName, openBracePosition, 1, Diagnostics.The_parser_expected_to_find_a_to_match_the_token_here) - ); - } - } + parseExpectedMatchingBrackets(SyntaxKind.OpenBraceToken, SyntaxKind.CloseBraceToken, 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); @@ -5711,9 +5713,10 @@ namespace ts { const pos = getNodePos(); const hasJSDoc = hasPrecedingJSDocComment(); parseExpected(SyntaxKind.IfKeyword); + const openParenPosition = scanner.getTokenPos(); parseExpected(SyntaxKind.OpenParenToken); const expression = allowInAnd(parseExpression); - parseExpected(SyntaxKind.CloseParenToken); + parseExpectedMatchingBrackets(SyntaxKind.OpenParenToken, SyntaxKind.CloseParenToken, openParenPosition); const thenStatement = parseStatement(); const elseStatement = parseOptional(SyntaxKind.ElseKeyword) ? parseStatement() : undefined; return withJSDoc(finishNode(factory.createIfStatement(expression, thenStatement, elseStatement), pos), hasJSDoc); @@ -5725,9 +5728,10 @@ namespace ts { parseExpected(SyntaxKind.DoKeyword); const statement = parseStatement(); parseExpected(SyntaxKind.WhileKeyword); + const openParenPosition = scanner.getTokenPos(); parseExpected(SyntaxKind.OpenParenToken); const expression = allowInAnd(parseExpression); - parseExpected(SyntaxKind.CloseParenToken); + parseExpectedMatchingBrackets(SyntaxKind.OpenParenToken, SyntaxKind.CloseParenToken, openParenPosition); // From: https://mail.mozilla.org/pipermail/es-discuss/2011-August/016188.html // 157 min --- All allen at wirfs-brock.com CONF --- "do{;}while(false)false" prohibited in @@ -5741,9 +5745,10 @@ namespace ts { const pos = getNodePos(); const hasJSDoc = hasPrecedingJSDocComment(); parseExpected(SyntaxKind.WhileKeyword); + const openParenPosition = scanner.getTokenPos(); parseExpected(SyntaxKind.OpenParenToken); const expression = allowInAnd(parseExpression); - parseExpected(SyntaxKind.CloseParenToken); + parseExpectedMatchingBrackets(SyntaxKind.OpenParenToken, SyntaxKind.CloseParenToken, openParenPosition); const statement = parseStatement(); return withJSDoc(finishNode(factory.createWhileStatement(expression, statement), pos), hasJSDoc); } @@ -5819,9 +5824,10 @@ namespace ts { const pos = getNodePos(); const hasJSDoc = hasPrecedingJSDocComment(); parseExpected(SyntaxKind.WithKeyword); + const openParenPosition = scanner.getTokenPos(); parseExpected(SyntaxKind.OpenParenToken); const expression = allowInAnd(parseExpression); - parseExpected(SyntaxKind.CloseParenToken); + parseExpectedMatchingBrackets(SyntaxKind.OpenParenToken, SyntaxKind.CloseParenToken, openParenPosition); const statement = doInsideOfContext(NodeFlags.InWithStatement, parseStatement); return withJSDoc(finishNode(factory.createWithStatement(expression, statement), pos), hasJSDoc); } @@ -8074,13 +8080,9 @@ namespace ts { hasChildren = true; if (child.kind === SyntaxKind.JSDocTypeTag) { if (childTypeTag) { - parseErrorAtCurrentToken(Diagnostics.A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags); - const lastError = lastOrUndefined(parseDiagnostics); + const lastError = parseErrorAtCurrentToken(Diagnostics.A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags); if (lastError) { - addRelatedInfo( - lastError, - createDetachedDiagnostic(fileName, 0, 0, Diagnostics.The_tag_was_first_specified_here) - ); + addRelatedInfo(lastError, createDetachedDiagnostic(fileName, 0, 0, Diagnostics.The_tag_was_first_specified_here)); } break; } diff --git a/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.errors.txt b/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.errors.txt index 2e3854ac84726..2e95e0d27dfdc 100644 --- a/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.errors.txt +++ b/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.errors.txt @@ -121,6 +121,7 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(261,1): error TS if (retValue != 0 ^= { ~~ !!! error TS1005: ')' expected. +!!! related TS1007 tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts:22:20: The parser expected to find a ')' to match the '(' token here. ~ diff --git a/tests/baselines/reference/errorRecoveryWithDotFollowedByNamespaceKeyword.errors.txt b/tests/baselines/reference/errorRecoveryWithDotFollowedByNamespaceKeyword.errors.txt index 3a7c89e2f4157..6bac67291472c 100644 --- a/tests/baselines/reference/errorRecoveryWithDotFollowedByNamespaceKeyword.errors.txt +++ b/tests/baselines/reference/errorRecoveryWithDotFollowedByNamespaceKeyword.errors.txt @@ -16,5 +16,4 @@ tests/cases/compiler/errorRecoveryWithDotFollowedByNamespaceKeyword.ts(9,2): err } !!! error TS1005: '}' expected. -!!! related TS1007 tests/cases/compiler/errorRecoveryWithDotFollowedByNamespaceKeyword.ts:3:19: The parser expected to find a '}' to match the '{' token here. -!!! related TS1007 tests/cases/compiler/errorRecoveryWithDotFollowedByNamespaceKeyword.ts:2:20: The parser expected to find a '}' to match the '{' token here. \ No newline at end of file +!!! related TS1007 tests/cases/compiler/errorRecoveryWithDotFollowedByNamespaceKeyword.ts:3:19: The parser expected to find a '}' to match the '{' token here. \ No newline at end of file diff --git a/tests/baselines/reference/missingCloseBracketInArray.errors.txt b/tests/baselines/reference/missingCloseBracketInArray.errors.txt new file mode 100644 index 0000000000000..26801c02812b4 --- /dev/null +++ b/tests/baselines/reference/missingCloseBracketInArray.errors.txt @@ -0,0 +1,8 @@ +tests/cases/compiler/missingCloseBracketInArray.ts(1,48): error TS1005: ']' expected. + + +==== tests/cases/compiler/missingCloseBracketInArray.ts (1 errors) ==== + var alphas:string[] = alphas = ["1","2","3","4" + +!!! error TS1005: ']' expected. +!!! related TS1007 tests/cases/compiler/missingCloseBracketInArray.ts:1:32: The parser expected to find a ']' to match the '[' token here. \ No newline at end of file diff --git a/tests/baselines/reference/missingCloseBracketInArray.js b/tests/baselines/reference/missingCloseBracketInArray.js new file mode 100644 index 0000000000000..cb842d1cc7413 --- /dev/null +++ b/tests/baselines/reference/missingCloseBracketInArray.js @@ -0,0 +1,5 @@ +//// [missingCloseBracketInArray.ts] +var alphas:string[] = alphas = ["1","2","3","4" + +//// [missingCloseBracketInArray.js] +var alphas = alphas = ["1", "2", "3", "4"]; diff --git a/tests/baselines/reference/missingCloseBracketInArray.symbols b/tests/baselines/reference/missingCloseBracketInArray.symbols new file mode 100644 index 0000000000000..4d28f8945fd13 --- /dev/null +++ b/tests/baselines/reference/missingCloseBracketInArray.symbols @@ -0,0 +1,5 @@ +=== tests/cases/compiler/missingCloseBracketInArray.ts === +var alphas:string[] = alphas = ["1","2","3","4" +>alphas : Symbol(alphas, Decl(missingCloseBracketInArray.ts, 0, 3)) +>alphas : Symbol(alphas, Decl(missingCloseBracketInArray.ts, 0, 3)) + diff --git a/tests/baselines/reference/missingCloseBracketInArray.types b/tests/baselines/reference/missingCloseBracketInArray.types new file mode 100644 index 0000000000000..557a865827c2b --- /dev/null +++ b/tests/baselines/reference/missingCloseBracketInArray.types @@ -0,0 +1,11 @@ +=== tests/cases/compiler/missingCloseBracketInArray.ts === +var alphas:string[] = alphas = ["1","2","3","4" +>alphas : string[] +>alphas = ["1","2","3","4" : string[] +>alphas : string[] +>["1","2","3","4" : string[] +>"1" : "1" +>"2" : "2" +>"3" : "3" +>"4" : "4" + diff --git a/tests/baselines/reference/missingCloseParenStatements.errors.txt b/tests/baselines/reference/missingCloseParenStatements.errors.txt new file mode 100644 index 0000000000000..3f49d5a036653 --- /dev/null +++ b/tests/baselines/reference/missingCloseParenStatements.errors.txt @@ -0,0 +1,32 @@ +tests/cases/compiler/missingCloseParenStatements.ts(2,26): error TS1005: ')' expected. +tests/cases/compiler/missingCloseParenStatements.ts(4,5): error TS1005: ')' expected. +tests/cases/compiler/missingCloseParenStatements.ts(8,39): error TS1005: ')' expected. +tests/cases/compiler/missingCloseParenStatements.ts(11,35): error TS1005: ')' expected. + + +==== tests/cases/compiler/missingCloseParenStatements.ts (4 errors) ==== + var a1, a2, a3 = 0; + if ( a1 && (a2 + a3 > 0) { + ~ +!!! error TS1005: ')' expected. +!!! related TS1007 tests/cases/compiler/missingCloseParenStatements.ts:2:4: The parser expected to find a ')' to match the '(' token here. + while( (a2 > 0) && a1 + { + ~ +!!! error TS1005: ')' expected. +!!! related TS1007 tests/cases/compiler/missingCloseParenStatements.ts:3:10: The parser expected to find a ')' to match the '(' token here. + do { + var i = i + 1; + a1 = a1 + i; + with ((a2 + a3 > 0) && a1 { + ~ +!!! error TS1005: ')' expected. +!!! related TS1007 tests/cases/compiler/missingCloseParenStatements.ts:8:18: The parser expected to find a ')' to match the '(' token here. + console.log(x); + } + } while (i < 5 && (a1 > 5); + ~ +!!! error TS1005: ')' expected. +!!! related TS1007 tests/cases/compiler/missingCloseParenStatements.ts:11:17: The parser expected to find a ')' to match the '(' token here. + } + } \ No newline at end of file diff --git a/tests/baselines/reference/missingCloseParenStatements.js b/tests/baselines/reference/missingCloseParenStatements.js new file mode 100644 index 0000000000000..8ba56b6b88183 --- /dev/null +++ b/tests/baselines/reference/missingCloseParenStatements.js @@ -0,0 +1,28 @@ +//// [missingCloseParenStatements.ts] +var a1, a2, a3 = 0; +if ( a1 && (a2 + a3 > 0) { + while( (a2 > 0) && a1 + { + do { + var i = i + 1; + a1 = a1 + i; + with ((a2 + a3 > 0) && a1 { + console.log(x); + } + } while (i < 5 && (a1 > 5); + } +} + +//// [missingCloseParenStatements.js] +var a1, a2, a3 = 0; +if (a1 && (a2 + a3 > 0)) { + while ((a2 > 0) && a1) { + do { + var i = i + 1; + a1 = a1 + i; + with ((a2 + a3 > 0) && a1) { + console.log(x); + } + } while (i < 5 && (a1 > 5)); + } +} diff --git a/tests/baselines/reference/missingCloseParenStatements.symbols b/tests/baselines/reference/missingCloseParenStatements.symbols new file mode 100644 index 0000000000000..e403570f8e832 --- /dev/null +++ b/tests/baselines/reference/missingCloseParenStatements.symbols @@ -0,0 +1,37 @@ +=== tests/cases/compiler/missingCloseParenStatements.ts === +var a1, a2, a3 = 0; +>a1 : Symbol(a1, Decl(missingCloseParenStatements.ts, 0, 3)) +>a2 : Symbol(a2, Decl(missingCloseParenStatements.ts, 0, 7)) +>a3 : Symbol(a3, Decl(missingCloseParenStatements.ts, 0, 11)) + +if ( a1 && (a2 + a3 > 0) { +>a1 : Symbol(a1, Decl(missingCloseParenStatements.ts, 0, 3)) +>a2 : Symbol(a2, Decl(missingCloseParenStatements.ts, 0, 7)) +>a3 : Symbol(a3, Decl(missingCloseParenStatements.ts, 0, 11)) + + while( (a2 > 0) && a1 +>a2 : Symbol(a2, Decl(missingCloseParenStatements.ts, 0, 7)) +>a1 : Symbol(a1, Decl(missingCloseParenStatements.ts, 0, 3)) + { + do { + var i = i + 1; +>i : Symbol(i, Decl(missingCloseParenStatements.ts, 5, 15)) +>i : Symbol(i, Decl(missingCloseParenStatements.ts, 5, 15)) + + a1 = a1 + i; +>a1 : Symbol(a1, Decl(missingCloseParenStatements.ts, 0, 3)) +>a1 : Symbol(a1, Decl(missingCloseParenStatements.ts, 0, 3)) +>i : Symbol(i, Decl(missingCloseParenStatements.ts, 5, 15)) + + with ((a2 + a3 > 0) && a1 { +>a2 : Symbol(a2, Decl(missingCloseParenStatements.ts, 0, 7)) +>a3 : Symbol(a3, Decl(missingCloseParenStatements.ts, 0, 11)) +>a1 : Symbol(a1, Decl(missingCloseParenStatements.ts, 0, 3)) + + console.log(x); + } + } while (i < 5 && (a1 > 5); +>i : Symbol(i, Decl(missingCloseParenStatements.ts, 5, 15)) +>a1 : Symbol(a1, Decl(missingCloseParenStatements.ts, 0, 3)) + } +} diff --git a/tests/baselines/reference/missingCloseParenStatements.types b/tests/baselines/reference/missingCloseParenStatements.types new file mode 100644 index 0000000000000..0d1b7469f6073 --- /dev/null +++ b/tests/baselines/reference/missingCloseParenStatements.types @@ -0,0 +1,67 @@ +=== tests/cases/compiler/missingCloseParenStatements.ts === +var a1, a2, a3 = 0; +>a1 : any +>a2 : any +>a3 : number +>0 : 0 + +if ( a1 && (a2 + a3 > 0) { +>a1 && (a2 + a3 > 0) : boolean +>a1 : any +>(a2 + a3 > 0) : boolean +>a2 + a3 > 0 : boolean +>a2 + a3 : any +>a2 : any +>a3 : number +>0 : 0 + + while( (a2 > 0) && a1 +>(a2 > 0) && a1 : any +>(a2 > 0) : boolean +>a2 > 0 : boolean +>a2 : any +>0 : 0 +>a1 : any + { + do { + var i = i + 1; +>i : any +>i + 1 : any +>i : any +>1 : 1 + + a1 = a1 + i; +>a1 = a1 + i : any +>a1 : any +>a1 + i : any +>a1 : any +>i : any + + with ((a2 + a3 > 0) && a1 { +>(a2 + a3 > 0) && a1 : any +>(a2 + a3 > 0) : boolean +>a2 + a3 > 0 : boolean +>a2 + a3 : any +>a2 : any +>a3 : number +>0 : 0 +>a1 : any + + console.log(x); +>console.log(x) : any +>console.log : any +>console : any +>log : any +>x : any + } + } while (i < 5 && (a1 > 5); +>i < 5 && (a1 > 5) : boolean +>i < 5 : boolean +>i : any +>5 : 5 +>(a1 > 5) : boolean +>a1 > 5 : boolean +>a1 : any +>5 : 5 + } +} diff --git a/tests/baselines/reference/nestedClassDeclaration.errors.txt b/tests/baselines/reference/nestedClassDeclaration.errors.txt index 5540ee024378d..f897c38d68191 100644 --- a/tests/baselines/reference/nestedClassDeclaration.errors.txt +++ b/tests/baselines/reference/nestedClassDeclaration.errors.txt @@ -32,7 +32,6 @@ tests/cases/conformance/classes/nestedClassDeclaration.ts(17,1): error TS1128: D !!! error TS2304: Cannot find name 'C4'. ~ !!! error TS1005: ',' expected. -!!! related TS1007 tests/cases/conformance/classes/nestedClassDeclaration.ts:14:9: The parser expected to find a '}' to match the '{' token here. } } ~ diff --git a/tests/baselines/reference/objectLiteralWithSemicolons4.errors.txt b/tests/baselines/reference/objectLiteralWithSemicolons4.errors.txt index 651c0b66df75c..544bddafff278 100644 --- a/tests/baselines/reference/objectLiteralWithSemicolons4.errors.txt +++ b/tests/baselines/reference/objectLiteralWithSemicolons4.errors.txt @@ -9,5 +9,4 @@ tests/cases/compiler/objectLiteralWithSemicolons4.ts(3,1): error TS1005: ',' exp !!! error TS18004: No value exists in scope for the shorthand property 'a'. Either declare one or provide an initializer. ; ~ -!!! error TS1005: ',' expected. -!!! related TS1007 tests/cases/compiler/objectLiteralWithSemicolons4.ts:1:9: The parser expected to find a '}' to match the '{' token here. \ No newline at end of file +!!! error TS1005: ',' expected. \ No newline at end of file diff --git a/tests/baselines/reference/objectSpreadNegativeParse.errors.txt b/tests/baselines/reference/objectSpreadNegativeParse.errors.txt index 692fb7617da63..b37200c4f0293 100644 --- a/tests/baselines/reference/objectSpreadNegativeParse.errors.txt +++ b/tests/baselines/reference/objectSpreadNegativeParse.errors.txt @@ -28,7 +28,6 @@ tests/cases/conformance/types/spread/objectSpreadNegativeParse.ts(4,20): error T !!! error TS2304: Cannot find name 'matchMedia'. ~ !!! error TS1005: ',' expected. -!!! related TS1007 tests/cases/conformance/types/spread/objectSpreadNegativeParse.ts:3:10: The parser expected to find a '}' to match the '{' token here. ~ !!! error TS1128: Declaration or statement expected. let o10 = { ...get x() { return 12; }}; diff --git a/tests/baselines/reference/parseErrorIncorrectReturnToken.errors.txt b/tests/baselines/reference/parseErrorIncorrectReturnToken.errors.txt index bc43cd5b7763b..2cf728848e45e 100644 --- a/tests/baselines/reference/parseErrorIncorrectReturnToken.errors.txt +++ b/tests/baselines/reference/parseErrorIncorrectReturnToken.errors.txt @@ -25,7 +25,6 @@ tests/cases/compiler/parseErrorIncorrectReturnToken.ts(12,1): error TS1128: Decl m(n: number) => string { ~~ !!! error TS1005: '{' expected. -!!! related TS1007 tests/cases/compiler/parseErrorIncorrectReturnToken.ts:8:9: The parser expected to find a '}' to match the '{' token here. ~~~~~~ !!! error TS2693: 'string' only refers to a type, but is being used as a value here. ~ diff --git a/tests/baselines/reference/parserErrorRecoveryIfStatement2.errors.txt b/tests/baselines/reference/parserErrorRecoveryIfStatement2.errors.txt index 45dd9935a6229..b88c48182a27b 100644 --- a/tests/baselines/reference/parserErrorRecoveryIfStatement2.errors.txt +++ b/tests/baselines/reference/parserErrorRecoveryIfStatement2.errors.txt @@ -11,6 +11,7 @@ tests/cases/conformance/parser/ecmascript5/ErrorRecovery/IfStatements/parserErro } ~ !!! error TS1005: ')' expected. +!!! related TS1007 tests/cases/conformance/parser/ecmascript5/ErrorRecovery/IfStatements/parserErrorRecoveryIfStatement2.ts:3:8: The parser expected to find a ')' to match the '(' token here. f2() { } f3() { diff --git a/tests/baselines/reference/parserErrorRecoveryIfStatement3.errors.txt b/tests/baselines/reference/parserErrorRecoveryIfStatement3.errors.txt index 631cdb08a90e4..cfd645e592542 100644 --- a/tests/baselines/reference/parserErrorRecoveryIfStatement3.errors.txt +++ b/tests/baselines/reference/parserErrorRecoveryIfStatement3.errors.txt @@ -11,6 +11,7 @@ tests/cases/conformance/parser/ecmascript5/ErrorRecovery/IfStatements/parserErro } ~ !!! error TS1005: ')' expected. +!!! related TS1007 tests/cases/conformance/parser/ecmascript5/ErrorRecovery/IfStatements/parserErrorRecoveryIfStatement3.ts:3:8: The parser expected to find a ')' to match the '(' token here. f2() { } f3() { diff --git a/tests/baselines/reference/parserFuzz1.errors.txt b/tests/baselines/reference/parserFuzz1.errors.txt index e11d25c48fa56..e90dda55244e6 100644 --- a/tests/baselines/reference/parserFuzz1.errors.txt +++ b/tests/baselines/reference/parserFuzz1.errors.txt @@ -20,5 +20,4 @@ tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserFuzz1.ts(2,15): e ~~~~~~ !!! error TS1005: ';' expected. -!!! error TS1005: '{' expected. -!!! related TS1007 tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserFuzz1.ts:1:9: The parser expected to find a '}' to match the '{' token here. \ No newline at end of file +!!! error TS1005: '{' expected. \ No newline at end of file diff --git a/tests/baselines/reference/reservedWords2.errors.txt b/tests/baselines/reference/reservedWords2.errors.txt index 599010b436872..6ecb9471631bd 100644 --- a/tests/baselines/reference/reservedWords2.errors.txt +++ b/tests/baselines/reference/reservedWords2.errors.txt @@ -45,6 +45,7 @@ tests/cases/compiler/reservedWords2.ts(12,17): error TS1138: Parameter declarati !!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ~ !!! error TS1005: ')' expected. +!!! related TS1007 tests/cases/compiler/reservedWords2.ts:1:14: The parser expected to find a ')' to match the '(' token here. import * as while from "foo" !!! error TS2300: Duplicate identifier '(Missing)'. @@ -58,6 +59,7 @@ tests/cases/compiler/reservedWords2.ts(12,17): error TS1138: Parameter declarati !!! error TS2304: Cannot find name 'from'. ~~~~~ !!! error TS1005: ')' expected. +!!! related TS1007 tests/cases/compiler/reservedWords2.ts:2:20: The parser expected to find a ')' to match the '(' token here. var typeof = 10; ~~~~~~ diff --git a/tests/baselines/reference/tsbuild/noEmitOnError/initial-build/syntax-errors-with-incremental.js b/tests/baselines/reference/tsbuild/noEmitOnError/initial-build/syntax-errors-with-incremental.js index 10d0e3770f161..308daf394aea9 100644 --- a/tests/baselines/reference/tsbuild/noEmitOnError/initial-build/syntax-errors-with-incremental.js +++ b/tests/baselines/reference/tsbuild/noEmitOnError/initial-build/syntax-errors-with-incremental.js @@ -47,11 +47,6 @@ Output:: 4 ;   ~ - src/src/main.ts:2:11 - 2 const a = { -    ~ - The parser expected to find a '}' to match the '{' token here. - Found 1 error. @@ -81,11 +76,6 @@ Output:: 4 ;   ~ - src/src/main.ts:2:11 - 2 const a = { -    ~ - The parser expected to find a '}' to match the '{' token here. - Found 1 error. diff --git a/tests/baselines/reference/tsbuild/noEmitOnError/initial-build/syntax-errors.js b/tests/baselines/reference/tsbuild/noEmitOnError/initial-build/syntax-errors.js index 4c55b9ce60f7f..e9ea12ea0d3e4 100644 --- a/tests/baselines/reference/tsbuild/noEmitOnError/initial-build/syntax-errors.js +++ b/tests/baselines/reference/tsbuild/noEmitOnError/initial-build/syntax-errors.js @@ -47,11 +47,6 @@ Output:: 4 ;   ~ - src/src/main.ts:2:11 - 2 const a = { -    ~ - The parser expected to find a '}' to match the '{' token here. - Found 1 error. @@ -81,11 +76,6 @@ Output:: 4 ;   ~ - src/src/main.ts:2:11 - 2 const a = { -    ~ - The parser expected to find a '}' to match the '{' token here. - Found 1 error. diff --git a/tests/baselines/reference/tsbuild/watchMode/noEmitOnError/does-not-emit-any-files-on-error-with-incremental.js b/tests/baselines/reference/tsbuild/watchMode/noEmitOnError/does-not-emit-any-files-on-error-with-incremental.js index 4b96a48f8f60c..1b17fdb2ee462 100644 --- a/tests/baselines/reference/tsbuild/watchMode/noEmitOnError/does-not-emit-any-files-on-error-with-incremental.js +++ b/tests/baselines/reference/tsbuild/watchMode/noEmitOnError/does-not-emit-any-files-on-error-with-incremental.js @@ -56,11 +56,6 @@ Output:: 4 ;   ~ - src/main.ts:2:11 - 2 const a = { -    ~ - The parser expected to find a '}' to match the '{' token here. - [12:00:35 AM] Found 1 error. Watching for file changes. @@ -113,11 +108,6 @@ Output:: 4 ;   ~ - src/main.ts:2:11 - 2 const a = { -    ~ - The parser expected to find a '}' to match the '{' token here. - [12:00:42 AM] Found 1 error. Watching for file changes. diff --git a/tests/baselines/reference/tsbuild/watchMode/noEmitOnError/does-not-emit-any-files-on-error.js b/tests/baselines/reference/tsbuild/watchMode/noEmitOnError/does-not-emit-any-files-on-error.js index 3e563e8f60930..6af8477219c81 100644 --- a/tests/baselines/reference/tsbuild/watchMode/noEmitOnError/does-not-emit-any-files-on-error.js +++ b/tests/baselines/reference/tsbuild/watchMode/noEmitOnError/does-not-emit-any-files-on-error.js @@ -56,11 +56,6 @@ Output:: 4 ;   ~ - src/main.ts:2:11 - 2 const a = { -    ~ - The parser expected to find a '}' to match the '{' token here. - [12:00:35 AM] Found 1 error. Watching for file changes. @@ -113,11 +108,6 @@ Output:: 4 ;   ~ - src/main.ts:2:11 - 2 const a = { -    ~ - The parser expected to find a '}' to match the '{' token here. - [12:00:42 AM] Found 1 error. Watching for file changes. diff --git a/tests/baselines/reference/tsc/incremental/initial-build/with-noEmitOnError-syntax-errors.js b/tests/baselines/reference/tsc/incremental/initial-build/with-noEmitOnError-syntax-errors.js index ab70d95535c29..6d8d5e1bd8330 100644 --- a/tests/baselines/reference/tsc/incremental/initial-build/with-noEmitOnError-syntax-errors.js +++ b/tests/baselines/reference/tsc/incremental/initial-build/with-noEmitOnError-syntax-errors.js @@ -47,11 +47,6 @@ Output:: 4 ;   ~ - src/src/main.ts:2:11 - 2 const a = { -    ~ - The parser expected to find a '}' to match the '{' token here. - Found 1 error. @@ -160,11 +155,6 @@ Output:: 4 ;   ~ - src/src/main.ts:2:11 - 2 const a = { -    ~ - The parser expected to find a '}' to match the '{' token here. - Found 1 error. diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/assumeChangesOnlyAffectDirectDependencies/with-noEmitOnError-with-incremental.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/assumeChangesOnlyAffectDirectDependencies/with-noEmitOnError-with-incremental.js index 9b6b0c05fdfbb..01d3cecd1bedd 100644 --- a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/assumeChangesOnlyAffectDirectDependencies/with-noEmitOnError-with-incremental.js +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/assumeChangesOnlyAffectDirectDependencies/with-noEmitOnError-with-incremental.js @@ -43,11 +43,6 @@ Output:: 4 ;   ~ - src/main.ts:2:11 - 2 const a = { -    ~ - The parser expected to find a '}' to match the '{' token here. - [12:00:37 AM] Found 1 error. Watching for file changes. @@ -180,11 +175,6 @@ Output:: 4 ;   ~ - src/main.ts:2:11 - 2 const a = { -    ~ - The parser expected to find a '}' to match the '{' token here. - [12:00:44 AM] Found 1 error. Watching for file changes. diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/assumeChangesOnlyAffectDirectDependencies/with-noEmitOnError.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/assumeChangesOnlyAffectDirectDependencies/with-noEmitOnError.js index 17c877f6ac1a6..16681988e8f32 100644 --- a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/assumeChangesOnlyAffectDirectDependencies/with-noEmitOnError.js +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/assumeChangesOnlyAffectDirectDependencies/with-noEmitOnError.js @@ -43,11 +43,6 @@ Output:: 4 ;   ~ - src/main.ts:2:11 - 2 const a = { -    ~ - The parser expected to find a '}' to match the '{' token here. - [12:00:32 AM] Found 1 error. Watching for file changes. @@ -104,11 +99,6 @@ Output:: 4 ;   ~ - src/main.ts:2:11 - 2 const a = { -    ~ - The parser expected to find a '}' to match the '{' token here. - [12:00:37 AM] Found 1 error. Watching for file changes. diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/assumeChangesOnlyAffectDirectDependenciesAndD/with-noEmitOnError-with-incremental.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/assumeChangesOnlyAffectDirectDependenciesAndD/with-noEmitOnError-with-incremental.js index c74e95b44358d..60cee519a51fa 100644 --- a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/assumeChangesOnlyAffectDirectDependenciesAndD/with-noEmitOnError-with-incremental.js +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/assumeChangesOnlyAffectDirectDependenciesAndD/with-noEmitOnError-with-incremental.js @@ -43,11 +43,6 @@ Output:: 4 ;   ~ - src/main.ts:2:11 - 2 const a = { -    ~ - The parser expected to find a '}' to match the '{' token here. - [12:00:37 AM] Found 1 error. Watching for file changes. @@ -181,11 +176,6 @@ Output:: 4 ;   ~ - src/main.ts:2:11 - 2 const a = { -    ~ - The parser expected to find a '}' to match the '{' token here. - [12:00:44 AM] Found 1 error. Watching for file changes. diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/assumeChangesOnlyAffectDirectDependenciesAndD/with-noEmitOnError.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/assumeChangesOnlyAffectDirectDependenciesAndD/with-noEmitOnError.js index 9c9b6f756c1bc..bae815eebebfb 100644 --- a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/assumeChangesOnlyAffectDirectDependenciesAndD/with-noEmitOnError.js +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/assumeChangesOnlyAffectDirectDependenciesAndD/with-noEmitOnError.js @@ -43,11 +43,6 @@ Output:: 4 ;   ~ - src/main.ts:2:11 - 2 const a = { -    ~ - The parser expected to find a '}' to match the '{' token here. - [12:00:32 AM] Found 1 error. Watching for file changes. @@ -104,11 +99,6 @@ Output:: 4 ;   ~ - src/main.ts:2:11 - 2 const a = { -    ~ - The parser expected to find a '}' to match the '{' token here. - [12:00:37 AM] Found 1 error. Watching for file changes. diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/default/with-noEmitOnError-with-incremental.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/default/with-noEmitOnError-with-incremental.js index 02366f1125102..be4cbb2503da1 100644 --- a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/default/with-noEmitOnError-with-incremental.js +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/default/with-noEmitOnError-with-incremental.js @@ -49,11 +49,6 @@ Output:: 4 ;   ~ - src/main.ts:2:11 - 2 const a = { -    ~ - The parser expected to find a '}' to match the '{' token here. - [12:00:37 AM] Found 1 error. Watching for file changes. @@ -185,11 +180,6 @@ Output:: 4 ;   ~ - src/main.ts:2:11 - 2 const a = { -    ~ - The parser expected to find a '}' to match the '{' token here. - [12:00:44 AM] Found 1 error. Watching for file changes. diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/default/with-noEmitOnError.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/default/with-noEmitOnError.js index fbb7a7ed57463..da78efc9fba32 100644 --- a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/default/with-noEmitOnError.js +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/default/with-noEmitOnError.js @@ -49,11 +49,6 @@ Output:: 4 ;   ~ - src/main.ts:2:11 - 2 const a = { -    ~ - The parser expected to find a '}' to match the '{' token here. - [12:00:32 AM] Found 1 error. Watching for file changes. @@ -110,11 +105,6 @@ Output:: 4 ;   ~ - src/main.ts:2:11 - 2 const a = { -    ~ - The parser expected to find a '}' to match the '{' token here. - [12:00:37 AM] Found 1 error. Watching for file changes. diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/defaultAndD/with-noEmitOnError-with-incremental.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/defaultAndD/with-noEmitOnError-with-incremental.js index 07f84519690f9..bf7e7e13c154d 100644 --- a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/defaultAndD/with-noEmitOnError-with-incremental.js +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/defaultAndD/with-noEmitOnError-with-incremental.js @@ -43,11 +43,6 @@ Output:: 4 ;   ~ - src/main.ts:2:11 - 2 const a = { -    ~ - The parser expected to find a '}' to match the '{' token here. - [12:00:37 AM] Found 1 error. Watching for file changes. @@ -180,11 +175,6 @@ Output:: 4 ;   ~ - src/main.ts:2:11 - 2 const a = { -    ~ - The parser expected to find a '}' to match the '{' token here. - [12:00:44 AM] Found 1 error. Watching for file changes. diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/defaultAndD/with-noEmitOnError.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/defaultAndD/with-noEmitOnError.js index 442f3d18610b8..3c0a5fcd89b5c 100644 --- a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/defaultAndD/with-noEmitOnError.js +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/defaultAndD/with-noEmitOnError.js @@ -43,11 +43,6 @@ Output:: 4 ;   ~ - src/main.ts:2:11 - 2 const a = { -    ~ - The parser expected to find a '}' to match the '{' token here. - [12:00:32 AM] Found 1 error. Watching for file changes. @@ -104,11 +99,6 @@ Output:: 4 ;   ~ - src/main.ts:2:11 - 2 const a = { -    ~ - The parser expected to find a '}' to match the '{' token here. - [12:00:37 AM] Found 1 error. Watching for file changes. diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/incremental/assumeChangesOnlyAffectDirectDependencies/with-noEmitOnError-with-incremental.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/incremental/assumeChangesOnlyAffectDirectDependencies/with-noEmitOnError-with-incremental.js index ec619eb4a7070..3347e57400a36 100644 --- a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/incremental/assumeChangesOnlyAffectDirectDependencies/with-noEmitOnError-with-incremental.js +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/incremental/assumeChangesOnlyAffectDirectDependencies/with-noEmitOnError-with-incremental.js @@ -43,11 +43,6 @@ Output:: 4 ;   ~ - src/main.ts:2:11 - 2 const a = { -    ~ - The parser expected to find a '}' to match the '{' token here. - [12:00:37 AM] Found 1 error. Watching for file changes. @@ -180,11 +175,6 @@ Output:: 4 ;   ~ - src/main.ts:2:11 - 2 const a = { -    ~ - The parser expected to find a '}' to match the '{' token here. - [12:00:44 AM] Found 1 error. Watching for file changes. diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/incremental/assumeChangesOnlyAffectDirectDependencies/with-noEmitOnError.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/incremental/assumeChangesOnlyAffectDirectDependencies/with-noEmitOnError.js index c463f068880d6..06c2ed70520e4 100644 --- a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/incremental/assumeChangesOnlyAffectDirectDependencies/with-noEmitOnError.js +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/incremental/assumeChangesOnlyAffectDirectDependencies/with-noEmitOnError.js @@ -43,11 +43,6 @@ Output:: 4 ;   ~ - src/main.ts:2:11 - 2 const a = { -    ~ - The parser expected to find a '}' to match the '{' token here. - [12:00:37 AM] Found 1 error. Watching for file changes. @@ -180,11 +175,6 @@ Output:: 4 ;   ~ - src/main.ts:2:11 - 2 const a = { -    ~ - The parser expected to find a '}' to match the '{' token here. - [12:00:44 AM] Found 1 error. Watching for file changes. diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/incremental/assumeChangesOnlyAffectDirectDependenciesAndD/with-noEmitOnError-with-incremental.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/incremental/assumeChangesOnlyAffectDirectDependenciesAndD/with-noEmitOnError-with-incremental.js index 21dbc506c20db..6a1ef2230ca43 100644 --- a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/incremental/assumeChangesOnlyAffectDirectDependenciesAndD/with-noEmitOnError-with-incremental.js +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/incremental/assumeChangesOnlyAffectDirectDependenciesAndD/with-noEmitOnError-with-incremental.js @@ -43,11 +43,6 @@ Output:: 4 ;   ~ - src/main.ts:2:11 - 2 const a = { -    ~ - The parser expected to find a '}' to match the '{' token here. - [12:00:37 AM] Found 1 error. Watching for file changes. @@ -181,11 +176,6 @@ Output:: 4 ;   ~ - src/main.ts:2:11 - 2 const a = { -    ~ - The parser expected to find a '}' to match the '{' token here. - [12:00:44 AM] Found 1 error. Watching for file changes. diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/incremental/assumeChangesOnlyAffectDirectDependenciesAndD/with-noEmitOnError.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/incremental/assumeChangesOnlyAffectDirectDependenciesAndD/with-noEmitOnError.js index 35e28f24cf7e8..34366e53ebaa5 100644 --- a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/incremental/assumeChangesOnlyAffectDirectDependenciesAndD/with-noEmitOnError.js +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/incremental/assumeChangesOnlyAffectDirectDependenciesAndD/with-noEmitOnError.js @@ -43,11 +43,6 @@ Output:: 4 ;   ~ - src/main.ts:2:11 - 2 const a = { -    ~ - The parser expected to find a '}' to match the '{' token here. - [12:00:37 AM] Found 1 error. Watching for file changes. @@ -181,11 +176,6 @@ Output:: 4 ;   ~ - src/main.ts:2:11 - 2 const a = { -    ~ - The parser expected to find a '}' to match the '{' token here. - [12:00:44 AM] Found 1 error. Watching for file changes. diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/incremental/default/with-noEmitOnError-with-incremental.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/incremental/default/with-noEmitOnError-with-incremental.js index 354221d990443..ead341c0c24c2 100644 --- a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/incremental/default/with-noEmitOnError-with-incremental.js +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/incremental/default/with-noEmitOnError-with-incremental.js @@ -49,11 +49,6 @@ Output:: 4 ;   ~ - src/main.ts:2:11 - 2 const a = { -    ~ - The parser expected to find a '}' to match the '{' token here. - [12:00:37 AM] Found 1 error. Watching for file changes. @@ -185,11 +180,6 @@ Output:: 4 ;   ~ - src/main.ts:2:11 - 2 const a = { -    ~ - The parser expected to find a '}' to match the '{' token here. - [12:00:44 AM] Found 1 error. Watching for file changes. diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/incremental/default/with-noEmitOnError.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/incremental/default/with-noEmitOnError.js index f3c5e03a4097d..63c9185d38bde 100644 --- a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/incremental/default/with-noEmitOnError.js +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/incremental/default/with-noEmitOnError.js @@ -49,11 +49,6 @@ Output:: 4 ;   ~ - src/main.ts:2:11 - 2 const a = { -    ~ - The parser expected to find a '}' to match the '{' token here. - [12:00:37 AM] Found 1 error. Watching for file changes. @@ -185,11 +180,6 @@ Output:: 4 ;   ~ - src/main.ts:2:11 - 2 const a = { -    ~ - The parser expected to find a '}' to match the '{' token here. - [12:00:44 AM] Found 1 error. Watching for file changes. diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/incremental/defaultAndD/with-noEmitOnError-with-incremental.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/incremental/defaultAndD/with-noEmitOnError-with-incremental.js index 5e2009b67b411..1b2e76b260800 100644 --- a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/incremental/defaultAndD/with-noEmitOnError-with-incremental.js +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/incremental/defaultAndD/with-noEmitOnError-with-incremental.js @@ -43,11 +43,6 @@ Output:: 4 ;   ~ - src/main.ts:2:11 - 2 const a = { -    ~ - The parser expected to find a '}' to match the '{' token here. - [12:00:37 AM] Found 1 error. Watching for file changes. @@ -180,11 +175,6 @@ Output:: 4 ;   ~ - src/main.ts:2:11 - 2 const a = { -    ~ - The parser expected to find a '}' to match the '{' token here. - [12:00:44 AM] Found 1 error. Watching for file changes. diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/incremental/defaultAndD/with-noEmitOnError.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/incremental/defaultAndD/with-noEmitOnError.js index 0b2f2feee3f16..9e0103cd7fdc5 100644 --- a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/incremental/defaultAndD/with-noEmitOnError.js +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/incremental/defaultAndD/with-noEmitOnError.js @@ -43,11 +43,6 @@ Output:: 4 ;   ~ - src/main.ts:2:11 - 2 const a = { -    ~ - The parser expected to find a '}' to match the '{' token here. - [12:00:37 AM] Found 1 error. Watching for file changes. @@ -180,11 +175,6 @@ Output:: 4 ;   ~ - src/main.ts:2:11 - 2 const a = { -    ~ - The parser expected to find a '}' to match the '{' token here. - [12:00:44 AM] Found 1 error. Watching for file changes. diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/incremental/isolatedModules/with-noEmitOnError-with-incremental.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/incremental/isolatedModules/with-noEmitOnError-with-incremental.js index b0cd5f57eb796..878514fada7ae 100644 --- a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/incremental/isolatedModules/with-noEmitOnError-with-incremental.js +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/incremental/isolatedModules/with-noEmitOnError-with-incremental.js @@ -43,11 +43,6 @@ Output:: 4 ;   ~ - src/main.ts:2:11 - 2 const a = { -    ~ - The parser expected to find a '}' to match the '{' token here. - [12:00:37 AM] Found 1 error. Watching for file changes. @@ -179,11 +174,6 @@ Output:: 4 ;   ~ - src/main.ts:2:11 - 2 const a = { -    ~ - The parser expected to find a '}' to match the '{' token here. - [12:00:44 AM] Found 1 error. Watching for file changes. diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/incremental/isolatedModules/with-noEmitOnError.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/incremental/isolatedModules/with-noEmitOnError.js index 10e6adbf42082..bdb72e4bede96 100644 --- a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/incremental/isolatedModules/with-noEmitOnError.js +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/incremental/isolatedModules/with-noEmitOnError.js @@ -43,11 +43,6 @@ Output:: 4 ;   ~ - src/main.ts:2:11 - 2 const a = { -    ~ - The parser expected to find a '}' to match the '{' token here. - [12:00:37 AM] Found 1 error. Watching for file changes. @@ -179,11 +174,6 @@ Output:: 4 ;   ~ - src/main.ts:2:11 - 2 const a = { -    ~ - The parser expected to find a '}' to match the '{' token here. - [12:00:44 AM] Found 1 error. Watching for file changes. diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/incremental/isolatedModulesAndD/with-noEmitOnError-with-incremental.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/incremental/isolatedModulesAndD/with-noEmitOnError-with-incremental.js index 3630b1ed77c64..f07286fecfbc6 100644 --- a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/incremental/isolatedModulesAndD/with-noEmitOnError-with-incremental.js +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/incremental/isolatedModulesAndD/with-noEmitOnError-with-incremental.js @@ -43,11 +43,6 @@ Output:: 4 ;   ~ - src/main.ts:2:11 - 2 const a = { -    ~ - The parser expected to find a '}' to match the '{' token here. - [12:00:37 AM] Found 1 error. Watching for file changes. @@ -180,11 +175,6 @@ Output:: 4 ;   ~ - src/main.ts:2:11 - 2 const a = { -    ~ - The parser expected to find a '}' to match the '{' token here. - [12:00:44 AM] Found 1 error. Watching for file changes. diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/incremental/isolatedModulesAndD/with-noEmitOnError.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/incremental/isolatedModulesAndD/with-noEmitOnError.js index 17038187ea58c..c88348bd5bc26 100644 --- a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/incremental/isolatedModulesAndD/with-noEmitOnError.js +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/incremental/isolatedModulesAndD/with-noEmitOnError.js @@ -43,11 +43,6 @@ Output:: 4 ;   ~ - src/main.ts:2:11 - 2 const a = { -    ~ - The parser expected to find a '}' to match the '{' token here. - [12:00:37 AM] Found 1 error. Watching for file changes. @@ -180,11 +175,6 @@ Output:: 4 ;   ~ - src/main.ts:2:11 - 2 const a = { -    ~ - The parser expected to find a '}' to match the '{' token here. - [12:00:44 AM] Found 1 error. Watching for file changes. diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/isolatedModules/with-noEmitOnError-with-incremental.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/isolatedModules/with-noEmitOnError-with-incremental.js index 63db0fe14a0f0..517e41b0e0111 100644 --- a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/isolatedModules/with-noEmitOnError-with-incremental.js +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/isolatedModules/with-noEmitOnError-with-incremental.js @@ -43,11 +43,6 @@ Output:: 4 ;   ~ - src/main.ts:2:11 - 2 const a = { -    ~ - The parser expected to find a '}' to match the '{' token here. - [12:00:37 AM] Found 1 error. Watching for file changes. @@ -179,11 +174,6 @@ Output:: 4 ;   ~ - src/main.ts:2:11 - 2 const a = { -    ~ - The parser expected to find a '}' to match the '{' token here. - [12:00:44 AM] Found 1 error. Watching for file changes. diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/isolatedModules/with-noEmitOnError.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/isolatedModules/with-noEmitOnError.js index 4093ad4830287..48c8bcb5bd307 100644 --- a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/isolatedModules/with-noEmitOnError.js +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/isolatedModules/with-noEmitOnError.js @@ -43,11 +43,6 @@ Output:: 4 ;   ~ - src/main.ts:2:11 - 2 const a = { -    ~ - The parser expected to find a '}' to match the '{' token here. - [12:00:32 AM] Found 1 error. Watching for file changes. @@ -104,11 +99,6 @@ Output:: 4 ;   ~ - src/main.ts:2:11 - 2 const a = { -    ~ - The parser expected to find a '}' to match the '{' token here. - [12:00:37 AM] Found 1 error. Watching for file changes. diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/isolatedModulesAndD/with-noEmitOnError-with-incremental.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/isolatedModulesAndD/with-noEmitOnError-with-incremental.js index 975e40a6ec0a7..75cf59365fe80 100644 --- a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/isolatedModulesAndD/with-noEmitOnError-with-incremental.js +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/isolatedModulesAndD/with-noEmitOnError-with-incremental.js @@ -43,11 +43,6 @@ Output:: 4 ;   ~ - src/main.ts:2:11 - 2 const a = { -    ~ - The parser expected to find a '}' to match the '{' token here. - [12:00:37 AM] Found 1 error. Watching for file changes. @@ -180,11 +175,6 @@ Output:: 4 ;   ~ - src/main.ts:2:11 - 2 const a = { -    ~ - The parser expected to find a '}' to match the '{' token here. - [12:00:44 AM] Found 1 error. Watching for file changes. diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/isolatedModulesAndD/with-noEmitOnError.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/isolatedModulesAndD/with-noEmitOnError.js index 659ad65715340..0969d50832bf8 100644 --- a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/isolatedModulesAndD/with-noEmitOnError.js +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/isolatedModulesAndD/with-noEmitOnError.js @@ -43,11 +43,6 @@ Output:: 4 ;   ~ - src/main.ts:2:11 - 2 const a = { -    ~ - The parser expected to find a '}' to match the '{' token here. - [12:00:32 AM] Found 1 error. Watching for file changes. @@ -104,11 +99,6 @@ Output:: 4 ;   ~ - src/main.ts:2:11 - 2 const a = { -    ~ - The parser expected to find a '}' to match the '{' token here. - [12:00:37 AM] Found 1 error. Watching for file changes. diff --git a/tests/baselines/reference/typeAssertions.errors.txt b/tests/baselines/reference/typeAssertions.errors.txt index 9d10ec17fe95d..cf132a12d0262 100644 --- a/tests/baselines/reference/typeAssertions.errors.txt +++ b/tests/baselines/reference/typeAssertions.errors.txt @@ -93,6 +93,7 @@ tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts(48,50): err !!! error TS2304: Cannot find name 'is'. ~~~~~~ !!! error TS1005: ')' expected. +!!! related TS1007 tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts:44:3: The parser expected to find a ')' to match the '(' token here. ~~~~~~ !!! error TS2693: 'string' only refers to a type, but is being used as a value here. ~ @@ -108,6 +109,7 @@ tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts(48,50): err !!! error TS2749: 'numOrStr' refers to a value, but is being used as a type here. Did you mean 'typeof numOrStr'? ~~ !!! error TS1005: ')' expected. +!!! related TS1007 tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts:48:3: The parser expected to find a ')' to match the '(' token here. ~~ !!! error TS2304: Cannot find name 'is'. ~~~~~~ diff --git a/tests/cases/compiler/missingCloseBracketInArray.ts b/tests/cases/compiler/missingCloseBracketInArray.ts new file mode 100644 index 0000000000000..cb99f0d227757 --- /dev/null +++ b/tests/cases/compiler/missingCloseBracketInArray.ts @@ -0,0 +1 @@ +var alphas:string[] = alphas = ["1","2","3","4" \ No newline at end of file diff --git a/tests/cases/compiler/missingCloseParenStatements.ts b/tests/cases/compiler/missingCloseParenStatements.ts new file mode 100644 index 0000000000000..7ff34bdae6a16 --- /dev/null +++ b/tests/cases/compiler/missingCloseParenStatements.ts @@ -0,0 +1,13 @@ +var a1, a2, a3 = 0; +if ( a1 && (a2 + a3 > 0) { + while( (a2 > 0) && a1 + { + do { + var i = i + 1; + a1 = a1 + i; + with ((a2 + a3 > 0) && a1 { + console.log(x); + } + } while (i < 5 && (a1 > 5); + } +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArrayLiteralExpressions/parserErrorRecoveryArrayLiteralExpression3.ts b/tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArrayLiteralExpressions/parserErrorRecoveryArrayLiteralExpression3.ts index 58df0691d8e2c..18ed3b5ef5a50 100644 --- a/tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArrayLiteralExpressions/parserErrorRecoveryArrayLiteralExpression3.ts +++ b/tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArrayLiteralExpressions/parserErrorRecoveryArrayLiteralExpression3.ts @@ -1,2 +1 @@ - var texCoords = [2, 2, 0.5000001192092895, 0.8749999 ; 403953552, 0.5000001192092895, 0.8749999403953552]; From e38a0cefab21a68f91718e35af29398db4e4d689 Mon Sep 17 00:00:00 2001 From: Jesse Trinity Date: Thu, 27 May 2021 13:16:04 -0700 Subject: [PATCH 2/7] fix missing opening brace match error --- src/compiler/parser.ts | 34 +++++++++++-------- .../reference/reservedWords2.errors.txt | 2 -- .../smartIndentMissingBracketsDoKeyword.ts | 7 ++++ .../smartIndentMissingBracketsIfKeyword.ts | 7 ++++ .../smartIndentMissingBracketsWhileKeyword.ts | 7 ++++ .../smartIndentMissingBracketsWithKeyword.ts | 7 ++++ 6 files changed, 47 insertions(+), 17 deletions(-) create mode 100644 tests/cases/fourslash/smartIndentMissingBracketsDoKeyword.ts create mode 100644 tests/cases/fourslash/smartIndentMissingBracketsIfKeyword.ts create mode 100644 tests/cases/fourslash/smartIndentMissingBracketsWhileKeyword.ts create mode 100644 tests/cases/fourslash/smartIndentMissingBracketsWithKeyword.ts diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 80bea252a5e07..ed20068384931 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -1555,7 +1555,10 @@ namespace ts { return false; } - function parseExpectedMatchingBrackets(openKind: SyntaxKind, closeKind: SyntaxKind, openPosition: number) { + function parseExpectedMatchingBrackets(openKind: SyntaxKind, closeKind: SyntaxKind, openParsed: boolean, openPosition: number) { + if (!openParsed) { + return parseExpected(closeKind); + } if (token() === closeKind) { nextToken(); return; @@ -5499,10 +5502,10 @@ namespace ts { function parseArrayLiteralExpression(): ArrayLiteralExpression { const pos = getNodePos(); const openBracketPosition = scanner.getTokenPos(); - parseExpected(SyntaxKind.OpenBracketToken); + const openBracketParsed = parseExpected(SyntaxKind.OpenBracketToken); const multiLine = scanner.hasPrecedingLineBreak(); const elements = parseDelimitedList(ParsingContext.ArrayLiteralMembers, parseArgumentOrArrayLiteralElement); - parseExpectedMatchingBrackets(SyntaxKind.OpenBracketToken, SyntaxKind.CloseBracketToken, openBracketPosition); + parseExpectedMatchingBrackets(SyntaxKind.OpenBracketToken, SyntaxKind.CloseBracketToken, openBracketParsed, openBracketPosition); return finishNode(factory.createArrayLiteralExpression(elements, multiLine), pos); } @@ -5568,10 +5571,10 @@ namespace ts { function parseObjectLiteralExpression(): ObjectLiteralExpression { const pos = getNodePos(); const openBracePosition = scanner.getTokenPos(); - parseExpected(SyntaxKind.OpenBraceToken); + const openBraceParsed = parseExpected(SyntaxKind.OpenBraceToken); const multiLine = scanner.hasPrecedingLineBreak(); const properties = parseDelimitedList(ParsingContext.ObjectLiteralMembers, parseObjectLiteralElement, /*considerSemicolonAsDelimiter*/ true); - parseExpectedMatchingBrackets(SyntaxKind.OpenBraceToken, SyntaxKind.CloseBraceToken, openBracePosition); + parseExpectedMatchingBrackets(SyntaxKind.OpenBraceToken, SyntaxKind.CloseBraceToken, openBraceParsed, openBracePosition); return finishNode(factory.createObjectLiteralExpression(properties, multiLine), pos); } @@ -5654,10 +5657,11 @@ namespace ts { const pos = getNodePos(); const hasJSDoc = hasPrecedingJSDocComment(); const openBracePosition = scanner.getTokenPos(); - if (parseExpected(SyntaxKind.OpenBraceToken, diagnosticMessage) || ignoreMissingOpenBrace) { + const openBraceParsed = parseExpected(SyntaxKind.OpenBraceToken, diagnosticMessage) + if (openBraceParsed || ignoreMissingOpenBrace) { const multiLine = scanner.hasPrecedingLineBreak(); const statements = parseList(ParsingContext.BlockStatements, parseStatement); - parseExpectedMatchingBrackets(SyntaxKind.OpenBraceToken, SyntaxKind.CloseBraceToken, openBracePosition); + 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); @@ -5714,9 +5718,9 @@ namespace ts { const hasJSDoc = hasPrecedingJSDocComment(); parseExpected(SyntaxKind.IfKeyword); const openParenPosition = scanner.getTokenPos(); - parseExpected(SyntaxKind.OpenParenToken); + const openParenParsed = parseExpected(SyntaxKind.OpenParenToken); const expression = allowInAnd(parseExpression); - parseExpectedMatchingBrackets(SyntaxKind.OpenParenToken, SyntaxKind.CloseParenToken, openParenPosition); + parseExpectedMatchingBrackets(SyntaxKind.OpenParenToken, SyntaxKind.CloseParenToken, openParenParsed, openParenPosition) const thenStatement = parseStatement(); const elseStatement = parseOptional(SyntaxKind.ElseKeyword) ? parseStatement() : undefined; return withJSDoc(finishNode(factory.createIfStatement(expression, thenStatement, elseStatement), pos), hasJSDoc); @@ -5729,9 +5733,9 @@ namespace ts { const statement = parseStatement(); parseExpected(SyntaxKind.WhileKeyword); const openParenPosition = scanner.getTokenPos(); - parseExpected(SyntaxKind.OpenParenToken); + const openParenParsed = parseExpected(SyntaxKind.OpenParenToken); const expression = allowInAnd(parseExpression); - parseExpectedMatchingBrackets(SyntaxKind.OpenParenToken, SyntaxKind.CloseParenToken, openParenPosition); + parseExpectedMatchingBrackets(SyntaxKind.OpenParenToken, SyntaxKind.CloseParenToken, openParenParsed, openParenPosition) // From: https://mail.mozilla.org/pipermail/es-discuss/2011-August/016188.html // 157 min --- All allen at wirfs-brock.com CONF --- "do{;}while(false)false" prohibited in @@ -5746,9 +5750,9 @@ namespace ts { const hasJSDoc = hasPrecedingJSDocComment(); parseExpected(SyntaxKind.WhileKeyword); const openParenPosition = scanner.getTokenPos(); - parseExpected(SyntaxKind.OpenParenToken); + const openParenParsed = parseExpected(SyntaxKind.OpenParenToken); const expression = allowInAnd(parseExpression); - parseExpectedMatchingBrackets(SyntaxKind.OpenParenToken, SyntaxKind.CloseParenToken, openParenPosition); + parseExpectedMatchingBrackets(SyntaxKind.OpenParenToken, SyntaxKind.CloseParenToken, openParenParsed, openParenPosition); const statement = parseStatement(); return withJSDoc(finishNode(factory.createWhileStatement(expression, statement), pos), hasJSDoc); } @@ -5825,9 +5829,9 @@ namespace ts { const hasJSDoc = hasPrecedingJSDocComment(); parseExpected(SyntaxKind.WithKeyword); const openParenPosition = scanner.getTokenPos(); - parseExpected(SyntaxKind.OpenParenToken); + const openParenParsed = parseExpected(SyntaxKind.OpenParenToken); const expression = allowInAnd(parseExpression); - parseExpectedMatchingBrackets(SyntaxKind.OpenParenToken, SyntaxKind.CloseParenToken, openParenPosition); + parseExpectedMatchingBrackets(SyntaxKind.OpenParenToken, SyntaxKind.CloseParenToken, openParenParsed, openParenPosition); const statement = doInsideOfContext(NodeFlags.InWithStatement, parseStatement); return withJSDoc(finishNode(factory.createWithStatement(expression, statement), pos), hasJSDoc); } diff --git a/tests/baselines/reference/reservedWords2.errors.txt b/tests/baselines/reference/reservedWords2.errors.txt index 6ecb9471631bd..599010b436872 100644 --- a/tests/baselines/reference/reservedWords2.errors.txt +++ b/tests/baselines/reference/reservedWords2.errors.txt @@ -45,7 +45,6 @@ tests/cases/compiler/reservedWords2.ts(12,17): error TS1138: Parameter declarati !!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ~ !!! error TS1005: ')' expected. -!!! related TS1007 tests/cases/compiler/reservedWords2.ts:1:14: The parser expected to find a ')' to match the '(' token here. import * as while from "foo" !!! error TS2300: Duplicate identifier '(Missing)'. @@ -59,7 +58,6 @@ tests/cases/compiler/reservedWords2.ts(12,17): error TS1138: Parameter declarati !!! error TS2304: Cannot find name 'from'. ~~~~~ !!! error TS1005: ')' expected. -!!! related TS1007 tests/cases/compiler/reservedWords2.ts:2:20: The parser expected to find a ')' to match the '(' token here. var typeof = 10; ~~~~~~ diff --git a/tests/cases/fourslash/smartIndentMissingBracketsDoKeyword.ts b/tests/cases/fourslash/smartIndentMissingBracketsDoKeyword.ts new file mode 100644 index 0000000000000..984499db5ae5b --- /dev/null +++ b/tests/cases/fourslash/smartIndentMissingBracketsDoKeyword.ts @@ -0,0 +1,7 @@ +/// + +////do {/*1*/ + +goTo.marker("1"); +edit.insert("\n"); +verify.indentationIs(4); diff --git a/tests/cases/fourslash/smartIndentMissingBracketsIfKeyword.ts b/tests/cases/fourslash/smartIndentMissingBracketsIfKeyword.ts new file mode 100644 index 0000000000000..0e260cdf1427e --- /dev/null +++ b/tests/cases/fourslash/smartIndentMissingBracketsIfKeyword.ts @@ -0,0 +1,7 @@ +/// + +////if /*1*/ + +goTo.marker("1"); +edit.insert("\n"); +verify.indentationIs(4); diff --git a/tests/cases/fourslash/smartIndentMissingBracketsWhileKeyword.ts b/tests/cases/fourslash/smartIndentMissingBracketsWhileKeyword.ts new file mode 100644 index 0000000000000..03e9be630ca3c --- /dev/null +++ b/tests/cases/fourslash/smartIndentMissingBracketsWhileKeyword.ts @@ -0,0 +1,7 @@ +/// + +////while /*1*/ + +goTo.marker("1"); +edit.insert("\n"); +verify.indentationIs(4); diff --git a/tests/cases/fourslash/smartIndentMissingBracketsWithKeyword.ts b/tests/cases/fourslash/smartIndentMissingBracketsWithKeyword.ts new file mode 100644 index 0000000000000..733fc0560a7c3 --- /dev/null +++ b/tests/cases/fourslash/smartIndentMissingBracketsWithKeyword.ts @@ -0,0 +1,7 @@ +/// + +////with /*1*/ + +goTo.marker("1"); +edit.insert("\n"); +verify.indentationIs(0); From fa19d47e0dda28eac1d4d55bc01dc8ee321ca30d Mon Sep 17 00:00:00 2001 From: Jesse Trinity Date: Wed, 2 Jun 2021 14:31:23 -0700 Subject: [PATCH 3/7] refactor parseExpectedMatchingBrackets --- src/compiler/parser.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index ed20068384931..dea7f21fdcd72 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -1555,15 +1555,15 @@ namespace ts { return false; } - function parseExpectedMatchingBrackets(openKind: SyntaxKind, closeKind: SyntaxKind, openParsed: boolean, openPosition: number) { - if (!openParsed) { - return parseExpected(closeKind); - } + function parseExpectedMatchingBrackets(openKind: SyntaxKind, closeKind: SyntaxKind, openParsed: boolean, openPosition: number) { if (token() === closeKind) { nextToken(); return; } const lastError = parseErrorAtCurrentToken(Diagnostics._0_expected, tokenToString(closeKind)); + if (!openParsed) { + return; + } if (lastError) { addRelatedInfo( lastError, @@ -5657,7 +5657,7 @@ namespace ts { const pos = getNodePos(); const hasJSDoc = hasPrecedingJSDocComment(); const openBracePosition = scanner.getTokenPos(); - const openBraceParsed = parseExpected(SyntaxKind.OpenBraceToken, diagnosticMessage) + const openBraceParsed = parseExpected(SyntaxKind.OpenBraceToken, diagnosticMessage); if (openBraceParsed || ignoreMissingOpenBrace) { const multiLine = scanner.hasPrecedingLineBreak(); const statements = parseList(ParsingContext.BlockStatements, parseStatement); @@ -5720,7 +5720,7 @@ namespace ts { const openParenPosition = scanner.getTokenPos(); const openParenParsed = parseExpected(SyntaxKind.OpenParenToken); const expression = allowInAnd(parseExpression); - parseExpectedMatchingBrackets(SyntaxKind.OpenParenToken, SyntaxKind.CloseParenToken, openParenParsed, openParenPosition) + parseExpectedMatchingBrackets(SyntaxKind.OpenParenToken, SyntaxKind.CloseParenToken, openParenParsed, openParenPosition); const thenStatement = parseStatement(); const elseStatement = parseOptional(SyntaxKind.ElseKeyword) ? parseStatement() : undefined; return withJSDoc(finishNode(factory.createIfStatement(expression, thenStatement, elseStatement), pos), hasJSDoc); @@ -5735,7 +5735,7 @@ namespace ts { const openParenPosition = scanner.getTokenPos(); const openParenParsed = parseExpected(SyntaxKind.OpenParenToken); const expression = allowInAnd(parseExpression); - parseExpectedMatchingBrackets(SyntaxKind.OpenParenToken, SyntaxKind.CloseParenToken, openParenParsed, openParenPosition) + parseExpectedMatchingBrackets(SyntaxKind.OpenParenToken, SyntaxKind.CloseParenToken, openParenParsed, openParenPosition); // From: https://mail.mozilla.org/pipermail/es-discuss/2011-August/016188.html // 157 min --- All allen at wirfs-brock.com CONF --- "do{;}while(false)false" prohibited in From c26543fd5517f7056606ea066b6f12dd8147e389 Mon Sep 17 00:00:00 2001 From: Jesse Trinity Date: Wed, 2 Jun 2021 16:06:03 -0700 Subject: [PATCH 4/7] use getNodePos --- src/compiler/parser.ts | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index dea7f21fdcd72..a01e3f2cb8b41 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -5501,11 +5501,10 @@ namespace ts { function parseArrayLiteralExpression(): ArrayLiteralExpression { const pos = getNodePos(); - const openBracketPosition = scanner.getTokenPos(); const openBracketParsed = parseExpected(SyntaxKind.OpenBracketToken); const multiLine = scanner.hasPrecedingLineBreak(); const elements = parseDelimitedList(ParsingContext.ArrayLiteralMembers, parseArgumentOrArrayLiteralElement); - parseExpectedMatchingBrackets(SyntaxKind.OpenBracketToken, SyntaxKind.CloseBracketToken, openBracketParsed, openBracketPosition); + parseExpectedMatchingBrackets(SyntaxKind.OpenBracketToken, SyntaxKind.CloseBracketToken, openBracketParsed, pos); return finishNode(factory.createArrayLiteralExpression(elements, multiLine), pos); } @@ -5570,11 +5569,10 @@ namespace ts { function parseObjectLiteralExpression(): ObjectLiteralExpression { const pos = getNodePos(); - const openBracePosition = scanner.getTokenPos(); const openBraceParsed = parseExpected(SyntaxKind.OpenBraceToken); const multiLine = scanner.hasPrecedingLineBreak(); const properties = parseDelimitedList(ParsingContext.ObjectLiteralMembers, parseObjectLiteralElement, /*considerSemicolonAsDelimiter*/ true); - parseExpectedMatchingBrackets(SyntaxKind.OpenBraceToken, SyntaxKind.CloseBraceToken, openBraceParsed, openBracePosition); + parseExpectedMatchingBrackets(SyntaxKind.OpenBraceToken, SyntaxKind.CloseBraceToken, openBraceParsed, pos); return finishNode(factory.createObjectLiteralExpression(properties, multiLine), pos); } @@ -5656,12 +5654,11 @@ namespace ts { function parseBlock(ignoreMissingOpenBrace: boolean, diagnosticMessage?: DiagnosticMessage): Block { const pos = getNodePos(); const hasJSDoc = hasPrecedingJSDocComment(); - const openBracePosition = scanner.getTokenPos(); const openBraceParsed = parseExpected(SyntaxKind.OpenBraceToken, diagnosticMessage); if (openBraceParsed || ignoreMissingOpenBrace) { const multiLine = scanner.hasPrecedingLineBreak(); const statements = parseList(ParsingContext.BlockStatements, parseStatement); - parseExpectedMatchingBrackets(SyntaxKind.OpenBraceToken, SyntaxKind.CloseBraceToken, openBraceParsed, openBracePosition); + parseExpectedMatchingBrackets(SyntaxKind.OpenBraceToken, SyntaxKind.CloseBraceToken, openBraceParsed, pos); 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); @@ -5717,7 +5714,7 @@ namespace ts { const pos = getNodePos(); const hasJSDoc = hasPrecedingJSDocComment(); parseExpected(SyntaxKind.IfKeyword); - const openParenPosition = scanner.getTokenPos(); + const openParenPosition = getNodePos(); const openParenParsed = parseExpected(SyntaxKind.OpenParenToken); const expression = allowInAnd(parseExpression); parseExpectedMatchingBrackets(SyntaxKind.OpenParenToken, SyntaxKind.CloseParenToken, openParenParsed, openParenPosition); @@ -5732,7 +5729,7 @@ namespace ts { parseExpected(SyntaxKind.DoKeyword); const statement = parseStatement(); parseExpected(SyntaxKind.WhileKeyword); - const openParenPosition = scanner.getTokenPos(); + const openParenPosition = getNodePos(); const openParenParsed = parseExpected(SyntaxKind.OpenParenToken); const expression = allowInAnd(parseExpression); parseExpectedMatchingBrackets(SyntaxKind.OpenParenToken, SyntaxKind.CloseParenToken, openParenParsed, openParenPosition); @@ -5749,7 +5746,7 @@ namespace ts { const pos = getNodePos(); const hasJSDoc = hasPrecedingJSDocComment(); parseExpected(SyntaxKind.WhileKeyword); - const openParenPosition = scanner.getTokenPos(); + const openParenPosition = getNodePos(); const openParenParsed = parseExpected(SyntaxKind.OpenParenToken); const expression = allowInAnd(parseExpression); parseExpectedMatchingBrackets(SyntaxKind.OpenParenToken, SyntaxKind.CloseParenToken, openParenParsed, openParenPosition); @@ -5828,7 +5825,7 @@ namespace ts { const pos = getNodePos(); const hasJSDoc = hasPrecedingJSDocComment(); parseExpected(SyntaxKind.WithKeyword); - const openParenPosition = scanner.getTokenPos(); + const openParenPosition = getNodePos(); const openParenParsed = parseExpected(SyntaxKind.OpenParenToken); const expression = allowInAnd(parseExpression); parseExpectedMatchingBrackets(SyntaxKind.OpenParenToken, SyntaxKind.CloseParenToken, openParenParsed, openParenPosition); From 0490253710e9450eeaa8331a2454c55780fcefbc Mon Sep 17 00:00:00 2001 From: Jesse Trinity Date: Wed, 2 Jun 2021 16:11:06 -0700 Subject: [PATCH 5/7] accept baselines --- .../constructorWithIncompleteTypeAnnotation.errors.txt | 2 +- ...rrorRecoveryWithDotFollowedByNamespaceKeyword.errors.txt | 2 +- tests/baselines/reference/exportInFunction.errors.txt | 2 +- tests/baselines/reference/jsonParserRecovery/JSX.errors.txt | 3 +-- .../reference/jsonParserRecovery/TypeScript_code.errors.txt | 3 +-- .../jsonParserRecovery/trailing_identifier.errors.txt | 3 +-- tests/baselines/reference/missingCloseBrace.errors.txt | 2 +- .../reference/missingCloseBraceInObjectLiteral.errors.txt | 2 +- .../reference/missingCloseBracketInArray.errors.txt | 2 +- .../reference/missingCloseParenStatements.errors.txt | 6 +++--- .../reference/parserErrorRecoveryIfStatement2.errors.txt | 2 +- .../reference/parserErrorRecoveryIfStatement3.errors.txt | 2 +- .../reference/parserErrorRecovery_ObjectLiteral2.errors.txt | 2 +- .../reference/parserErrorRecovery_ObjectLiteral3.errors.txt | 2 +- .../reference/parserErrorRecovery_ObjectLiteral4.errors.txt | 2 +- .../reference/parserErrorRecovery_ObjectLiteral5.errors.txt | 2 +- .../parserErrorRecovery_SwitchStatement2.errors.txt | 2 +- .../reference/prettyContextNotDebugAssertion.errors.txt | 6 +++--- 18 files changed, 22 insertions(+), 25 deletions(-) diff --git a/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.errors.txt b/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.errors.txt index 2e95e0d27dfdc..25324c8de8a53 100644 --- a/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.errors.txt +++ b/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.errors.txt @@ -121,7 +121,7 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(261,1): error TS if (retValue != 0 ^= { ~~ !!! error TS1005: ')' expected. -!!! related TS1007 tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts:22:20: The parser expected to find a ')' to match the '(' token here. +!!! related TS1007 tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts:22:19: The parser expected to find a ')' to match the '(' token here. ~ diff --git a/tests/baselines/reference/errorRecoveryWithDotFollowedByNamespaceKeyword.errors.txt b/tests/baselines/reference/errorRecoveryWithDotFollowedByNamespaceKeyword.errors.txt index 6bac67291472c..eb5873670cf62 100644 --- a/tests/baselines/reference/errorRecoveryWithDotFollowedByNamespaceKeyword.errors.txt +++ b/tests/baselines/reference/errorRecoveryWithDotFollowedByNamespaceKeyword.errors.txt @@ -16,4 +16,4 @@ tests/cases/compiler/errorRecoveryWithDotFollowedByNamespaceKeyword.ts(9,2): err } !!! error TS1005: '}' expected. -!!! related TS1007 tests/cases/compiler/errorRecoveryWithDotFollowedByNamespaceKeyword.ts:3:19: The parser expected to find a '}' to match the '{' token here. \ No newline at end of file +!!! related TS1007 tests/cases/compiler/errorRecoveryWithDotFollowedByNamespaceKeyword.ts:3:18: The parser expected to find a '}' to match the '{' token here. \ No newline at end of file diff --git a/tests/baselines/reference/exportInFunction.errors.txt b/tests/baselines/reference/exportInFunction.errors.txt index bfd43b23477cc..f76393405c77a 100644 --- a/tests/baselines/reference/exportInFunction.errors.txt +++ b/tests/baselines/reference/exportInFunction.errors.txt @@ -7,4 +7,4 @@ tests/cases/compiler/exportInFunction.ts(3,1): error TS1005: '}' expected. !!! error TS1005: '}' expected. -!!! related TS1007 tests/cases/compiler/exportInFunction.ts:1:14: The parser expected to find a '}' to match the '{' token here. \ No newline at end of file +!!! related TS1007 tests/cases/compiler/exportInFunction.ts:1:13: The parser expected to find a '}' to match the '{' token here. \ No newline at end of file diff --git a/tests/baselines/reference/jsonParserRecovery/JSX.errors.txt b/tests/baselines/reference/jsonParserRecovery/JSX.errors.txt index 7789f6c00190e..772c67ee4936b 100644 --- a/tests/baselines/reference/jsonParserRecovery/JSX.errors.txt +++ b/tests/baselines/reference/jsonParserRecovery/JSX.errors.txt @@ -33,5 +33,4 @@ JSX(15,10): error TS1005: '}' expected. ) -!!! error TS1005: '}' expected. -!!! related TS1007 JSX:4:9: The parser expected to find a '}' to match the '{' token here. \ No newline at end of file +!!! error TS1005: '}' expected. \ No newline at end of file diff --git a/tests/baselines/reference/jsonParserRecovery/TypeScript_code.errors.txt b/tests/baselines/reference/jsonParserRecovery/TypeScript_code.errors.txt index cd17a0c487edf..357be436faf96 100644 --- a/tests/baselines/reference/jsonParserRecovery/TypeScript_code.errors.txt +++ b/tests/baselines/reference/jsonParserRecovery/TypeScript_code.errors.txt @@ -16,5 +16,4 @@ TypeScript code(1,22): error TS1005: '}' expected. ~~~~ !!! error TS1012: Unexpected token. -!!! error TS1005: '}' expected. -!!! related TS1007 TypeScript code:1:18: The parser expected to find a '}' to match the '{' token here. \ No newline at end of file +!!! error TS1005: '}' expected. \ No newline at end of file diff --git a/tests/baselines/reference/jsonParserRecovery/trailing_identifier.errors.txt b/tests/baselines/reference/jsonParserRecovery/trailing_identifier.errors.txt index 11c44b08f0060..295513f3c6053 100644 --- a/tests/baselines/reference/jsonParserRecovery/trailing_identifier.errors.txt +++ b/tests/baselines/reference/jsonParserRecovery/trailing_identifier.errors.txt @@ -7,5 +7,4 @@ trailing identifier(1,8): error TS1005: '}' expected. ~~~~ !!! error TS1012: Unexpected token. -!!! error TS1005: '}' expected. -!!! related TS1007 trailing identifier:1:4: The parser expected to find a '}' to match the '{' token here. \ No newline at end of file +!!! error TS1005: '}' expected. \ No newline at end of file diff --git a/tests/baselines/reference/missingCloseBrace.errors.txt b/tests/baselines/reference/missingCloseBrace.errors.txt index 27db81d27da94..0d48c82985f99 100644 --- a/tests/baselines/reference/missingCloseBrace.errors.txt +++ b/tests/baselines/reference/missingCloseBrace.errors.txt @@ -13,4 +13,4 @@ tests/cases/compiler/missingCloseBrace.ts(9,1): error TS1005: '}' expected. !!! error TS1005: '}' expected. -!!! related TS1007 tests/cases/compiler/missingCloseBrace.ts:1:22: The parser expected to find a '}' to match the '{' token here. \ No newline at end of file +!!! related TS1007 tests/cases/compiler/missingCloseBrace.ts:1:21: The parser expected to find a '}' to match the '{' token here. \ No newline at end of file diff --git a/tests/baselines/reference/missingCloseBraceInObjectLiteral.errors.txt b/tests/baselines/reference/missingCloseBraceInObjectLiteral.errors.txt index 436c8843c7582..23bd8f0e4adab 100644 --- a/tests/baselines/reference/missingCloseBraceInObjectLiteral.errors.txt +++ b/tests/baselines/reference/missingCloseBraceInObjectLiteral.errors.txt @@ -9,4 +9,4 @@ tests/cases/compiler/missingCloseBraceInObjectLiteral.ts(5,1): error TS1005: '}' !!! error TS1005: '}' expected. -!!! related TS1007 tests/cases/compiler/missingCloseBraceInObjectLiteral.ts:1:11: The parser expected to find a '}' to match the '{' token here. \ No newline at end of file +!!! related TS1007 tests/cases/compiler/missingCloseBraceInObjectLiteral.ts:1:10: The parser expected to find a '}' to match the '{' token here. \ No newline at end of file diff --git a/tests/baselines/reference/missingCloseBracketInArray.errors.txt b/tests/baselines/reference/missingCloseBracketInArray.errors.txt index 26801c02812b4..6efe976750d53 100644 --- a/tests/baselines/reference/missingCloseBracketInArray.errors.txt +++ b/tests/baselines/reference/missingCloseBracketInArray.errors.txt @@ -5,4 +5,4 @@ tests/cases/compiler/missingCloseBracketInArray.ts(1,48): error TS1005: ']' expe var alphas:string[] = alphas = ["1","2","3","4" !!! error TS1005: ']' expected. -!!! related TS1007 tests/cases/compiler/missingCloseBracketInArray.ts:1:32: The parser expected to find a ']' to match the '[' token here. \ No newline at end of file +!!! related TS1007 tests/cases/compiler/missingCloseBracketInArray.ts:1:31: The parser expected to find a ']' to match the '[' token here. \ No newline at end of file diff --git a/tests/baselines/reference/missingCloseParenStatements.errors.txt b/tests/baselines/reference/missingCloseParenStatements.errors.txt index 3f49d5a036653..3cae4b65bcd4f 100644 --- a/tests/baselines/reference/missingCloseParenStatements.errors.txt +++ b/tests/baselines/reference/missingCloseParenStatements.errors.txt @@ -9,7 +9,7 @@ tests/cases/compiler/missingCloseParenStatements.ts(11,35): error TS1005: ')' ex if ( a1 && (a2 + a3 > 0) { ~ !!! error TS1005: ')' expected. -!!! related TS1007 tests/cases/compiler/missingCloseParenStatements.ts:2:4: The parser expected to find a ')' to match the '(' token here. +!!! related TS1007 tests/cases/compiler/missingCloseParenStatements.ts:2:3: The parser expected to find a ')' to match the '(' token here. while( (a2 > 0) && a1 { ~ @@ -21,12 +21,12 @@ tests/cases/compiler/missingCloseParenStatements.ts(11,35): error TS1005: ')' ex with ((a2 + a3 > 0) && a1 { ~ !!! error TS1005: ')' expected. -!!! related TS1007 tests/cases/compiler/missingCloseParenStatements.ts:8:18: The parser expected to find a ')' to match the '(' token here. +!!! related TS1007 tests/cases/compiler/missingCloseParenStatements.ts:8:17: The parser expected to find a ')' to match the '(' token here. console.log(x); } } while (i < 5 && (a1 > 5); ~ !!! error TS1005: ')' expected. -!!! related TS1007 tests/cases/compiler/missingCloseParenStatements.ts:11:17: The parser expected to find a ')' to match the '(' token here. +!!! related TS1007 tests/cases/compiler/missingCloseParenStatements.ts:11:16: The parser expected to find a ')' to match the '(' token here. } } \ No newline at end of file diff --git a/tests/baselines/reference/parserErrorRecoveryIfStatement2.errors.txt b/tests/baselines/reference/parserErrorRecoveryIfStatement2.errors.txt index b88c48182a27b..806f2cf7914dc 100644 --- a/tests/baselines/reference/parserErrorRecoveryIfStatement2.errors.txt +++ b/tests/baselines/reference/parserErrorRecoveryIfStatement2.errors.txt @@ -11,7 +11,7 @@ tests/cases/conformance/parser/ecmascript5/ErrorRecovery/IfStatements/parserErro } ~ !!! error TS1005: ')' expected. -!!! related TS1007 tests/cases/conformance/parser/ecmascript5/ErrorRecovery/IfStatements/parserErrorRecoveryIfStatement2.ts:3:8: The parser expected to find a ')' to match the '(' token here. +!!! related TS1007 tests/cases/conformance/parser/ecmascript5/ErrorRecovery/IfStatements/parserErrorRecoveryIfStatement2.ts:3:7: The parser expected to find a ')' to match the '(' token here. f2() { } f3() { diff --git a/tests/baselines/reference/parserErrorRecoveryIfStatement3.errors.txt b/tests/baselines/reference/parserErrorRecoveryIfStatement3.errors.txt index cfd645e592542..a92e4f81fd2b2 100644 --- a/tests/baselines/reference/parserErrorRecoveryIfStatement3.errors.txt +++ b/tests/baselines/reference/parserErrorRecoveryIfStatement3.errors.txt @@ -11,7 +11,7 @@ tests/cases/conformance/parser/ecmascript5/ErrorRecovery/IfStatements/parserErro } ~ !!! error TS1005: ')' expected. -!!! related TS1007 tests/cases/conformance/parser/ecmascript5/ErrorRecovery/IfStatements/parserErrorRecoveryIfStatement3.ts:3:8: The parser expected to find a ')' to match the '(' token here. +!!! related TS1007 tests/cases/conformance/parser/ecmascript5/ErrorRecovery/IfStatements/parserErrorRecoveryIfStatement3.ts:3:7: The parser expected to find a ')' to match the '(' token here. f2() { } f3() { diff --git a/tests/baselines/reference/parserErrorRecovery_ObjectLiteral2.errors.txt b/tests/baselines/reference/parserErrorRecovery_ObjectLiteral2.errors.txt index 1b1cb56af702c..983e890edf9d4 100644 --- a/tests/baselines/reference/parserErrorRecovery_ObjectLiteral2.errors.txt +++ b/tests/baselines/reference/parserErrorRecovery_ObjectLiteral2.errors.txt @@ -15,4 +15,4 @@ tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ObjectLiterals/parserEr !!! error TS1005: ':' expected. !!! error TS1005: '}' expected. -!!! related TS1007 tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ObjectLiterals/parserErrorRecovery_ObjectLiteral2.ts:1:9: The parser expected to find a '}' to match the '{' token here. \ No newline at end of file +!!! related TS1007 tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ObjectLiterals/parserErrorRecovery_ObjectLiteral2.ts:1:8: The parser expected to find a '}' to match the '{' token here. \ No newline at end of file diff --git a/tests/baselines/reference/parserErrorRecovery_ObjectLiteral3.errors.txt b/tests/baselines/reference/parserErrorRecovery_ObjectLiteral3.errors.txt index cfde9bcd8a35a..9c4912628a846 100644 --- a/tests/baselines/reference/parserErrorRecovery_ObjectLiteral3.errors.txt +++ b/tests/baselines/reference/parserErrorRecovery_ObjectLiteral3.errors.txt @@ -12,4 +12,4 @@ tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ObjectLiterals/parserEr !!! error TS1005: ':' expected. !!! error TS1005: '}' expected. -!!! related TS1007 tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ObjectLiterals/parserErrorRecovery_ObjectLiteral3.ts:1:9: The parser expected to find a '}' to match the '{' token here. \ No newline at end of file +!!! related TS1007 tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ObjectLiterals/parserErrorRecovery_ObjectLiteral3.ts:1:8: The parser expected to find a '}' to match the '{' token here. \ No newline at end of file diff --git a/tests/baselines/reference/parserErrorRecovery_ObjectLiteral4.errors.txt b/tests/baselines/reference/parserErrorRecovery_ObjectLiteral4.errors.txt index 8b67b285eb7fe..29e666c681905 100644 --- a/tests/baselines/reference/parserErrorRecovery_ObjectLiteral4.errors.txt +++ b/tests/baselines/reference/parserErrorRecovery_ObjectLiteral4.errors.txt @@ -12,4 +12,4 @@ tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ObjectLiterals/parserEr !!! error TS1005: ':' expected. !!! error TS1005: '}' expected. -!!! related TS1007 tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ObjectLiterals/parserErrorRecovery_ObjectLiteral4.ts:1:9: The parser expected to find a '}' to match the '{' token here. \ No newline at end of file +!!! related TS1007 tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ObjectLiterals/parserErrorRecovery_ObjectLiteral4.ts:1:8: The parser expected to find a '}' to match the '{' token here. \ No newline at end of file diff --git a/tests/baselines/reference/parserErrorRecovery_ObjectLiteral5.errors.txt b/tests/baselines/reference/parserErrorRecovery_ObjectLiteral5.errors.txt index 3915b915e46a5..75826e126e9e9 100644 --- a/tests/baselines/reference/parserErrorRecovery_ObjectLiteral5.errors.txt +++ b/tests/baselines/reference/parserErrorRecovery_ObjectLiteral5.errors.txt @@ -9,4 +9,4 @@ tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ObjectLiterals/parserEr !!! error TS1005: ':' expected. !!! error TS1005: '}' expected. -!!! related TS1007 tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ObjectLiterals/parserErrorRecovery_ObjectLiteral5.ts:1:9: The parser expected to find a '}' to match the '{' token here. \ No newline at end of file +!!! related TS1007 tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ObjectLiterals/parserErrorRecovery_ObjectLiteral5.ts:1:8: The parser expected to find a '}' to match the '{' token here. \ No newline at end of file diff --git a/tests/baselines/reference/parserErrorRecovery_SwitchStatement2.errors.txt b/tests/baselines/reference/parserErrorRecovery_SwitchStatement2.errors.txt index 2fca88d8bebb0..0fe4208a0140c 100644 --- a/tests/baselines/reference/parserErrorRecovery_SwitchStatement2.errors.txt +++ b/tests/baselines/reference/parserErrorRecovery_SwitchStatement2.errors.txt @@ -16,4 +16,4 @@ tests/cases/conformance/parser/ecmascript5/ErrorRecovery/SwitchStatements/parser } !!! error TS1005: '}' expected. -!!! related TS1007 tests/cases/conformance/parser/ecmascript5/ErrorRecovery/SwitchStatements/parserErrorRecovery_SwitchStatement2.ts:2:17: The parser expected to find a '}' to match the '{' token here. \ No newline at end of file +!!! related TS1007 tests/cases/conformance/parser/ecmascript5/ErrorRecovery/SwitchStatements/parserErrorRecovery_SwitchStatement2.ts:2:16: The parser expected to find a '}' to match the '{' token here. \ No newline at end of file diff --git a/tests/baselines/reference/prettyContextNotDebugAssertion.errors.txt b/tests/baselines/reference/prettyContextNotDebugAssertion.errors.txt index 2bb96b27a9d32..ba72657ea52e0 100644 --- a/tests/baselines/reference/prettyContextNotDebugAssertion.errors.txt +++ b/tests/baselines/reference/prettyContextNotDebugAssertion.errors.txt @@ -3,9 +3,9 @@ 2    - tests/cases/compiler/index.ts:1:11 + tests/cases/compiler/index.ts:1:10 1 if (true) { -    ~ +    ~ The parser expected to find a '}' to match the '{' token here. @@ -14,6 +14,6 @@ !!! error TS1005: '}' expected. -!!! related TS1007 tests/cases/compiler/index.ts:1:11: The parser expected to find a '}' to match the '{' token here. +!!! related TS1007 tests/cases/compiler/index.ts:1:10: The parser expected to find a '}' to match the '{' token here. Found 1 error. From f02bd72c1b3f4b1826d261085beeeb110620e783 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Tue, 15 Mar 2022 15:17:24 -0700 Subject: [PATCH 6/7] delete mistakenly added files --- src/compiler/JUST-IN-CASE-OF-CRASH.txt | 532 -------- src/compiler/plain-errors.txt | 1570 ------------------------ 2 files changed, 2102 deletions(-) delete mode 100644 src/compiler/JUST-IN-CASE-OF-CRASH.txt delete mode 100644 src/compiler/plain-errors.txt diff --git a/src/compiler/JUST-IN-CASE-OF-CRASH.txt b/src/compiler/JUST-IN-CASE-OF-CRASH.txt deleted file mode 100644 index 2b00ee6f287a7..0000000000000 --- a/src/compiler/JUST-IN-CASE-OF-CRASH.txt +++ /dev/null @@ -1,532 +0,0 @@ - - Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies - - Diagnostics.Private_identifiers_are_only_allowed_in_class_bodies_and_may_only_be_used_as_part_of_a_class_member_declaration_property_access_or_on_the_left_hand_side_of_an_in_expression - - Diagnostics.Cannot_find_name_0 - -```js -class C { - q = #unbound - m() { - #p++ - q++ - this.#q - if (#po in this) { - - } - const o = { a: 1, a: 2 } - return o.a - } - #m() { - this.#m = () => {} - } -} -#unrelated -``` - -These 3 errors need improvement, but at least the first two should behave the same in JS as TS - - - Diagnostics.Cannot_assign_to_private_method_0_Private_methods_are_not_writable - -```js -class C { - #m() { - this.#m = () => {} - } -} -``` - - - Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies -`junk.#m` (you get a better error if C is defined and even better if C.#m is defined) - - - Diagnostics._0_and_1_operations_cannot_be_mixed_without_parentheses - -```js -var x = 1 || 2 ?? 2 -var x = 2 ?? 3 || 4 -var x = -2 ** 3 -``` - - - Diagnostics.For_await_loops_cannot_be_used_inside_a_class_static_block - -```js -class C { - static { - for await (const x of [1,2,3]) { - console.log(x) - } - } -} -``` - - - Diagnostics.A_default_clause_cannot_appear_more_than_once_in_a_switch_statement - -```js -var b = true -switch (b) { - case false: - console.log('no') - default: - console.log('yes') - default: - console.log('wat') -} -``` - - - Diagnostics.Duplicate_label_0 - -```js -label: for (const x in [1,2,3]) { - label: for (const y in [1,2,3]) { - break label; - } -} -``` - - - Diagnostics.Cannot_redeclare_identifier_0_in_catch_clause - -```js -try { - throw 2 -} -catch (e) { - const e = 1 - console.log(e) -} -``` - - - Diagnostics.Class_decorators_can_t_be_used_with_static_private_identifier_Consider_removing_the_experimental_decorator - -```js -declare var deco: any -@deco -class C { - static #p = 1 -} -``` - -But this doesn't run on any JS runtime today so it probably shouldn't apply - - - Diagnostics.A_class_member_cannot_have_the_0_keyword - -```js - class C { - const x = 1 - const y() { - return 12 - } -} -``` - - - Diagnostics._0_modifier_already_seen - -```js -class C { - static static x = 1 -} -``` - - - Diagnostics._0_modifier_must_precede_1_modifier - -```js -class C { - static async x (){ } -} -``` - - - Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element - -```js -export static var x = 1 -``` - - - Diagnostics._0_modifier_cannot_appear_on_a_parameter - -```js -function f(static x = 1) { return x } -``` - - - Diagnostics._0_modifier_already_seen - -```js -export export var x = 1 -``` - - - Diagnostics._0_modifier_must_precede_1_modifier - -```js -async export function f(x = 1) { return x } -``` - - - Diagnostics._0_modifier_cannot_appear_on_class_elements_of_this_kind - -```js -class C { - export p = 1 - export m() { - } -} -``` - -Note that there's an existing, bogus error in JS which is supposed to be issued on - exports from namespaces, which are not in JS of course. - - - Diagnostics._0_modifier_cannot_appear_on_a_parameter - -```js -function f(export x = 1) { return x } -``` - - - Diagnostics._0_modifier_must_precede_1_modifier - -```js -default export 13; -``` - - - Diagnostics._0_modifier_already_seen - -```js -async async function f() { - return 1 -} -``` - - - Diagnostics._0_modifier_cannot_appear_on_a_parameter - -```js -function f(async x = 1) { return x } -``` - - - Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration - -```js -class C { - static constructor() { } -} -``` - - - Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration - -```js -class C { - async constructor() { } -} -``` - - - Diagnostics._0_modifier_cannot_be_used_here - -```js -async class C { - async x = 1 -} -async const y = 2 -async import './other' -async export { C } -``` - - - Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list - -```js -function f (...x, y) { -} -``` - - - Diagnostics.A_rest_parameter_cannot_have_an_initializer - -```js -function f (...x = [1,2,3]) { -} -``` - - - Diagnostics.Line_terminator_not_permitted_before_arrow - -```js -const arr = x - => x + 1 - ``` - - - Diagnostics.Tagged_template_expressions_are_not_permitted_in_an_optional_chain - -```js -var a = [1,2] -a?.`length`; -``` - - - Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name - -```js -const o = { - [console.log('oh no'),2]: 'hi' -} -``` - - - - InvalidQuestionMark - -```js -const o = { - x?: 12 -} -``` - - But: this already errors with a JS-specific error, so maybe the first should too. - -```js -const o = { - m?() { return 12 } -} -``` - - - InvalidExclamationToken - -```js -var x = 1 -const o = { - x! -} -const o = { - m!() { return 12 } -} -``` - - - Diagnostics.A_rest_element_cannot_contain_a_binding_pattern - -```js -const o = { - x: 1, y: 2 -} -let x; let y -;({ ...[] } = o) -``` - - - Diagnostics.Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_part_of_a_destructuring_pattern - -```js -const o = { x = 1 } -``` - - - Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies - -```js -const o = { #x: 1 } -``` - - - Diagnostics._0_modifier_cannot_be_used_here - -```js -const o = { export x: 1 } -``` - - - Diagnostics.Duplicate_identifier_0 - -TODO: Duplicated with An object literal cannot have multiple properties with the same name in strict mode. - -```js -const o = { - x: 1, - x() { } -``` - - - Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name - - Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression - - Diagnostics.JSX_property_access_expressions_cannot_include_JSX_namespace_names - - Diagnostics.JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array - -- TODO Come back here and figure out what JSX errors are good -- - - - Diagnostics.The_left_hand_side_of_a_for_of_statement_may_not_be_async - -```js -let async -export const l = [1,2,3] -for (async of l) { - console.log(x) -} -``` - - - Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer - -```js -for (const x = 1 in [1,2,3]) { - console.log(x) -} -``` - - - Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer; - -```js -for (const x = 1 of [1,2,3]) { - console.log(x) -} -``` - - - Diagnostics._0_Expected - -```js -class C { - get x(); -} -``` - - - Diagnostics.A_get_accessor_cannot_have_parameters - -```js -class C { - get x(n) { return 1 } -} -``` - - - Diagnostics.A_set_accessor_must_have_exactly_one_parameter - -```js -class C { - set x() { } - set y(a, b) { } -} -``` - - - Diagnostics.A_set_accessor_cannot_have_rest_parameter - -```js -class C { - set x(...n) { } -} -``` - - - Diagnostics.Jump_target_cannot_cross_function_boundary - -```js -function outer() { - outer: for(;;) { - function test() { - break outer - } - test() - } -} -outer() -``` - - - Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement - -```js -function outer(x) { - outer: switch (x) { - case 1: - continue outer - } -} -outer(1) -``` - - - Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement - -```js -function outer(x) { - break outer -} -``` - - - Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement; - -```js -function outer(x) { - continue outer -} -outer(1) -``` - - - Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement - -```js -function outer(x) { - break -} -``` - - - Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; - -```js -function outer(x) { - continue -} -``` - - - Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern - -```js -const o = { e: 1, m: 1, name: "knee-deep" } -const { ...rest, e: a, m: n } = o -a + n -``` - - - Diagnostics.A_rest_element_cannot_have_a_property_name - -```js -const o = { e: 1, m: 1, name: "knee-deep" } -const { e: a, m: n, ...est: x } = o -a + n -``` - - - Diagnostics.A_destructuring_declaration_must_have_an_initializer - -```js -const { e: a, m: n } -``` - - - Diagnostics.const_declarations_must_be_initialized - -```js -const a -``` - - - Diagnostics.let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations - -```js -let let = 12 -``` - - - Diagnostics.let_declarations_can_only_be_declared_inside_a_block - -```js -if (true) - let c3 = 0 -``` - - - Diagnostics.const_declarations_can_only_be_declared_inside_a_block - -```js -if (true) - const c3 = 0 -``` - - - Diagnostics._0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2 - -```js -export let x = import.metal -``` - - - Diagnostics._0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2 - -```js -function foo() { new.targe } -``` - - - Diagnostics.Classes_may_not_have_a_field_named_constructor - -```js -class C { - "constructor" = 1 -} -``` - - - Diagnostics.Dynamic_imports_can_only_accept_a_module_specifier_and_an_optional_assertion_as_arguments - -```js -const x = import() -const y = import('1', '2', '3') -``` - - - Diagnostics.Argument_of_dynamic_import_cannot_be_spread_element - -```js -const x = import(...[]) -``` - diff --git a/src/compiler/plain-errors.txt b/src/compiler/plain-errors.txt deleted file mode 100644 index d6ab1c1db15c2..0000000000000 --- a/src/compiler/plain-errors.txt +++ /dev/null @@ -1,1570 +0,0 @@ -## grammarErrorOnNode (184) ## - - 28190: Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies - 28193: Diagnostics.Private_identifiers_are_only_allowed_in_class_bodies_and_may_only_be_used_as_part_of_a_class_member_declaration_property_access_or_on_the_left_hand_side_of_an_in_expression - 28196: Diagnostics.Cannot_find_name_0 -class C { - q = #unbound - m() { - #p++ - q++ - this.#q - if (#po in this) { - - } - const o = { a: 1, a: 2 } - return o.a - } - #m() { - this.#m = () => {} - } -} -#unrelated - -These 3 errors suck, but at least the first two should behave the same in JS as TS - -28310: Diagnostics.Cannot_assign_to_private_method_0_Private_methods_are_not_writable -class C { - #m() { - this.#m = () => {} - } -} - -28341: Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies -junk.#m (you get a better error if C is defined and even better if C.#m is defined) - -31247: Diagnostics.This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Use_an_as_expression_instead --- - 33015: Diagnostics._0_and_1_operations_cannot_be_mixed_without_parentheses - 33018: Diagnostics._0_and_1_operations_cannot_be_mixed_without_parentheses -var x = 1 || 2 ?? 2 -var x = 2 ?? 3 || 4 -var x = -2 ** 3 (somewhere down there this will be needed) - 34848: Diagnostics.Tuple_members_must_all_have_names_or_all_not_have_names - 34864: Diagnostics.A_rest_element_cannot_follow_another_rest_element - 34871: Diagnostics.An_optional_element_cannot_follow_a_rest_element - 34877: Diagnostics.A_required_element_cannot_follow_an_optional_element - 34953: Diagnostics.A_mapped_type_may_not_declare_properties_or_methods - 34972: Diagnostics.infer_declarations_are_only_permitted_in_the_extends_clause_of_a_conditional_type - 34994: Diagnostics.A_tuple_member_cannot_be_both_optional_and_rest - 34997: Diagnostics.A_labeled_tuple_element_is_declared_as_optional_with_a_question_mark_after_the_name_and_before_the_colon_rather_than_after_the_type - 35000: Diagnostics.A_labeled_tuple_element_is_declared_as_rest_with_a_before_the_name_rather_than_before_the_type --- - 37195: Diagnostics.For_await_loops_cannot_be_used_inside_a_class_static_block -class C { - static { - for await (const x of [1,2,3]) { - console.log(x) - } - } -} - 38167: Diagnostics.A_default_clause_cannot_appear_more_than_once_in_a_switch_statement -var b = true -switch (b) { - case false: - console.log('no') - default: - console.log('yes') - default: - console.log('wat') -} - 38206: Diagnostics.Duplicate_label_0 -label: for (const x in [1,2,3]) { - label: for (const y in [1,2,3]) { - break label; - } -} - 38256: Diagnostics.Cannot_redeclare_identifier_0_in_catch_clause -try { - throw 2 -} -catch (e) { - const e = 1 - console.log(e) -} - 38501: Diagnostics.Class_decorators_can_t_be_used_with_static_private_identifier_Consider_removing_the_experimental_decorator -declare var deco: any -@deco -class C { - static #p = 1 -} -But this doesn't run on any JS runtime today so it probably shouldn't apply - 39498: Diagnostics.Only_ambient_modules_can_use_quoted_names - 39770: Diagnostics.Import_assertions_cannot_be_used_with_type_only_imports_or_exports - 39843: Diagnostics.An_import_alias_cannot_use_import_type - 39849: Diagnostics.Import_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead - 39917: Diagnostics.Only_named_exports_may_use_export_type - 40059: Diagnostics.The_expression_of_an_export_assignment_must_be_an_identifier_or_qualified_name_in_an_ambient_context - 40065: Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or_another_module_format_instead - 40069: Diagnostics.Export_assignment_is_not_supported_when_module_flag_is_system - 40326: Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments - 42411: Diagnostics._0_modifier_cannot_appear_on_a_type_member - 42414: Diagnostics._0_modifier_cannot_appear_on_an_index_signature --- - 42420: Diagnostics.A_class_member_cannot_have_the_0_keyword - class C { - const x = 1 - const y() { - return 12 - } -} - 42426: Diagnostics._0_modifier_already_seen - 42429: Diagnostics._0_modifier_cannot_be_used_with_1_modifier - 42432: Diagnostics._0_modifier_must_precede_1_modifier - 42435: Diagnostics._0_modifier_must_precede_1_modifier - 42447: Diagnostics.Accessibility_modifier_already_seen - 42450: Diagnostics._0_modifier_must_precede_1_modifier - 42453: Diagnostics._0_modifier_must_precede_1_modifier - 42456: Diagnostics._0_modifier_must_precede_1_modifier - 42459: Diagnostics._0_modifier_must_precede_1_modifier - 42462: Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element - 42466: Diagnostics._0_modifier_cannot_be_used_with_1_modifier - 42469: Diagnostics._0_modifier_must_precede_1_modifier - 42473: Diagnostics.An_accessibility_modifier_cannot_be_used_with_a_private_identifier - -- - 42480: Diagnostics._0_modifier_already_seen -class C { - static static x = 1 -} - 42483: Diagnostics._0_modifier_must_precede_1_modifier - -- - 42486: Diagnostics._0_modifier_must_precede_1_modifier -class C { - static async x (){ } -} - 42489: Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element -export static var x = 1 - 42492: Diagnostics._0_modifier_cannot_appear_on_a_parameter -function f(static x = 1) { return x } - 42495: Diagnostics._0_modifier_cannot_be_used_with_1_modifier - 42498: Diagnostics._0_modifier_must_precede_1_modifier - 42506: Diagnostics._0_modifier_already_seen - 42510: Diagnostics.readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature - -- - 42518: Diagnostics._0_modifier_already_seen -export export var x = 1 - 42521: Diagnostics._0_modifier_must_precede_1_modifier - 42524: Diagnostics._0_modifier_must_precede_1_modifier - -- - 42527: Diagnostics._0_modifier_must_precede_1_modifier -async export function f(x = 1) { return x } - 42530: Diagnostics._0_modifier_cannot_appear_on_class_elements_of_this_kind -class C { - export p = 1 - export m() { - } -} -Note that there's an existing, bogus error in JS which is supposed to be issued on - exports from namespaces, which are not in JS of course. - 42533: Diagnostics._0_modifier_cannot_appear_on_a_parameter -function f(export x = 1) { return x } - 42540: Diagnostics.A_default_export_can_only_be_used_in_an_ECMAScript_style_module - -- - 42543: Diagnostics._0_modifier_must_precede_1_modifier -default export 13; - 42550: Diagnostics._0_modifier_already_seen - 42553: Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context - 42556: Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context - 42559: Diagnostics._0_modifier_cannot_appear_on_class_elements_of_this_kind - 42562: Diagnostics._0_modifier_cannot_appear_on_a_parameter - 42565: Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context - 42568: Diagnostics._0_modifier_cannot_be_used_with_a_private_identifier - 42576: Diagnostics._0_modifier_already_seen - 42584: Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration - 42587: Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class - 42590: Diagnostics._0_modifier_cannot_be_used_with_1_modifier - 42593: Diagnostics._0_modifier_cannot_be_used_with_1_modifier - 42596: Diagnostics._0_modifier_cannot_be_used_with_1_modifier - 42599: Diagnostics._0_modifier_must_precede_1_modifier - 42603: Diagnostics._0_modifier_cannot_be_used_with_a_private_identifier - 42611: Diagnostics._0_modifier_already_seen -async async function f() { - return 1 -} - 42614: Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context - 42617: Diagnostics._0_modifier_cannot_appear_on_a_parameter -function f(async x = 1) { return x } - 42620: Diagnostics._0_modifier_cannot_be_used_with_1_modifier - 42630: Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration -class C { - static constructor() { } -} - 42633: Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration - 42636: Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration - 42639: Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration -class C { - async constructor() { } -} - 42642: Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration - 42647: Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration - 42650: Diagnostics.A_parameter_property_may_not_be_declared_using_a_binding_pattern - 42653: Diagnostics.A_parameter_property_cannot_be_declared_using_a_rest_parameter - 42726: Diagnostics._0_modifier_cannot_be_used_here -async class C { - async x = 1 -} -async const y = 2 -async import './other' -async export { C } - 42753: Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list -function f (...x, y) { -} - 42760: Diagnostics.A_rest_parameter_cannot_be_optional - -- - 42764: Diagnostics.A_rest_parameter_cannot_have_an_initializer -function f (...x = [1,2,3]) { -} - 42770: Diagnostics.Parameter_cannot_have_question_mark_and_initializer - -- - 42774: Diagnostics.A_required_parameter_cannot_follow_an_optional_parameter - -- sure it can! - 42830: Diagnostics.This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Add_a_trailing_comma_or_explicit_constraint - 42837: Diagnostics.Line_terminator_not_permitted_before_arrow -const arr = x - => x + 1 - 42844: Diagnostics.An_index_signature_must_have_exactly_one_parameter - 42847: Diagnostics.An_index_signature_must_have_exactly_one_parameter - 42852: Diagnostics.An_index_signature_cannot_have_a_rest_parameter - 42855: Diagnostics.An_index_signature_parameter_cannot_have_an_accessibility_modifier - 42858: Diagnostics.An_index_signature_parameter_cannot_have_a_question_mark - 42861: Diagnostics.An_index_signature_parameter_cannot_have_an_initializer - 42864: Diagnostics.An_index_signature_parameter_must_have_a_type_annotation - 42868: Diagnostics.An_index_signature_parameter_type_cannot_be_a_literal_type_or_generic_type_Consider_using_a_mapped_object_type_instead - 42871: Diagnostics.An_index_signature_parameter_type_must_be_string_number_symbol_or_a_template_literal_type - 42874: Diagnostics.An_index_signature_must_have_a_type_annotation - -- - 42901: Diagnostics.Tagged_template_expressions_are_not_permitted_in_an_optional_chain -var a = [1,2] -a?.`length`; - 43005: Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name -const o = { - [console.log('oh no'),2]: 'hi' -} - 43017: Diagnostics.Generators_are_not_allowed_in_an_ambient_context - 43020: Diagnostics.An_overload_signature_cannot_be_declared_as_a_generator - -43026: InvalidQuestionMark - -const o = { - x?: 12 -} - But: this already errors with a JS-specific error, so maybe the first should too. -const o = { - m?() { return 12 } -} -43030: InvalidExclamationToken -var x = 1 -const o = { - x! -} -const o = { - m!() { return 12 } -} -43042: Diagnostics.A_rest_element_cannot_contain_a_binding_pattern -const o = { - x: 1, y: 2 -} -let x; let y -;({ ...[] } = o) - 43056: Diagnostics.Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_part_of_a_destructuring_pattern -const o = { x = 1 } - 43060: Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies -const o = { #x: 1 } - 43067: Diagnostics._0_modifier_cannot_be_used_here -const o = { export x: 1 } - 43118: Diagnostics.Duplicate_identifier_0 -TODO: Duplicated with An object ligteral cannot have multiple properties with the same name in strict mode. -const o = { - x: 1, - x() { } - 43125: Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name - 43129: Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name - -- - 43151: Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name - 43155: Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression - 43178: Diagnostics.JSX_property_access_expressions_cannot_include_JSX_namespace_names - 43185: Diagnostics.JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array - -- TODO Come back here and figure out what JSX errors are good -- - 43229: Diagnostics.The_left_hand_side_of_a_for_of_statement_may_not_be_async -let async -export const l = [1,2,3] -for (async of l) { - console.log(x) -} - 43259: Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer -for (const x = 1 in [1,2,3]) { - console.log(x) -} - 43260: Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer; -for (const x = 1 of [1,2,3]) { - console.log(x) -} - 43261: Diagnostics.Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher - 43281: Diagnostics.Private_identifiers_are_only_available_when_targeting_ECMAScript_2015_and_higher - 43284: Diagnostics._0_Expected -class C { - get x(); -} - 43289: Diagnostics.An_abstract_accessor_cannot_have_an_implementation - 43292: Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts - 43296: Diagnostics.An_accessor_cannot_have_type_parameters - 43299: Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation - 43301: Diagnostics.A_get_accessor_cannot_have_parameters -class C { - get x(n) { return 1 } -} - 43302: Diagnostics.A_set_accessor_must_have_exactly_one_parameter -class C { - set x() { } - set y(a, b) { } -} - 43310: Diagnostics.A_set_accessor_cannot_have_rest_parameter -class C { - set x(...n) { } -} - 43313: Diagnostics.A_set_accessor_cannot_have_an_optional_parameter - 43316: Diagnostics.A_set_accessor_parameter_cannot_have_an_initializer - -- - 43339: Diagnostics._0_expected - 43354: Diagnostics.unique_symbol_types_may_not_be_used_on_a_variable_declaration_with_a_binding_name - 43357: Diagnostics.unique_symbol_types_are_only_allowed_on_variables_in_a_variable_statement - 43360: Diagnostics.A_variable_whose_type_is_a_unique_symbol_type_must_be_const - 43367: Diagnostics.A_property_of_a_class_whose_type_is_a_unique_symbol_type_must_be_both_static_and_readonly - 43373: Diagnostics.A_property_of_an_interface_or_type_literal_whose_type_is_a_unique_symbol_type_must_be_readonly - 43378: Diagnostics.unique_symbol_types_are_not_allowed_here - 43390: checkGrammarForInvalidDynamicName - 43390: Diagnostics.Private_identifiers_are_only_available_when_targeting_ECMAScript_2015_and_higher - -- - 43448: Diagnostics.Jump_target_cannot_cross_function_boundary -function outer() { - outer: for(;;) { - function test() { - break outer - } - test() - } -} -outer() - 43460: Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement -function outer(x) { - outer: switch (x) { - case 1: - continue outer - } -} -outer(1) - 43500: Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement -function outer(x) { - break outer -} - 43501: Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement; -function outer(x) { - continue outer -} -outer(1) - 43507: Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement -function outer(x) { - break -} - 43508: Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; -function outer(x) { - continue -} - 43488: Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern -const o = { e: 1, m: 1, name: "knee-deep" } -const { ...rest, e: a, m: n } = o -a + n - 43507: Diagnostics.A_rest_element_cannot_have_a_property_name -const o = { e: 1, m: 1, name: "knee-deep" } -const { e: a, m: n, ...est: x } = o -a + n - 43548: Diagnostics.A_const_initializer_in_an_ambient_context_must_be_a_string_or_numeric_literal_or_literal_enum_reference - 43552: Diagnostics.Initializers_are_not_allowed_in_ambient_contexts - 43555: Diagnostics.Initializers_are_not_allowed_in_ambient_contexts - 43567: Diagnostics.A_destructuring_declaration_must_have_an_initializer -const { e: a, m: n } - 43570: Diagnostics.const_declarations_must_be_initialized -const a - 43581: Diagnostics.Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules - 43621: Diagnostics.let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations -let let = 12 - 43667: Diagnostics.let_declarations_can_only_be_declared_inside_a_block -if (true) - let c3 = 0 - 43670: Diagnostics.const_declarations_can_only_be_declared_inside_a_block -if (true) - const c3 = 0 - 43680: Diagnostics._0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2 -export let x = import.metal - 43685: Diagnostics._0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2 -function foo() { new.targe } - 43714: DiagnosticMessage - 43723: DiagnosticMessage - 43744: Diagnostics.Type_annotation_cannot_appear_on_a_constructor_declaration - 43750: Diagnostics.Classes_may_not_have_a_field_named_constructor -class C { - "constructor" = 1 -} - 43762: Diagnostics.Private_identifiers_are_only_available_when_targeting_ECMAScript_2015_and_higher - 43770: Diagnostics.An_interface_property_cannot_have_an_initializer - 43778: Diagnostics.A_type_literal_property_cannot_have_an_initializer - 43793: Diagnostics.BigInt_literals_are_not_available_when_targeting_lower_than_ES2020 - 43952: Diagnostics.A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both - 43974: Diagnostics.Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd_system_umd_node12_or_nodenext - 43978: Diagnostics.Dynamic_import_cannot_have_type_arguments - 43988: Diagnostics.Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_or_nodenext - 43993: Diagnostics.Dynamic_imports_can_only_accept_a_module_specifier_and_an_optional_assertion_as_arguments -const x = import() -const y = import('1', '2', '3') - 44000: Diagnostics.Argument_of_dynamic_import_cannot_be_spread_element -const x = import(...[]) - -## All Errors (1076) - - 704: diagnostics = addRange(diagnostics, suggestionDiagnostics.getDiagnostics(file.fileName)); - 865: mustHaveANextMethodDiagnostic: Diagnostics.An_async_iterator_must_have_a_next_method, - 866: mustBeAMethodDiagnostic: Diagnostics.The_0_property_of_an_async_iterator_must_be_a_method, - 867: mustHaveAValueDiagnostic: Diagnostics.The_type_returned_by_the_0_method_of_an_async_iterator_must_be_a_promise_for_a_type_with_a_value_property, - 879: mustHaveANextMethodDiagnostic: Diagnostics.An_iterator_must_have_a_next_method, - 880: mustBeAMethodDiagnostic: Diagnostics.The_0_property_of_an_iterator_must_be_a_method, - 881: mustHaveAValueDiagnostic: Diagnostics.The_type_returned_by_the_0_method_of_an_iterator_must_have_a_value_property, - 1153: suggestionDiagnostics.add({ ...diagnostic, category: DiagnosticCategory.Suggestion }); - 1177: const related = createDiagnosticForNode(location, Diagnostics.Did_you_forget_to_use_await); - 1188: createDiagnosticForNode(deprecatedTag, Diagnostics.The_declaration_was_marked_as_deprecated_here) - 1192: suggestionDiagnostics.add(diagnostic); - 1197: const diagnostic = createDiagnosticForNode(location, Diagnostics._0_is_deprecated, deprecatedEntity); - 1203: ? createDiagnosticForNode(location, Diagnostics.The_signature_0_of_1_is_deprecated, signatureString, deprecatedEntity) - 1204: : createDiagnosticForNode(location, Diagnostics._0_is_deprecated, signatureString); - 1304: Diagnostics.Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity, - 1312: ? Diagnostics.Enum_declarations_can_only_merge_with_namespace_or_other_enum_declarations - 1314: ? Diagnostics.Cannot_redeclare_block_scoped_variable_0 - 1315: : Diagnostics.Duplicate_identifier_0; - 1360: const leadingMessage = createDiagnosticForNode(adjustedNode, Diagnostics._0_was_also_declared_here, symbolName); - 1361: const followOnMessage = createDiagnosticForNode(adjustedNode, Diagnostics.and_here); - 1400: ? Diagnostics.Invalid_module_name_in_augmentation_module_0_cannot_be_found - 1437: error(moduleName, Diagnostics.Cannot_augment_module_0_because_it_resolves_to_a_non_module_entity, (moduleName as StringLiteral).text); - 1949: error(errorLocation, Diagnostics.Static_members_cannot_reference_class_type_parameters); - 1968: error(errorLocation, Diagnostics.Base_class_expressions_cannot_reference_class_type_parameters); - 1987: error(errorLocation, Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); - 2144: const message = meaning === SymbolFlags.Namespace || nameArg && typeof nameArg !== "string" && nodeIsSynthesized(nameArg) ? Diagnostics.Cannot_find_namespace_0_Did_you_mean_1 - 2145: : isUncheckedJS ? Diagnostics.Could_not_find_name_0_Did_you_mean_1 - 2146: : Diagnostics.Cannot_find_name_0_Did_you_mean_1; - 2152: createDiagnosticForNode(suggestion.valueDeclaration, Diagnostics._0_is_declared_here, suggestionName) - 2181: error(errorLocation, Diagnostics.Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor, - 2210: errorOrSuggestion(!compilerOptions.allowUmdGlobalAccess, errorLocation!, Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead, unescapeLeadingUnderscores(name)); - 2220: error(errorLocation, Diagnostics.Parameter_0_cannot_reference_itself, declarationNameToString(associatedDeclarationForContainingInitializerOrBindingName.name)); - 2224: error(errorLocation, Diagnostics.Parameter_0_cannot_reference_identifier_1_declared_after_it, declarationNameToString(associatedDeclarationForContainingInitializerOrBindingName.name), declarationNameToString(errorLocation as Identifier)); - 2239: ? Diagnostics._0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type - 2240: : Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type; - 2256: typeOnlyDeclaration.kind === SyntaxKind.ExportSpecifier ? Diagnostics._0_was_exported_here : Diagnostics._0_was_imported_here, - 2328: error(errorLocation, Diagnostics.Cannot_find_name_0_Did_you_mean_the_static_member_1_0, diagnosticName(nameArg), symbolToString(classSymbol)); - 2337: error(errorLocation, Diagnostics.Cannot_find_name_0_Did_you_mean_the_instance_member_this_0, diagnosticName(nameArg)); - 2352: error(errorLocation, Diagnostics.Cannot_extend_an_interface_0_Did_you_mean_implements, getTextOfNode(expression)); - 2389: Diagnostics.Cannot_access_0_1_because_0_is_a_type_but_not_a_namespace_Did_you_mean_to_retrieve_the_type_of_the_property_1_in_0_with_0_1, - 2396: error(errorLocation, Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here, unescapeLeadingUnderscores(name)); - 2408: error(errorLocation, Diagnostics._0_refers_to_a_value_but_is_being_used_as_a_type_here_Did_you_mean_typeof_0, unescapeLeadingUnderscores(name)); - 2421: error(errorLocation, Diagnostics.Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module, name as string); - 2430: error(errorLocation, Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here, unescapeLeadingUnderscores(name)); - 2437: error(errorLocation, Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_es2015_or_later, rawName); - 2440: error(errorLocation, Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Did_you_mean_to_use_1_in_0, rawName, rawName === "K" ? "P" : "K"); - 2443: error(errorLocation, Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here, rawName); - 2480: Diagnostics.Cannot_use_namespace_0_as_a_value, - 2488: error(errorLocation, Diagnostics.Cannot_use_namespace_0_as_a_type, unescapeLeadingUnderscores(name)); - 2511: diagnosticMessage = error(errorLocation, Diagnostics.Block_scoped_variable_0_used_before_its_declaration, declarationName); - 2514: diagnosticMessage = error(errorLocation, Diagnostics.Class_0_used_before_its_declaration, declarationName); - 2517: diagnosticMessage = error(errorLocation, Diagnostics.Enum_0_used_before_its_declaration, declarationName); - 2522: diagnosticMessage = error(errorLocation, Diagnostics.Enum_0_used_before_its_declaration, declarationName); - 2528: createDiagnosticForNode(declaration, Diagnostics._0_is_declared_here, declarationName) - 2626: ? Diagnostics.An_import_alias_cannot_reference_a_declaration_that_was_exported_using_export_type - 2627: : Diagnostics.An_import_alias_cannot_reference_a_declaration_that_was_imported_using_import_type; - 2629: ? Diagnostics._0_was_exported_here - 2630: : Diagnostics._0_was_imported_here; - 2720: const err = error(node.name, Diagnostics.Module_0_can_only_be_default_imported_using_the_1_flag, symbolToString(moduleSymbol), compilerOptionName); - 2725: Diagnostics.This_module_is_declared_with_using_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag, - 2749: Diagnostics.Module_0_has_no_default_export_Did_you_mean_to_use_import_1_from_0_instead, - 2755: const diagnostic = error(node.name, Diagnostics.Module_0_has_no_default_export, symbolToString(moduleSymbol)); - 2763: addRelatedInfo(diagnostic, createDiagnosticForNode(defaultExport, Diagnostics.export_Asterisk_does_not_re_export_a_default)); - 2880: const diagnostic = error(name, Diagnostics._0_has_no_exported_member_named_1_Did_you_mean_2, moduleName, declarationName, suggestionName); - 2883: createDiagnosticForNode(suggestion.valueDeclaration, Diagnostics._0_is_declared_here, suggestionName) - 2891: Diagnostics.Module_0_has_no_exported_member_1_Did_you_mean_to_use_import_1_from_0_instead, - 2913: error(name, Diagnostics.Module_0_has_no_exported_member_1, moduleName, declarationName); - 2917: const diagnostic = exportedSymbol ? error(name, Diagnostics.Module_0_declares_1_locally_but_it_is_exported_as_2, moduleName, declarationName, symbolToString(exportedSymbol)) : - 2918: error(name, Diagnostics.Module_0_declares_1_locally_but_it_is_not_exported, moduleName, declarationName); - 2922: createDiagnosticForNode(decl, index === 0 ? Diagnostics._0_is_declared_here : Diagnostics.and_here, declarationName))); - 2927: error(name, Diagnostics.Module_0_has_no_exported_member_1, moduleName, declarationName); - 2933: const message = getESModuleInterop(compilerOptions) ? Diagnostics._0_can_only_be_imported_by_using_a_default_import : - 2934: Diagnostics._0_can_only_be_imported_by_turning_on_the_esModuleInterop_flag_and_using_a_default_import; - 2939: const message = getESModuleInterop(compilerOptions) ? Diagnostics._0_can_only_be_imported_by_using_a_require_call_or_by_using_a_default_import : - 2940: Diagnostics._0_can_only_be_imported_by_using_a_require_call_or_by_turning_on_the_esModuleInterop_flag_and_using_a_default_import; - 2944: const message = getESModuleInterop(compilerOptions) ? Diagnostics._0_can_only_be_imported_by_using_import_1_require_2_or_a_default_import : - 2945: Diagnostics._0_can_only_be_imported_by_using_import_1_require_2_or_by_turning_on_the_esModuleInterop_flag_and_using_a_default_import; - 3078: error(node, Diagnostics.Circular_definition_of_import_alias_0, symbolToString(symbol)); - 3262: const message = meaning === namespaceMeaning || nodeIsSynthesized(name) ? Diagnostics.Cannot_find_namespace_0 : getCannotFindNameDiagnosticForName(getFirstIdentifier(name)); - 3302: error(right, Diagnostics._0_has_no_exported_member_named_1_Did_you_mean_2, namespaceName, declarationName, symbolToString(suggestionForNonexistentModule)); - 3315: Diagnostics._0_refers_to_a_value_but_is_being_used_as_a_type_here_Did_you_mean_typeof_0, - 3326: Diagnostics.Cannot_access_0_1_because_0_is_a_type_but_not_a_namespace_Did_you_mean_to_retrieve_the_type_of_the_property_1_in_0_with_0_1, - 3334: error(right, Diagnostics.Namespace_0_has_no_exported_member_1, namespaceName, declarationName); - 3430: Diagnostics.Cannot_find_module_0_Did_you_mean_to_set_the_moduleResolution_option_to_node_or_to_add_aliases_to_the_paths_option - 3431: : Diagnostics.Cannot_find_module_0_or_its_corresponding_type_declarations; - 3443: const diag = Diagnostics.Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1; - 3473: error(errorNode, Diagnostics.Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_cannot_be_imported_synchronously_Use_dynamic_import_instead, moduleReference); - 3476: error(errorNode, Diagnostics.JSON_imports_are_experimental_in_ES_module_mode_imports); - 3484: error(errorNode, Diagnostics.File_0_is_not_a_module, sourceFile.fileName); - 3505: if (resolvedModule && !resolutionExtensionIsTSOrJson(resolvedModule.extension) && resolutionDiagnostic === undefined || resolutionDiagnostic === Diagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type) { - 3507: const diag = Diagnostics.Invalid_module_name_in_augmentation_Module_0_resolves_to_an_untyped_module_at_1_which_cannot_be_augmented; - 3522: error(errorNode, Diagnostics.Output_file_0_has_not_been_built_from_source_file_1, redirect, resolvedModule.resolvedFileName); - 3537: const diag = Diagnostics.An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead; - 3553: error(errorNode, Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension, moduleReference); - 3560: Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node12_or_nodenext_Did_you_mean_0, - 3564: error(errorNode, Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node12_or_nodenext_Consider_adding_an_extension_to_the_import_path); - 3580: Diagnostics.If_the_0_package_actually_exposes_this_module_consider_sending_a_pull_request_to_amend_https_Colon_Slash_Slashgithub_com_SlashDefinitelyTyped_SlashDefinitelyTyped_Slashtree_Slashmaster_Slashtypes_Slash_1, - 3585: Diagnostics.If_the_0_package_actually_exposes_this_module_try_adding_a_new_declaration_d_ts_file_containing_declare_module_1, - 3590: Diagnostics.Try_npm_i_save_dev_types_Slash_1_if_it_exists_or_add_a_new_declaration_d_ts_file_containing_declare_module_0, - 3596: Diagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type, - 3651: error(referencingLocation, Diagnostics.This_module_can_only_be_referenced_with_ECMAScript_imports_Slashexports_by_turning_on_the_0_flag_and_referencing_its_default_export, compilerOptionName); - 3857: Diagnostics.Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambiguity, - 8571: error(declaration, Diagnostics.Rest_types_may_only_be_created_from_object_types); - 8843: error(symbol.valueDeclaration, Diagnostics.Member_0_implicitly_has_an_1_type, symbolToString(symbol), typeToString(flowType)); - 8863: error(symbol.valueDeclaration, Diagnostics.Member_0_implicitly_has_an_1_type, symbolToString(symbol), typeToString(flowType)); - 9057: error(s.valueDeclaration, Diagnostics.Duplicate_identifier_0, unescapedName), - 9058: createDiagnosticForNode(exportedMemberName, Diagnostics._0_was_also_declared_here, unescapedName)); - 9060: error(exportedMemberName, Diagnostics.Duplicate_identifier_0, unescapedName), - 9061: createDiagnosticForNode(s.valueDeclaration, Diagnostics._0_was_also_declared_here, unescapedName)); - 9460: error(getter, Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol)); - 9505: errorOrSuggestion(noImplicitAny, setter, Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation, symbolToString(symbol)); - 9512: errorOrSuggestion(noImplicitAny, getter, Diagnostics.Property_0_implicitly_has_type_any_because_its_get_accessor_lacks_a_return_type_annotation, symbolToString(symbol)); - 9630: error(symbol.valueDeclaration, Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, - 9636: error(symbol.valueDeclaration, Diagnostics._0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, - 9909: error(type.symbol.valueDeclaration, Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_base_expression, symbolToString(type.symbol)); - 9913: const err = error(baseTypeNode.expression, Diagnostics.Type_0_is_not_a_constructor_function_type, typeToString(baseConstructorType)); - 9924: addRelatedInfo(err, createDiagnosticForNode(baseConstructorType.symbol.declarations[0], Diagnostics.Did_you_mean_for_0_to_be_constrained_to_type_new_args_Colon_any_1, symbolToString(baseConstructorType.symbol), typeToString(ctorReturn))); - 9957: error(node, Diagnostics.Type_0_recursively_references_itself_as_a_base_type, typeToString(type, /*enclosingDeclaration*/ undefined, TypeFormatFlags.WriteArrayAsGenericType)); - 10020: error(baseTypeNode.expression, Diagnostics.No_base_constructor_has_the_specified_number_of_type_arguments); - 10032: const diagnostic = chainDiagnosticMessages(elaboration, Diagnostics.Base_constructor_return_type_0_is_not_an_object_type_or_intersection_of_object_types_with_statically_known_members, typeToString(reducedBaseType)); - 10037: error(type.symbol.valueDeclaration, Diagnostics.Type_0_recursively_references_itself_as_a_base_type, - 10099: error(node, Diagnostics.An_interface_can_only_extend_an_object_type_or_intersection_of_object_types_with_statically_known_members); - 10203: error(declaration.typeExpression.type, Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol)); - 10206: error(isNamedDeclaration(declaration) ? declaration.name : declaration || declaration, Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol)); - 10617: forEach(declarations, declaration => error(getNameOfDeclaration(declaration) || declaration, Diagnostics.Property_0_was_also_declared_here, name)); - 10618: error(declName || decl, Diagnostics.Duplicate_property_0, name); - 11488: error(currentNode, Diagnostics.Type_of_property_0_circularly_references_itself_in_mapped_type_1, symbolToString(symbol), typeToString(mappedType)); - 11868: const diagnostic = error(errorNode, Diagnostics.Type_parameter_0_has_a_circular_constraint, typeToString(t)); - 11870: addRelatedInfo(diagnostic, createDiagnosticForNode(currentNode, Diagnostics.Circularity_originates_in_type_at_this_location)); - 12272: return chainDiagnosticMessages(errorInfo, Diagnostics.The_intersection_0_was_reduced_to_never_because_property_1_has_conflicting_types_in_some_constituents, - 12277: return chainDiagnosticMessages(errorInfo, Diagnostics.The_intersection_0_was_reduced_to_never_because_property_1_exists_in_multiple_constituents_and_is_private_in_some, - 12792: error(typeNode, Diagnostics.Return_type_annotation_circularly_references_itself); - 12798: error(name, Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, declarationNameToString(name)); - 12801: error(declaration, Diagnostics.Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions); - 13202: type.target.symbol ? Diagnostics.Type_arguments_for_0_circularly_reference_themselves : Diagnostics.Tuple_type_arguments_circularly_reference_themselves, - 13230: Diagnostics.Expected_0_type_arguments_provide_these_with_an_extends_tag : - 13231: Diagnostics.Generic_type_0_requires_1_type_argument_s : - 13233: Diagnostics.Expected_0_1_type_arguments_provide_these_with_an_extends_tag : - 13234: Diagnostics.Generic_type_0_requires_between_1_and_2_type_arguments; - 13298: Diagnostics.Generic_type_0_requires_1_type_argument_s : - 13299: Diagnostics.Generic_type_0_requires_between_1_and_2_type_arguments, - 13479: error(node, Diagnostics.Type_0_is_not_generic, symbol ? symbolToString(symbol) : (node as TypeReferenceNode).typeName ? declarationNameToString((node as TypeReferenceNode).typeName) : anon); - 13610: error(getTypeDeclaration(symbol), Diagnostics.Global_type_0_must_be_a_class_or_interface_type, symbolName(symbol)); - 13614: error(getTypeDeclaration(symbol), Diagnostics.Global_type_0_must_have_1_type_parameter_s, symbolName(symbol), arity); - 13621: return getGlobalSymbol(name, SymbolFlags.Value, reportErrors ? Diagnostics.Cannot_find_global_value_0 : undefined); - 13625: return getGlobalSymbol(name, SymbolFlags.Type, reportErrors ? Diagnostics.Cannot_find_global_type_0 : undefined); - 13629: const symbol = getGlobalSymbol(name, SymbolFlags.Type, reportErrors ? Diagnostics.Cannot_find_global_type_0 : undefined); - 13636: error(decl, Diagnostics.Global_type_0_must_have_1_type_parameter_s, symbolName(symbol), arity); - 14052: ? Diagnostics.Type_produces_a_tuple_type_that_is_too_large_to_represent - 14053: : Diagnostics.Expression_produces_a_tuple_type_that_is_too_large_to_represent); - 14219: error(currentNode, Diagnostics.Expression_produces_a_union_type_that_is_too_complex_to_represent); - 14729: error(currentNode, Diagnostics.Expression_produces_a_union_type_that_is_too_complex_to_represent); - 15130: error(accessExpression.argumentExpression, Diagnostics.Cannot_assign_to_0_because_it_is_a_read_only_property, symbolToString(prop)); - 15149: error(indexNode, Diagnostics.Tuple_type_0_of_length_1_has_no_element_at_index_2, - 15153: error(indexNode, Diagnostics.Property_0_does_not_exist_on_type_1, unescapeLeadingUnderscores(propName), typeToString(objectType)); - 15173: error(accessExpression, Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(originalObjectType)); - 15179: error(indexNode, Diagnostics.Type_0_cannot_be_used_as_an_index_type, typeToString(indexType)); - 15194: diagnostics.add(createDiagnosticForNode(accessExpression, Diagnostics.Property_0_does_not_exist_on_type_1, (indexType as StringLiteralType).value, typeToString(objectType))); - 15206: error(accessExpression, Diagnostics.Property_0_does_not_exist_on_type_1, unescapeLeadingUnderscores(propName), typeToString(objectType)); - 15211: error(accessExpression, Diagnostics.Property_0_does_not_exist_on_type_1_Did_you_mean_to_access_the_static_member_2_instead, propName as string, typeName, typeName + "[" + getTextOfNode(accessExpression.argumentExpression) + "]"); - 15214: error(accessExpression.argumentExpression, Diagnostics.Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number); - 15220: error(accessExpression.argumentExpression, Diagnostics.Property_0_does_not_exist_on_type_1_Did_you_mean_2, propName as string, typeToString(objectType), suggestion); - 15226: error(accessExpression, Diagnostics.Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature_Did_you_mean_to_call_1, typeToString(objectType), suggestion); - 15231: errorInfo = chainDiagnosticMessages(/* details */ undefined, Diagnostics.Property_0_does_not_exist_on_type_1, "[" + typeToString(indexType) + "]", typeToString(objectType)); - 15235: errorInfo = chainDiagnosticMessages(/* details */ undefined, Diagnostics.Property_0_does_not_exist_on_type_1, "[" + symbolName + "]", typeToString(objectType)); - 15238: errorInfo = chainDiagnosticMessages(/* details */ undefined, Diagnostics.Property_0_does_not_exist_on_type_1, (indexType as StringLiteralType).value, typeToString(objectType)); - 15241: errorInfo = chainDiagnosticMessages(/* details */ undefined, Diagnostics.Property_0_does_not_exist_on_type_1, (indexType as NumberLiteralType).value, typeToString(objectType)); - 15244: errorInfo = chainDiagnosticMessages(/* details */ undefined, Diagnostics.No_index_signature_with_a_parameter_of_type_0_was_found_on_type_1, typeToString(indexType), typeToString(objectType)); - 15249: Diagnostics.Element_implicitly_has_an_any_type_because_expression_of_type_0_can_t_be_used_to_index_type_1, typeToString(fullIndexType), typeToString(objectType) - 15265: error(indexNode, Diagnostics.Property_0_does_not_exist_on_type_1, "" + (indexType as StringLiteralType | NumberLiteralType).value, typeToString(objectType)); - 15268: error(indexNode, Diagnostics.Type_0_has_no_matching_index_signature_for_type_1, typeToString(objectType), typeToString(indexType)); - 15271: error(indexNode, Diagnostics.Type_0_cannot_be_used_as_an_index_type, typeToString(indexType)); - 15281: error(accessExpression, Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType)); - 15601: error(currentNode, Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite); - 15789: error(node, Diagnostics.Type_arguments_cannot_be_used_here); - 15794: error(node.argument, Diagnostics.String_literal_expected); - 15820: error(current, Diagnostics.Namespace_0_has_no_exported_member_1, getFullyQualifiedName(currentNamespace), declarationNameToString(current)); - 15835: ? Diagnostics.Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here - 15836: : Diagnostics.Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0; - 16168: error(node, Diagnostics.A_this_type_is_available_only_in_a_non_static_member_of_a_class_or_interface); - 16741: error(currentNode, Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite); - 17091: signatures === constructSignatures ? Diagnostics.Did_you_mean_to_use_new_with_this_expression : Diagnostics.Did_you_mean_to_call_this_expression - 17137: Diagnostics.The_expected_type_comes_from_the_return_type_of_this_signature, - 17148: Diagnostics.Did_you_mean_to_mark_this_function_as_async - 17212: const diag = createDiagnosticForNode(prop, Diagnostics.Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_type_of_the_target, typeToString(specificSource), typeToString(targetPropType)); - 17237: addRelatedInfo(reportedDiag, createDiagnosticForNode(indexInfo.declaration, Diagnostics.The_expected_type_comes_from_this_index_signature)); - 17246: Diagnostics.The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1, - 17338: Diagnostics.This_JSX_tag_s_0_prop_expects_a_single_child_of_type_1_but_multiple_children_were_provided, - 17367: Diagnostics.This_JSX_tag_s_0_prop_expects_type_1_which_requires_multiple_children_but_only_a_single_child_was_provided, - 17385: const diagnostic = Diagnostics._0_components_don_t_accept_text_as_child_elements_Text_in_JSX_has_the_type_string_but_the_expected_type_of_1_is_2; - 17450: yield { errorNode: prop.name, innerExpression: prop.initializer, nameType: type, errorMessage: isComputedNonLiteralName(prop.name) ? Diagnostics.Type_of_computed_property_s_value_is_0_which_is_not_assignable_to_type_1 : undefined }; - 17553: errorReporter!(Diagnostics.The_this_types_of_each_signature_are_incompatible); - 17589: errorReporter!(Diagnostics.Types_of_parameters_0_and_1_are_incompatible, - 17621: errorReporter!(Diagnostics.Signature_0_must_be_a_type_predicate, signatureToString(source)); - 17650: errorReporter!(Diagnostics.A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard); - 17651: errorReporter!(Diagnostics.Type_predicate_0_is_not_assignable_to_1, typePredicateToString(source), typePredicateToString(target)); - 17659: errorReporter!(Diagnostics.Parameter_0_is_not_in_the_same_position_as_parameter_1, source.parameterName, (target as IdentifierTypePredicate).parameterName); - 17660: errorReporter!(Diagnostics.Type_predicate_0_is_not_assignable_to_1, typePredicateToString(source), typePredicateToString(target)); - 17670: errorReporter!(Diagnostics.Type_predicate_0_is_not_assignable_to_1, typePredicateToString(source), typePredicateToString(target)); - 17739: errorReporter(Diagnostics.Property_0_is_missing_in_type_1, symbolName(property), - 17885: const diag = error(errorNode || currentNode, Diagnostics.Excessive_stack_depth_comparing_types_0_and_1, typeToString(source), typeToString(target)); - 17907: const diag = createDiagnosticForNode(links.originatingImport, Diagnostics.Type_originates_at_this_import_A_namespace_style_import_cannot_be_called_or_constructed_and_will_cause_a_failure_at_runtime_Consider_using_a_default_import_or_import_require_here_instead); - 17974: case Diagnostics.Types_of_property_0_are_incompatible.code: { - 17998: case Diagnostics.Call_signature_return_types_0_and_1_are_incompatible.code: - 17999: case Diagnostics.Construct_signature_return_types_0_and_1_are_incompatible.code: - 18000: case Diagnostics.Call_signatures_with_no_arguments_have_incompatible_return_types_0_and_1.code: - 18001: case Diagnostics.Construct_signatures_with_no_arguments_have_incompatible_return_types_0_and_1.code: { - 18006: if (msg.code === Diagnostics.Call_signatures_with_no_arguments_have_incompatible_return_types_0_and_1.code) { - 18007: mappedMsg = Diagnostics.Call_signature_return_types_0_and_1_are_incompatible; - 18009: else if (msg.code === Diagnostics.Construct_signatures_with_no_arguments_have_incompatible_return_types_0_and_1.code) { - 18010: mappedMsg = Diagnostics.Construct_signature_return_types_0_and_1_are_incompatible; - 18015: const prefix = (msg.code === Diagnostics.Construct_signature_return_types_0_and_1_are_incompatible.code || - 18016: msg.code === Diagnostics.Construct_signatures_with_no_arguments_have_incompatible_return_types_0_and_1.code) - 18019: const params = (msg.code === Diagnostics.Call_signatures_with_no_arguments_have_incompatible_return_types_0_and_1.code || - 18020: msg.code === Diagnostics.Construct_signatures_with_no_arguments_have_incompatible_return_types_0_and_1.code) - 18027: case Diagnostics.Type_at_position_0_in_source_is_not_compatible_with_type_at_position_1_in_target.code: { - 18028: secondaryRootErrors.unshift([Diagnostics.Type_at_position_0_in_source_is_not_compatible_with_type_at_position_1_in_target, args[0], args[1]]); - 18031: case Diagnostics.Type_at_positions_0_through_1_in_source_is_not_compatible_with_type_at_position_2_in_target.code: { - 18032: secondaryRootErrors.unshift([Diagnostics.Type_at_positions_0_through_1_in_source_is_not_compatible_with_type_at_position_2_in_target, args[0], args[1], args[2]]); - 18041: ? Diagnostics.The_types_returned_by_0_are_incompatible_between_these_types - 18042: : Diagnostics.The_types_of_0_are_incompatible_between_these_types, - 18096: Diagnostics._0_is_assignable_to_the_constraint_of_type_1_but_1_could_be_instantiated_with_a_different_subtype_of_constraint_2, - 18105: Diagnostics._0_could_be_instantiated_with_an_arbitrary_type_which_could_be_unrelated_to_1, - 18114: message = Diagnostics.Type_0_is_not_comparable_to_type_1; - 18117: message = Diagnostics.Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated; - 18120: message = Diagnostics.Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_types_of_the_target_s_properties; - 18126: reportError(Diagnostics.Type_0_is_not_assignable_to_type_1_Did_you_mean_2, generalizedSourceType, targetType, typeToString(suggestedType)); - 18130: message = Diagnostics.Type_0_is_not_assignable_to_type_1; - 18133: else if (message === Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1 - 18136: message = Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_types_of_the_target_s_properties; - 18150: reportError(Diagnostics._0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible, targetType, sourceType); - 18171: reportError(Diagnostics.The_type_0_is_readonly_and_cannot_be_assigned_to_the_mutable_type_1, typeToString(source), typeToString(target)); - 18179: reportError(Diagnostics.The_type_0_is_readonly_and_cannot_be_assigned_to_the_mutable_type_1, typeToString(source), typeToString(target)); - 18276: reportError(Diagnostics.Value_of_type_0_has_no_properties_in_common_with_type_1_Did_you_mean_to_call_it, sourceString, targetString); - 18279: reportError(Diagnostics.Type_0_has_no_properties_in_common_with_type_1, sourceString, targetString); - 18374: reportError(Diagnostics.The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead); - 18490: reportError(Diagnostics.Property_0_does_not_exist_on_type_1_Did_you_mean_2, propName, typeToString(errorTarget), suggestion); - 18493: reportError(Diagnostics.Property_0_does_not_exist_on_type_1, propName, typeToString(errorTarget)); - 18512: reportError(Diagnostics.Object_literal_may_only_specify_known_properties_but_0_does_not_exist_in_type_1_Did_you_mean_to_write_2, - 18516: reportError(Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1, - 18525: reportIncompatibleError(Diagnostics.Types_of_property_0_are_incompatible, symbolToString(prop)); - 19564: reportError(Diagnostics.Types_have_separate_declarations_of_a_private_property_0, symbolToString(targetProp)); - 19567: reportError(Diagnostics.Property_0_is_private_in_type_1_but_not_in_type_2, symbolToString(targetProp), - 19578: reportError(Diagnostics.Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2, symbolToString(targetProp), - 19586: reportError(Diagnostics.Property_0_is_protected_in_type_1_but_public_in_type_2, - 19595: reportIncompatibleError(Diagnostics.Types_of_property_0_are_incompatible, symbolToString(targetProp)); - 19609: reportError(Diagnostics.Property_0_is_optional_in_type_1_but_required_in_type_2, - 19631: Diagnostics.Property_0_in_type_1_refers_to_a_different_member_that_cannot_be_accessed_from_within_type_2, - 19639: if (!headMessage || (headMessage.code !== Diagnostics.Class_0_incorrectly_implements_interface_1.code && - 19640: headMessage.code !== Diagnostics.Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclass.code)) { - 19645: reportError(Diagnostics.Property_0_is_missing_in_type_1_but_required_in_type_2, propName, ...getTypeNamesForErrorDisplay(source, target)); - 19647: associateRelatedInfo(createDiagnosticForNode(unmatchedProperty.declarations![0], Diagnostics._0_is_declared_here, propName)); - 19655: reportError(Diagnostics.Type_0_is_missing_the_following_properties_from_type_1_Colon_2_and_3_more, typeToString(source), typeToString(target), map(props.slice(0, 4), p => symbolToString(p)).join(", "), props.length - 4); - 19658: reportError(Diagnostics.Type_0_is_missing_the_following_properties_from_type_1_Colon_2, typeToString(source), typeToString(target), map(props, p => symbolToString(p)).join(", ")); - 19685: reportError(Diagnostics.Source_has_0_element_s_but_target_requires_1, sourceArity, targetMinLength); - 19691: reportError(Diagnostics.Source_has_0_element_s_but_target_allows_only_1, sourceMinLength, targetArity); - 19698: reportError(Diagnostics.Target_requires_0_element_s_but_source_may_have_fewer, targetMinLength); - 19701: reportError(Diagnostics.Target_allows_only_0_element_s_but_source_may_have_more, targetArity); - 19717: reportError(Diagnostics.Source_provides_no_match_for_variadic_element_at_position_0_in_target, i); - 19723: reportError(Diagnostics.Variadic_element_at_position_0_in_source_does_not_match_element_at_position_1_in_target, sourceIndex, i); - 19729: reportError(Diagnostics.Source_provides_no_match_for_required_element_at_position_0_in_target, i); - 19752: reportIncompatibleError(Diagnostics.Type_at_position_0_in_source_is_not_compatible_with_type_at_position_1_in_target, sourceIndex, i); - 19755: reportIncompatibleError(Diagnostics.Type_at_positions_0_through_1_in_source_is_not_compatible_with_type_at_position_2_in_target, startCount, sourceArity - endCount - 1, i); - 19782: reportError(Diagnostics.Property_0_does_not_exist_on_type_1, symbolToString(sourceProp), typeToString(target)); - 19858: reportError(Diagnostics.Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type); - 19899: reportError(Diagnostics.Type_0_is_not_assignable_to_type_1, constructSignatureToString(sourceSignature), constructSignatureToString(targetSignature)); - 19900: reportError(Diagnostics.Types_of_construct_signatures_are_incompatible); - 19919: reportError(Diagnostics.Type_0_provides_no_match_for_the_signature_1, - 19931: return (source: Type, target: Type) => reportIncompatibleError(Diagnostics.Call_signatures_with_no_arguments_have_incompatible_return_types_0_and_1, typeToString(source), typeToString(target)); - 19933: return (source: Type, target: Type) => reportIncompatibleError(Diagnostics.Call_signature_return_types_0_and_1_are_incompatible, typeToString(source), typeToString(target)); - 19938: return (source: Type, target: Type) => reportIncompatibleError(Diagnostics.Construct_signatures_with_no_arguments_have_incompatible_return_types_0_and_1, typeToString(source), typeToString(target)); - 19940: return (source: Type, target: Type) => reportIncompatibleError(Diagnostics.Construct_signature_return_types_0_and_1_are_incompatible, typeToString(source), typeToString(target)); - 19985: reportError(Diagnostics.Property_0_is_incompatible_with_index_signature, symbolToString(prop)); - 20008: reportError(Diagnostics._0_index_signatures_are_incompatible, typeToString(sourceInfo.keyType)); - 20011: reportError(Diagnostics._0_and_1_index_signatures_are_incompatible, typeToString(sourceInfo.keyType), typeToString(targetInfo.keyType)); - 20046: reportError(Diagnostics.Index_signature_for_type_0_is_missing_in_type_1, typeToString(targetInfo.keyType), typeToString(source)); - 20090: reportError(Diagnostics.Cannot_assign_a_0_constructor_type_to_a_1_constructor_type, visibilityToString(sourceAccessibility), visibilityToString(targetAccessibility)); - 21195: error(p.valueDeclaration, Diagnostics.Object_literal_s_property_0_implicitly_has_an_1_type, symbolToString(p), typeToString(getWidenedType(t))); - 21216: diagnostic = noImplicitAny ? Diagnostics.Member_0_implicitly_has_an_1_type : Diagnostics.Member_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage; - 21227: errorOrSuggestion(noImplicitAny, declaration, Diagnostics.Parameter_has_a_name_but_no_type_Did_you_mean_0_Colon_1, newName, typeName); - 21231: noImplicitAny ? Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : Diagnostics.Rest_parameter_0_implicitly_has_an_any_type_but_a_better_type_may_be_inferred_from_usage : - 21232: noImplicitAny ? Diagnostics.Parameter_0_implicitly_has_an_1_type : Diagnostics.Parameter_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage; - 21235: diagnostic = Diagnostics.Binding_element_0_implicitly_has_an_1_type; - 21242: error(declaration, Diagnostics.Function_type_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString); - 21253: error(declaration, Diagnostics.Generator_implicitly_has_yield_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_type_annotation, typeAsString); - 21256: error(declaration, Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString); - 21260: diagnostic = !noImplicitAny ? Diagnostics._0_implicitly_has_an_1_return_type_but_a_better_type_may_be_inferred_from_usage : - 21261: wideningKind === WideningKind.GeneratorYield ? Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_yield_type : - 21262: Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type; - 21266: error(declaration, Diagnostics.Mapped_object_type_implicitly_has_an_any_template_type); - 21270: diagnostic = noImplicitAny ? Diagnostics.Variable_0_implicitly_has_an_1_type : Diagnostics.Variable_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage; - 22494: return Diagnostics.Cannot_find_name_0_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_include_dom; - 22497: ? Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_jQuery_Try_npm_i_save_dev_types_Slashjquery_and_then_add_jquery_to_the_types_field_in_your_tsconfig - 22498: : Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_jQuery_Try_npm_i_save_dev_types_Slashjquery; - 22504: ? Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_a_test_runner_Try_npm_i_save_dev_types_Slashjest_or_npm_i_save_dev_types_Slashmocha_and_then_add_jest_or_mocha_to_the_types_field_in_your_tsconfig - 22505: : Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_a_test_runner_Try_npm_i_save_dev_types_Slashjest_or_npm_i_save_dev_types_Slashmocha; - 22511: ? Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashnode_and_then_add_node_to_the_types_field_in_your_tsconfig - 22512: : Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashnode; - 22531: return Diagnostics.Cannot_find_name_0_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_1_or_later; - 22534: return Diagnostics.No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer; - 22537: return Diagnostics.Cannot_find_name_0; - 23372: addRelatedInfo(diagnostic, createDiagnosticForNode(declaration, Diagnostics._0_needs_an_explicit_type_annotation, symbolToString(symbol))); - 23465: diagnostics.add(createFileDiagnostic(sourceFile, span.start, span.length, Diagnostics.The_containing_function_or_module_body_is_too_large_for_control_flow_analysis)); - 24988: error(node, Diagnostics.arguments_cannot_be_referenced_in_property_initializers); - 24995: error(node, Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression); - 24998: error(node, Diagnostics.The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_using_a_standard_function_or_method); - 25063: const assignmentError = localOrExportSymbol.flags & SymbolFlags.Enum ? Diagnostics.Cannot_assign_to_0_because_it_is_an_enum - 25064: : localOrExportSymbol.flags & SymbolFlags.Class ? Diagnostics.Cannot_assign_to_0_because_it_is_a_class - 25065: : localOrExportSymbol.flags & SymbolFlags.Module ? Diagnostics.Cannot_assign_to_0_because_it_is_a_namespace - 25066: : localOrExportSymbol.flags & SymbolFlags.Function ? Diagnostics.Cannot_assign_to_0_because_it_is_a_function - 25067: : localOrExportSymbol.flags & SymbolFlags.Alias ? Diagnostics.Cannot_assign_to_0_because_it_is_an_import - 25068: : Diagnostics.Cannot_assign_to_0_because_it_is_not_a_variable; - 25075: error(node, Diagnostics.Cannot_assign_to_0_because_it_is_a_constant, symbolToString(symbol)); - 25078: error(node, Diagnostics.Cannot_assign_to_0_because_it_is_a_read_only_property, symbolToString(symbol)); - 25142: error(getNameOfDeclaration(declaration), Diagnostics.Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined, symbolToString(symbol), typeToString(flowType)); - 25143: error(node, Diagnostics.Variable_0_implicitly_has_an_1_type, symbolToString(symbol), typeToString(flowType)); - 25149: error(node, Diagnostics.Variable_0_is_used_before_being_assigned, symbolToString(symbol)); - 25309: error(thisExpression, Diagnostics.Cannot_use_this_in_a_static_property_initializer_of_a_decorated_class); - 25321: checkThisBeforeSuper(node, container, Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class); - 25333: error(node, Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body); - 25337: error(node, Diagnostics.this_cannot_be_referenced_in_current_location); - 25342: error(node, Diagnostics.this_cannot_be_referenced_in_constructor_arguments); - 25347: error(node, Diagnostics.this_cannot_be_referenced_in_a_computed_property_name); - 25360: error(node, Diagnostics.The_containing_arrow_function_captures_the_global_value_of_this); - 25364: const diag = error(node, Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation); - 25368: addRelatedInfo(diag, createDiagnosticForNode(container, Diagnostics.An_outer_value_of_this_is_shadowed_by_this_container)); - 25537: error(node, Diagnostics.super_cannot_be_referenced_in_a_computed_property_name); - 25540: error(node, Diagnostics.Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors); - 25543: error(node, Diagnostics.super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions); - 25546: error(node, Diagnostics.super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class); - 25552: checkThisBeforeSuper(node, container, Diagnostics.super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class); - 25653: error(node, Diagnostics.super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher); - 25665: error(node, Diagnostics.super_can_only_be_referenced_in_a_derived_class); - 25677: error(node, Diagnostics.super_cannot_be_referenced_in_constructor_arguments); - 26631: error(context, Diagnostics.JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property, unescapeLeadingUnderscores(forcedLookupLocation)); - 27005: error(node, Diagnostics.A_computed_property_name_must_be_of_type_string_number_symbol_or_any); - 27134: error(memberDecl.name, Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1, - 27175: error(memberDecl, Diagnostics.Spread_types_may_only_be_created_from_object_types); - 27221: Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); - 27318: ? Diagnostics.The_jsxFragmentFactory_compiler_option_must_be_provided_to_use_JSX_fragments_with_the_jsxFactory_compiler_option - 27319: : Diagnostics.An_jsxFrag_pragma_is_required_when_using_an_jsx_pragma_with_JSX_fragments); - 27422: error(attributes, Diagnostics._0_are_specified_twice_The_attribute_named_0_will_be_overwritten, unescapeLeadingUnderscores(jsxChildrenPropertyName)); - 27490: const diagnostic = error(left.valueDeclaration, Diagnostics._0_is_specified_more_than_once_so_this_usage_will_be_overwritten, unescapeLeadingUnderscores(left.escapedName)); - 27491: addRelatedInfo(diagnostic, createDiagnosticForNode(spread, Diagnostics.This_spread_always_overwrites_this_property)); - 27540: error(node, Diagnostics.Property_0_does_not_exist_on_type_1, idText(node.tagName), "JSX." + JsxNames.IntrinsicElements); - 27545: error(node, Diagnostics.JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists, unescapeLeadingUnderscores(JsxNames.IntrinsicElements)); - 27568: ? Diagnostics.Cannot_find_module_0_Did_you_mean_to_set_the_moduleResolution_option_to_node_or_to_add_aliases_to_the_paths_option - 27569: : Diagnostics.Cannot_find_module_0_or_its_corresponding_type_declarations; - 27638: error(jsxElementAttribPropInterfaceSym.declarations[0], Diagnostics.The_global_type_JSX_0_may_not_have_more_than_one_property, unescapeLeadingUnderscores(nameOfAttribPropContainer)); - 27669: error(caller, Diagnostics.Property_0_does_not_exist_on_type_1, (elementType as StringLiteralType).value, "JSX." + JsxNames.IntrinsicElements); - 27717: checkTypeRelatedTo(elemInstanceType, sfcReturnConstraint, assignableRelation, openingLikeElement.tagName, Diagnostics.Its_return_type_0_is_not_a_valid_JSX_element, generateInitialErrorChain); - 27724: checkTypeRelatedTo(elemInstanceType, classConstraint, assignableRelation, openingLikeElement.tagName, Diagnostics.Its_instance_type_0_is_not_a_valid_JSX_element, generateInitialErrorChain); - 27734: checkTypeRelatedTo(elemInstanceType, combined, assignableRelation, openingLikeElement.tagName, Diagnostics.Its_element_type_0_is_not_a_valid_JSX_element, generateInitialErrorChain); - 27739: return chainDiagnosticMessages(/* details */ undefined, Diagnostics._0_cannot_be_used_as_a_JSX_component, componentName); - 27795: error(errorNode, Diagnostics.Cannot_use_JSX_unless_the_jsx_flag_is_provided); - 27800: error(errorNode, Diagnostics.JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist); - 27817: const jsxFactoryRefErr = diagnostics && compilerOptions.jsx === JsxEmit.React ? Diagnostics.Cannot_find_name_0 : undefined; - 27904: error(node, Diagnostics.JSX_spread_child_must_be_an_array_type); - 27979: error(errorNode, Diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword); - 27991: Diagnostics.Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression, - 28006: Diagnostics.Abstract_property_0_in_class_1_cannot_be_accessed_in_the_constructor, - 28027: Diagnostics.Property_0_is_private_and_only_accessible_within_class_1, - 28057: Diagnostics.Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses, - 28078: Diagnostics.Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1_This_is_an_instance_of_class_2, - 28109: Diagnostics.Object_is_possibly_null_or_undefined : - 28110: Diagnostics.Object_is_possibly_undefined : - 28111: Diagnostics.Object_is_possibly_null - 28117: Diagnostics.Cannot_invoke_an_object_which_is_possibly_null_or_undefined : - 28118: Diagnostics.Cannot_invoke_an_object_which_is_possibly_undefined : - 28119: Diagnostics.Cannot_invoke_an_object_which_is_possibly_null - 28129: error(node, Diagnostics.Object_is_of_type_unknown); - 28148: error(node, Diagnostics.Object_is_possibly_undefined); - 28190: return grammarErrorOnNode(privId, Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies); - 28193: return grammarErrorOnNode(privId, Diagnostics.Private_identifiers_are_only_allowed_in_class_bodies_and_may_only_be_used_as_part_of_a_class_member_declaration_property_access_or_on_the_left_hand_side_of_an_in_expression); - 28196: return grammarErrorOnNode(privId, Diagnostics.Cannot_find_name_0, idText(privId)); - 28255: Diagnostics.The_property_0_cannot_be_accessed_on_type_1_within_this_class_because_it_is_shadowed_by_another_private_identifier_with_the_same_spelling, - 28264: Diagnostics.The_shadowing_declaration_of_0_is_defined_here, - 28269: Diagnostics.The_declaration_of_0_that_you_probably_intended_to_use_is_defined_here, - 28278: Diagnostics.Property_0_is_not_accessible_outside_class_1_because_it_has_a_private_identifier, - 28310: grammarErrorOnNode(right, Diagnostics.Cannot_assign_to_private_method_0_Private_methods_are_not_writable, idText(right)); - 28326: Diagnostics.Property_0_may_not_be_used_in_a_static_property_s_initializer_in_the_same_class_when_target_is_esnext_and_useDefineForClassFields_is_false, - 28330: Diagnostics.Initializer_for_property_0, - 28341: grammarErrorOnNode(right, Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies); - 28353: error(node, Diagnostics.Private_accessor_was_defined_without_a_getter); - 28385: error(right, Diagnostics.Property_0_does_not_exist_on_type_1, unescapeLeadingUnderscores(right.escapedText), typeToString(leftType)); - 28388: error(right, Diagnostics.Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature, typeToString(leftType)); - 28398: error(node, Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(apparentType)); - 28403: error(right, Diagnostics.Property_0_comes_from_an_index_signature_so_it_must_be_accessed_with_0, unescapeLeadingUnderscores(right.escapedText)); - 28416: error(right, Diagnostics.Cannot_assign_to_0_because_it_is_a_read_only_property, idText(right)); - 28488: error(errorNode, Diagnostics.Property_0_is_used_before_being_assigned, symbolToString(prop!)); // TODO: GH#18217 - 28508: diagnosticMessage = error(right, Diagnostics.Property_0_is_used_before_its_initialization, declarationName); - 28514: diagnosticMessage = error(right, Diagnostics.Class_0_used_before_its_declaration, declarationName); - 28519: createDiagnosticForNode(valueDeclaration, Diagnostics._0_is_declared_here, declarationName) - 28588: errorInfo = chainDiagnosticMessages(errorInfo, Diagnostics.Property_0_does_not_exist_on_type_1, declarationNameToString(propNode), typeToString(subtype)); - 28596: errorInfo = chainDiagnosticMessages(errorInfo, Diagnostics.Property_0_does_not_exist_on_type_1_Did_you_mean_to_access_the_static_member_2_instead, propName, typeName, typeName + "." + propName); - 28601: errorInfo = chainDiagnosticMessages(errorInfo, Diagnostics.Property_0_does_not_exist_on_type_1, declarationNameToString(propNode), typeToString(containingType)); - 28602: relatedInfo = createDiagnosticForNode(propNode, Diagnostics.Did_you_forget_to_use_await); - 28609: errorInfo = chainDiagnosticMessages(errorInfo, Diagnostics.Property_0_does_not_exist_on_type_1_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_2_or_later, missingProperty, container, libSuggestion); - 28615: const message = isUncheckedJS ? Diagnostics.Property_0_may_not_exist_on_type_1_Did_you_mean_2 : Diagnostics.Property_0_does_not_exist_on_type_1_Did_you_mean_2; - 28617: relatedInfo = suggestion.valueDeclaration && createDiagnosticForNode(suggestion.valueDeclaration, Diagnostics._0_is_declared_here, suggestedName); - 28621: ? Diagnostics.Property_0_does_not_exist_on_type_1_Try_changing_the_lib_compiler_option_to_include_dom - 28622: : Diagnostics.Property_0_does_not_exist_on_type_1; - 28632: addErrorOrSuggestion(!isUncheckedJS || errorInfo.code !== Diagnostics.Property_0_may_not_exist_on_type_1_Did_you_mean_2.code, resultDiagnostic); - 28992: error(indexExpression, Diagnostics.A_const_enum_member_can_only_be_accessed_using_a_string_literal); - 29379: const errorInfo = reportErrors && headMessage ? (() => chainDiagnosticMessages(/*details*/ undefined, Diagnostics.Type_0_does_not_satisfy_the_constraint_1)) : undefined; - 29380: const typeArgumentHeadMessage = headMessage || Diagnostics.Type_0_does_not_satisfy_the_constraint_1; - 29504: const diag = createDiagnosticForNode(node.tagName, Diagnostics.Tag_0_expects_at_least_1_arguments_but_the_JSX_factory_2_provides_at_most_3, entityNameToString(node.tagName), absoluteMinArgCount, entityNameToString(factory), maxParamCount); - 29507: addRelatedInfo(diag, createDiagnosticForNode(tagNameDeclaration, Diagnostics._0_is_declared_here, entityNameToString(node.tagName))); - 29546: const headMessage = Diagnostics.The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1; - 29552: const headMessage = Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1; - 29594: addRelatedInfo(errorOutputContainer.errors[0], createDiagnosticForNode(errorNode, Diagnostics.Did_you_forget_to_use_await)); - 29774: return createDiagnosticForNode(args[spreadIndex], Diagnostics.A_spread_argument_must_either_have_a_tuple_type_or_be_passed_to_a_rest_parameter); - 29799: const error = hasRestParameter ? Diagnostics.Expected_at_least_0_arguments_but_got_1 - 29800: : parameterRange === 1 && args.length === 0 && isPromiseResolveArityError(node) ? Diagnostics.Expected_0_arguments_but_got_1_Did_you_forget_to_include_void_in_your_type_argument_to_Promise - 29801: : Diagnostics.Expected_0_arguments_but_got_1; - 29804: return getDiagnosticForCallNode(node, Diagnostics.No_overload_expects_0_arguments_but_overloads_do_exist_that_expect_either_1_or_2_arguments, args.length, maxBelow, minAbove); - 29813: isBindingPattern(parameter.name) ? Diagnostics.An_argument_matching_this_binding_pattern_was_not_provided - 29814: : isRestParameter(parameter) ? Diagnostics.Arguments_for_the_rest_parameter_0_were_not_provided - 29815: : Diagnostics.An_argument_for_0_was_not_provided, - 29842: return createDiagnosticForNodeArray(getSourceFileOfNode(node), typeArguments, Diagnostics.Expected_0_type_arguments_but_got_1, min < max ? min + "-" + max : min , argCount); - 29858: return createDiagnosticForNodeArray(getSourceFileOfNode(node), typeArguments, Diagnostics.No_overload_expects_0_type_arguments_but_overloads_do_exist_that_expect_either_1_or_2_type_arguments, argCount, belowArgCount, aboveArgCount); - 29860: return createDiagnosticForNodeArray(getSourceFileOfNode(node), typeArguments, Diagnostics.Expected_0_type_arguments_but_got_1, belowArgCount === -Infinity ? aboveArgCount : belowArgCount, argCount); - 29885: diagnostics.add(getDiagnosticForCallNode(node, Diagnostics.Call_target_does_not_contain_any_signatures)); - 29968: chain = chainDiagnosticMessages(chain, Diagnostics.The_last_overload_gave_the_following_error); - 29969: chain = chainDiagnosticMessages(chain, Diagnostics.No_overload_matches_this_call); - 29975: addRelatedInfo(d, createDiagnosticForNode(last.declaration, Diagnostics.The_last_overload_is_declared_here)); - 29992: const chain = () => chainDiagnosticMessages(/*details*/ undefined, Diagnostics.Overload_0_of_1_2_gave_the_following_error, i + 1, candidates.length, signatureToString(c)); - 30000: allDiagnostics.push(diags); - 30012: Diagnostics.No_overload_matches_this_call); - 30062: addRelatedInfo(diagnostic, createDiagnosticForNode(implDecl, Diagnostics.The_call_would_have_succeeded_against_this_implementation_but_implementation_signatures_of_overloads_are_not_externally_visible)); - 30345: error(node, Diagnostics.Untyped_function_calls_may_not_accept_type_arguments); - 30354: error(node, Diagnostics.Value_of_type_0_is_not_callable_Did_you_mean_to_include_new, typeToString(funcType)); - 30361: relatedInformation = createDiagnosticForNode(node.expression, Diagnostics.Are_you_missing_a_semicolon); - 30386: error(node, Diagnostics.Value_of_type_0_is_not_callable_Did_you_mean_to_include_new, typeToString(funcType)); - 30412: error(node.arguments[spreadIndex], Diagnostics.Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_5_and_higher); - 30437: error(node, Diagnostics.Untyped_function_calls_may_not_accept_type_arguments); - 30456: error(node, Diagnostics.Cannot_create_an_instance_of_an_abstract_class); - 30461: error(node, Diagnostics.Cannot_create_an_instance_of_an_abstract_class); - 30477: error(node, Diagnostics.Only_a_void_function_can_be_called_with_the_new_keyword); - 30480: error(node, Diagnostics.A_function_that_is_called_with_the_new_keyword_cannot_have_a_this_type_that_is_void); - 30548: error(node, Diagnostics.Constructor_of_class_0_is_private_and_only_accessible_within_the_class_declaration, typeToString(declaringClass)); - 30551: error(node, Diagnostics.Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration, typeToString(declaringClass)); - 30582: Diagnostics.Type_0_has_no_call_signatures : - 30583: Diagnostics.Type_0_has_no_construct_signatures, - 30589: Diagnostics.Not_all_constituents_of_type_0_are_callable : - 30590: Diagnostics.Not_all_constituents_of_type_0_are_constructable, - 30604: Diagnostics.No_constituent_of_type_0_is_callable : - 30605: Diagnostics.No_constituent_of_type_0_is_constructable, - 30613: Diagnostics.Each_member_of_the_union_type_0_has_signatures_but_none_of_those_signatures_are_compatible_with_each_other : - 30614: Diagnostics.Each_member_of_the_union_type_0_has_construct_signatures_but_none_of_those_signatures_are_compatible_with_each_other, - 30623: Diagnostics.Type_0_has_no_call_signatures : - 30624: Diagnostics.Type_0_has_no_construct_signatures, - 30629: let headMessage = isCall ? Diagnostics.This_expression_is_not_callable : Diagnostics.This_expression_is_not_constructable; - 30635: headMessage = Diagnostics.This_expression_is_not_callable_because_it_is_a_get_accessor_Did_you_mean_to_use_it_without; - 30641: relatedMessage: maybeMissingAwait ? Diagnostics.Did_you_forget_to_use_await : undefined, - 30671: createDiagnosticForNode(importNode, Diagnostics.Type_originates_at_this_import_A_namespace_style_import_cannot_be_called_or_constructed_and_will_cause_a_failure_at_runtime_Consider_using_a_default_import_or_import_require_here_instead) - 30694: const diagnostic = createDiagnosticForNode(node.tag, Diagnostics.It_is_likely_that_you_are_missing_a_comma_to_separate_these_two_template_expressions_They_form_a_tagged_template_expression_which_cannot_be_invoked); - 30713: return Diagnostics.Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression; - 30716: return Diagnostics.Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression; - 30719: return Diagnostics.Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression; - 30724: return Diagnostics.Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression; - 30749: error(node, Diagnostics._0_accepts_too_few_arguments_to_be_used_as_a_decorator_here_Did_you_mean_to_call_it_first_and_write_0, nodeStr); - 30801: diagnostics.add(createDiagnosticForNodeArray(getSourceFileOfNode(node), node.typeArguments!, Diagnostics.Expected_0_type_arguments_but_got_1, 0, length(node.typeArguments))); - 30818: error(node.tagName, Diagnostics.JSX_element_type_0_does_not_have_any_construct_or_call_signatures, getTextOfNode(node.tagName)); - 31028: error(node, Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type); - 31048: error(node.expression, Diagnostics.Assertions_require_the_call_target_to_be_an_identifier_or_qualified_name); - 31051: const diagnostic = error(node.expression, Diagnostics.Assertions_require_every_name_in_the_call_target_to_be_declared_with_an_explicit_type_annotation); - 31136: error(specifier, Diagnostics.Dynamic_import_s_specifier_must_be_of_type_string_but_here_has_type_0, typeToString(specifierType)); - 31247: grammarErrorOnNode(node, Diagnostics.This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Use_an_as_expression_instead); - 31288: error(expression, Diagnostics.A_const_assertions_can_only_be_applied_to_references_to_enum_members_or_string_number_boolean_array_or_object_literals); - 31299: Diagnostics.Conversion_of_type_0_to_type_1_may_be_a_mistake_because_neither_type_sufficiently_overlaps_with_the_other_If_this_was_intentional_convert_the_expression_to_unknown_first); - 31345: error(node, Diagnostics.Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor, "new.target"); - 31361: error(node, Diagnostics.The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output); - 31365: error(node, Diagnostics.The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system_node12_or_nodenext); - 31719: Diagnostics.A_dynamic_import_call_returns_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option : - 31720: Diagnostics.An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option); - 31725: Diagnostics.A_dynamic_import_call_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option : - 31726: Diagnostics.An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option); - 31765: returnType = unwrapAwaitedType(checkAwaitedType(returnType, /*withAlias*/ false, /*errorNode*/ func, Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member)); - 31903: ? Diagnostics.Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member - 31904: : Diagnostics.Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member); - 31998: type = unwrapAwaitedType(checkAwaitedType(type, /*withAlias*/ false, func, Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member)); - 32063: error(errorNode, Diagnostics.A_function_returning_never_cannot_have_a_reachable_end_point); - 32068: error(errorNode, Diagnostics.A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value); - 32071: error(errorNode, Diagnostics.Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined); - 32086: error(errorNode, Diagnostics.Not_all_code_paths_return_a_value); - 32200: const awaitedType = checkAwaitedType(exprType, /*withAlias*/ false, node.body, Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member); - 32334: error(expr, Diagnostics.The_operand_of_a_delete_operator_must_be_a_property_reference); - 32338: error(expr, Diagnostics.The_operand_of_a_delete_operator_cannot_be_a_private_identifier); - 32344: error(expr, Diagnostics.The_operand_of_a_delete_operator_cannot_be_a_read_only_property); - 32356: error(expr, Diagnostics.The_operand_of_a_delete_operator_must_be_optional); - 32375: error(node, Diagnostics.Await_expression_cannot_be_used_inside_a_class_static_block); - 32385: Diagnostics.await_expressions_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module); - 32391: Diagnostics.Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher); - 32401: const diagnostic = createFileDiagnostic(sourceFile, span.start, span.length, Diagnostics.await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules); - 32403: const relatedInfo = createDiagnosticForNode(container, Diagnostics.Did_you_mean_to_mark_this_function_as_async); - 32412: error(node, Diagnostics.await_expressions_cannot_be_used_in_a_parameter_initializer); - 32417: const awaitedType = checkAwaitedType(operandType, /*withAlias*/ true, node, Diagnostics.Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member); - 32419: addErrorOrSuggestion(/*isError*/ false, createDiagnosticForNode(node, Diagnostics.await_has_no_effect_on_the_type_of_this_expression)); - 32452: error(node.operand, Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, tokenToString(node.operator)); - 32456: error(node.operand, Diagnostics.Operator_0_cannot_be_applied_to_type_1, tokenToString(node.operator), typeToString(getBaseTypeOfLiteralType(operandType))); - 32470: Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_bigint_or_an_enum_type); - 32475: Diagnostics.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access, - 32476: Diagnostics.The_operand_of_an_increment_or_decrement_operator_may_not_be_an_optional_property_access); - 32491: Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_bigint_or_an_enum_type); - 32496: Diagnostics.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access, - 32497: Diagnostics.The_operand_of_an_increment_or_decrement_operator_may_not_be_an_optional_property_access); - 32573: error(left, Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); - 32577: error(right, Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type); - 32603: error(left, Diagnostics.The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or_symbol); - 32633: error(right, Diagnostics.The_right_hand_side_of_an_in_expression_must_not_be_a_primitive); - 32670: error(property, Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern); - 32685: checkGrammarForDisallowedTrailingComma(allProperties, Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma); - 32690: error(property, Diagnostics.Property_assignment_expected); - 32733: error(element, Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern); - 32738: error((restExpression as BinaryExpression).operatorToken, Diagnostics.A_rest_element_cannot_have_an_initializer); - 32741: checkGrammarForDisallowedTrailingComma(node.elements, Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma); - 32787: Diagnostics.The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access : - 32788: Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access; - 32790: Diagnostics.The_target_of_an_object_rest_assignment_may_not_be_an_optional_property_access : - 32791: Diagnostics.The_left_hand_side_of_an_assignment_expression_may_not_be_an_optional_property_access; - 33015: grammarErrorOnNode(left, Diagnostics._0_and_1_operations_cannot_be_mixed_without_parentheses, tokenToString(left.operatorToken.kind), tokenToString(operatorToken.kind)); - 33018: grammarErrorOnNode(right, Diagnostics._0_and_1_operations_cannot_be_mixed_without_parentheses, tokenToString(right.operatorToken.kind), tokenToString(operatorToken.kind)); - 33087: error(errorNode || operatorToken, Diagnostics.The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead, tokenToString(operatorToken.kind), tokenToString(suggestedOperator)); - 33092: const leftOk = checkArithmeticOperandType(left, leftType, Diagnostics.The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type, /*isAwaitValid*/ true); - 33093: const rightOk = checkArithmeticOperandType(right, rightType, Diagnostics.The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type, /*isAwaitValid*/ true); - 33112: error(errorNode, Diagnostics.Exponentiation_cannot_be_performed_on_bigint_values_unless_the_target_option_is_set_to_es2016_or_later); - 33256: const isInDiag2657 = sf.parseDiagnostics.some(diag => { - 33257: if (diag.code !== Diagnostics.JSX_expressions_must_have_one_parent_element.code) return false; - 33260: if (!isInDiag2657) error(left, Diagnostics.Left_side_of_comma_operator_is_unused_and_has_no_side_effects); - 33280: addDuplicateDeclarationErrorsForSymbols(symbol, Diagnostics.Duplicate_identifier_0, unescapeLeadingUnderscores(name), prop); - 33281: addDuplicateDeclarationErrorsForSymbols(prop, Diagnostics.Duplicate_identifier_0, unescapeLeadingUnderscores(name), symbol); - 33300: error(offendingSymbolOperand, Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, tokenToString(operator)); - 33333: Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access, - 33334: Diagnostics.The_left_hand_side_of_an_assignment_expression_may_not_be_an_optional_property_access) - 33341: headMessage = Diagnostics.Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_type_of_the_target; - 33400: Diagnostics.Operator_0_cannot_be_applied_to_types_1_and_2, - 33424: Diagnostics.This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap, - 33448: grammarErrorOnFirstToken(node, Diagnostics.A_yield_expression_is_only_allowed_in_a_generator_body); - 33452: error(node, Diagnostics.yield_expressions_cannot_be_used_in_a_parameter_initializer); - 33508: error(node, Diagnostics.yield_expression_implicitly_results_in_an_any_type_because_its_containing_generator_lacks_a_return_type_annotation); - 33535: error(span.expression, Diagnostics.Implicit_conversion_of_a_symbol_to_a_string_will_fail_at_runtime_Consider_wrapping_this_expression_in_String); - 33972: error(node, Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment_or_type_query); - 33979: error(node, Diagnostics.Cannot_access_ambient_const_enums_when_the_isolatedModules_flag_is_provided); - 34113: grammarErrorOnFirstToken(node.expression, Diagnostics.Type_expected); - 34122: error(node.default, Diagnostics.Type_parameter_0_has_a_circular_default, typeToString(typeParameter)); - 34127: checkTypeAssignableTo(defaultType, getTypeWithThisArgument(instantiateType(constraintType, makeUnaryTypeMapper(typeParameter, defaultType)), defaultType), node.default, Diagnostics.Type_0_does_not_satisfy_the_constraint_1); - 34130: checkTypeNameIsReserved(node.name, Diagnostics.Type_parameter_name_cannot_be_0); - 34145: error(node, Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); - 34148: error(node.name, Diagnostics.constructor_cannot_be_used_as_a_parameter_property_name); - 34152: error(node, Diagnostics.A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature); - 34156: error(node, Diagnostics.A_0_parameter_must_be_the_first_parameter, node.name.escapedText as string); - 34159: error(node, Diagnostics.A_constructor_cannot_have_a_this_parameter); - 34162: error(node, Diagnostics.An_arrow_function_cannot_have_a_this_parameter); - 34165: error(node, Diagnostics.get_and_set_accessors_cannot_declare_this_parameters); - 34172: error(node, Diagnostics.A_rest_parameter_must_be_of_an_array_type); - 34180: error(node, Diagnostics.A_type_predicate_is_only_allowed_in_return_type_position_for_functions_and_methods); - 34199: error(parameterName, Diagnostics.A_type_predicate_cannot_reference_a_rest_parameter); - 34203: const leadingError = () => chainDiagnosticMessages(/*details*/ undefined, Diagnostics.A_type_predicate_s_type_must_be_assignable_to_its_parameter_s_type); - 34222: error(node.parameterName, Diagnostics.Cannot_find_parameter_0, typePredicate.parameterName); - 34256: Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, - 34317: error(node, Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); - 34320: error(node, Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); - 34330: error(returnTypeNode, Diagnostics.A_generator_cannot_have_a_void_type_annotation); - 34410: error(location, Diagnostics.Duplicate_identifier_0_Static_and_instance_elements_cannot_share_the_same_private_name, getTextOfNode(location)); - 34417: error(location, Diagnostics.Duplicate_identifier_0, getTextOfNode(location)); - 34422: error(location, Diagnostics.Duplicate_identifier_0, getTextOfNode(location)); - 34458: const message = Diagnostics.Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1; - 34486: error(getNameOfDeclaration(member.symbol.valueDeclaration), Diagnostics.Duplicate_identifier_0, memberName); - 34487: error(member.name, Diagnostics.Duplicate_identifier_0, memberName); - 34528: error(declaration, Diagnostics.Duplicate_index_signature_for_type_0, typeToString(entry.type)); - 34542: error(node.initializer, Diagnostics.Static_fields_with_private_names_can_t_have_initializers_when_the_useDefineForClassFields_flag_is_not_specified_with_a_target_of_esnext_Consider_adding_the_useDefineForClassFields_flag); - 34546: error(node, Diagnostics.Property_0_cannot_have_an_initializer_because_it_is_marked_abstract, declarationNameToString(node.name)); - 34552: error(node, Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies); - 34566: error(node, Diagnostics.Method_0_cannot_have_an_implementation_because_it_is_marked_abstract, declarationNameToString(node.name)); - 34571: error(node, Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies); - 34646: error(superCall, Diagnostics.A_constructor_cannot_contain_a_super_call_when_its_class_extends_null); - 34675: error(node, Diagnostics.A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_parameter_properties_or_private_identifiers); - 34680: error(node, Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call); - 34695: error(node.name, Diagnostics.A_get_accessor_must_return_a_value); - 34717: error(getter.name, Diagnostics.Accessors_must_both_be_abstract_or_non_abstract); - 34718: error(setter.name, Diagnostics.Accessors_must_both_be_abstract_or_non_abstract); - 34722: error(getter.name, Diagnostics.A_get_accessor_must_be_at_least_as_accessible_as_the_setter); - 34723: error(setter.name, Diagnostics.A_get_accessor_must_be_at_least_as_accessible_as_the_setter); - 34729: checkTypeAssignableTo(getterType, setterType, getter, Diagnostics.The_return_type_of_a_get_accessor_must_be_assignable_to_its_set_accessor_type); - 34766: Diagnostics.Type_0_does_not_satisfy_the_constraint_1); - 34787: grammarErrorAtPos(node, node.typeName.jsdocDotPos, 1, Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments); - 34808: error(node, Diagnostics.Enum_type_0_has_members_with_initializers_that_are_not_literals, typeToString(type)); - 34848: grammarErrorOnNode(e, Diagnostics.Tuple_members_must_all_have_names_or_all_not_have_names); - 34855: error(e, Diagnostics.A_rest_element_type_must_be_an_array_type); - 34864: grammarErrorOnNode(e, Diagnostics.A_rest_element_cannot_follow_another_rest_element); - 34871: grammarErrorOnNode(e, Diagnostics.An_optional_element_cannot_follow_a_rest_element); - 34877: grammarErrorOnNode(e, Diagnostics.A_required_element_cannot_follow_an_optional_element); - 34900: error(accessNode, Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType)); - 34915: error(accessNode, Diagnostics.Private_or_protected_member_0_cannot_be_accessed_on_a_type_parameter, unescapeLeadingUnderscores(propertyName)); - 34920: error(accessNode, Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(objectType)); - 34953: return grammarErrorOnNode(node.members[0], Diagnostics.A_mapped_type_may_not_declare_properties_or_methods); - 34972: grammarErrorOnNode(node, Diagnostics.infer_declarations_are_only_permitted_in_the_extends_clause_of_a_conditional_type); - 34994: grammarErrorOnNode(node, Diagnostics.A_tuple_member_cannot_be_both_optional_and_rest); - 34997: grammarErrorOnNode(node.type, Diagnostics.A_labeled_tuple_element_is_declared_as_optional_with_a_question_mark_after_the_name_and_before_the_colon_rather_than_after_the_type); - 35000: grammarErrorOnNode(node.type, Diagnostics.A_labeled_tuple_element_is_declared_as_rest_with_a_before_the_name_rather_than_before_the_type); - 35053: error(getNameOfDeclaration(o), Diagnostics.Overload_signatures_must_all_be_exported_or_non_exported); - 35056: error(getNameOfDeclaration(o), Diagnostics.Overload_signatures_must_all_be_ambient_or_non_ambient); - 35059: error(getNameOfDeclaration(o) || o, Diagnostics.Overload_signatures_must_all_be_public_private_or_protected); - 35062: error(getNameOfDeclaration(o), Diagnostics.Overload_signatures_must_all_be_abstract_or_non_abstract); - 35074: error(getNameOfDeclaration(o), Diagnostics.Overload_signatures_must_all_be_optional_or_required); - 35131: const diagnostic = isStatic(node) ? Diagnostics.Function_overload_must_be_static : Diagnostics.Function_overload_must_not_be_static; - 35137: error(errorNode, Diagnostics.Function_implementation_name_must_be_0, declarationNameToString(node.name)); - 35144: error(errorNode, Diagnostics.Constructor_implementation_is_missing); - 35150: error(errorNode, Diagnostics.All_declarations_of_an_abstract_method_must_be_consecutive); - 35153: error(errorNode, Diagnostics.Function_implementation_is_missing_or_not_immediately_following_the_declaration); - 35223: error(declaration, Diagnostics.Multiple_constructor_implementations_are_not_allowed); - 35229: error(getNameOfDeclaration(declaration) || declaration, Diagnostics.Duplicate_function_implementation); - 35235: .map(d => createDiagnosticForNode(d, Diagnostics.Consider_adding_a_declare_modifier_to_this_class)); - 35239: ? Diagnostics.Class_declaration_cannot_implement_overload_list_for_0 - 35241: ? Diagnostics.Function_with_bodies_can_only_merge_with_classes_that_are_ambient - 35270: error(signature.declaration, Diagnostics.This_overload_signature_is_not_compatible_with_its_implementation_signature), - 35271: createDiagnosticForNode(bodyDeclaration, Diagnostics.The_implementation_signature_is_declared_here) - 35336: error(name, Diagnostics.Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead, declarationNameToString(name)); - 35339: error(name, Diagnostics.Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local, declarationNameToString(name)); - 35452: error(errorNode, Diagnostics.A_promise_must_have_a_then_method); - 35465: error(errorNode, Diagnostics.The_first_parameter_of_the_then_method_of_a_promise_must_be_a_callback); - 35641: error(errorNode, Diagnostics.Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method); - 35732: error(returnTypeNode, Diagnostics.The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_Did_you_mean_to_write_Promise_0, typeToString(getAwaitedTypeNoAlias(returnType) || voidType)); - 35746: error(returnTypeNode, Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, typeToString(returnType)); - 35754: error(returnTypeNode, Diagnostics.An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option); - 35757: error(returnTypeNode, Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, entityNameToString(promiseConstructorName)); - 35766: error(returnTypeNode, Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, entityNameToString(promiseConstructorName)); - 35771: Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value)) { - 35779: error(collidingSymbol.valueDeclaration, Diagnostics.Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions, - 35785: checkAwaitedType(returnType, /*withAlias*/ false, node, Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member); - 35811: Diagnostics.The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any); - 35819: Diagnostics.The_return_type_of_a_property_decorator_function_must_be_either_void_or_any); - 35955: error(node, Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_in_your_tsconfig_or_jsconfig_to_remove_this_warning); - 36020: error(node.name, Diagnostics.JSDoc_typedef_tag_should_either_have_a_type_annotation_or_be_followed_by_property_or_member_tags); - 36024: checkTypeNameIsReserved(node.name, Diagnostics.Type_alias_name_cannot_be_0); - 36056: Diagnostics.Qualified_name_0_is_not_allowed_without_a_leading_param_object_1, - 36062: Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name, - 36070: Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_It_would_match_arguments_if_it_had_an_array_type, - 36091: error(classLike, Diagnostics.JSDoc_0_is_not_attached_to_a_class, idText(node.tagName)); - 36098: error(classLike, Diagnostics.JSDoc_0_is_not_attached_to_a_class, idText(node.tagName)); - 36105: error(augmentsTags[1], Diagnostics.Class_declarations_cannot_have_more_than_one_augments_or_extends_tag); - 36113: error(name, Diagnostics.JSDoc_0_1_does_not_match_the_extends_2_clause, idText(node.tagName), idText(name), idText(className)); - 36121: error(node, Diagnostics.An_accessibility_modifier_cannot_be_used_with_a_private_identifier); - 36200: error(typeTag.typeExpression.type, Diagnostics.The_type_of_a_function_declaration_must_match_the_function_s_signature); - 36275: const message = isTypeDeclaration(declaration) ? Diagnostics._0_is_declared_but_never_used : Diagnostics._0_is_declared_but_its_value_is_never_read; - 36298: addDiagnostic(member, UnusedKind.Local, createDiagnosticForNode(member.name!, Diagnostics._0_is_declared_but_its_value_is_never_read, symbolToString(symbol))); - 36304: addDiagnostic(parameter, UnusedKind.Local, createDiagnosticForNode(parameter.name, Diagnostics.Property_0_is_declared_but_its_value_is_never_read, symbolName(parameter.symbol))); - 36322: addDiagnostic(node, UnusedKind.Parameter, createDiagnosticForNode(node, Diagnostics._0_is_declared_but_its_value_is_never_read, idText(typeParameter.name))); - 36350: const message = only ? Diagnostics._0_is_declared_but_its_value_is_never_read : Diagnostics.All_type_parameters_are_unused; - 36357: addDiagnostic(typeParameter, UnusedKind.Parameter, createDiagnosticForNode(typeParameter, Diagnostics._0_is_declared_but_its_value_is_never_read, name)); - 36435: addDiagnostic(parameter, UnusedKind.Parameter, createDiagnosticForNode(name, Diagnostics._0_is_declared_but_its_value_is_never_read, symbolName(local))); - 36454: ? createDiagnosticForNode(importDecl, Diagnostics._0_is_declared_but_its_value_is_never_read, idText(first(unuseds).name!)) - 36455: : createDiagnosticForNode(importDecl, Diagnostics.All_imports_in_import_declaration_are_unused)); - 36469: ? createDiagnosticForNode(bindingPattern, Diagnostics._0_is_declared_but_its_value_is_never_read, bindingNameText(first(bindingElements).name)) - 36470: : createDiagnosticForNode(bindingPattern, Diagnostics.All_destructured_elements_are_unused)); - 36475: addDiagnostic(e, kind, createDiagnosticForNode(e, Diagnostics._0_is_declared_but_its_value_is_never_read, bindingNameText(e.name))); - 36482: ? createDiagnosticForNode(first(declarations).name, Diagnostics._0_is_declared_but_its_value_is_never_read, bindingNameText(first(declarations).name)) - 36483: : createDiagnosticForNode(declarationList.parent.kind === SyntaxKind.VariableStatement ? declarationList.parent : declarationList, Diagnostics.All_variables_are_unused)); - 36487: addDiagnostic(decl, UnusedKind.Local, createDiagnosticForNode(decl, Diagnostics._0_is_declared_but_its_value_is_never_read, bindingNameText(decl.name))); - 36539: errorSkippedOn("noEmit", p, Diagnostics.Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters); - 36592: error(getNameOfDeclaration(node as Declaration), Diagnostics.Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference); - 36595: error(node, Diagnostics.Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference); - 36608: error(getNameOfDeclaration(node as Declaration), Diagnostics.Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_meta_property_reference); - 36611: error(node, Diagnostics.Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta_property_reference); - 36638: errorSkippedOn("noEmit", name, Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, - 36657: errorSkippedOn("noEmit", name, Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions, - 36673: errorSkippedOn("noEmit", node, Diagnostics.Compiler_reserves_name_0_when_emitting_private_identifier_downlevel, node.name.escapedText); - 36709: errorSkippedOn("noEmit", node, Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_when_emitting_super_references_in_static_initializers, - 36722: checkTypeNameIsReserved(name, Diagnostics.Class_name_cannot_be_0); - 36728: checkTypeNameIsReserved(name, Diagnostics.Enum_name_cannot_be_0); - 36799: error(node, Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name, name); - 36869: error(node, Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation); - 36923: error(node.name, Diagnostics.All_declarations_of_0_must_have_identical_modifiers, declarationNameToString(node.name)); - 36941: error(node.name, Diagnostics.All_declarations_of_0_must_have_identical_modifiers, declarationNameToString(node.name)); - 36957: ? Diagnostics.Subsequent_property_declarations_must_have_the_same_type_Property_0_must_be_of_type_1_but_here_has_type_2 - 36958: : Diagnostics.Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2; - 36969: createDiagnosticForNode(firstDeclaration, Diagnostics._0_was_also_declared_here, declName) - 37028: error(node.thenStatement, Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement); - 37071: Diagnostics.This_condition_will_always_return_true_since_this_0_is_always_defined, - 37075: error(location, Diagnostics.This_condition_will_always_return_true_since_this_function_is_always_defined_Did_you_mean_to_call_it_instead); - 37155: error(node, Diagnostics.An_expression_of_type_void_cannot_be_tested_for_truthiness); - 37195: grammarErrorOnNode(node.awaitModifier, Diagnostics.For_await_loops_cannot_be_used_inside_a_class_static_block); - 37233: Diagnostics.The_left_hand_side_of_a_for_of_statement_must_be_a_variable_or_a_property_access, - 37234: Diagnostics.The_left_hand_side_of_a_for_of_statement_may_not_be_an_optional_property_access); - 37265: error(variable.name, Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); - 37277: error(varExpr, Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); - 37280: error(varExpr, Diagnostics.The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any); - 37286: Diagnostics.The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access, - 37287: Diagnostics.The_left_hand_side_of_a_for_in_statement_may_not_be_an_optional_property_access); - 37294: error(node.expression, Diagnostics.The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_but_here_has_type_0, typeToString(rightType)); - 37349: use & IterationUse.ForOfFlag ? Diagnostics.Cannot_iterate_value_because_the_next_method_of_its_iterator_expects_type_1_but_for_of_will_always_send_0 : - 37350: use & IterationUse.SpreadFlag ? Diagnostics.Cannot_iterate_value_because_the_next_method_of_its_iterator_expects_type_1_but_array_spread_will_always_send_0 : - 37351: use & IterationUse.DestructuringFlag ? Diagnostics.Cannot_iterate_value_because_the_next_method_of_its_iterator_expects_type_1_but_array_destructuring_will_always_send_0 : - 37352: use & IterationUse.YieldStarFlag ? Diagnostics.Cannot_delegate_iteration_to_value_because_the_next_method_of_its_iterator_expects_type_1_but_the_containing_generator_will_always_send_0 : - 37389: error(errorNode, Diagnostics.Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher); - 37435: ? [Diagnostics.Type_0_is_not_an_array_type_or_a_string_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator, true] - 37436: : [Diagnostics.Type_0_is_not_an_array_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator, true]; - 37442: return [Diagnostics.Type_0_is_not_an_array_type_or_a_string_type_Use_compiler_option_downlevelIteration_to_allow_iterating_of_iterators, false]; - 37446: return [Diagnostics.Type_0_can_only_be_iterated_through_when_using_the_downlevelIteration_flag_or_with_a_target_of_es2015_or_higher, true]; - 37450: ? [Diagnostics.Type_0_is_not_an_array_type_or_a_string_type, true] - 37451: : [Diagnostics.Type_0_is_not_an_array_type, true]; - 37779: ? Diagnostics.Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator - 37780: : Diagnostics.Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator; - 38090: grammarErrorOnFirstToken(node, Diagnostics.A_return_statement_cannot_be_used_inside_a_class_static_block); - 38095: grammarErrorOnFirstToken(node, Diagnostics.A_return_statement_can_only_be_used_within_a_function_body); - 38106: error(node, Diagnostics.Setters_cannot_return_a_value); - 38111: error(node, Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); - 38117: ? checkAwaitedType(exprType, /*withAlias*/ false, node, Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member) - 38129: error(node, Diagnostics.Not_all_code_paths_return_a_value); - 38137: grammarErrorOnFirstToken(node, Diagnostics.with_statements_are_not_allowed_in_an_async_function_block); - 38147: grammarErrorAtPos(sourceFile, start, end - start, Diagnostics.The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any); - 38167: grammarErrorOnNode(clause, Diagnostics.A_default_clause_cannot_appear_more_than_once_in_a_switch_statement); - 38190: error(clause, Diagnostics.Fallthrough_case_in_switch); - 38206: grammarErrorOnNode(node.label, Diagnostics.Duplicate_label_0, getTextOfNode(node.label)); - 38221: grammarErrorAfterFirstToken(node, Diagnostics.Line_break_not_permitted_here); - 38244: grammarErrorOnFirstToken(typeNode, Diagnostics.Catch_clause_variable_type_annotation_must_be_any_or_unknown_if_specified); - 38248: grammarErrorOnFirstToken(declaration.initializer, Diagnostics.Catch_clause_variable_cannot_have_an_initializer); - 38256: grammarErrorOnNode(blockLocal.valueDeclaration, Diagnostics.Cannot_redeclare_identifier_0_in_catch_clause, caughtName); - 38317: error(errorNode, Diagnostics.Property_0_of_type_1_is_not_assignable_to_2_index_type_3, - 38337: error(errorNode, Diagnostics._0_index_type_1_is_not_assignable_to_2_index_type_3, - 38367: error(name, Diagnostics.Class_name_cannot_be_Object_when_targeting_ES5_with_module_0, ModuleKind[moduleKind]); // https://github.com/Microsoft/TypeScript/issues/17494 - 38387: error(node, Diagnostics.Required_type_parameters_may_not_follow_optional_type_parameters); - 38391: error(node.name, Diagnostics.Duplicate_identifier_0, declarationNameToString(node.name)); - 38408: error(node, Diagnostics.Type_parameter_defaults_can_only_reference_previously_declared_type_parameters); - 38436: error(declaration.name, Diagnostics.All_declarations_of_0_must_have_identical_type_parameters, name); - 38501: grammarErrorOnNode(node.decorators[0], Diagnostics.Class_decorators_can_t_be_used_with_static_private_identifier_Consider_removing_the_experimental_decorator); - 38504: grammarErrorOnFirstToken(node, Diagnostics.A_class_declaration_without_the_default_modifier_must_have_a_name); - 38561: issueMemberSpecificError(node, typeWithThis, baseWithThis, Diagnostics.Class_0_incorrectly_extends_base_class_1); - 38566: Diagnostics.Class_static_side_0_incorrectly_extends_base_class_static_side_1); - 38570: error(node.name || node, Diagnostics.A_mixin_class_must_have_a_constructor_with_a_single_rest_parameter_of_type_any); - 38575: error(node.name || node, Diagnostics.A_mixin_class_that_extends_from_a_type_variable_containing_an_abstract_construct_signature_must_also_be_declared_abstract); - 38585: error(baseTypeNode.expression, Diagnostics.Base_constructors_must_all_have_the_same_return_type); - 38598: error(typeRefNode.expression, Diagnostics.A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments); - 38606: Diagnostics.Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclass : - 38607: Diagnostics.Class_0_incorrectly_implements_interface_1; - 38614: error(typeRefNode, Diagnostics.A_class_can_only_implement_an_object_type_or_intersection_of_object_types_with_statically_known_members); - 38746: Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1 : - 38747: Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1, - 38753: Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0 : - 38754: Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0, - 38769: Diagnostics.This_parameter_property_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_class_0 : - 38770: Diagnostics.This_parameter_property_must_have_an_override_modifier_because_it_overrides_a_member_in_base_class_0 : - 38772: Diagnostics.This_member_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_class_0 : - 38773: Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0; - 38780: error(errorNode, Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared_in_the_base_class_0, baseClassName); - 38792: Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_its_containing_class_0_does_not_extend_another_class : - 38793: Diagnostics.This_member_cannot_have_an_override_modifier_because_its_containing_class_0_does_not_extend_another_class, - 38816: Diagnostics.Property_0_in_type_1_is_not_assignable_to_the_same_property_in_base_type_2, - 38840: error(node, Diagnostics.Cannot_extend_a_class_0_Class_constructor_is_marked_as_private, getFullyQualifiedName(type.symbol)); - 38955: error(derivedClassDecl, Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, - 38959: error(derivedClassDecl, Diagnostics.Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2, - 38989: Diagnostics._0_is_defined_as_an_accessor_in_class_1_but_is_overridden_here_in_2_as_an_instance_property : - 38990: Diagnostics._0_is_defined_as_a_property_in_class_1_but_is_overridden_here_in_2_as_an_accessor; - 39007: const errorMessage = Diagnostics.Property_0_will_overwrite_the_base_property_in_1_If_this_is_intentional_add_an_initializer_Otherwise_add_a_declare_modifier_or_remove_the_redundant_declaration; - 39023: errorMessage = Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor; - 39027: errorMessage = Diagnostics.Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function; - 39030: errorMessage = Diagnostics.Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function; - 39088: let errorInfo = chainDiagnosticMessages(/*details*/ undefined, Diagnostics.Named_property_0_of_types_1_and_2_are_not_identical, symbolToString(prop), typeName1, typeName2); - 39089: errorInfo = chainDiagnosticMessages(errorInfo, Diagnostics.Interface_0_cannot_simultaneously_extend_types_1_and_2, typeToString(type), typeName1, typeName2); - 39114: error(member.name, Diagnostics.Property_0_has_no_initializer_and_is_not_definitely_assigned_in_the_constructor, declarationNameToString(propName)); - 39161: checkTypeNameIsReserved(node.name, Diagnostics.Interface_name_cannot_be_0); - 39175: checkTypeAssignableTo(typeWithThis, getTypeWithThisArgument(baseType, type.thisType), node.name, Diagnostics.Interface_0_incorrectly_extends_interface_1); - 39184: error(heritageElement.expression, Diagnostics.An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments); - 39200: checkTypeNameIsReserved(node.name, Diagnostics.Type_alias_name_cannot_be_0); - 39205: error(node.type, Diagnostics.The_intrinsic_keyword_can_only_be_used_to_declare_compiler_provided_intrinsic_types); - 39229: error(member.name, Diagnostics.Computed_property_names_are_not_allowed_in_enums); - 39234: error(member.name, Diagnostics.An_enum_member_cannot_have_a_numeric_name); - 39252: error(member.name, Diagnostics.Enum_member_must_have_initializer); - 39264: Diagnostics.const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN : - 39265: Diagnostics.const_enum_member_initializer_was_evaluated_to_a_non_finite_value); - 39269: error(initializer, Diagnostics.Computed_values_are_not_permitted_in_an_enum_with_string_valued_members); - 39273: error(initializer, Diagnostics.const_enum_member_initializers_can_only_contain_literal_values_and_other_computed_enum_values); - 39276: error(initializer, Diagnostics.In_ambient_enum_declarations_member_initializer_must_be_constant_expression); - 39282: error(initializer, Diagnostics.Only_numeric_enums_can_have_computed_members_but_this_expression_has_type_0_If_you_do_not_need_exhaustiveness_checks_consider_using_an_object_literal_instead, typeToString(source)); - 39368: error(expr, Diagnostics.A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums); - 39372: error(expr, Diagnostics.Property_0_is_used_before_being_assigned, symbolToString(memberSymbol)); - 39414: error(getNameOfDeclaration(decl), Diagnostics.Enum_declarations_must_all_be_const_or_non_const); - 39434: error(firstEnumMember.name, Diagnostics.In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element); - 39446: error(node, Diagnostics.An_enum_member_cannot_be_named_with_a_private_identifier); - 39484: error(node.name, Diagnostics.Augmentations_for_the_global_scope_should_have_declare_modifier_unless_they_appear_in_already_ambient_context); - 39489: ? Diagnostics.An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file - 39490: : Diagnostics.A_namespace_declaration_is_only_allowed_in_a_namespace_or_module; - 39498: grammarErrorOnNode(node.name, Diagnostics.Only_ambient_modules_can_use_quoted_names); - 39518: error(node.name, Diagnostics.A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged); - 39521: error(node.name, Diagnostics.A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged); - 39550: error(node.name, Diagnostics.Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_declarations); - 39553: error(node.name, Diagnostics.Ambient_module_declaration_cannot_specify_relative_module_name); - 39558: error(node.name, Diagnostics.Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_declarations); - 39563: error(node.name, Diagnostics.Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces); - 39587: grammarErrorOnFirstToken(node, Diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations); - 39591: grammarErrorOnFirstToken(node, Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module); - 39656: error(moduleName, Diagnostics.String_literal_expected); - 39662: Diagnostics.Export_declarations_are_not_permitted_in_a_namespace : - 39663: Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module); - 39674: error(node, Diagnostics.Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relative_module_name); - 39699: Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : - 39700: Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0; - 39717: ? Diagnostics._0_is_a_type_and_must_be_imported_using_a_type_only_import_when_preserveValueImports_and_isolatedModules_are_both_enabled - 39718: : Diagnostics._0_resolves_to_a_type_only_declaration_and_must_be_imported_using_a_type_only_import_when_preserveValueImports_and_isolatedModules_are_both_enabled; - 39734: ? Diagnostics.Re_exporting_a_type_when_the_isolatedModules_flag_is_provided_requires_using_export_type - 39735: : Diagnostics._0_resolves_to_a_type_only_declaration_and_must_be_re_exported_using_a_type_only_re_export_when_isolatedModules_is_enabled; - 39772: ? Diagnostics.Import_assertions_are_not_allowed_on_statements_that_transpile_to_commonjs_require_calls - 39773: : Diagnostics.Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_or_nodenext); - 39777: return grammarErrorOnNode(declaration.assertClause, Diagnostics.Import_assertions_cannot_be_used_with_type_only_imports_or_exports); - 39783: if (checkGrammarModuleElementContext(node, Diagnostics.An_import_declaration_can_only_be_used_in_a_namespace_or_module)) { - 39788: grammarErrorOnFirstToken(node, Diagnostics.An_import_declaration_cannot_have_modifiers); - 39817: if (checkGrammarModuleElementContext(node, Diagnostics.An_import_declaration_can_only_be_used_in_a_namespace_or_module)) { - 39835: error(moduleName, Diagnostics.Module_0_is_hidden_by_a_local_declaration_with_the_same_name, declarationNameToString(moduleName)); - 39839: checkTypeNameIsReserved(node.name, Diagnostics.Import_name_cannot_be_0); - 39843: grammarErrorOnNode(node, Diagnostics.An_import_alias_cannot_use_import_type); - 39849: grammarErrorOnNode(node, Diagnostics.Import_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead); - 39856: if (checkGrammarModuleElementContext(node, Diagnostics.An_export_declaration_can_only_be_used_in_a_module)) { - 39862: grammarErrorOnFirstToken(node, Diagnostics.An_export_declaration_cannot_have_modifiers); - 39879: error(node, Diagnostics.Export_declarations_are_not_permitted_in_a_namespace); - 39887: error(node.moduleSpecifier, Diagnostics.Module_0_uses_export_and_cannot_be_used_with_export_Asterisk, symbolToString(moduleSymbol)); - 39917: return grammarErrorOnNode(node, Diagnostics.Only_named_exports_may_use_export_type); - 39966: Diagnostics.This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set_to_error); - 39982: error(exportedName, Diagnostics.Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module, idText(exportedName)); - 40004: ? Diagnostics.An_export_assignment_must_be_at_the_top_level_of_a_file_or_module_declaration - 40005: : Diagnostics.A_default_export_must_be_at_the_top_level_of_a_file_or_module_declaration; - 40014: error(node, Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); - 40017: error(node, Diagnostics.A_default_export_can_only_be_used_in_an_ECMAScript_style_module); - 40024: grammarErrorOnFirstToken(node, Diagnostics.An_export_assignment_cannot_have_modifiers); - 40059: grammarErrorOnNode(node.expression, Diagnostics.The_expression_of_an_export_assignment_must_be_an_identifier_or_qualified_name_in_an_ambient_context); - 40065: grammarErrorOnNode(node, Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or_another_module_format_instead); - 40069: grammarErrorOnNode(node, Diagnostics.Export_assignment_is_not_supported_when_module_flag_is_system); - 40086: error(declaration, Diagnostics.An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements); - 40111: diagnostics.add(createDiagnosticForNode(declaration, Diagnostics.Cannot_redeclare_exported_variable_0, unescapeLeadingUnderscores(id))); - 40156: errorOrSuggestion(compilerOptions.allowUnreachableCode === false, node, Diagnostics.Unreachable_code_detected); - 40326: grammarErrorOnNode(node, Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments); - 40338: error(node, Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list); - 40344: error(node, Diagnostics.JSDoc_may_only_appear_in_the_last_parameter_of_a_signature); - 40349: error(node, Diagnostics.JSDoc_may_only_appear_in_the_last_parameter_of_a_signature); - 40361: error(node, Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list); - 40575: // may not be reported in the first call to getGlobalDiagnostics. - 40578: const previousGlobalDiagnosticsSize = previousGlobalDiagnostics.length; - 40589: else if (previousGlobalDiagnosticsSize === 0 && currentGlobalDiagnostics.length > 0) { - 42189: diagnostics.add(createDiagnosticForNode(declaration, Diagnostics.Declaration_name_conflicts_with_built_in_global_identifier_0, "globalThis")); - 42232: addToSymbolTable(globals, builtinGlobals, Diagnostics.Declaration_name_conflicts_with_built_in_global_identifier_0); - 42276: const message = isBlockScoped ? Diagnostics.Cannot_redeclare_block_scoped_variable_0 : Diagnostics.Duplicate_identifier_0; - 42289: createDiagnosticForNode(firstFile, Diagnostics.Definitions_of_the_following_identifiers_conflict_with_those_in_another_file_Colon_0, list), - 42290: createDiagnosticForNode(secondFile, Diagnostics.Conflicts_are_in_this_file) - 42293: createDiagnosticForNode(secondFile, Diagnostics.Definitions_of_the_following_identifiers_conflict_with_those_in_another_file_Colon_0, list), - 42294: createDiagnosticForNode(firstFile, Diagnostics.Conflicts_are_in_this_file) - 42313: error(location, Diagnostics.This_syntax_requires_an_imported_helper_named_1_which_does_not_exist_in_0_Consider_upgrading_your_version_of_0, externalHelpersModuleNameText, name); - 42317: error(location, Diagnostics.This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_one_in_0_Consider_upgrading_your_version_of_0, externalHelpersModuleNameText, name, 4); - 42322: error(location, Diagnostics.This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_one_in_0_Consider_upgrading_your_version_of_0, externalHelpersModuleNameText, name, 5); - 42327: error(location, Diagnostics.This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_one_in_0_Consider_upgrading_your_version_of_0, externalHelpersModuleNameText, name, 3); - 42369: externalHelpersModule = resolveExternalModule(node, externalHelpersModuleNameText, Diagnostics.This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found, errorNode) || unknownSymbol; - 42385: return grammarErrorOnFirstToken(node, Diagnostics.A_decorator_can_only_decorate_a_method_implementation_not_an_overload); - 42388: return grammarErrorOnFirstToken(node, Diagnostics.Decorators_are_not_valid_here); - 42394: return grammarErrorOnFirstToken(node, Diagnostics.Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name); - 42411: return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_type_member, tokenToString(modifier.kind)); - 42414: return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_an_index_signature, tokenToString(modifier.kind)); - 42420: return grammarErrorOnNode(node, Diagnostics.A_class_member_cannot_have_the_0_keyword, tokenToString(SyntaxKind.ConstKeyword)); - 42426: return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, "override"); - 42429: return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "override", "declare"); - 42432: return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "override", "readonly"); - 42435: return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "override", "async"); - 42447: return grammarErrorOnNode(modifier, Diagnostics.Accessibility_modifier_already_seen); - 42450: return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, text, "override"); - 42453: return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, text, "static"); - 42456: return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, text, "readonly"); - 42459: return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, text, "async"); - 42462: return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, text); - 42466: return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, text, "abstract"); - 42469: return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, text, "abstract"); - 42473: return grammarErrorOnNode(modifier, Diagnostics.An_accessibility_modifier_cannot_be_used_with_a_private_identifier); - 42480: return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, "static"); - 42483: return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "static", "readonly"); - 42486: return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "static", "async"); - 42489: return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, "static"); - 42492: return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static"); - 42495: return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "static", "abstract"); - 42498: return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "static", "override"); - 42506: return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, "readonly"); - 42510: return grammarErrorOnNode(modifier, Diagnostics.readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature); - 42518: return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, "export"); - 42521: return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "export", "declare"); - 42524: return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "export", "abstract"); - 42527: return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "export", "async"); - 42530: return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_class_elements_of_this_kind, "export"); - 42533: return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export"); - 42540: return grammarErrorOnNode(modifier, Diagnostics.A_default_export_can_only_be_used_in_an_ECMAScript_style_module); - 42543: return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "export", "default"); - 42550: return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, "declare"); - 42553: return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); - 42556: return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "override"); - 42559: return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_class_elements_of_this_kind, "declare"); - 42562: return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); - 42565: return grammarErrorOnNode(modifier, Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); - 42568: return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_a_private_identifier, "declare"); - 42576: return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, "abstract"); - 42584: return grammarErrorOnNode(modifier, Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration); - 42587: return grammarErrorOnNode(modifier, Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class); - 42590: return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "static", "abstract"); - 42593: return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "private", "abstract"); - 42596: return grammarErrorOnNode(lastAsync, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "async", "abstract"); - 42599: return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "abstract", "override"); - 42603: return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_a_private_identifier, "abstract"); - 42611: return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, "async"); - 42614: return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); - 42617: return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_parameter, "async"); - 42620: return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "async", "abstract"); - 42630: return grammarErrorOnNode(lastStatic!, Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static"); - 42633: return grammarErrorOnNode(lastStatic!, Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "abstract"); // TODO: GH#18217 - 42636: return grammarErrorOnNode(lastOverride!, Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "override"); // TODO: GH#18217 - 42639: return grammarErrorOnNode(lastAsync!, Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "async"); - 42642: return grammarErrorOnNode(lastReadonly!, Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "readonly"); - 42647: return grammarErrorOnNode(lastDeclare!, Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare"); - 42650: return grammarErrorOnNode(node, Diagnostics.A_parameter_property_may_not_be_declared_using_a_binding_pattern); - 42653: return grammarErrorOnNode(node, Diagnostics.A_parameter_property_cannot_be_declared_using_a_rest_parameter); - 42669: ? grammarErrorOnFirstToken(node, Diagnostics.Modifiers_cannot_appear_here) - 42726: return grammarErrorOnNode(asyncModifier, Diagnostics._0_modifier_cannot_be_used_here, "async"); - 42729: function checkGrammarForDisallowedTrailingComma(list: NodeArray | undefined, diag = Diagnostics.Trailing_comma_not_allowed): boolean { - 42740: return grammarErrorAtPos(file, start, end - start, Diagnostics.Type_parameter_list_cannot_be_empty); - 42753: return grammarErrorOnNode(parameter.dotDotDotToken, Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list); - 42756: checkGrammarForDisallowedTrailingComma(parameters, Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma); - 42760: return grammarErrorOnNode(parameter.questionToken, Diagnostics.A_rest_parameter_cannot_be_optional); - 42764: return grammarErrorOnNode(parameter.name, Diagnostics.A_rest_parameter_cannot_have_an_initializer); - 42770: return grammarErrorOnNode(parameter.name, Diagnostics.Parameter_cannot_have_question_mark_and_initializer); - 42774: return grammarErrorOnNode(parameter.name, Diagnostics.A_required_parameter_cannot_follow_an_optional_parameter); - 42791: error(parameter, Diagnostics.This_parameter_is_not_allowed_with_use_strict_directive), - 42792: createDiagnosticForNode(useStrictDirective, Diagnostics.use_strict_directive_used_here) - 42797: index === 0 ? createDiagnosticForNode(parameter, Diagnostics.Non_simple_parameter_declared_here) : createDiagnosticForNode(parameter, Diagnostics.and_here) - 42799: addRelatedInfo(error(useStrictDirective, Diagnostics.use_strict_directive_cannot_be_used_with_non_simple_parameter_list), ...diagnostics); - 42830: grammarErrorOnNode(node.typeParameters[0], Diagnostics.This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Add_a_trailing_comma_or_explicit_constraint); - 42837: return startLine !== endLine && grammarErrorOnNode(equalsGreaterThanToken, Diagnostics.Line_terminator_not_permitted_before_arrow); - 42844: return grammarErrorOnNode(parameter.name, Diagnostics.An_index_signature_must_have_exactly_one_parameter); - 42847: return grammarErrorOnNode(node, Diagnostics.An_index_signature_must_have_exactly_one_parameter); - 42850: checkGrammarForDisallowedTrailingComma(node.parameters, Diagnostics.An_index_signature_cannot_have_a_trailing_comma); - 42852: return grammarErrorOnNode(parameter.dotDotDotToken, Diagnostics.An_index_signature_cannot_have_a_rest_parameter); - 42855: return grammarErrorOnNode(parameter.name, Diagnostics.An_index_signature_parameter_cannot_have_an_accessibility_modifier); - 42858: return grammarErrorOnNode(parameter.questionToken, Diagnostics.An_index_signature_parameter_cannot_have_a_question_mark); - 42861: return grammarErrorOnNode(parameter.name, Diagnostics.An_index_signature_parameter_cannot_have_an_initializer); - 42864: return grammarErrorOnNode(parameter.name, Diagnostics.An_index_signature_parameter_must_have_a_type_annotation); - 42868: return grammarErrorOnNode(parameter.name, Diagnostics.An_index_signature_parameter_type_cannot_be_a_literal_type_or_generic_type_Consider_using_a_mapped_object_type_instead); - 42871: return grammarErrorOnNode(parameter.name, Diagnostics.An_index_signature_parameter_type_must_be_string_number_symbol_or_a_template_literal_type); - 42874: return grammarErrorOnNode(node, Diagnostics.An_index_signature_must_have_a_type_annotation); - 42889: return grammarErrorAtPos(sourceFile, start, end - start, Diagnostics.Type_argument_list_cannot_be_empty); - 42901: return grammarErrorOnNode(node.template, Diagnostics.Tagged_template_expressions_are_not_permitted_in_an_optional_chain); - 42910: return grammarErrorAtPos(arg, arg.pos, 0, Diagnostics.Argument_expression_expected); - 42928: return grammarErrorAtPos(node, types.pos, 0, Diagnostics._0_list_cannot_be_empty, listType); - 42945: return grammarErrorOnFirstToken(heritageClause, Diagnostics.extends_clause_already_seen); - 42949: return grammarErrorOnFirstToken(heritageClause, Diagnostics.extends_clause_must_precede_implements_clause); - 42953: return grammarErrorOnFirstToken(heritageClause.types[1], Diagnostics.Classes_can_only_extend_a_single_class); - 42961: return grammarErrorOnFirstToken(heritageClause, Diagnostics.implements_clause_already_seen); - 42980: return grammarErrorOnFirstToken(heritageClause, Diagnostics.extends_clause_already_seen); - 42987: return grammarErrorOnFirstToken(heritageClause, Diagnostics.Interface_declaration_cannot_have_implements_clause); - 43005: return grammarErrorOnNode(computedPropertyName.expression, Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name); - 43017: return grammarErrorOnNode(node.asteriskToken, Diagnostics.Generators_are_not_allowed_in_an_ambient_context); - 43020: return grammarErrorOnNode(node.asteriskToken, Diagnostics.An_overload_signature_cannot_be_declared_as_a_generator); - 43042: return grammarErrorOnNode(prop.expression, Diagnostics.A_rest_element_cannot_contain_a_binding_pattern); - 43056: return grammarErrorOnNode(prop.equalsToken!, Diagnostics.Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_part_of_a_destructuring_pattern); - 43060: grammarErrorOnNode(name, Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies); - 43067: grammarErrorOnNode(mod, Diagnostics._0_modifier_cannot_be_used_here, getTextOfNode(mod)); - 43083: checkGrammarForInvalidExclamationToken(prop.exclamationToken, Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context); - 43087: checkGrammarForInvalidQuestionMark(prop.questionToken, Diagnostics.An_object_member_cannot_be_declared_optional); - 43118: grammarErrorOnNode(name, Diagnostics.Duplicate_identifier_0, getTextOfNode(name)); - 43125: return grammarErrorOnNode(name, Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name); - 43129: return grammarErrorOnNode(name, Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name); - 43151: return grammarErrorOnNode(name, Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); - 43155: return grammarErrorOnNode(initializer, Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression); - 43178: return grammarErrorOnNode(name, Diagnostics.JSX_property_access_expressions_cannot_include_JSX_namespace_names); - 43185: return grammarErrorOnNode(node.expression, Diagnostics.JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array); - 43201: Diagnostics.for_await_loops_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module)); - 43205: Diagnostics.Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher)); - 43212: const diagnostic = createDiagnosticForNode(forInOrOfStatement.awaitModifier, Diagnostics.for_await_loops_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules); - 43216: const relatedInfo = createDiagnosticForNode(func, Diagnostics.Did_you_mean_to_mark_this_function_as_async); - 43229: grammarErrorOnNode(forInOrOfStatement.initializer, Diagnostics.The_left_hand_side_of_a_for_of_statement_may_not_be_async); - 43251: ? Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement - 43252: : Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement; - 43259: ? Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer - 43260: : Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer; - 43265: ? Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation - 43266: : Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation; - 43278: return grammarErrorOnNode(accessor.name, Diagnostics.Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher); - 43281: return grammarErrorOnNode(accessor.name, Diagnostics.Private_identifiers_are_only_available_when_targeting_ECMAScript_2015_and_higher); - 43284: return grammarErrorAtPos(accessor, accessor.end - 1, ";".length, Diagnostics._0_expected, "{"); - 43289: return grammarErrorOnNode(accessor, Diagnostics.An_abstract_accessor_cannot_have_an_implementation); - 43292: return grammarErrorOnNode(accessor.body, Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts); - 43296: return grammarErrorOnNode(accessor.name, Diagnostics.An_accessor_cannot_have_type_parameters); - 43301: Diagnostics.A_get_accessor_cannot_have_parameters : - 43302: Diagnostics.A_set_accessor_must_have_exactly_one_parameter); - 43306: return grammarErrorOnNode(accessor.name, Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation); - 43310: return grammarErrorOnNode(parameter.dotDotDotToken, Diagnostics.A_set_accessor_cannot_have_rest_parameter); - 43313: return grammarErrorOnNode(parameter.questionToken, Diagnostics.A_set_accessor_cannot_have_an_optional_parameter); - 43316: return grammarErrorOnNode(accessor.name, Diagnostics.A_set_accessor_parameter_cannot_have_an_initializer); - 43339: return grammarErrorOnNode(node.type, Diagnostics._0_expected, tokenToString(SyntaxKind.SymbolKeyword)); - 43354: return grammarErrorOnNode(node, Diagnostics.unique_symbol_types_may_not_be_used_on_a_variable_declaration_with_a_binding_name); - 43357: return grammarErrorOnNode(node, Diagnostics.unique_symbol_types_are_only_allowed_on_variables_in_a_variable_statement); - 43360: return grammarErrorOnNode((parent as VariableDeclaration).name, Diagnostics.A_variable_whose_type_is_a_unique_symbol_type_must_be_const); - 43367: return grammarErrorOnNode((parent as PropertyDeclaration).name, Diagnostics.A_property_of_a_class_whose_type_is_a_unique_symbol_type_must_be_both_static_and_readonly); - 43373: return grammarErrorOnNode((parent as PropertySignature).name, Diagnostics.A_property_of_an_interface_or_type_literal_whose_type_is_a_unique_symbol_type_must_be_readonly); - 43378: return grammarErrorOnNode(node, Diagnostics.unique_symbol_types_are_not_allowed_here); - 43383: return grammarErrorOnFirstToken(node, Diagnostics.readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types, tokenToString(SyntaxKind.SymbolKeyword)); - 43403: return grammarErrorOnFirstToken(node, Diagnostics.Modifiers_cannot_appear_here); - 43405: else if (checkGrammarForInvalidQuestionMark(node.questionToken, Diagnostics.An_object_member_cannot_be_declared_optional)) { - 43408: else if (checkGrammarForInvalidExclamationToken(node.exclamationToken, Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context)) { - 43412: return grammarErrorAtPos(node, node.end - 1, ";".length, Diagnostics._0_expected, "{"); - 43422: return grammarErrorOnNode(node.name, Diagnostics.Private_identifiers_are_only_available_when_targeting_ECMAScript_2015_and_higher); - 43430: return checkGrammarForInvalidDynamicName(node.name, Diagnostics.A_computed_property_name_in_an_ambient_context_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type); - 43433: return checkGrammarForInvalidDynamicName(node.name, Diagnostics.A_computed_property_name_in_a_method_overload_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type); - 43437: return checkGrammarForInvalidDynamicName(node.name, Diagnostics.A_computed_property_name_in_an_interface_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type); - 43440: return checkGrammarForInvalidDynamicName(node.name, Diagnostics.A_computed_property_name_in_a_type_literal_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type); - 43448: return grammarErrorOnNode(node, Diagnostics.Jump_target_cannot_cross_function_boundary); - 43460: return grammarErrorOnNode(node, Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement); - 43485: ? Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement - 43486: : Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement; - 43492: ? Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement - 43493: : Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; - 43502: return grammarErrorOnNode(node, Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern); - 43504: checkGrammarForDisallowedTrailingComma(elements, Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma); - 43507: return grammarErrorOnNode(node.name, Diagnostics.A_rest_element_cannot_have_a_property_name); - 43513: return grammarErrorAtPos(node, node.initializer.pos - 1, 1, Diagnostics.A_rest_element_cannot_have_an_initializer); - 43548: return grammarErrorOnNode(initializer, Diagnostics.A_const_initializer_in_an_ambient_context_must_be_a_string_or_numeric_literal_or_literal_enum_reference); - 43552: return grammarErrorOnNode(initializer, Diagnostics.Initializers_are_not_allowed_in_ambient_contexts); - 43555: return grammarErrorOnNode(initializer, Diagnostics.Initializers_are_not_allowed_in_ambient_contexts); - 43567: return grammarErrorOnNode(node, Diagnostics.A_destructuring_declaration_must_have_an_initializer); - 43570: return grammarErrorOnNode(node, Diagnostics.const_declarations_must_be_initialized); - 43577: ? Diagnostics.Declarations_with_initializers_cannot_also_have_definite_assignment_assertions - 43579: ? Diagnostics.Declarations_with_definite_assignment_assertions_must_also_have_type_annotations - 43580: : Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context; - 43604: return grammarErrorOnNodeSkippedOn("noEmit", name, Diagnostics.Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules); - 43621: return grammarErrorOnNode(name, Diagnostics.let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations); - 43642: return grammarErrorAtPos(declarationList, declarations.pos, declarations.end - declarations.pos, Diagnostics.Variable_declaration_list_cannot_be_empty); - 43667: return grammarErrorOnNode(node, Diagnostics.let_declarations_can_only_be_declared_inside_a_block); - 43670: return grammarErrorOnNode(node, Diagnostics.const_declarations_can_only_be_declared_inside_a_block); - 43680: return grammarErrorOnNode(node.name, Diagnostics._0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2, node.name.escapedText, tokenToString(node.keywordToken), "target"); - 43685: return grammarErrorOnNode(node.name, Diagnostics._0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2, node.name.escapedText, tokenToString(node.keywordToken), "meta"); - 43692: return sourceFile.parseDiagnostics.length > 0; - 43737: return grammarErrorAtPos(node, pos, range.end - pos, Diagnostics.Type_parameters_cannot_appear_on_a_constructor_declaration); - 43744: return grammarErrorOnNode(type, Diagnostics.Type_annotation_cannot_appear_on_a_constructor_declaration); - 43752: Diagnostics.A_mapped_type_may_not_declare_properties_or_methods); - 43756: return grammarErrorOnNode(node.name, Diagnostics.Classes_may_not_have_a_field_named_constructor); - 43758: if (checkGrammarForInvalidDynamicName(node.name, Diagnostics.A_computed_property_name_in_a_class_property_declaration_must_have_a_simple_literal_type_or_a_unique_symbol_type)) { - 43762: return grammarErrorOnNode(node.name, Diagnostics.Private_identifiers_are_only_available_when_targeting_ECMAScript_2015_and_higher); - 43766: if (checkGrammarForInvalidDynamicName(node.name, Diagnostics.A_computed_property_name_in_an_interface_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type)) { - 43770: return grammarErrorOnNode(node.initializer, Diagnostics.An_interface_property_cannot_have_an_initializer); - 43774: if (checkGrammarForInvalidDynamicName(node.name, Diagnostics.A_computed_property_name_in_a_type_literal_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type)) { - 43778: return grammarErrorOnNode(node.initializer, Diagnostics.A_type_literal_property_cannot_have_an_initializer); - 43789: ? Diagnostics.Declarations_with_initializers_cannot_also_have_definite_assignment_assertions - 43791: ? Diagnostics.Declarations_with_definite_assignment_assertions_must_also_have_type_annotations - 43792: : Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context; - 43821: return grammarErrorOnFirstToken(node, Diagnostics.Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier); - 43844: return getNodeLinks(node).hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts); - 43856: return links.hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, Diagnostics.Statements_are_not_allowed_in_ambient_contexts); - 43873: diagnosticMessage = Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0; - 43876: diagnosticMessage = Diagnostics.Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0; - 43879: diagnosticMessage = Diagnostics.Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0; - 43911: addErrorOrSuggestion(/*isError*/ false, createDiagnosticForNode(node, Diagnostics.Numeric_literals_with_absolute_values_equal_to_2_53_or_greater_are_too_large_to_be_represented_accurately_as_integers)); - 43919: if (grammarErrorOnNode(node, Diagnostics.BigInt_literals_are_not_available_when_targeting_lower_than_ES2020)) { - 43952: return grammarErrorOnNode(node, Diagnostics.A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both); - 43966: ? Diagnostics.The_type_modifier_cannot_be_used_on_a_named_import_when_import_type_is_used_on_its_import_statement - 43967: : Diagnostics.The_type_modifier_cannot_be_used_on_a_named_export_when_export_type_is_used_on_its_export_statement); - 43974: return grammarErrorOnNode(node, Diagnostics.Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd_system_umd_node12_or_nodenext); - 43978: return grammarErrorOnNode(node, Diagnostics.Dynamic_import_cannot_have_type_arguments); - 43988: return grammarErrorOnNode(assertionArgument, Diagnostics.Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_or_nodenext); - 43993: return grammarErrorOnNode(node, Diagnostics.Dynamic_imports_can_only_accept_a_module_specifier_and_an_optional_assertion_as_arguments); - 44000: return grammarErrorOnNode(spreadElement, Diagnostics.Argument_of_dynamic_import_cannot_be_spread_element); - -## grammarErrorOnFirstToken (32) ## - 33448: Diagnostics.A_yield_expression_is_only_allowed_in_a_generator_body - // this is a normal ReferenceError in JS -yield -function nonGenerator() { yield } - 34113: Diagnostics.Type_expected - 38090: Diagnostics.A_return_statement_cannot_be_used_inside_a_class_static_block - class C { static { return } } - 38095: Diagnostics.A_return_statement_can_only_be_used_within_a_function_body - return - 38137: Diagnostics.with_statements_are_not_allowed_in_an_async_function_block - guess this isn't really an error in JS (at least V8) - 38244: Diagnostics.Catch_clause_variable_type_annotation_must_be_any_or_unknown_if_specified - 38248: Diagnostics.Catch_clause_variable_cannot_have_an_initializer - try { } catch (e = 1) { } - 38504: Diagnostics.A_class_declaration_without_the_default_modifier_must_have_a_name - class { } - 39587: Diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations - 39591: Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module - 39788: Diagnostics.An_import_declaration_cannot_have_modifiers - export import 'fs' - 39862: Diagnostics.An_export_declaration_cannot_have_modifiers -export export { C } - 39926: Diagnostics.An_export_assignment_cannot_have_modifiers - 39941: checkGrammarModuleElementContext - Diagnostics.An_import_declaration_can_only_be_used_in_a_namespace_or_module -function f() { import 'fs' } - Diagnostics.An_export_declaration_can_only_be_used_in_a_module -function f() { export { C } } - ? Diagnostics.An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file - : Diagnostics.A_namespace_declaration_is_only_allowed_in_a_namespace_or_module; - ? Diagnostics.An_export_assignment_must_be_at_the_top_level_of_a_file_or_module_declaration - : Diagnostics.A_default_export_must_be_at_the_top_level_of_a_file_or_module_declaration; -function f() { export default 12 } - 42385: Diagnostics.A_decorator_can_only_decorate_a_method_implementation_not_an_overload - 42388: Diagnostics.Decorators_are_not_valid_here - 42394: Diagnostics.Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name - 42669: Diagnostics.Modifiers_cannot_appear_here - 42945: Diagnostics.extends_clause_already_seen - 42949: Diagnostics.extends_clause_must_precede_implements_clause - 42953: Diagnostics.Classes_can_only_extend_a_single_class - 42961: Diagnostics.implements_clause_already_seen - 42980: Diagnostics.extends_clause_already_seen - 42987: Diagnostics.Interface_declaration_cannot_have_implements_clause - 43251: Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement -for (let y, x in [1,2,3]) { - console.log(x) -} - 43252: Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement; -for (let y, x of [1,2,3]) { - console.log(x) -} - -43253: Diagnostics.readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types - 43403: Diagnostics.Modifiers_cannot_appear_here - 43695: DiagnosticMessage - 43821: Diagnostics.Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier - 43844: Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts - 43856: Diagnostics.Statements_are_not_allowed_in_ambient_contexts - 43963: return grammarErrorOnFirstToken( - -## grammarErrorAtPos (15) ## - - 34787: Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments - 38147: Diagnostics.The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any - 42731: return grammarErrorAtPos(list[0], list.end - ",".length, ",".length, diag); - Diagnostics.Trailing_comma_not_allowed -var x = 1, y = 2,; - Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma -export function f (...x: any[],) { -} - 42740: Diagnostics.Type_parameter_list_cannot_be_empty - 42889: Diagnostics.Type_argument_list_cannot_be_empty - 42910: Diagnostics.Argument_expression_expected -f(1,,2) <-- happens in parser first though - 42928: Diagnostics._0_list_cannot_be_empty -class MissingExtends extends { } - 43284: Diagnostics._0_expected - 43412: Diagnostics._0_expected - 43513: Diagnostics.A_rest_element_cannot_have_an_initializer -const o = { e: 1, m: 1, name: "knee-deep" } -const { e: a, m: n, ...est = 1 } = o - 43642: Diagnostics.Variable_declaration_list_cannot_be_empty - var; - 43737: Diagnostics.Type_parameters_cannot_appear_on_a_constructor_declaration From 18a4df45d42827095db027196239291de93f08d1 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Tue, 15 Mar 2022 15:59:41 -0700 Subject: [PATCH 7/7] Revert getNodePos addition --- src/compiler/parser.ts | 17 ++++++++++------- ...uctorWithIncompleteTypeAnnotation.errors.txt | 2 +- ...WithDotFollowedByNamespaceKeyword.errors.txt | 2 +- .../reference/exportInFunction.errors.txt | 2 +- .../reference/missingCloseBrace.errors.txt | 2 +- .../missingCloseBraceInObjectLiteral.errors.txt | 2 +- .../missingCloseBracketInArray.errors.txt | 2 +- .../missingCloseParenStatements.errors.txt | 6 +++--- .../parserErrorRecoveryIfStatement2.errors.txt | 2 +- .../parserErrorRecoveryIfStatement3.errors.txt | 2 +- ...arserErrorRecovery_ObjectLiteral2.errors.txt | 2 +- ...arserErrorRecovery_ObjectLiteral3.errors.txt | 2 +- ...arserErrorRecovery_ObjectLiteral4.errors.txt | 2 +- ...arserErrorRecovery_ObjectLiteral5.errors.txt | 2 +- ...serErrorRecovery_SwitchStatement2.errors.txt | 2 +- .../prettyContextNotDebugAssertion.errors.txt | 6 +++--- ...ic-diagnostics-are-returned-with-no-error.js | 4 ++-- 17 files changed, 31 insertions(+), 28 deletions(-) diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 98d2f394b3277..69e9ada739c03 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -5792,10 +5792,11 @@ namespace ts { function parseArrayLiteralExpression(): ArrayLiteralExpression { const pos = getNodePos(); + const openBracketPosition = scanner.getTokenPos(); const openBracketParsed = parseExpected(SyntaxKind.OpenBracketToken); const multiLine = scanner.hasPrecedingLineBreak(); const elements = parseDelimitedList(ParsingContext.ArrayLiteralMembers, parseArgumentOrArrayLiteralElement); - parseExpectedMatchingBrackets(SyntaxKind.OpenBracketToken, SyntaxKind.CloseBracketToken, openBracketParsed, pos); + parseExpectedMatchingBrackets(SyntaxKind.OpenBracketToken, SyntaxKind.CloseBracketToken, openBracketParsed, openBracketPosition); return finishNode(factory.createArrayLiteralExpression(elements, multiLine), pos); } @@ -5860,10 +5861,11 @@ namespace ts { function parseObjectLiteralExpression(): ObjectLiteralExpression { const pos = getNodePos(); + const openBracePosition = scanner.getTokenPos(); const openBraceParsed = parseExpected(SyntaxKind.OpenBraceToken); const multiLine = scanner.hasPrecedingLineBreak(); const properties = parseDelimitedList(ParsingContext.ObjectLiteralMembers, parseObjectLiteralElement, /*considerSemicolonAsDelimiter*/ true); - parseExpectedMatchingBrackets(SyntaxKind.OpenBraceToken, SyntaxKind.CloseBraceToken, openBraceParsed, pos); + parseExpectedMatchingBrackets(SyntaxKind.OpenBraceToken, SyntaxKind.CloseBraceToken, openBraceParsed, openBracePosition); return finishNode(factory.createObjectLiteralExpression(properties, multiLine), pos); } @@ -5926,11 +5928,12 @@ namespace ts { function parseBlock(ignoreMissingOpenBrace: boolean, diagnosticMessage?: DiagnosticMessage): Block { const pos = getNodePos(); const hasJSDoc = hasPrecedingJSDocComment(); + const openBracePosition = scanner.getTokenPos(); const openBraceParsed = parseExpected(SyntaxKind.OpenBraceToken, diagnosticMessage); if (openBraceParsed || ignoreMissingOpenBrace) { const multiLine = scanner.hasPrecedingLineBreak(); const statements = parseList(ParsingContext.BlockStatements, parseStatement); - parseExpectedMatchingBrackets(SyntaxKind.OpenBraceToken, SyntaxKind.CloseBraceToken, openBraceParsed, pos); + 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); @@ -5986,7 +5989,7 @@ namespace ts { const pos = getNodePos(); const hasJSDoc = hasPrecedingJSDocComment(); parseExpected(SyntaxKind.IfKeyword); - const openParenPosition = getNodePos(); + const openParenPosition = scanner.getTokenPos(); const openParenParsed = parseExpected(SyntaxKind.OpenParenToken); const expression = allowInAnd(parseExpression); parseExpectedMatchingBrackets(SyntaxKind.OpenParenToken, SyntaxKind.CloseParenToken, openParenParsed, openParenPosition); @@ -6001,7 +6004,7 @@ namespace ts { parseExpected(SyntaxKind.DoKeyword); const statement = parseStatement(); parseExpected(SyntaxKind.WhileKeyword); - const openParenPosition = getNodePos(); + const openParenPosition = scanner.getTokenPos(); const openParenParsed = parseExpected(SyntaxKind.OpenParenToken); const expression = allowInAnd(parseExpression); parseExpectedMatchingBrackets(SyntaxKind.OpenParenToken, SyntaxKind.CloseParenToken, openParenParsed, openParenPosition); @@ -6018,7 +6021,7 @@ namespace ts { const pos = getNodePos(); const hasJSDoc = hasPrecedingJSDocComment(); parseExpected(SyntaxKind.WhileKeyword); - const openParenPosition = getNodePos(); + const openParenPosition = scanner.getTokenPos(); const openParenParsed = parseExpected(SyntaxKind.OpenParenToken); const expression = allowInAnd(parseExpression); parseExpectedMatchingBrackets(SyntaxKind.OpenParenToken, SyntaxKind.CloseParenToken, openParenParsed, openParenPosition); @@ -6097,7 +6100,7 @@ namespace ts { const pos = getNodePos(); const hasJSDoc = hasPrecedingJSDocComment(); parseExpected(SyntaxKind.WithKeyword); - const openParenPosition = getNodePos(); + const openParenPosition = scanner.getTokenPos(); const openParenParsed = parseExpected(SyntaxKind.OpenParenToken); const expression = allowInAnd(parseExpression); parseExpectedMatchingBrackets(SyntaxKind.OpenParenToken, SyntaxKind.CloseParenToken, openParenParsed, openParenPosition); diff --git a/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.errors.txt b/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.errors.txt index 25324c8de8a53..2e95e0d27dfdc 100644 --- a/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.errors.txt +++ b/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.errors.txt @@ -121,7 +121,7 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(261,1): error TS if (retValue != 0 ^= { ~~ !!! error TS1005: ')' expected. -!!! related TS1007 tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts:22:19: The parser expected to find a ')' to match the '(' token here. +!!! related TS1007 tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts:22:20: The parser expected to find a ')' to match the '(' token here. ~ diff --git a/tests/baselines/reference/errorRecoveryWithDotFollowedByNamespaceKeyword.errors.txt b/tests/baselines/reference/errorRecoveryWithDotFollowedByNamespaceKeyword.errors.txt index eb5873670cf62..6bac67291472c 100644 --- a/tests/baselines/reference/errorRecoveryWithDotFollowedByNamespaceKeyword.errors.txt +++ b/tests/baselines/reference/errorRecoveryWithDotFollowedByNamespaceKeyword.errors.txt @@ -16,4 +16,4 @@ tests/cases/compiler/errorRecoveryWithDotFollowedByNamespaceKeyword.ts(9,2): err } !!! error TS1005: '}' expected. -!!! related TS1007 tests/cases/compiler/errorRecoveryWithDotFollowedByNamespaceKeyword.ts:3:18: The parser expected to find a '}' to match the '{' token here. \ No newline at end of file +!!! related TS1007 tests/cases/compiler/errorRecoveryWithDotFollowedByNamespaceKeyword.ts:3:19: The parser expected to find a '}' to match the '{' token here. \ No newline at end of file diff --git a/tests/baselines/reference/exportInFunction.errors.txt b/tests/baselines/reference/exportInFunction.errors.txt index f76393405c77a..bfd43b23477cc 100644 --- a/tests/baselines/reference/exportInFunction.errors.txt +++ b/tests/baselines/reference/exportInFunction.errors.txt @@ -7,4 +7,4 @@ tests/cases/compiler/exportInFunction.ts(3,1): error TS1005: '}' expected. !!! error TS1005: '}' expected. -!!! related TS1007 tests/cases/compiler/exportInFunction.ts:1:13: The parser expected to find a '}' to match the '{' token here. \ No newline at end of file +!!! related TS1007 tests/cases/compiler/exportInFunction.ts:1:14: The parser expected to find a '}' to match the '{' token here. \ No newline at end of file diff --git a/tests/baselines/reference/missingCloseBrace.errors.txt b/tests/baselines/reference/missingCloseBrace.errors.txt index 0d48c82985f99..27db81d27da94 100644 --- a/tests/baselines/reference/missingCloseBrace.errors.txt +++ b/tests/baselines/reference/missingCloseBrace.errors.txt @@ -13,4 +13,4 @@ tests/cases/compiler/missingCloseBrace.ts(9,1): error TS1005: '}' expected. !!! error TS1005: '}' expected. -!!! related TS1007 tests/cases/compiler/missingCloseBrace.ts:1:21: The parser expected to find a '}' to match the '{' token here. \ No newline at end of file +!!! related TS1007 tests/cases/compiler/missingCloseBrace.ts:1:22: The parser expected to find a '}' to match the '{' token here. \ No newline at end of file diff --git a/tests/baselines/reference/missingCloseBraceInObjectLiteral.errors.txt b/tests/baselines/reference/missingCloseBraceInObjectLiteral.errors.txt index 23bd8f0e4adab..436c8843c7582 100644 --- a/tests/baselines/reference/missingCloseBraceInObjectLiteral.errors.txt +++ b/tests/baselines/reference/missingCloseBraceInObjectLiteral.errors.txt @@ -9,4 +9,4 @@ tests/cases/compiler/missingCloseBraceInObjectLiteral.ts(5,1): error TS1005: '}' !!! error TS1005: '}' expected. -!!! related TS1007 tests/cases/compiler/missingCloseBraceInObjectLiteral.ts:1:10: The parser expected to find a '}' to match the '{' token here. \ No newline at end of file +!!! related TS1007 tests/cases/compiler/missingCloseBraceInObjectLiteral.ts:1:11: The parser expected to find a '}' to match the '{' token here. \ No newline at end of file diff --git a/tests/baselines/reference/missingCloseBracketInArray.errors.txt b/tests/baselines/reference/missingCloseBracketInArray.errors.txt index 6efe976750d53..26801c02812b4 100644 --- a/tests/baselines/reference/missingCloseBracketInArray.errors.txt +++ b/tests/baselines/reference/missingCloseBracketInArray.errors.txt @@ -5,4 +5,4 @@ tests/cases/compiler/missingCloseBracketInArray.ts(1,48): error TS1005: ']' expe var alphas:string[] = alphas = ["1","2","3","4" !!! error TS1005: ']' expected. -!!! related TS1007 tests/cases/compiler/missingCloseBracketInArray.ts:1:31: The parser expected to find a ']' to match the '[' token here. \ No newline at end of file +!!! related TS1007 tests/cases/compiler/missingCloseBracketInArray.ts:1:32: The parser expected to find a ']' to match the '[' token here. \ No newline at end of file diff --git a/tests/baselines/reference/missingCloseParenStatements.errors.txt b/tests/baselines/reference/missingCloseParenStatements.errors.txt index 3cae4b65bcd4f..3f49d5a036653 100644 --- a/tests/baselines/reference/missingCloseParenStatements.errors.txt +++ b/tests/baselines/reference/missingCloseParenStatements.errors.txt @@ -9,7 +9,7 @@ tests/cases/compiler/missingCloseParenStatements.ts(11,35): error TS1005: ')' ex if ( a1 && (a2 + a3 > 0) { ~ !!! error TS1005: ')' expected. -!!! related TS1007 tests/cases/compiler/missingCloseParenStatements.ts:2:3: The parser expected to find a ')' to match the '(' token here. +!!! related TS1007 tests/cases/compiler/missingCloseParenStatements.ts:2:4: The parser expected to find a ')' to match the '(' token here. while( (a2 > 0) && a1 { ~ @@ -21,12 +21,12 @@ tests/cases/compiler/missingCloseParenStatements.ts(11,35): error TS1005: ')' ex with ((a2 + a3 > 0) && a1 { ~ !!! error TS1005: ')' expected. -!!! related TS1007 tests/cases/compiler/missingCloseParenStatements.ts:8:17: The parser expected to find a ')' to match the '(' token here. +!!! related TS1007 tests/cases/compiler/missingCloseParenStatements.ts:8:18: The parser expected to find a ')' to match the '(' token here. console.log(x); } } while (i < 5 && (a1 > 5); ~ !!! error TS1005: ')' expected. -!!! related TS1007 tests/cases/compiler/missingCloseParenStatements.ts:11:16: The parser expected to find a ')' to match the '(' token here. +!!! related TS1007 tests/cases/compiler/missingCloseParenStatements.ts:11:17: The parser expected to find a ')' to match the '(' token here. } } \ No newline at end of file diff --git a/tests/baselines/reference/parserErrorRecoveryIfStatement2.errors.txt b/tests/baselines/reference/parserErrorRecoveryIfStatement2.errors.txt index 806f2cf7914dc..b88c48182a27b 100644 --- a/tests/baselines/reference/parserErrorRecoveryIfStatement2.errors.txt +++ b/tests/baselines/reference/parserErrorRecoveryIfStatement2.errors.txt @@ -11,7 +11,7 @@ tests/cases/conformance/parser/ecmascript5/ErrorRecovery/IfStatements/parserErro } ~ !!! error TS1005: ')' expected. -!!! related TS1007 tests/cases/conformance/parser/ecmascript5/ErrorRecovery/IfStatements/parserErrorRecoveryIfStatement2.ts:3:7: The parser expected to find a ')' to match the '(' token here. +!!! related TS1007 tests/cases/conformance/parser/ecmascript5/ErrorRecovery/IfStatements/parserErrorRecoveryIfStatement2.ts:3:8: The parser expected to find a ')' to match the '(' token here. f2() { } f3() { diff --git a/tests/baselines/reference/parserErrorRecoveryIfStatement3.errors.txt b/tests/baselines/reference/parserErrorRecoveryIfStatement3.errors.txt index a92e4f81fd2b2..cfd645e592542 100644 --- a/tests/baselines/reference/parserErrorRecoveryIfStatement3.errors.txt +++ b/tests/baselines/reference/parserErrorRecoveryIfStatement3.errors.txt @@ -11,7 +11,7 @@ tests/cases/conformance/parser/ecmascript5/ErrorRecovery/IfStatements/parserErro } ~ !!! error TS1005: ')' expected. -!!! related TS1007 tests/cases/conformance/parser/ecmascript5/ErrorRecovery/IfStatements/parserErrorRecoveryIfStatement3.ts:3:7: The parser expected to find a ')' to match the '(' token here. +!!! related TS1007 tests/cases/conformance/parser/ecmascript5/ErrorRecovery/IfStatements/parserErrorRecoveryIfStatement3.ts:3:8: The parser expected to find a ')' to match the '(' token here. f2() { } f3() { diff --git a/tests/baselines/reference/parserErrorRecovery_ObjectLiteral2.errors.txt b/tests/baselines/reference/parserErrorRecovery_ObjectLiteral2.errors.txt index 983e890edf9d4..1b1cb56af702c 100644 --- a/tests/baselines/reference/parserErrorRecovery_ObjectLiteral2.errors.txt +++ b/tests/baselines/reference/parserErrorRecovery_ObjectLiteral2.errors.txt @@ -15,4 +15,4 @@ tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ObjectLiterals/parserEr !!! error TS1005: ':' expected. !!! error TS1005: '}' expected. -!!! related TS1007 tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ObjectLiterals/parserErrorRecovery_ObjectLiteral2.ts:1:8: The parser expected to find a '}' to match the '{' token here. \ No newline at end of file +!!! related TS1007 tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ObjectLiterals/parserErrorRecovery_ObjectLiteral2.ts:1:9: The parser expected to find a '}' to match the '{' token here. \ No newline at end of file diff --git a/tests/baselines/reference/parserErrorRecovery_ObjectLiteral3.errors.txt b/tests/baselines/reference/parserErrorRecovery_ObjectLiteral3.errors.txt index 9c4912628a846..cfde9bcd8a35a 100644 --- a/tests/baselines/reference/parserErrorRecovery_ObjectLiteral3.errors.txt +++ b/tests/baselines/reference/parserErrorRecovery_ObjectLiteral3.errors.txt @@ -12,4 +12,4 @@ tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ObjectLiterals/parserEr !!! error TS1005: ':' expected. !!! error TS1005: '}' expected. -!!! related TS1007 tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ObjectLiterals/parserErrorRecovery_ObjectLiteral3.ts:1:8: The parser expected to find a '}' to match the '{' token here. \ No newline at end of file +!!! related TS1007 tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ObjectLiterals/parserErrorRecovery_ObjectLiteral3.ts:1:9: The parser expected to find a '}' to match the '{' token here. \ No newline at end of file diff --git a/tests/baselines/reference/parserErrorRecovery_ObjectLiteral4.errors.txt b/tests/baselines/reference/parserErrorRecovery_ObjectLiteral4.errors.txt index 29e666c681905..8b67b285eb7fe 100644 --- a/tests/baselines/reference/parserErrorRecovery_ObjectLiteral4.errors.txt +++ b/tests/baselines/reference/parserErrorRecovery_ObjectLiteral4.errors.txt @@ -12,4 +12,4 @@ tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ObjectLiterals/parserEr !!! error TS1005: ':' expected. !!! error TS1005: '}' expected. -!!! related TS1007 tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ObjectLiterals/parserErrorRecovery_ObjectLiteral4.ts:1:8: The parser expected to find a '}' to match the '{' token here. \ No newline at end of file +!!! related TS1007 tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ObjectLiterals/parserErrorRecovery_ObjectLiteral4.ts:1:9: The parser expected to find a '}' to match the '{' token here. \ No newline at end of file diff --git a/tests/baselines/reference/parserErrorRecovery_ObjectLiteral5.errors.txt b/tests/baselines/reference/parserErrorRecovery_ObjectLiteral5.errors.txt index 75826e126e9e9..3915b915e46a5 100644 --- a/tests/baselines/reference/parserErrorRecovery_ObjectLiteral5.errors.txt +++ b/tests/baselines/reference/parserErrorRecovery_ObjectLiteral5.errors.txt @@ -9,4 +9,4 @@ tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ObjectLiterals/parserEr !!! error TS1005: ':' expected. !!! error TS1005: '}' expected. -!!! related TS1007 tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ObjectLiterals/parserErrorRecovery_ObjectLiteral5.ts:1:8: The parser expected to find a '}' to match the '{' token here. \ No newline at end of file +!!! related TS1007 tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ObjectLiterals/parserErrorRecovery_ObjectLiteral5.ts:1:9: The parser expected to find a '}' to match the '{' token here. \ No newline at end of file diff --git a/tests/baselines/reference/parserErrorRecovery_SwitchStatement2.errors.txt b/tests/baselines/reference/parserErrorRecovery_SwitchStatement2.errors.txt index 0fe4208a0140c..2fca88d8bebb0 100644 --- a/tests/baselines/reference/parserErrorRecovery_SwitchStatement2.errors.txt +++ b/tests/baselines/reference/parserErrorRecovery_SwitchStatement2.errors.txt @@ -16,4 +16,4 @@ tests/cases/conformance/parser/ecmascript5/ErrorRecovery/SwitchStatements/parser } !!! error TS1005: '}' expected. -!!! related TS1007 tests/cases/conformance/parser/ecmascript5/ErrorRecovery/SwitchStatements/parserErrorRecovery_SwitchStatement2.ts:2:16: The parser expected to find a '}' to match the '{' token here. \ No newline at end of file +!!! related TS1007 tests/cases/conformance/parser/ecmascript5/ErrorRecovery/SwitchStatements/parserErrorRecovery_SwitchStatement2.ts:2:17: The parser expected to find a '}' to match the '{' token here. \ No newline at end of file diff --git a/tests/baselines/reference/prettyContextNotDebugAssertion.errors.txt b/tests/baselines/reference/prettyContextNotDebugAssertion.errors.txt index d88bc1147a317..1718e1d04e867 100644 --- a/tests/baselines/reference/prettyContextNotDebugAssertion.errors.txt +++ b/tests/baselines/reference/prettyContextNotDebugAssertion.errors.txt @@ -3,9 +3,9 @@ 2    - tests/cases/compiler/index.ts:1:10 + tests/cases/compiler/index.ts:1:11 1 if (true) { -    ~ +    ~ The parser expected to find a '}' to match the '{' token here. @@ -14,6 +14,6 @@ !!! error TS1005: '}' expected. -!!! related TS1007 tests/cases/compiler/index.ts:1:10: The parser expected to find a '}' to match the '{' token here. +!!! related TS1007 tests/cases/compiler/index.ts:1:11: The parser expected to find a '}' to match the '{' token here. Found 1 error in tests/cases/compiler/index.ts:2 diff --git a/tests/baselines/reference/tsserver/partialSemanticServer/syntactic-diagnostics-are-returned-with-no-error.js b/tests/baselines/reference/tsserver/partialSemanticServer/syntactic-diagnostics-are-returned-with-no-error.js index ca2e203294dcf..f7903c275312e 100644 --- a/tests/baselines/reference/tsserver/partialSemanticServer/syntactic-diagnostics-are-returned-with-no-error.js +++ b/tests/baselines/reference/tsserver/partialSemanticServer/syntactic-diagnostics-are-returned-with-no-error.js @@ -24,8 +24,8 @@ Open files: Projects: /dev/null/inferredProject1* response:{"responseRequired":false} request:{"type":"request","seq":1,"command":"syntacticDiagnosticsSync","arguments":{"file":"/user/username/projects/myproject/a.ts"}} -response:{"response":[{"start":{"line":1,"offset":17},"end":{"line":1,"offset":18},"text":"')' expected.","code":1005,"category":"error","relatedInformation":[{"span":{"start":{"line":1,"offset":3},"end":{"line":1,"offset":4},"file":"/user/username/projects/myproject/a.ts"},"message":"The parser expected to find a ')' to match the '(' token here.","category":"error","code":1007}]}],"responseRequired":true} +response:{"response":[{"start":{"line":1,"offset":17},"end":{"line":1,"offset":18},"text":"')' expected.","code":1005,"category":"error","relatedInformation":[{"span":{"start":{"line":1,"offset":4},"end":{"line":1,"offset":5},"file":"/user/username/projects/myproject/a.ts"},"message":"The parser expected to find a ')' to match the '(' token here.","category":"error","code":1007}]}],"responseRequired":true} request:{"command":"geterr","arguments":{"delay":0,"files":["/user/username/projects/myproject/a.ts"]},"seq":2,"type":"request"} response:{"responseRequired":false} -Session does not support events: ignored event: {"seq":0,"type":"event","event":"syntaxDiag","body":{"file":"/user/username/projects/myproject/a.ts","diagnostics":[{"start":{"line":1,"offset":17},"end":{"line":1,"offset":18},"text":"')' expected.","code":1005,"category":"error","relatedInformation":[{"span":{"start":{"line":1,"offset":3},"end":{"line":1,"offset":4},"file":"/user/username/projects/myproject/a.ts"},"message":"The parser expected to find a ')' to match the '(' token here.","category":"error","code":1007}]}]}} +Session does not support events: ignored event: {"seq":0,"type":"event","event":"syntaxDiag","body":{"file":"/user/username/projects/myproject/a.ts","diagnostics":[{"start":{"line":1,"offset":17},"end":{"line":1,"offset":18},"text":"')' expected.","code":1005,"category":"error","relatedInformation":[{"span":{"start":{"line":1,"offset":4},"end":{"line":1,"offset":5},"file":"/user/username/projects/myproject/a.ts"},"message":"The parser expected to find a ')' to match the '(' token here.","category":"error","code":1007}]}]}} Session does not support events: ignored event: {"seq":0,"type":"event","event":"requestCompleted","body":{"request_seq":2}} \ No newline at end of file