diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 387d7123beb4b..cf86150ee3b24 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 898f50c475eff..69e9ada739c03 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -1434,24 +1434,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 { @@ -1779,6 +1782,23 @@ namespace ts { return false; } + 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, + 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(); @@ -3739,7 +3759,7 @@ namespace ts { 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) + createDetachedDiagnostic(fileName, openBracePosition, 1, Diagnostics.The_parser_expected_to_find_a_1_to_match_the_0_token_here, "{", "}") ); } } @@ -5772,10 +5792,11 @@ namespace ts { function parseArrayLiteralExpression(): ArrayLiteralExpression { const pos = getNodePos(); - parseExpected(SyntaxKind.OpenBracketToken); + const openBracketPosition = scanner.getTokenPos(); + const openBracketParsed = parseExpected(SyntaxKind.OpenBracketToken); const multiLine = scanner.hasPrecedingLineBreak(); const elements = parseDelimitedList(ParsingContext.ArrayLiteralMembers, parseArgumentOrArrayLiteralElement); - parseExpected(SyntaxKind.CloseBracketToken); + parseExpectedMatchingBrackets(SyntaxKind.OpenBracketToken, SyntaxKind.CloseBracketToken, openBracketParsed, openBracketPosition); return finishNode(factory.createArrayLiteralExpression(elements, multiLine), pos); } @@ -5841,18 +5862,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); - 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, openBraceParsed, openBracePosition); return finishNode(factory.createObjectLiteralExpression(properties, multiLine), pos); } @@ -5916,18 +5929,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); - 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, 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); @@ -5983,9 +5989,10 @@ namespace ts { const pos = getNodePos(); const hasJSDoc = hasPrecedingJSDocComment(); parseExpected(SyntaxKind.IfKeyword); - parseExpected(SyntaxKind.OpenParenToken); + const openParenPosition = scanner.getTokenPos(); + const openParenParsed = parseExpected(SyntaxKind.OpenParenToken); const expression = allowInAnd(parseExpression); - parseExpected(SyntaxKind.CloseParenToken); + 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); @@ -5997,9 +6004,10 @@ namespace ts { parseExpected(SyntaxKind.DoKeyword); const statement = parseStatement(); parseExpected(SyntaxKind.WhileKeyword); - parseExpected(SyntaxKind.OpenParenToken); + const openParenPosition = scanner.getTokenPos(); + const openParenParsed = parseExpected(SyntaxKind.OpenParenToken); const expression = allowInAnd(parseExpression); - parseExpected(SyntaxKind.CloseParenToken); + 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 @@ -6013,9 +6021,10 @@ namespace ts { const pos = getNodePos(); const hasJSDoc = hasPrecedingJSDocComment(); parseExpected(SyntaxKind.WhileKeyword); - parseExpected(SyntaxKind.OpenParenToken); + const openParenPosition = scanner.getTokenPos(); + const openParenParsed = parseExpected(SyntaxKind.OpenParenToken); const expression = allowInAnd(parseExpression); - parseExpected(SyntaxKind.CloseParenToken); + parseExpectedMatchingBrackets(SyntaxKind.OpenParenToken, SyntaxKind.CloseParenToken, openParenParsed, openParenPosition); const statement = parseStatement(); return withJSDoc(finishNode(factory.createWhileStatement(expression, statement), pos), hasJSDoc); } @@ -6091,9 +6100,10 @@ namespace ts { const pos = getNodePos(); const hasJSDoc = hasPrecedingJSDocComment(); parseExpected(SyntaxKind.WithKeyword); - parseExpected(SyntaxKind.OpenParenToken); + const openParenPosition = scanner.getTokenPos(); + const openParenParsed = parseExpected(SyntaxKind.OpenParenToken); const expression = allowInAnd(parseExpression); - parseExpected(SyntaxKind.CloseParenToken); + parseExpectedMatchingBrackets(SyntaxKind.OpenParenToken, SyntaxKind.CloseParenToken, openParenParsed, openParenPosition); const statement = doInsideOfContext(NodeFlags.InWithStatement, parseStatement); return withJSDoc(finishNode(factory.createWithStatement(expression, statement), pos), hasJSDoc); } @@ -7398,7 +7408,7 @@ namespace ts { 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) + createDetachedDiagnostic(fileName, openBracePosition, 1, Diagnostics.The_parser_expected_to_find_a_1_to_match_the_0_token_here, "{", "}") ); } } @@ -8453,13 +8463,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/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/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 a5533c3c12af2..c98dfa1cf7f22 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 TS1434: Unexpected keyword or identifier. ~~~~~~ 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 88934111f142d..6ab8b1489e2e7 100644 --- a/tests/baselines/reference/parserFuzz1.errors.txt +++ b/tests/baselines/reference/parserFuzz1.errors.txt @@ -23,5 +23,4 @@ tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserFuzz1.ts(2,15): e ~~~~~~ !!! error TS1128: Declaration or statement 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/tsbuild/noEmitOnError/initial-build/syntax-errors-with-incremental.js b/tests/baselines/reference/tsbuild/noEmitOnError/initial-build/syntax-errors-with-incremental.js index 082c0357e23ad..1136e600ff010 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. @@ -83,11 +78,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 f7d8b3ce70772..2c6df079b51ff 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. @@ -83,11 +78,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 dbe3f9406cc0b..8c147b7dba4b9 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. @@ -115,11 +110,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 a5650427a1eec..dd26029f8f51e 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. @@ -115,11 +110,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 f58c1eada940d..9e9ee7f46c9d7 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 in src/src/main.ts:4 @@ -166,11 +161,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 in src/src/main.ts:4 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 1b6ac4047e971..10cfb6a2a9db9 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. @@ -186,11 +181,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 aa7e92cea40b6..4aff6d522fa99 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. @@ -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/assumeChangesOnlyAffectDirectDependenciesAndD/with-noEmitOnError-with-incremental.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/assumeChangesOnlyAffectDirectDependenciesAndD/with-noEmitOnError-with-incremental.js index b10c0f6511528..2390754cc1538 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. @@ -187,11 +182,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 ddaecdf84612d..a858fd1aff63c 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. @@ -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/default/with-noEmitOnError-with-incremental.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/default/with-noEmitOnError-with-incremental.js index 680ca0162399a..d01d060fe1319 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. @@ -191,11 +186,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 49c10238bde54..bd644b773bad1 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. @@ -116,11 +111,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 5504e79d6c0a4..3e5507d61da81 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. @@ -186,11 +181,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 b9b04241577ec..efbd1eccf804c 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. @@ -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/incremental/assumeChangesOnlyAffectDirectDependencies/with-noEmitOnError-with-incremental.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/incremental/assumeChangesOnlyAffectDirectDependencies/with-noEmitOnError-with-incremental.js index 7291c98e72737..e42e43bd8b646 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. @@ -186,11 +181,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 4bc5c19afa412..9dde0054674ce 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. @@ -186,11 +181,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 d9742fb8dc2f8..a4f88ae81e0a5 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. @@ -187,11 +182,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 63451347e9da4..869ce1a85e67a 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. @@ -187,11 +182,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 bfe304fb1016b..050317bc3b808 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. @@ -191,11 +186,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 8b2a1ce440c96..ab3c4d7927f42 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. @@ -191,11 +186,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 0dc3563c45f10..a7fb75106e936 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. @@ -186,11 +181,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 43f3dac67f63b..bc663a126affe 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. @@ -186,11 +181,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 4d7a3186387f2..7df8484e45904 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. @@ -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/isolatedModules/with-noEmitOnError.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/incremental/isolatedModules/with-noEmitOnError.js index fca72b9245541..ecd40437efddc 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. @@ -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/isolatedModulesAndD/with-noEmitOnError-with-incremental.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/incremental/isolatedModulesAndD/with-noEmitOnError-with-incremental.js index e0dbb9ef2cc5c..7b7d97027af24 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. @@ -186,11 +181,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 24b383020ebe6..0944f16a31671 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. @@ -186,11 +181,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 e87e69f5f1f24..b6855669b1717 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. @@ -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/isolatedModules/with-noEmitOnError.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/isolatedModules/with-noEmitOnError.js index 0408218258aa4..eeeb35625e47a 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. @@ -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/isolatedModulesAndD/with-noEmitOnError-with-incremental.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/isolatedModulesAndD/with-noEmitOnError-with-incremental.js index 8e870b9adab40..b1af51bc769ed 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. @@ -186,11 +181,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 183aa9d1b4e97..e95bfc9ace12c 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. @@ -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/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 86350b8eca27d..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"}],"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"}]}} +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 diff --git a/tests/baselines/reference/typeAssertions.errors.txt b/tests/baselines/reference/typeAssertions.errors.txt index f525a4be507ac..9f085d7b2a97a 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]; 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);