diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index b71edb82c4bd0..06c5a54d18d9f 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1368,6 +1368,46 @@ "category": "Error", "code": 1433 }, + "Unexpected keyword or identifier.": { + "category": "Error", + "code": 1434 + }, + "Unknown keyword or identifier. Did you mean '{0}'?": { + "category": "Error", + "code": 1435 + }, + "Decorators must precede the name and all keywords of property declarations.": { + "category": "Error", + "code": 1436 + }, + "Namespace must be given a name.": { + "category": "Error", + "code": 1437 + }, + "Interface must be given a name.": { + "category": "Error", + "code": 1438 + }, + "Type alias must be given a name.": { + "category": "Error", + "code": 1439 + }, + "Variable declaration not allowed at this location.": { + "category": "Error", + "code": 1440 + }, + "Cannot start a function call in a type annotation.": { + "category": "Error", + "code": 1441 + }, + "Missing '=' before default property value.": { + "category": "Error", + "code": 1442 + }, + "Module declaration names may only use ' or \" quoted strings.": { + "category": "Error", + "code": 1443 + }, "The types of '{0}' are incompatible between these types.": { "category": "Error", @@ -3356,6 +3396,10 @@ "category": "Error", "code": 2818 }, + "Namespace name cannot be '{0}'.": { + "category": "Error", + "code": 2819 + }, "Import declaration '{0}' is using private name '{1}'.": { "category": "Error", diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index bc7a23e26e419..abfeadb48f970 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -1549,6 +1549,149 @@ namespace ts { return false; } + const viableKeywordSuggestions = Object.keys(textToKeywordObj).filter(keyword => keyword.length > 2); + + /** + * Provides a better error message than the generic "';' expected" if possible for + * known common variants of a missing semicolon, such as from a mispelled names. + * + * @param node Node preceding the expected semicolon location. + */ + function parseErrorForMissingSemicolonAfter(node: Expression | PropertyName): void { + // Tagged template literals are sometimes used in places where only simple strings are allowed, i.e.: + // module `M1` { + // ^^^^^^^^^^^ This block is parsed as a template literal like module`M1`. + if (isTaggedTemplateExpression(node)) { + parseErrorAt(skipTrivia(sourceText, node.template.pos), node.template.end, Diagnostics.Module_declaration_names_may_only_use_or_quoted_strings); + return; + } + + // Otherwise, if this isn't a well-known keyword-like identifier, give the generic fallback message. + const expressionText = ts.isIdentifier(node) ? idText(node) : undefined; + if (!expressionText || !isIdentifierText(expressionText, languageVersion)) { + parseErrorAtCurrentToken(Diagnostics._0_expected, tokenToString(SyntaxKind.SemicolonToken)); + return; + } + + const pos = skipTrivia(sourceText, node.pos); + + // Some known keywords are likely signs of syntax being used improperly. + switch (expressionText) { + case "const": + case "let": + case "var": + parseErrorAt(pos, node.end, Diagnostics.Variable_declaration_not_allowed_at_this_location); + return; + + case "declare": + // If a declared node failed to parse, it would have emitted a diagnostic already. + return; + + case "interface": + parseErrorForInvalidName(Diagnostics.Interface_name_cannot_be_0, Diagnostics.Interface_must_be_given_a_name, SyntaxKind.OpenBraceToken); + return; + + case "is": + parseErrorAt(pos, scanner.getTextPos(), Diagnostics.A_type_predicate_is_only_allowed_in_return_type_position_for_functions_and_methods); + return; + + case "module": + case "namespace": + parseErrorForInvalidName(Diagnostics.Namespace_name_cannot_be_0, Diagnostics.Namespace_must_be_given_a_name, SyntaxKind.OpenBraceToken); + return; + + case "type": + parseErrorForInvalidName(Diagnostics.Type_alias_name_cannot_be_0, Diagnostics.Type_alias_must_be_given_a_name, SyntaxKind.EqualsToken); + return; + } + + // The user alternatively might have misspelled or forgotten to add a space after a common keyword. + const suggestion = getSpellingSuggestion(expressionText, viableKeywordSuggestions, n => n) ?? getSpaceSuggestion(expressionText); + if (suggestion) { + parseErrorAt(pos, node.end, Diagnostics.Unknown_keyword_or_identifier_Did_you_mean_0, suggestion); + return; + } + + // Unknown tokens are handled with their own errors in the scanner + if (token() === SyntaxKind.Unknown) { + return; + } + + // Otherwise, we know this some kind of unknown word, not just a missing expected semicolon. + parseErrorAt(pos, node.end, Diagnostics.Unexpected_keyword_or_identifier); + } + + /** + * Reports a diagnostic error for the current token being an invalid name. + * + * @param blankDiagnostic Diagnostic to report for the case of the name being blank (matched tokenIfBlankName). + * @param nameDiagnostic Diagnostic to report for all other cases. + * @param tokenIfBlankName Current token if the name was invalid for being blank (not provided / skipped). + */ + function parseErrorForInvalidName(nameDiagnostic: DiagnosticMessage, blankDiagnostic: DiagnosticMessage, tokenIfBlankName: SyntaxKind) { + if (token() === tokenIfBlankName) { + parseErrorAtCurrentToken(blankDiagnostic); + } + else { + parseErrorAtCurrentToken(nameDiagnostic, tokenToString(token())); + } + } + + function getSpaceSuggestion(expressionText: string) { + for (const keyword of viableKeywordSuggestions) { + if (expressionText.length > keyword.length + 2 && startsWith(expressionText, keyword)) { + return `${keyword} ${expressionText.slice(keyword.length)}`; + } + } + + return undefined; + } + + function parseSemicolonAfterPropertyName(name: PropertyName, type: TypeNode | undefined, initializer: Expression | undefined) { + switch (token()) { + case SyntaxKind.AtToken: + parseErrorAtCurrentToken(Diagnostics.Decorators_must_precede_the_name_and_all_keywords_of_property_declarations); + return; + + case SyntaxKind.OpenParenToken: + parseErrorAtCurrentToken(Diagnostics.Cannot_start_a_function_call_in_a_type_annotation); + nextToken(); + return; + } + + if (type && !canParseSemicolon()) { + if (initializer) { + parseErrorAtCurrentToken(Diagnostics._0_expected, tokenToString(SyntaxKind.SemicolonToken)); + } + else { + parseErrorAtCurrentToken(Diagnostics.Missing_before_default_property_value); + } + return; + } + + if (tryParseSemicolon()) { + return; + } + + // If an initializer was parsed but there is still an error in finding the next semicolon, + // we generally know there was an error already reported in the initializer... + // class Example { a = new Map([), ) } + // ~ + if (initializer) { + // ...unless we've found the start of a block after a property declaration, in which + // case we can know that regardless of the initializer we should complain on the block. + // class Example { a = 0 {} } + // ~ + if (token() === SyntaxKind.OpenBraceToken) { + parseErrorAtCurrentToken(Diagnostics._0_expected, tokenToString(SyntaxKind.SemicolonToken)); + } + + return; + } + + parseErrorForMissingSemicolonAfter(name); + } + function parseExpectedJSDoc(kind: JSDocSyntaxKind) { if (token() === kind) { nextTokenJSDoc(); @@ -1618,18 +1761,21 @@ namespace ts { return token() === SyntaxKind.CloseBraceToken || token() === SyntaxKind.EndOfFileToken || scanner.hasPrecedingLineBreak(); } - function parseSemicolon(): boolean { - if (canParseSemicolon()) { - if (token() === SyntaxKind.SemicolonToken) { - // consume the semicolon if it was explicitly provided. - nextToken(); - } - - return true; + function tryParseSemicolon() { + if (!canParseSemicolon()) { + return false; } - else { - return parseExpected(SyntaxKind.SemicolonToken); + + if (token() === SyntaxKind.SemicolonToken) { + // consume the semicolon if it was explicitly provided. + nextToken(); } + + return true; + } + + function parseSemicolon(): boolean { + return tryParseSemicolon() || parseExpected(SyntaxKind.SemicolonToken); } function createNodeArray(elements: T[], pos: number, end?: number, hasTrailingComma?: boolean): NodeArray { @@ -5888,7 +6034,9 @@ namespace ts { identifierCount++; expression = finishNode(factory.createIdentifier(""), getNodePos()); } - parseSemicolon(); + if (!tryParseSemicolon()) { + parseErrorForMissingSemicolonAfter(expression); + } return withJSDoc(finishNode(factory.createThrowStatement(expression), pos), hasJSDoc); } @@ -5951,7 +6099,9 @@ namespace ts { node = factory.createLabeledStatement(expression, parseStatement()); } else { - parseSemicolon(); + if (!tryParseSemicolon()) { + parseErrorForMissingSemicolonAfter(expression); + } node = factory.createExpressionStatement(expression); if (hasParen) { // do not parse the same jsdoc twice @@ -6546,7 +6696,7 @@ namespace ts { const exclamationToken = !questionToken && !scanner.hasPrecedingLineBreak() ? parseOptionalToken(SyntaxKind.ExclamationToken) : undefined; const type = parseTypeAnnotation(); const initializer = doOutsideOfContext(NodeFlags.YieldContext | NodeFlags.AwaitContext | NodeFlags.DisallowInContext, parseInitializer); - parseSemicolon(); + parseSemicolonAfterPropertyName(name, type, initializer); const node = factory.createPropertyDeclaration(decorators, modifiers, name, questionToken || exclamationToken, type, initializer); return withJSDoc(finishNode(node, pos), hasJSDoc); } diff --git a/src/compiler/scanner.ts b/src/compiler/scanner.ts index 1c84e7d9164ff..225dc353a0a23 100644 --- a/src/compiler/scanner.ts +++ b/src/compiler/scanner.ts @@ -77,7 +77,8 @@ namespace ts { tryScan(callback: () => T): T; } - const textToKeywordObj: MapLike = { + /** @internal */ + export const textToKeywordObj: MapLike = { abstract: SyntaxKind.AbstractKeyword, any: SyntaxKind.AnyKeyword, as: SyntaxKind.AsKeyword, diff --git a/tests/baselines/reference/ClassDeclaration26.errors.txt b/tests/baselines/reference/ClassDeclaration26.errors.txt index 0972a287de3bc..4b7534741b1f2 100644 --- a/tests/baselines/reference/ClassDeclaration26.errors.txt +++ b/tests/baselines/reference/ClassDeclaration26.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/ClassDeclaration26.ts(2,22): error TS1005: ';' expected. +tests/cases/compiler/ClassDeclaration26.ts(2,18): error TS1440: Variable declaration not allowed at this location. tests/cases/compiler/ClassDeclaration26.ts(4,5): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. tests/cases/compiler/ClassDeclaration26.ts(4,20): error TS1005: ',' expected. tests/cases/compiler/ClassDeclaration26.ts(4,23): error TS1005: '=>' expected. @@ -8,8 +8,8 @@ tests/cases/compiler/ClassDeclaration26.ts(5,1): error TS1128: Declaration or st ==== tests/cases/compiler/ClassDeclaration26.ts (5 errors) ==== class C { public const var export foo = 10; - ~~~~~~ -!!! error TS1005: ';' expected. + ~~~ +!!! error TS1440: Variable declaration not allowed at this location. var constructor() { } ~~~ diff --git a/tests/baselines/reference/anonymousModules.errors.txt b/tests/baselines/reference/anonymousModules.errors.txt index b14520a8c1c36..419eb5d3d3e9b 100644 --- a/tests/baselines/reference/anonymousModules.errors.txt +++ b/tests/baselines/reference/anonymousModules.errors.txt @@ -1,9 +1,9 @@ tests/cases/compiler/anonymousModules.ts(1,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -tests/cases/compiler/anonymousModules.ts(1,8): error TS1005: ';' expected. +tests/cases/compiler/anonymousModules.ts(1,8): error TS1437: Namespace must be given a name. tests/cases/compiler/anonymousModules.ts(4,2): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -tests/cases/compiler/anonymousModules.ts(4,9): error TS1005: ';' expected. +tests/cases/compiler/anonymousModules.ts(4,9): error TS1437: Namespace must be given a name. tests/cases/compiler/anonymousModules.ts(10,2): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -tests/cases/compiler/anonymousModules.ts(10,9): error TS1005: ';' expected. +tests/cases/compiler/anonymousModules.ts(10,9): error TS1437: Namespace must be given a name. ==== tests/cases/compiler/anonymousModules.ts (6 errors) ==== @@ -11,14 +11,14 @@ tests/cases/compiler/anonymousModules.ts(10,9): error TS1005: ';' expected. ~~~~~~ !!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ~ -!!! error TS1005: ';' expected. +!!! error TS1437: Namespace must be given a name. export var foo = 1; module { ~~~~~~ !!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ~ -!!! error TS1005: ';' expected. +!!! error TS1437: Namespace must be given a name. export var bar = 1; } @@ -28,7 +28,7 @@ tests/cases/compiler/anonymousModules.ts(10,9): error TS1005: ';' expected. ~~~~~~ !!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ~ -!!! error TS1005: ';' expected. +!!! error TS1437: Namespace must be given a name. var x = bar; } } \ No newline at end of file diff --git a/tests/baselines/reference/classUpdateTests.errors.txt b/tests/baselines/reference/classUpdateTests.errors.txt index 1d6e767aad589..4a10022982838 100644 --- a/tests/baselines/reference/classUpdateTests.errors.txt +++ b/tests/baselines/reference/classUpdateTests.errors.txt @@ -11,14 +11,16 @@ tests/cases/compiler/classUpdateTests.ts(95,1): error TS1128: Declaration or sta tests/cases/compiler/classUpdateTests.ts(99,3): error TS1128: Declaration or statement expected. tests/cases/compiler/classUpdateTests.ts(101,1): error TS1128: Declaration or statement expected. tests/cases/compiler/classUpdateTests.ts(105,3): error TS1128: Declaration or statement expected. -tests/cases/compiler/classUpdateTests.ts(105,14): error TS1005: ';' expected. +tests/cases/compiler/classUpdateTests.ts(105,10): error TS1434: Unexpected keyword or identifier. +tests/cases/compiler/classUpdateTests.ts(105,14): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. tests/cases/compiler/classUpdateTests.ts(107,1): error TS1128: Declaration or statement expected. tests/cases/compiler/classUpdateTests.ts(111,3): error TS1128: Declaration or statement expected. -tests/cases/compiler/classUpdateTests.ts(111,15): error TS1005: ';' expected. +tests/cases/compiler/classUpdateTests.ts(111,11): error TS1434: Unexpected keyword or identifier. +tests/cases/compiler/classUpdateTests.ts(111,15): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. tests/cases/compiler/classUpdateTests.ts(113,1): error TS1128: Declaration or statement expected. -==== tests/cases/compiler/classUpdateTests.ts (16 errors) ==== +==== tests/cases/compiler/classUpdateTests.ts (18 errors) ==== // // test codegen for instance properties // @@ -154,8 +156,10 @@ tests/cases/compiler/classUpdateTests.ts(113,1): error TS1128: Declaration or st public this.p1 = 0; // ERROR ~~~~~~ !!! error TS1128: Declaration or statement expected. + ~~~~ +!!! error TS1434: Unexpected keyword or identifier. ~ -!!! error TS1005: ';' expected. +!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. } } ~ @@ -166,8 +170,10 @@ tests/cases/compiler/classUpdateTests.ts(113,1): error TS1128: Declaration or st private this.p1 = 0; // ERROR ~~~~~~~ !!! error TS1128: Declaration or statement expected. + ~~~~ +!!! error TS1434: Unexpected keyword or identifier. ~ -!!! error TS1005: ';' expected. +!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. } } ~ diff --git a/tests/baselines/reference/commonMissingSemicolons.errors.txt b/tests/baselines/reference/commonMissingSemicolons.errors.txt new file mode 100644 index 0000000000000..15df55ec4aa9a --- /dev/null +++ b/tests/baselines/reference/commonMissingSemicolons.errors.txt @@ -0,0 +1,313 @@ +tests/cases/compiler/commonMissingSemicolons.ts(2,1): error TS1435: Unknown keyword or identifier. Did you mean 'async'? +tests/cases/compiler/commonMissingSemicolons.ts(2,1): error TS2304: Cannot find name 'asynd'. +tests/cases/compiler/commonMissingSemicolons.ts(3,1): error TS1435: Unknown keyword or identifier. Did you mean 'async'? +tests/cases/compiler/commonMissingSemicolons.ts(3,1): error TS2304: Cannot find name 'sasync'. +tests/cases/compiler/commonMissingSemicolons.ts(8,23): error TS2304: Cannot find name 'asyncd'. +tests/cases/compiler/commonMissingSemicolons.ts(8,33): error TS1005: ';' expected. +tests/cases/compiler/commonMissingSemicolons.ts(11,1): error TS1435: Unknown keyword or identifier. Did you mean 'class'? +tests/cases/compiler/commonMissingSemicolons.ts(11,1): error TS2304: Cannot find name 'clasd'. +tests/cases/compiler/commonMissingSemicolons.ts(11,7): error TS1434: Unexpected keyword or identifier. +tests/cases/compiler/commonMissingSemicolons.ts(11,7): error TS2552: Cannot find name 'MyClass2'. Did you mean 'MyClass1'? +tests/cases/compiler/commonMissingSemicolons.ts(12,1): error TS1435: Unknown keyword or identifier. Did you mean 'class'? +tests/cases/compiler/commonMissingSemicolons.ts(12,1): error TS2304: Cannot find name 'classs'. +tests/cases/compiler/commonMissingSemicolons.ts(12,8): error TS1434: Unexpected keyword or identifier. +tests/cases/compiler/commonMissingSemicolons.ts(12,8): error TS2552: Cannot find name 'MyClass3'. Did you mean 'MyClass1'? +tests/cases/compiler/commonMissingSemicolons.ts(15,1): error TS1435: Unknown keyword or identifier. Did you mean 'const'? +tests/cases/compiler/commonMissingSemicolons.ts(15,1): error TS2304: Cannot find name 'consd'. +tests/cases/compiler/commonMissingSemicolons.ts(15,7): error TS2552: Cannot find name 'myConst2'. Did you mean 'myConst1'? +tests/cases/compiler/commonMissingSemicolons.ts(16,1): error TS1435: Unknown keyword or identifier. Did you mean 'const'? +tests/cases/compiler/commonMissingSemicolons.ts(16,1): error TS2304: Cannot find name 'constd'. +tests/cases/compiler/commonMissingSemicolons.ts(16,8): error TS2304: Cannot find name 'myConst3'. +tests/cases/compiler/commonMissingSemicolons.ts(19,1): error TS1435: Unknown keyword or identifier. Did you mean 'declare'? +tests/cases/compiler/commonMissingSemicolons.ts(19,1): error TS2304: Cannot find name 'declared'. +tests/cases/compiler/commonMissingSemicolons.ts(20,1): error TS2304: Cannot find name 'declare'. +tests/cases/compiler/commonMissingSemicolons.ts(20,9): error TS1435: Unknown keyword or identifier. Did you mean 'const'? +tests/cases/compiler/commonMissingSemicolons.ts(20,9): error TS2304: Cannot find name 'constd'. +tests/cases/compiler/commonMissingSemicolons.ts(21,1): error TS1435: Unknown keyword or identifier. Did you mean 'declare'? +tests/cases/compiler/commonMissingSemicolons.ts(21,1): error TS2304: Cannot find name 'declared'. +tests/cases/compiler/commonMissingSemicolons.ts(21,10): error TS1435: Unknown keyword or identifier. Did you mean 'const'? +tests/cases/compiler/commonMissingSemicolons.ts(21,10): error TS2304: Cannot find name 'constd'. +tests/cases/compiler/commonMissingSemicolons.ts(22,1): error TS1435: Unknown keyword or identifier. Did you mean 'declare const'? +tests/cases/compiler/commonMissingSemicolons.ts(22,1): error TS2304: Cannot find name 'declareconst'. +tests/cases/compiler/commonMissingSemicolons.ts(22,14): error TS2304: Cannot find name 'myDeclareConst5'. +tests/cases/compiler/commonMissingSemicolons.ts(25,1): error TS1435: Unknown keyword or identifier. Did you mean 'function'? +tests/cases/compiler/commonMissingSemicolons.ts(25,1): error TS2304: Cannot find name 'functiond'. +tests/cases/compiler/commonMissingSemicolons.ts(25,11): error TS2304: Cannot find name 'myFunction2'. +tests/cases/compiler/commonMissingSemicolons.ts(25,25): error TS1005: ';' expected. +tests/cases/compiler/commonMissingSemicolons.ts(26,10): error TS1359: Identifier expected. 'function' is a reserved word that cannot be used here. +tests/cases/compiler/commonMissingSemicolons.ts(26,18): error TS1003: Identifier expected. +tests/cases/compiler/commonMissingSemicolons.ts(27,1): error TS2304: Cannot find name 'functionMyFunction'. +tests/cases/compiler/commonMissingSemicolons.ts(30,1): error TS1435: Unknown keyword or identifier. Did you mean 'interface'? +tests/cases/compiler/commonMissingSemicolons.ts(30,1): error TS2304: Cannot find name 'interfaced'. +tests/cases/compiler/commonMissingSemicolons.ts(30,12): error TS1434: Unexpected keyword or identifier. +tests/cases/compiler/commonMissingSemicolons.ts(30,12): error TS2304: Cannot find name 'myInterface2'. +tests/cases/compiler/commonMissingSemicolons.ts(32,1): error TS2693: 'interface' only refers to a type, but is being used as a value here. +tests/cases/compiler/commonMissingSemicolons.ts(32,11): error TS1438: Interface must be given a name. +tests/cases/compiler/commonMissingSemicolons.ts(33,1): error TS2693: 'interface' only refers to a type, but is being used as a value here. +tests/cases/compiler/commonMissingSemicolons.ts(33,11): error TS2427: Interface name cannot be 'void'. +tests/cases/compiler/commonMissingSemicolons.ts(34,1): error TS1435: Unknown keyword or identifier. Did you mean 'interface MyInterface'? +tests/cases/compiler/commonMissingSemicolons.ts(34,1): error TS2304: Cannot find name 'interfaceMyInterface'. +tests/cases/compiler/commonMissingSemicolons.ts(38,1): error TS1435: Unknown keyword or identifier. Did you mean 'let'? +tests/cases/compiler/commonMissingSemicolons.ts(38,1): error TS2304: Cannot find name 'letd'. +tests/cases/compiler/commonMissingSemicolons.ts(38,6): error TS2304: Cannot find name 'let2'. +tests/cases/compiler/commonMissingSemicolons.ts(39,1): error TS2304: Cannot find name 'letMyLet'. +tests/cases/compiler/commonMissingSemicolons.ts(41,10): error TS1005: '=' expected. +tests/cases/compiler/commonMissingSemicolons.ts(45,1): error TS1435: Unknown keyword or identifier. Did you mean 'type'? +tests/cases/compiler/commonMissingSemicolons.ts(45,1): error TS2304: Cannot find name 'typed'. +tests/cases/compiler/commonMissingSemicolons.ts(45,7): error TS2304: Cannot find name 'type4'. +tests/cases/compiler/commonMissingSemicolons.ts(46,1): error TS1435: Unknown keyword or identifier. Did you mean 'type'? +tests/cases/compiler/commonMissingSemicolons.ts(46,1): error TS2304: Cannot find name 'typed'. +tests/cases/compiler/commonMissingSemicolons.ts(46,7): error TS2304: Cannot find name 'type5'. +tests/cases/compiler/commonMissingSemicolons.ts(46,15): error TS2693: 'type' only refers to a type, but is being used as a value here. +tests/cases/compiler/commonMissingSemicolons.ts(47,1): error TS2304: Cannot find name 'typeMyType'. +tests/cases/compiler/commonMissingSemicolons.ts(50,1): error TS1435: Unknown keyword or identifier. Did you mean 'var'? +tests/cases/compiler/commonMissingSemicolons.ts(50,1): error TS2304: Cannot find name 'vard'. +tests/cases/compiler/commonMissingSemicolons.ts(50,6): error TS2304: Cannot find name 'myVar2'. +tests/cases/compiler/commonMissingSemicolons.ts(51,1): error TS2304: Cannot find name 'varMyVar'. +tests/cases/compiler/commonMissingSemicolons.ts(55,3): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. +tests/cases/compiler/commonMissingSemicolons.ts(56,1): error TS1128: Declaration or statement expected. +tests/cases/compiler/commonMissingSemicolons.ts(60,3): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. +tests/cases/compiler/commonMissingSemicolons.ts(61,1): error TS1128: Declaration or statement expected. +tests/cases/compiler/commonMissingSemicolons.ts(65,3): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. +tests/cases/compiler/commonMissingSemicolons.ts(66,1): error TS1128: Declaration or statement expected. +tests/cases/compiler/commonMissingSemicolons.ts(70,11): error TS1005: ';' expected. +tests/cases/compiler/commonMissingSemicolons.ts(71,1): error TS1128: Declaration or statement expected. +tests/cases/compiler/commonMissingSemicolons.ts(75,11): error TS1005: ';' expected. +tests/cases/compiler/commonMissingSemicolons.ts(78,1): error TS1128: Declaration or statement expected. + + +==== tests/cases/compiler/commonMissingSemicolons.ts (76 errors) ==== + async function myAsyncFunction1() {} + asynd function myAsyncFunction2() {} + ~~~~~ +!!! error TS1435: Unknown keyword or identifier. Did you mean 'async'? + ~~~~~ +!!! error TS2304: Cannot find name 'asynd'. + sasync function myAsyncFunction3() {} + ~~~~~~ +!!! error TS1435: Unknown keyword or identifier. Did you mean 'async'? + ~~~~~~ +!!! error TS2304: Cannot find name 'sasync'. + + // Arrow functions don't (yet?) parse as nicely as standalone functions. + // Eventually it would be good to get them the same "did you mean" for typos such as "asyncd". + const myAsyncArrow1 = async () => 3; + const myAsyncArrow2 = asyncd () => 3; + ~~~~~~ +!!! error TS2304: Cannot find name 'asyncd'. + ~~ +!!! error TS1005: ';' expected. + + class MyClass1 {} + clasd MyClass2 {} + ~~~~~ +!!! error TS1435: Unknown keyword or identifier. Did you mean 'class'? + ~~~~~ +!!! error TS2304: Cannot find name 'clasd'. + ~~~~~~~~ +!!! error TS1434: Unexpected keyword or identifier. + ~~~~~~~~ +!!! error TS2552: Cannot find name 'MyClass2'. Did you mean 'MyClass1'? +!!! related TS2728 tests/cases/compiler/commonMissingSemicolons.ts:10:7: 'MyClass1' is declared here. + classs MyClass3 {} + ~~~~~~ +!!! error TS1435: Unknown keyword or identifier. Did you mean 'class'? + ~~~~~~ +!!! error TS2304: Cannot find name 'classs'. + ~~~~~~~~ +!!! error TS1434: Unexpected keyword or identifier. + ~~~~~~~~ +!!! error TS2552: Cannot find name 'MyClass3'. Did you mean 'MyClass1'? +!!! related TS2728 tests/cases/compiler/commonMissingSemicolons.ts:10:7: 'MyClass1' is declared here. + + const myConst1 = 1; + consd myConst2 = 1; + ~~~~~ +!!! error TS1435: Unknown keyword or identifier. Did you mean 'const'? + ~~~~~ +!!! error TS2304: Cannot find name 'consd'. + ~~~~~~~~ +!!! error TS2552: Cannot find name 'myConst2'. Did you mean 'myConst1'? +!!! related TS2728 tests/cases/compiler/commonMissingSemicolons.ts:14:7: 'myConst1' is declared here. + constd myConst3 = 1; + ~~~~~~ +!!! error TS1435: Unknown keyword or identifier. Did you mean 'const'? + ~~~~~~ +!!! error TS2304: Cannot find name 'constd'. + ~~~~~~~~ +!!! error TS2304: Cannot find name 'myConst3'. + + declare const myDeclareConst1: 1; + declared const myDeclareConst2: 1; + ~~~~~~~~ +!!! error TS1435: Unknown keyword or identifier. Did you mean 'declare'? + ~~~~~~~~ +!!! error TS2304: Cannot find name 'declared'. + declare constd myDeclareConst3: 1; + ~~~~~~~ +!!! error TS2304: Cannot find name 'declare'. + ~~~~~~ +!!! error TS1435: Unknown keyword or identifier. Did you mean 'const'? + ~~~~~~ +!!! error TS2304: Cannot find name 'constd'. + declared constd myDeclareConst4: 1; + ~~~~~~~~ +!!! error TS1435: Unknown keyword or identifier. Did you mean 'declare'? + ~~~~~~~~ +!!! error TS2304: Cannot find name 'declared'. + ~~~~~~ +!!! error TS1435: Unknown keyword or identifier. Did you mean 'const'? + ~~~~~~ +!!! error TS2304: Cannot find name 'constd'. + declareconst myDeclareConst5; + ~~~~~~~~~~~~ +!!! error TS1435: Unknown keyword or identifier. Did you mean 'declare const'? + ~~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'declareconst'. + ~~~~~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'myDeclareConst5'. + + function myFunction1() { } + functiond myFunction2() { } + ~~~~~~~~~ +!!! error TS1435: Unknown keyword or identifier. Did you mean 'function'? + ~~~~~~~~~ +!!! error TS2304: Cannot find name 'functiond'. + ~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'myFunction2'. + ~ +!!! error TS1005: ';' expected. + function function() { } + ~~~~~~~~ +!!! error TS1359: Identifier expected. 'function' is a reserved word that cannot be used here. + ~ +!!! error TS1003: Identifier expected. + functionMyFunction; + ~~~~~~~~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'functionMyFunction'. + + interface myInterface1 { } + interfaced myInterface2 { } + ~~~~~~~~~~ +!!! error TS1435: Unknown keyword or identifier. Did you mean 'interface'? + ~~~~~~~~~~ +!!! error TS2304: Cannot find name 'interfaced'. + ~~~~~~~~~~~~ +!!! error TS1434: Unexpected keyword or identifier. + ~~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'myInterface2'. + interface interface { } + interface { } + ~~~~~~~~~ +!!! error TS2693: 'interface' only refers to a type, but is being used as a value here. + ~ +!!! error TS1438: Interface must be given a name. + interface void { } + ~~~~~~~~~ +!!! error TS2693: 'interface' only refers to a type, but is being used as a value here. + ~~~~ +!!! error TS2427: Interface name cannot be 'void'. + interfaceMyInterface { } + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS1435: Unknown keyword or identifier. Did you mean 'interface MyInterface'? + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'interfaceMyInterface'. + + let let = 1; + let let1 = 1; + letd let2 = 1; + ~~~~ +!!! error TS1435: Unknown keyword or identifier. Did you mean 'let'? + ~~~~ +!!! error TS2304: Cannot find name 'letd'. + ~~~~ +!!! error TS2304: Cannot find name 'let2'. + letMyLet; + ~~~~~~~~ +!!! error TS2304: Cannot find name 'letMyLet'. + + type type; + ~ +!!! error TS1005: '=' expected. + type type1 = {}; + type type2 = type; + type type3 = {}; + typed type4 = {} + ~~~~~ +!!! error TS1435: Unknown keyword or identifier. Did you mean 'type'? + ~~~~~ +!!! error TS2304: Cannot find name 'typed'. + ~~~~~ +!!! error TS2304: Cannot find name 'type4'. + typed type5 = type; + ~~~~~ +!!! error TS1435: Unknown keyword or identifier. Did you mean 'type'? + ~~~~~ +!!! error TS2304: Cannot find name 'typed'. + ~~~~~ +!!! error TS2304: Cannot find name 'type5'. + ~~~~ +!!! error TS2693: 'type' only refers to a type, but is being used as a value here. + typeMyType; + ~~~~~~~~~~ +!!! error TS2304: Cannot find name 'typeMyType'. + + var myVar1 = 1; + vard myVar2 = 1; + ~~~~ +!!! error TS1435: Unknown keyword or identifier. Did you mean 'var'? + ~~~~ +!!! error TS2304: Cannot find name 'vard'. + ~~~~~~ +!!! error TS2304: Cannot find name 'myVar2'. + varMyVar; + ~~~~~~~~ +!!! error TS2304: Cannot find name 'varMyVar'. + + class NoSemicolonClassA { + ['a'] = 0 + {} + ~ +!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. + } + ~ +!!! error TS1128: Declaration or statement expected. + + class NoSemicolonClassB { + ['a'] = 0 + {} + ~ +!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. + } + ~ +!!! error TS1128: Declaration or statement expected. + + class NoSemicolonClassC { + ['a'] = 0; + {} + ~ +!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. + } + ~ +!!! error TS1128: Declaration or statement expected. + + class NoSemicolonClassD { + ['a'] = 0 + ['b']() {} + ~ +!!! error TS1005: ';' expected. + } + ~ +!!! error TS1128: Declaration or statement expected. + + class NoSemicolonClassE { + ['a'] = 0 + ['b']() { + ~ +!!! error TS1005: ';' expected. + c: true + } + } + ~ +!!! error TS1128: Declaration or statement expected. + \ No newline at end of file diff --git a/tests/baselines/reference/commonMissingSemicolons.symbols b/tests/baselines/reference/commonMissingSemicolons.symbols new file mode 100644 index 0000000000000..3cdb4c4301821 --- /dev/null +++ b/tests/baselines/reference/commonMissingSemicolons.symbols @@ -0,0 +1,93 @@ +=== tests/cases/compiler/commonMissingSemicolons.ts === +async function myAsyncFunction1() {} +>myAsyncFunction1 : Symbol(myAsyncFunction1, Decl(commonMissingSemicolons.ts, 0, 0)) + +asynd function myAsyncFunction2() {} +>myAsyncFunction2 : Symbol(myAsyncFunction2, Decl(commonMissingSemicolons.ts, 1, 5)) + +sasync function myAsyncFunction3() {} +>myAsyncFunction3 : Symbol(myAsyncFunction3, Decl(commonMissingSemicolons.ts, 2, 6)) + +// Arrow functions don't (yet?) parse as nicely as standalone functions. +// Eventually it would be good to get them the same "did you mean" for typos such as "asyncd". +const myAsyncArrow1 = async () => 3; +>myAsyncArrow1 : Symbol(myAsyncArrow1, Decl(commonMissingSemicolons.ts, 6, 5)) + +const myAsyncArrow2 = asyncd () => 3; +>myAsyncArrow2 : Symbol(myAsyncArrow2, Decl(commonMissingSemicolons.ts, 7, 5)) + +class MyClass1 {} +>MyClass1 : Symbol(MyClass1, Decl(commonMissingSemicolons.ts, 7, 37)) + +clasd MyClass2 {} +classs MyClass3 {} + +const myConst1 = 1; +>myConst1 : Symbol(myConst1, Decl(commonMissingSemicolons.ts, 13, 5)) + +consd myConst2 = 1; +constd myConst3 = 1; + +declare const myDeclareConst1: 1; +>myDeclareConst1 : Symbol(myDeclareConst1, Decl(commonMissingSemicolons.ts, 17, 13)) + +declared const myDeclareConst2: 1; +>myDeclareConst2 : Symbol(myDeclareConst2, Decl(commonMissingSemicolons.ts, 18, 14)) + +declare constd myDeclareConst3: 1; +declared constd myDeclareConst4: 1; +declareconst myDeclareConst5; + +function myFunction1() { } +>myFunction1 : Symbol(myFunction1, Decl(commonMissingSemicolons.ts, 21, 29)) + +functiond myFunction2() { } +function function() { } +> : Symbol((Missing), Decl(commonMissingSemicolons.ts, 24, 27), Decl(commonMissingSemicolons.ts, 25, 8)) +> : Symbol((Missing), Decl(commonMissingSemicolons.ts, 24, 27), Decl(commonMissingSemicolons.ts, 25, 8)) + +functionMyFunction; + +interface myInterface1 { } +>myInterface1 : Symbol(myInterface1, Decl(commonMissingSemicolons.ts, 26, 19)) + +interfaced myInterface2 { } +interface interface { } +>interface : Symbol(interface, Decl(commonMissingSemicolons.ts, 29, 27)) + +interface { } +interface void { } +interfaceMyInterface { } + +let let = 1; +>let : Symbol(let, Decl(commonMissingSemicolons.ts, 35, 3)) + +let let1 = 1; +>let1 : Symbol(let1, Decl(commonMissingSemicolons.ts, 36, 3)) + +letd let2 = 1; +letMyLet; + +type type; +>type : Symbol(type, Decl(commonMissingSemicolons.ts, 38, 9)) + +type type1 = {}; +>type1 : Symbol(type1, Decl(commonMissingSemicolons.ts, 40, 10)) + +type type2 = type; +>type2 : Symbol(type2, Decl(commonMissingSemicolons.ts, 41, 16)) +>type : Symbol(type, Decl(commonMissingSemicolons.ts, 38, 9)) + +type type3 = {}; +>type3 : Symbol(type3, Decl(commonMissingSemicolons.ts, 42, 18)) + +typed type4 = {} +typed type5 = type; +typeMyType; + +var myVar1 = 1; +>myVar1 : Symbol(myVar1, Decl(commonMissingSemicolons.ts, 48, 3)) + +vard myVar2 = 1; +varMyVar; + diff --git a/tests/baselines/reference/commonMissingSemicolons.types b/tests/baselines/reference/commonMissingSemicolons.types new file mode 100644 index 0000000000000..57e4c2e51dc1b --- /dev/null +++ b/tests/baselines/reference/commonMissingSemicolons.types @@ -0,0 +1,164 @@ +=== tests/cases/compiler/commonMissingSemicolons.ts === +async function myAsyncFunction1() {} +>myAsyncFunction1 : () => Promise + +asynd function myAsyncFunction2() {} +>asynd : any +>myAsyncFunction2 : () => void + +sasync function myAsyncFunction3() {} +>sasync : any +>myAsyncFunction3 : () => void + +// Arrow functions don't (yet?) parse as nicely as standalone functions. +// Eventually it would be good to get them the same "did you mean" for typos such as "asyncd". +const myAsyncArrow1 = async () => 3; +>myAsyncArrow1 : () => Promise +>async () => 3 : () => Promise +>3 : 3 + +const myAsyncArrow2 = asyncd () => 3; +>myAsyncArrow2 : any +>asyncd () : any +>asyncd : any +>3 : 3 + +class MyClass1 {} +>MyClass1 : MyClass1 + +clasd MyClass2 {} +>clasd : any +>MyClass2 : any + +classs MyClass3 {} +>classs : any +>MyClass3 : any + +const myConst1 = 1; +>myConst1 : 1 +>1 : 1 + +consd myConst2 = 1; +>consd : any +>myConst2 = 1 : 1 +>myConst2 : any +>1 : 1 + +constd myConst3 = 1; +>constd : any +>myConst3 = 1 : 1 +>myConst3 : any +>1 : 1 + +declare const myDeclareConst1: 1; +>myDeclareConst1 : 1 + +declared const myDeclareConst2: 1; +>declared : any +>myDeclareConst2 : 1 + +declare constd myDeclareConst3: 1; +>declare : any +>constd : any +>myDeclareConst3 : any +>1 : 1 + +declared constd myDeclareConst4: 1; +>declared : any +>constd : any +>myDeclareConst4 : any +>1 : 1 + +declareconst myDeclareConst5; +>declareconst : any +>myDeclareConst5 : any + +function myFunction1() { } +>myFunction1 : () => void + +functiond myFunction2() { } +>functiond : any +>myFunction2() : any +>myFunction2 : any + +function function() { } +> : () => any +> : () => any + +functionMyFunction; +>functionMyFunction : any + +interface myInterface1 { } +interfaced myInterface2 { } +>interfaced : any +>myInterface2 : any + +interface interface { } +interface { } +>interface : any + +interface void { } +>interface : any +>void { } : undefined +>{ } : {} + +interfaceMyInterface { } +>interfaceMyInterface : any + +let let = 1; +>let : number +>1 : 1 + +let let1 = 1; +>let1 : number +>1 : 1 + +letd let2 = 1; +>letd : any +>let2 = 1 : 1 +>let2 : any +>1 : 1 + +letMyLet; +>letMyLet : any + +type type; +>type : any + +type type1 = {}; +>type1 : type1 + +type type2 = type; +>type2 : any + +type type3 = {}; +>type3 : type3 + +typed type4 = {} +>typed : any +>type4 = {} : {} +>type4 : any +>{} : {} + +typed type5 = type; +>typed : any +>type5 = type : any +>type5 : any +>type : any + +typeMyType; +>typeMyType : any + +var myVar1 = 1; +>myVar1 : number +>1 : 1 + +vard myVar2 = 1; +>vard : any +>myVar2 = 1 : 1 +>myVar2 : any +>1 : 1 + +varMyVar; +>varMyVar : any + diff --git a/tests/baselines/reference/decoratorOnClassAccessor3.errors.txt b/tests/baselines/reference/decoratorOnClassAccessor3.errors.txt index 98b96b9b1c44e..f57ce1f2927ca 100644 --- a/tests/baselines/reference/decoratorOnClassAccessor3.errors.txt +++ b/tests/baselines/reference/decoratorOnClassAccessor3.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor3.ts(4,12): error TS1005: ';' expected. +tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor3.ts(4,12): error TS1436: Decorators must precede the name and all keywords of property declarations. ==== tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor3.ts (1 errors) ==== @@ -7,5 +7,5 @@ tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor3.ts(4 class C { public @dec get accessor() { return 1; } ~ -!!! error TS1005: ';' expected. +!!! error TS1436: Decorators must precede the name and all keywords of property declarations. } \ No newline at end of file diff --git a/tests/baselines/reference/decoratorOnClassAccessor6.errors.txt b/tests/baselines/reference/decoratorOnClassAccessor6.errors.txt index e430b4cf1eea5..1f18744c7c5ef 100644 --- a/tests/baselines/reference/decoratorOnClassAccessor6.errors.txt +++ b/tests/baselines/reference/decoratorOnClassAccessor6.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor6.ts(4,12): error TS1005: ';' expected. +tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor6.ts(4,12): error TS1436: Decorators must precede the name and all keywords of property declarations. ==== tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor6.ts (1 errors) ==== @@ -7,5 +7,5 @@ tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor6.ts(4 class C { public @dec set accessor(value: number) { } ~ -!!! error TS1005: ';' expected. +!!! error TS1436: Decorators must precede the name and all keywords of property declarations. } \ No newline at end of file diff --git a/tests/baselines/reference/decoratorOnClassMethod3.errors.txt b/tests/baselines/reference/decoratorOnClassMethod3.errors.txt index 4881502a02eed..5d5be3f17125e 100644 --- a/tests/baselines/reference/decoratorOnClassMethod3.errors.txt +++ b/tests/baselines/reference/decoratorOnClassMethod3.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/decorators/class/method/decoratorOnClassMethod3.ts(4,12): error TS1005: ';' expected. +tests/cases/conformance/decorators/class/method/decoratorOnClassMethod3.ts(4,12): error TS1436: Decorators must precede the name and all keywords of property declarations. ==== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod3.ts (1 errors) ==== @@ -7,5 +7,5 @@ tests/cases/conformance/decorators/class/method/decoratorOnClassMethod3.ts(4,12) class C { public @dec method() {} ~ -!!! error TS1005: ';' expected. +!!! error TS1436: Decorators must precede the name and all keywords of property declarations. } \ No newline at end of file diff --git a/tests/baselines/reference/decoratorOnClassProperty3.errors.txt b/tests/baselines/reference/decoratorOnClassProperty3.errors.txt index 12d0efb78d78c..d21e42db43736 100644 --- a/tests/baselines/reference/decoratorOnClassProperty3.errors.txt +++ b/tests/baselines/reference/decoratorOnClassProperty3.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/decorators/class/property/decoratorOnClassProperty3.ts(4,12): error TS1005: ';' expected. +tests/cases/conformance/decorators/class/property/decoratorOnClassProperty3.ts(4,12): error TS1436: Decorators must precede the name and all keywords of property declarations. ==== tests/cases/conformance/decorators/class/property/decoratorOnClassProperty3.ts (1 errors) ==== @@ -7,5 +7,5 @@ tests/cases/conformance/decorators/class/property/decoratorOnClassProperty3.ts(4 class C { public @dec prop; ~ -!!! error TS1005: ';' expected. +!!! error TS1436: Decorators must precede the name and all keywords of property declarations. } \ No newline at end of file diff --git a/tests/baselines/reference/derivedClassSuperCallsInNonConstructorMembers.errors.txt b/tests/baselines/reference/derivedClassSuperCallsInNonConstructorMembers.errors.txt index fbf03bd2f231a..eb44057eadf0c 100644 --- a/tests/baselines/reference/derivedClassSuperCallsInNonConstructorMembers.errors.txt +++ b/tests/baselines/reference/derivedClassSuperCallsInNonConstructorMembers.errors.txt @@ -1,43 +1,18 @@ tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(8,8): error TS2304: Cannot find name 'super'. -tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(8,13): error TS1005: ';' expected. -tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(8,14): error TS1109: Expression expected. -tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(9,5): error TS2304: Cannot find name 'b'. -tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(9,9): error TS1005: ';' expected. +tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(8,13): error TS1441: Cannot start a function call in a type annotation. +tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(8,14): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(10,9): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors. -tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(12,5): error TS2304: Cannot find name 'get'. -tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(12,9): error TS1005: ';' expected. -tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(12,9): error TS2304: Cannot find name 'C'. -tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(12,13): error TS1005: ';' expected. tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(13,9): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors. -tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(16,5): error TS2304: Cannot find name 'set'. -tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(16,9): error TS1005: ';' expected. -tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(16,9): error TS2304: Cannot find name 'C'. -tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(16,11): error TS2304: Cannot find name 'v'. -tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(16,14): error TS1005: ';' expected. tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(17,9): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors. -tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(20,5): error TS1128: Declaration or statement expected. -tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(20,15): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors. -tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(21,5): error TS1128: Declaration or statement expected. -tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(21,12): error TS2304: Cannot find name 'b'. -tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(21,16): error TS1005: ';' expected. +tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(20,15): error TS2304: Cannot find name 'super'. +tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(20,20): error TS1441: Cannot start a function call in a type annotation. +tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(20,21): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(22,9): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors. -tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(24,5): error TS1128: Declaration or statement expected. -tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(24,12): error TS2304: Cannot find name 'get'. -tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(24,16): error TS1005: ';' expected. -tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(24,16): error TS2304: Cannot find name 'C'. -tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(24,20): error TS1005: ';' expected. tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(25,9): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors. -tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(28,5): error TS1128: Declaration or statement expected. -tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(28,12): error TS2304: Cannot find name 'set'. -tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(28,16): error TS1005: ';' expected. -tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(28,16): error TS2304: Cannot find name 'C'. -tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(28,18): error TS2304: Cannot find name 'v'. -tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(28,21): error TS1005: ';' expected. tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(29,9): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors. -tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(31,1): error TS1128: Declaration or statement expected. -==== tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts (37 errors) ==== +==== tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts (12 errors) ==== // error to use super calls outside a constructor class Base { @@ -49,97 +24,47 @@ tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassS ~~~~~ !!! error TS2304: Cannot find name 'super'. ~ -!!! error TS1005: ';' expected. +!!! error TS1441: Cannot start a function call in a type annotation. ~ -!!! error TS1109: Expression expected. +!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. b() { - ~ -!!! error TS2304: Cannot find name 'b'. - ~ -!!! error TS1005: ';' expected. super(); ~~~~~ !!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors. } get C() { - ~~~ -!!! error TS2304: Cannot find name 'get'. - ~ -!!! error TS1005: ';' expected. - ~ -!!! error TS2304: Cannot find name 'C'. - ~ -!!! error TS1005: ';' expected. super(); ~~~~~ !!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors. return 1; } set C(v) { - ~~~ -!!! error TS2304: Cannot find name 'set'. - ~ -!!! error TS1005: ';' expected. - ~ -!!! error TS2304: Cannot find name 'C'. - ~ -!!! error TS2304: Cannot find name 'v'. - ~ -!!! error TS1005: ';' expected. super(); ~~~~~ !!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors. } static a: super(); - ~~~~~~ -!!! error TS1128: Declaration or statement expected. ~~~~~ -!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors. +!!! error TS2304: Cannot find name 'super'. + ~ +!!! error TS1441: Cannot start a function call in a type annotation. + ~ +!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. static b() { - ~~~~~~ -!!! error TS1128: Declaration or statement expected. - ~ -!!! error TS2304: Cannot find name 'b'. - ~ -!!! error TS1005: ';' expected. super(); ~~~~~ !!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors. } static get C() { - ~~~~~~ -!!! error TS1128: Declaration or statement expected. - ~~~ -!!! error TS2304: Cannot find name 'get'. - ~ -!!! error TS1005: ';' expected. - ~ -!!! error TS2304: Cannot find name 'C'. - ~ -!!! error TS1005: ';' expected. super(); ~~~~~ !!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors. return 1; } static set C(v) { - ~~~~~~ -!!! error TS1128: Declaration or statement expected. - ~~~ -!!! error TS2304: Cannot find name 'set'. - ~ -!!! error TS1005: ';' expected. - ~ -!!! error TS2304: Cannot find name 'C'. - ~ -!!! error TS2304: Cannot find name 'v'. - ~ -!!! error TS1005: ';' expected. super(); ~~~~~ !!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors. } - } - ~ -!!! error TS1128: Declaration or statement expected. \ No newline at end of file + } \ No newline at end of file diff --git a/tests/baselines/reference/derivedClassSuperCallsInNonConstructorMembers.js b/tests/baselines/reference/derivedClassSuperCallsInNonConstructorMembers.js index 0c1332fa55f1a..7f75e0c1fdf2d 100644 --- a/tests/baselines/reference/derivedClassSuperCallsInNonConstructorMembers.js +++ b/tests/baselines/reference/derivedClassSuperCallsInNonConstructorMembers.js @@ -58,37 +58,35 @@ var Derived = /** @class */ (function (_super) { function Derived() { return _super !== null && _super.apply(this, arguments) || this; } + ; + Derived.prototype.b = function () { + _this = _super.call(this) || this; + }; + Object.defineProperty(Derived.prototype, "C", { + get: function () { + _this = _super.call(this) || this; + return 1; + }, + set: function (v) { + _this = _super.call(this) || this; + }, + enumerable: false, + configurable: true + }); + ; + Derived.b = function () { + _this = _super.call(this) || this; + }; + Object.defineProperty(Derived, "C", { + get: function () { + _this = _super.call(this) || this; + return 1; + }, + set: function (v) { + _this = _super.call(this) || this; + }, + enumerable: false, + configurable: true + }); return Derived; }(Base)); -(); -b(); -{ - _this = _super.call(this) || this; -} -get; -C(); -{ - _this = _super.call(this) || this; - return 1; -} -set; -C(v); -{ - _this = _super.call(this) || this; -} -a: _this = _super.call(this) || this; -b(); -{ - _this = _super.call(this) || this; -} -get; -C(); -{ - _this = _super.call(this) || this; - return 1; -} -set; -C(v); -{ - _this = _super.call(this) || this; -} diff --git a/tests/baselines/reference/derivedClassSuperCallsInNonConstructorMembers.symbols b/tests/baselines/reference/derivedClassSuperCallsInNonConstructorMembers.symbols index 8a394e9d6593a..0d5c10321cd05 100644 --- a/tests/baselines/reference/derivedClassSuperCallsInNonConstructorMembers.symbols +++ b/tests/baselines/reference/derivedClassSuperCallsInNonConstructorMembers.symbols @@ -16,25 +16,41 @@ class Derived extends Base { >a : Symbol(Derived.a, Decl(derivedClassSuperCallsInNonConstructorMembers.ts, 6, 28)) b() { +>b : Symbol(Derived.b, Decl(derivedClassSuperCallsInNonConstructorMembers.ts, 7, 15)) + super(); } get C() { +>C : Symbol(Derived.C, Decl(derivedClassSuperCallsInNonConstructorMembers.ts, 10, 5), Decl(derivedClassSuperCallsInNonConstructorMembers.ts, 14, 5)) + super(); return 1; } set C(v) { +>C : Symbol(Derived.C, Decl(derivedClassSuperCallsInNonConstructorMembers.ts, 10, 5), Decl(derivedClassSuperCallsInNonConstructorMembers.ts, 14, 5)) +>v : Symbol(v, Decl(derivedClassSuperCallsInNonConstructorMembers.ts, 15, 10)) + super(); } static a: super(); +>a : Symbol(Derived.a, Decl(derivedClassSuperCallsInNonConstructorMembers.ts, 17, 5)) + static b() { +>b : Symbol(Derived.b, Decl(derivedClassSuperCallsInNonConstructorMembers.ts, 19, 22)) + super(); } static get C() { +>C : Symbol(Derived.C, Decl(derivedClassSuperCallsInNonConstructorMembers.ts, 22, 5), Decl(derivedClassSuperCallsInNonConstructorMembers.ts, 26, 5)) + super(); return 1; } static set C(v) { +>C : Symbol(Derived.C, Decl(derivedClassSuperCallsInNonConstructorMembers.ts, 22, 5), Decl(derivedClassSuperCallsInNonConstructorMembers.ts, 26, 5)) +>v : Symbol(v, Decl(derivedClassSuperCallsInNonConstructorMembers.ts, 27, 17)) + super(); } } diff --git a/tests/baselines/reference/derivedClassSuperCallsInNonConstructorMembers.types b/tests/baselines/reference/derivedClassSuperCallsInNonConstructorMembers.types index 715686667de21..06098482ad3e1 100644 --- a/tests/baselines/reference/derivedClassSuperCallsInNonConstructorMembers.types +++ b/tests/baselines/reference/derivedClassSuperCallsInNonConstructorMembers.types @@ -14,21 +14,16 @@ class Derived extends Base { a: super(); >a : any ->() : any -> : any b() { ->b() : any ->b : any +>b : () => void super(); >super() : void >super : any } get C() { ->get : any ->C() : any ->C : any +>C : number super(); >super() : void @@ -38,10 +33,8 @@ class Derived extends Base { >1 : 1 } set C(v) { ->set : any ->C(v) : any ->C : any ->v : any +>C : number +>v : number super(); >super() : void @@ -50,21 +43,16 @@ class Derived extends Base { static a: super(); >a : any ->super() : void ->super : any static b() { ->b() : any ->b : any +>b : () => void super(); >super() : void >super : any } static get C() { ->get : any ->C() : any ->C : any +>C : number super(); >super() : void @@ -74,10 +62,8 @@ class Derived extends Base { >1 : 1 } static set C(v) { ->set : any ->C(v) : any ->C : any ->v : any +>C : number +>v : number super(); >super() : void diff --git a/tests/baselines/reference/es6ImportNamedImportParsingError.errors.txt b/tests/baselines/reference/es6ImportNamedImportParsingError.errors.txt index aa89e2dc9977d..ff928a4b62cf2 100644 --- a/tests/baselines/reference/es6ImportNamedImportParsingError.errors.txt +++ b/tests/baselines/reference/es6ImportNamedImportParsingError.errors.txt @@ -1,14 +1,14 @@ tests/cases/compiler/es6ImportNamedImportParsingError_1.ts(1,10): error TS1003: Identifier expected. tests/cases/compiler/es6ImportNamedImportParsingError_1.ts(1,10): error TS1141: String literal expected. tests/cases/compiler/es6ImportNamedImportParsingError_1.ts(1,12): error TS1109: Expression expected. +tests/cases/compiler/es6ImportNamedImportParsingError_1.ts(1,14): error TS1434: Unexpected keyword or identifier. tests/cases/compiler/es6ImportNamedImportParsingError_1.ts(1,14): error TS2304: Cannot find name 'from'. -tests/cases/compiler/es6ImportNamedImportParsingError_1.ts(1,19): error TS1005: ';' expected. tests/cases/compiler/es6ImportNamedImportParsingError_1.ts(2,8): error TS1192: Module '"tests/cases/compiler/es6ImportNamedImportParsingError_0"' has no default export. tests/cases/compiler/es6ImportNamedImportParsingError_1.ts(2,24): error TS1005: '{' expected. tests/cases/compiler/es6ImportNamedImportParsingError_1.ts(3,1): error TS1128: Declaration or statement expected. tests/cases/compiler/es6ImportNamedImportParsingError_1.ts(3,8): error TS1128: Declaration or statement expected. +tests/cases/compiler/es6ImportNamedImportParsingError_1.ts(3,16): error TS1434: Unexpected keyword or identifier. tests/cases/compiler/es6ImportNamedImportParsingError_1.ts(3,16): error TS2304: Cannot find name 'from'. -tests/cases/compiler/es6ImportNamedImportParsingError_1.ts(3,21): error TS1005: ';' expected. tests/cases/compiler/es6ImportNamedImportParsingError_1.ts(4,13): error TS1005: 'from' expected. tests/cases/compiler/es6ImportNamedImportParsingError_1.ts(4,13): error TS1141: String literal expected. tests/cases/compiler/es6ImportNamedImportParsingError_1.ts(4,20): error TS1005: ';' expected. @@ -28,9 +28,9 @@ tests/cases/compiler/es6ImportNamedImportParsingError_1.ts(4,20): error TS1005: ~ !!! error TS1109: Expression expected. ~~~~ +!!! error TS1434: Unexpected keyword or identifier. + ~~~~ !!! error TS2304: Cannot find name 'from'. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1005: ';' expected. import defaultBinding, from "es6ImportNamedImportParsingError_0"; ~~~~~~~~~~~~~~ !!! error TS1192: Module '"tests/cases/compiler/es6ImportNamedImportParsingError_0"' has no default export. @@ -42,9 +42,9 @@ tests/cases/compiler/es6ImportNamedImportParsingError_1.ts(4,20): error TS1005: ~ !!! error TS1128: Declaration or statement expected. ~~~~ +!!! error TS1434: Unexpected keyword or identifier. + ~~~~ !!! error TS2304: Cannot find name 'from'. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1005: ';' expected. import { a }, from "es6ImportNamedImportParsingError_0"; ~ !!! error TS1005: 'from' expected. diff --git a/tests/baselines/reference/extension.errors.txt b/tests/baselines/reference/extension.errors.txt index d643cd9e30bd0..b7828e1d05143 100644 --- a/tests/baselines/reference/extension.errors.txt +++ b/tests/baselines/reference/extension.errors.txt @@ -1,7 +1,7 @@ tests/cases/compiler/extension.ts(10,18): error TS2300: Duplicate identifier 'C'. tests/cases/compiler/extension.ts(16,5): error TS1128: Declaration or statement expected. +tests/cases/compiler/extension.ts(16,12): error TS1434: Unexpected keyword or identifier. tests/cases/compiler/extension.ts(16,12): error TS2304: Cannot find name 'extension'. -tests/cases/compiler/extension.ts(16,22): error TS1005: ';' expected. tests/cases/compiler/extension.ts(16,28): error TS2300: Duplicate identifier 'C'. tests/cases/compiler/extension.ts(22,3): error TS2339: Property 'pe' does not exist on type 'C'. @@ -28,9 +28,9 @@ tests/cases/compiler/extension.ts(22,3): error TS2339: Property 'pe' does not ex ~~~~~~ !!! error TS1128: Declaration or statement expected. ~~~~~~~~~ +!!! error TS1434: Unexpected keyword or identifier. + ~~~~~~~~~ !!! error TS2304: Cannot find name 'extension'. - ~~~~~ -!!! error TS1005: ';' expected. ~ !!! error TS2300: Duplicate identifier 'C'. public pe:string; diff --git a/tests/baselines/reference/externModule.errors.txt b/tests/baselines/reference/externModule.errors.txt index 4d6773c90ea46..438db5d0e77bb 100644 --- a/tests/baselines/reference/externModule.errors.txt +++ b/tests/baselines/reference/externModule.errors.txt @@ -1,7 +1,6 @@ tests/cases/compiler/externModule.ts(1,1): error TS2304: Cannot find name 'declare'. -tests/cases/compiler/externModule.ts(1,9): error TS1005: ';' expected. tests/cases/compiler/externModule.ts(1,9): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -tests/cases/compiler/externModule.ts(1,16): error TS1005: ';' expected. +tests/cases/compiler/externModule.ts(1,16): error TS1437: Namespace must be given a name. tests/cases/compiler/externModule.ts(3,10): error TS2391: Function implementation is missing or not immediately following the declaration. tests/cases/compiler/externModule.ts(4,10): error TS2391: Function implementation is missing or not immediately following the declaration. tests/cases/compiler/externModule.ts(18,6): error TS2390: Constructor implementation is missing. @@ -14,16 +13,14 @@ tests/cases/compiler/externModule.ts(36,7): error TS2552: Cannot find name 'XDat tests/cases/compiler/externModule.ts(37,3): error TS2552: Cannot find name 'XDate'. Did you mean 'Date'? -==== tests/cases/compiler/externModule.ts (14 errors) ==== +==== tests/cases/compiler/externModule.ts (13 errors) ==== declare module { ~~~~~~~ !!! error TS2304: Cannot find name 'declare'. ~~~~~~ -!!! error TS1005: ';' expected. - ~~~~~~ !!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ~ -!!! error TS1005: ';' expected. +!!! error TS1437: Namespace must be given a name. export class XDate { public getDay():number; ~~~~~~ diff --git a/tests/baselines/reference/innerModExport1.errors.txt b/tests/baselines/reference/innerModExport1.errors.txt index 28ff80d9da53a..26e4b8d09006c 100644 --- a/tests/baselines/reference/innerModExport1.errors.txt +++ b/tests/baselines/reference/innerModExport1.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/innerModExport1.ts(5,5): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -tests/cases/compiler/innerModExport1.ts(5,12): error TS1005: ';' expected. +tests/cases/compiler/innerModExport1.ts(5,12): error TS1437: Namespace must be given a name. ==== tests/cases/compiler/innerModExport1.ts (2 errors) ==== @@ -11,7 +11,7 @@ tests/cases/compiler/innerModExport1.ts(5,12): error TS1005: ';' expected. ~~~~~~ !!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ~ -!!! error TS1005: ';' expected. +!!! error TS1437: Namespace must be given a name. var non_export_var = 0; export var export_var = 1; diff --git a/tests/baselines/reference/innerModExport2.errors.txt b/tests/baselines/reference/innerModExport2.errors.txt index 6c79afcddb419..7057b7e6d7aa1 100644 --- a/tests/baselines/reference/innerModExport2.errors.txt +++ b/tests/baselines/reference/innerModExport2.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/innerModExport2.ts(5,5): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -tests/cases/compiler/innerModExport2.ts(5,12): error TS1005: ';' expected. +tests/cases/compiler/innerModExport2.ts(5,12): error TS1437: Namespace must be given a name. tests/cases/compiler/innerModExport2.ts(7,20): error TS2395: Individual declarations in merged declaration 'export_var' must be all exported or all local. tests/cases/compiler/innerModExport2.ts(13,9): error TS2395: Individual declarations in merged declaration 'export_var' must be all exported or all local. tests/cases/compiler/innerModExport2.ts(20,7): error TS2339: Property 'NonExportFunc' does not exist on type 'typeof Outer'. @@ -14,7 +14,7 @@ tests/cases/compiler/innerModExport2.ts(20,7): error TS2339: Property 'NonExport ~~~~~~ !!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ~ -!!! error TS1005: ';' expected. +!!! error TS1437: Namespace must be given a name. var non_export_var = 0; export var export_var = 1; ~~~~~~~~~~ diff --git a/tests/baselines/reference/interfaceDeclaration4.errors.txt b/tests/baselines/reference/interfaceDeclaration4.errors.txt index f1838011818c0..58f487dd02997 100644 --- a/tests/baselines/reference/interfaceDeclaration4.errors.txt +++ b/tests/baselines/reference/interfaceDeclaration4.errors.txt @@ -6,8 +6,8 @@ tests/cases/compiler/interfaceDeclaration4.ts(27,7): error TS2420: Class 'C2' in tests/cases/compiler/interfaceDeclaration4.ts(36,7): error TS2420: Class 'C3' incorrectly implements interface 'I1'. Property 'item' is missing in type 'C3' but required in type 'I1'. tests/cases/compiler/interfaceDeclaration4.ts(39,14): error TS1005: '{' expected. +tests/cases/compiler/interfaceDeclaration4.ts(39,15): error TS1434: Unexpected keyword or identifier. tests/cases/compiler/interfaceDeclaration4.ts(39,15): error TS2304: Cannot find name 'I1'. -tests/cases/compiler/interfaceDeclaration4.ts(39,18): error TS1005: ';' expected. ==== tests/cases/compiler/interfaceDeclaration4.ts (6 errors) ==== @@ -65,7 +65,7 @@ tests/cases/compiler/interfaceDeclaration4.ts(39,18): error TS1005: ';' expected ~ !!! error TS1005: '{' expected. ~~ +!!! error TS1434: Unexpected keyword or identifier. + ~~ !!! error TS2304: Cannot find name 'I1'. - ~ -!!! error TS1005: ';' expected. \ No newline at end of file diff --git a/tests/baselines/reference/interfaceNaming1.errors.txt b/tests/baselines/reference/interfaceNaming1.errors.txt index f328e14fb1a78..30026d6335280 100644 --- a/tests/baselines/reference/interfaceNaming1.errors.txt +++ b/tests/baselines/reference/interfaceNaming1.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/interfaceNaming1.ts(1,1): error TS2693: 'interface' only refers to a type, but is being used as a value here. -tests/cases/compiler/interfaceNaming1.ts(1,11): error TS1005: ';' expected. +tests/cases/compiler/interfaceNaming1.ts(1,11): error TS1438: Interface must be given a name. tests/cases/compiler/interfaceNaming1.ts(3,1): error TS2693: 'interface' only refers to a type, but is being used as a value here. tests/cases/compiler/interfaceNaming1.ts(3,13): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type. @@ -9,7 +9,7 @@ tests/cases/compiler/interfaceNaming1.ts(3,13): error TS2363: The right-hand sid ~~~~~~~~~ !!! error TS2693: 'interface' only refers to a type, but is being used as a value here. ~ -!!! error TS1005: ';' expected. +!!! error TS1438: Interface must be given a name. interface interface{ } interface & { } ~~~~~~~~~ diff --git a/tests/baselines/reference/interfacesWithPredefinedTypesAsNames.errors.txt b/tests/baselines/reference/interfacesWithPredefinedTypesAsNames.errors.txt index d6ad166fb0f73..d6193774a222a 100644 --- a/tests/baselines/reference/interfacesWithPredefinedTypesAsNames.errors.txt +++ b/tests/baselines/reference/interfacesWithPredefinedTypesAsNames.errors.txt @@ -3,7 +3,7 @@ tests/cases/conformance/interfaces/interfaceDeclarations/interfacesWithPredefine tests/cases/conformance/interfaces/interfaceDeclarations/interfacesWithPredefinedTypesAsNames.ts(3,11): error TS2427: Interface name cannot be 'string'. tests/cases/conformance/interfaces/interfaceDeclarations/interfacesWithPredefinedTypesAsNames.ts(4,11): error TS2427: Interface name cannot be 'boolean'. tests/cases/conformance/interfaces/interfaceDeclarations/interfacesWithPredefinedTypesAsNames.ts(5,1): error TS2304: Cannot find name 'interface'. -tests/cases/conformance/interfaces/interfaceDeclarations/interfacesWithPredefinedTypesAsNames.ts(5,11): error TS1005: ';' expected. +tests/cases/conformance/interfaces/interfaceDeclarations/interfacesWithPredefinedTypesAsNames.ts(5,11): error TS2427: Interface name cannot be 'void'. tests/cases/conformance/interfaces/interfaceDeclarations/interfacesWithPredefinedTypesAsNames.ts(6,11): error TS2427: Interface name cannot be 'unknown'. tests/cases/conformance/interfaces/interfaceDeclarations/interfacesWithPredefinedTypesAsNames.ts(7,11): error TS2427: Interface name cannot be 'never'. @@ -25,7 +25,7 @@ tests/cases/conformance/interfaces/interfaceDeclarations/interfacesWithPredefine ~~~~~~~~~ !!! error TS2304: Cannot find name 'interface'. ~~~~ -!!! error TS1005: ';' expected. +!!! error TS2427: Interface name cannot be 'void'. interface unknown {} ~~~~~~~ !!! error TS2427: Interface name cannot be 'unknown'. diff --git a/tests/baselines/reference/invalidSyntaxNamespaceImportWithAMD.errors.txt b/tests/baselines/reference/invalidSyntaxNamespaceImportWithAMD.errors.txt index 97afe586046e9..6f4e15039880f 100644 --- a/tests/baselines/reference/invalidSyntaxNamespaceImportWithAMD.errors.txt +++ b/tests/baselines/reference/invalidSyntaxNamespaceImportWithAMD.errors.txt @@ -2,13 +2,12 @@ tests/cases/conformance/externalModules/1.ts(1,10): error TS1005: 'as' expected. tests/cases/conformance/externalModules/1.ts(1,15): error TS1005: 'from' expected. tests/cases/conformance/externalModules/1.ts(1,15): error TS1141: String literal expected. tests/cases/conformance/externalModules/1.ts(1,20): error TS1005: ';' expected. -tests/cases/conformance/externalModules/1.ts(1,25): error TS1005: ';' expected. ==== tests/cases/conformance/externalModules/0.ts (0 errors) ==== export class C { } -==== tests/cases/conformance/externalModules/1.ts (5 errors) ==== +==== tests/cases/conformance/externalModules/1.ts (4 errors) ==== import * from Zero from "./0" ~~~~ !!! error TS1005: 'as' expected. @@ -17,6 +16,4 @@ tests/cases/conformance/externalModules/1.ts(1,25): error TS1005: ';' expected. ~~~~ !!! error TS1141: String literal expected. ~~~~ -!!! error TS1005: ';' expected. - ~~~~~ !!! error TS1005: ';' expected. \ No newline at end of file diff --git a/tests/baselines/reference/invalidSyntaxNamespaceImportWithCommonjs.errors.txt b/tests/baselines/reference/invalidSyntaxNamespaceImportWithCommonjs.errors.txt index 97afe586046e9..6f4e15039880f 100644 --- a/tests/baselines/reference/invalidSyntaxNamespaceImportWithCommonjs.errors.txt +++ b/tests/baselines/reference/invalidSyntaxNamespaceImportWithCommonjs.errors.txt @@ -2,13 +2,12 @@ tests/cases/conformance/externalModules/1.ts(1,10): error TS1005: 'as' expected. tests/cases/conformance/externalModules/1.ts(1,15): error TS1005: 'from' expected. tests/cases/conformance/externalModules/1.ts(1,15): error TS1141: String literal expected. tests/cases/conformance/externalModules/1.ts(1,20): error TS1005: ';' expected. -tests/cases/conformance/externalModules/1.ts(1,25): error TS1005: ';' expected. ==== tests/cases/conformance/externalModules/0.ts (0 errors) ==== export class C { } -==== tests/cases/conformance/externalModules/1.ts (5 errors) ==== +==== tests/cases/conformance/externalModules/1.ts (4 errors) ==== import * from Zero from "./0" ~~~~ !!! error TS1005: 'as' expected. @@ -17,6 +16,4 @@ tests/cases/conformance/externalModules/1.ts(1,25): error TS1005: ';' expected. ~~~~ !!! error TS1141: String literal expected. ~~~~ -!!! error TS1005: ';' expected. - ~~~~~ !!! error TS1005: ';' expected. \ No newline at end of file diff --git a/tests/baselines/reference/invalidSyntaxNamespaceImportWithSystem.errors.txt b/tests/baselines/reference/invalidSyntaxNamespaceImportWithSystem.errors.txt index 97afe586046e9..6f4e15039880f 100644 --- a/tests/baselines/reference/invalidSyntaxNamespaceImportWithSystem.errors.txt +++ b/tests/baselines/reference/invalidSyntaxNamespaceImportWithSystem.errors.txt @@ -2,13 +2,12 @@ tests/cases/conformance/externalModules/1.ts(1,10): error TS1005: 'as' expected. tests/cases/conformance/externalModules/1.ts(1,15): error TS1005: 'from' expected. tests/cases/conformance/externalModules/1.ts(1,15): error TS1141: String literal expected. tests/cases/conformance/externalModules/1.ts(1,20): error TS1005: ';' expected. -tests/cases/conformance/externalModules/1.ts(1,25): error TS1005: ';' expected. ==== tests/cases/conformance/externalModules/0.ts (0 errors) ==== export class C { } -==== tests/cases/conformance/externalModules/1.ts (5 errors) ==== +==== tests/cases/conformance/externalModules/1.ts (4 errors) ==== import * from Zero from "./0" ~~~~ !!! error TS1005: 'as' expected. @@ -17,6 +16,4 @@ tests/cases/conformance/externalModules/1.ts(1,25): error TS1005: ';' expected. ~~~~ !!! error TS1141: String literal expected. ~~~~ -!!! error TS1005: ';' expected. - ~~~~~ !!! error TS1005: ';' expected. \ No newline at end of file diff --git a/tests/baselines/reference/parseErrorIncorrectReturnToken.errors.txt b/tests/baselines/reference/parseErrorIncorrectReturnToken.errors.txt index bc43cd5b7763b..a5533c3c12af2 100644 --- a/tests/baselines/reference/parseErrorIncorrectReturnToken.errors.txt +++ b/tests/baselines/reference/parseErrorIncorrectReturnToken.errors.txt @@ -2,8 +2,8 @@ tests/cases/compiler/parseErrorIncorrectReturnToken.ts(2,17): error TS1005: ':' tests/cases/compiler/parseErrorIncorrectReturnToken.ts(4,22): error TS1005: '=>' expected. tests/cases/compiler/parseErrorIncorrectReturnToken.ts(4,24): error TS2693: 'string' only refers to a type, but is being used as a value here. tests/cases/compiler/parseErrorIncorrectReturnToken.ts(9,18): error TS1005: '{' expected. +tests/cases/compiler/parseErrorIncorrectReturnToken.ts(9,21): error TS1434: Unexpected keyword or identifier. tests/cases/compiler/parseErrorIncorrectReturnToken.ts(9,21): error TS2693: 'string' only refers to a type, but is being used as a value here. -tests/cases/compiler/parseErrorIncorrectReturnToken.ts(9,28): error TS1005: ';' expected. tests/cases/compiler/parseErrorIncorrectReturnToken.ts(12,1): error TS1128: Declaration or statement expected. @@ -27,9 +27,9 @@ tests/cases/compiler/parseErrorIncorrectReturnToken.ts(12,1): error TS1128: Decl !!! 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. + ~~~~~~ !!! error TS2693: 'string' only refers to a type, but is being used as a value here. - ~ -!!! error TS1005: ';' expected. return n.toString(); } }; diff --git a/tests/baselines/reference/parser.numericSeparators.decmialNegative.errors.txt b/tests/baselines/reference/parser.numericSeparators.decmialNegative.errors.txt index 52c0581246a99..c9f5d90f09324 100644 --- a/tests/baselines/reference/parser.numericSeparators.decmialNegative.errors.txt +++ b/tests/baselines/reference/parser.numericSeparators.decmialNegative.errors.txt @@ -5,8 +5,8 @@ tests/cases/conformance/parser/ecmascript2021/numericSeparators/12.ts(1,2): erro tests/cases/conformance/parser/ecmascript2021/numericSeparators/13.ts(1,3): error TS6188: Numeric separators are not allowed here. tests/cases/conformance/parser/ecmascript2021/numericSeparators/14.ts(1,4): error TS6188: Numeric separators are not allowed here. tests/cases/conformance/parser/ecmascript2021/numericSeparators/15.ts(1,5): error TS6188: Numeric separators are not allowed here. +tests/cases/conformance/parser/ecmascript2021/numericSeparators/16.ts(1,1): error TS1434: Unexpected keyword or identifier. tests/cases/conformance/parser/ecmascript2021/numericSeparators/16.ts(1,1): error TS2304: Cannot find name '_0'. -tests/cases/conformance/parser/ecmascript2021/numericSeparators/16.ts(1,3): error TS1005: ';' expected. tests/cases/conformance/parser/ecmascript2021/numericSeparators/17.ts(1,6): error TS6188: Numeric separators are not allowed here. tests/cases/conformance/parser/ecmascript2021/numericSeparators/18.ts(1,3): error TS6189: Multiple consecutive numeric separators are not permitted. tests/cases/conformance/parser/ecmascript2021/numericSeparators/19.ts(1,5): error TS6189: Multiple consecutive numeric separators are not permitted. @@ -20,8 +20,8 @@ tests/cases/conformance/parser/ecmascript2021/numericSeparators/25.ts(1,2): erro tests/cases/conformance/parser/ecmascript2021/numericSeparators/26.ts(1,3): error TS6188: Numeric separators are not allowed here. tests/cases/conformance/parser/ecmascript2021/numericSeparators/27.ts(1,4): error TS6188: Numeric separators are not allowed here. tests/cases/conformance/parser/ecmascript2021/numericSeparators/28.ts(1,6): error TS6188: Numeric separators are not allowed here. +tests/cases/conformance/parser/ecmascript2021/numericSeparators/29.ts(1,1): error TS1434: Unexpected keyword or identifier. tests/cases/conformance/parser/ecmascript2021/numericSeparators/29.ts(1,1): error TS2304: Cannot find name '_0'. -tests/cases/conformance/parser/ecmascript2021/numericSeparators/29.ts(1,3): error TS1005: ';' expected. tests/cases/conformance/parser/ecmascript2021/numericSeparators/3.ts(1,3): error TS6189: Multiple consecutive numeric separators are not permitted. tests/cases/conformance/parser/ecmascript2021/numericSeparators/30.ts(1,7): error TS6188: Numeric separators are not allowed here. tests/cases/conformance/parser/ecmascript2021/numericSeparators/31.ts(1,3): error TS6189: Multiple consecutive numeric separators are not permitted. @@ -36,8 +36,8 @@ tests/cases/conformance/parser/ecmascript2021/numericSeparators/39.ts(1,3): erro tests/cases/conformance/parser/ecmascript2021/numericSeparators/4.ts(1,2): error TS6188: Numeric separators are not allowed here. tests/cases/conformance/parser/ecmascript2021/numericSeparators/40.ts(1,4): error TS6188: Numeric separators are not allowed here. tests/cases/conformance/parser/ecmascript2021/numericSeparators/41.ts(1,6): error TS6188: Numeric separators are not allowed here. +tests/cases/conformance/parser/ecmascript2021/numericSeparators/42.ts(1,1): error TS1434: Unexpected keyword or identifier. tests/cases/conformance/parser/ecmascript2021/numericSeparators/42.ts(1,1): error TS2304: Cannot find name '_0'. -tests/cases/conformance/parser/ecmascript2021/numericSeparators/42.ts(1,3): error TS1005: ';' expected. tests/cases/conformance/parser/ecmascript2021/numericSeparators/43.ts(1,7): error TS6188: Numeric separators are not allowed here. tests/cases/conformance/parser/ecmascript2021/numericSeparators/44.ts(1,3): error TS6189: Multiple consecutive numeric separators are not permitted. tests/cases/conformance/parser/ecmascript2021/numericSeparators/45.ts(1,5): error TS6189: Multiple consecutive numeric separators are not permitted. @@ -136,9 +136,9 @@ tests/cases/conformance/parser/ecmascript2021/numericSeparators/9.ts(1,3): error ==== tests/cases/conformance/parser/ecmascript2021/numericSeparators/16.ts (2 errors) ==== _0.0e0 ~~ +!!! error TS1434: Unexpected keyword or identifier. + ~~ !!! error TS2304: Cannot find name '_0'. - ~~~~ -!!! error TS1005: ';' expected. ==== tests/cases/conformance/parser/ecmascript2021/numericSeparators/17.ts (1 errors) ==== 0.0e0_ @@ -203,9 +203,9 @@ tests/cases/conformance/parser/ecmascript2021/numericSeparators/9.ts(1,3): error ==== tests/cases/conformance/parser/ecmascript2021/numericSeparators/29.ts (2 errors) ==== _0.0e+0 ~~ +!!! error TS1434: Unexpected keyword or identifier. + ~~ !!! error TS2304: Cannot find name '_0'. - ~~~~~ -!!! error TS1005: ';' expected. ==== tests/cases/conformance/parser/ecmascript2021/numericSeparators/30.ts (1 errors) ==== 0.0e+0_ @@ -270,9 +270,9 @@ tests/cases/conformance/parser/ecmascript2021/numericSeparators/9.ts(1,3): error ==== tests/cases/conformance/parser/ecmascript2021/numericSeparators/42.ts (2 errors) ==== _0.0e-0 ~~ +!!! error TS1434: Unexpected keyword or identifier. + ~~ !!! error TS2304: Cannot find name '_0'. - ~~~~~ -!!! error TS1005: ';' expected. ==== tests/cases/conformance/parser/ecmascript2021/numericSeparators/43.ts (1 errors) ==== 0.0e-0_ diff --git a/tests/baselines/reference/parser0_004152.errors.txt b/tests/baselines/reference/parser0_004152.errors.txt index 93ac55f4c409f..a1790a5f7305c 100644 --- a/tests/baselines/reference/parser0_004152.errors.txt +++ b/tests/baselines/reference/parser0_004152.errors.txt @@ -1,6 +1,6 @@ tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,28): error TS2304: Cannot find name 'DisplayPosition'. tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,45): error TS1137: Expression or comma expected. -tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,46): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,46): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,49): error TS1005: ';' expected. tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,51): error TS2300: Duplicate identifier '3'. tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,52): error TS1005: ';' expected. @@ -26,13 +26,14 @@ tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,82): error T tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,84): error TS2300: Duplicate identifier '0'. tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,85): error TS1005: ';' expected. tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,86): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. -tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,94): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,88): error TS1434: Unexpected keyword or identifier. +tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,94): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,96): error TS2300: Duplicate identifier '0'. tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,97): error TS1005: ';' expected. tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(3,25): error TS2304: Cannot find name 'SeedCoords'. -==== tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts (32 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts (33 errors) ==== export class Game { private position = new DisplayPosition([), 3, 3, 3, 3, 3, 0, 3, 3, 3, 3, 3, 3, 0], NoMove, 0); ~~~~~~~~~~~~~~~ @@ -40,7 +41,7 @@ tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(3,25): error T ~ !!! error TS1137: Expression or comma expected. ~ -!!! error TS1005: ';' expected. +!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. ~ !!! error TS1005: ';' expected. ~ @@ -91,8 +92,10 @@ tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(3,25): error T !!! error TS1005: ';' expected. ~ !!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. + ~~~~~~ +!!! error TS1434: Unexpected keyword or identifier. ~ -!!! error TS1005: ';' expected. +!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. ~ !!! error TS2300: Duplicate identifier '0'. ~ diff --git a/tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable2.errors.txt b/tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable2.errors.txt index 0a5ab5e26e647..f5602fea178b1 100644 --- a/tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable2.errors.txt +++ b/tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable2.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/parser/ecmascript5/ErrorRecovery/IncompleteMemberVariables/parserErrorRecovery_IncompleteMemberVariable2.ts(12,20): error TS2304: Cannot find name 'C'. -tests/cases/conformance/parser/ecmascript5/ErrorRecovery/IncompleteMemberVariables/parserErrorRecovery_IncompleteMemberVariable2.ts(12,22): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascript5/ErrorRecovery/IncompleteMemberVariables/parserErrorRecovery_IncompleteMemberVariable2.ts(12,22): error TS1442: Missing '=' before default property value. ==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/IncompleteMemberVariables/parserErrorRecovery_IncompleteMemberVariable2.ts (2 errors) ==== @@ -18,7 +18,7 @@ tests/cases/conformance/parser/ecmascript5/ErrorRecovery/IncompleteMemberVariabl ~ !!! error TS2304: Cannot find name 'C'. ~~~~~~~ -!!! error TS1005: ';' expected. +!!! error TS1442: Missing '=' before default property value. // Constructor constructor (public x: number, public y: number) { } diff --git a/tests/baselines/reference/parserFuzz1.errors.txt b/tests/baselines/reference/parserFuzz1.errors.txt index e11d25c48fa56..88934111f142d 100644 --- a/tests/baselines/reference/parserFuzz1.errors.txt +++ b/tests/baselines/reference/parserFuzz1.errors.txt @@ -1,12 +1,13 @@ tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserFuzz1.ts(1,1): error TS2304: Cannot find name 'cla'. tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserFuzz1.ts(1,6): error TS2304: Cannot find name 'ss'. tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserFuzz1.ts(1,9): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserFuzz1.ts(2,3): error TS1434: Unexpected keyword or identifier. tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserFuzz1.ts(2,3): error TS2304: Cannot find name '_'. -tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserFuzz1.ts(2,5): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserFuzz1.ts(2,5): error TS1128: Declaration or statement expected. tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserFuzz1.ts(2,15): error TS1005: '{' expected. -==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserFuzz1.ts (6 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserFuzz1.ts (7 errors) ==== cla ' expected. tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserUnterminatedGeneric2.ts(4,9): error TS2304: Cannot find name 'assign'. tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserUnterminatedGeneric2.ts(4,16): error TS2304: Cannot find name 'context'. @@ -19,9 +19,9 @@ tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserUnterminatedGener declare module ng { interfaceICompiledExpression { ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1435: Unknown keyword or identifier. Did you mean 'interface ICompiledExpression'? + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2304: Cannot find name 'interfaceICompiledExpression'. - ~ -!!! error TS1005: ';' expected. (context: any, locals?: any): any; ~ !!! error TS1005: '=>' expected. diff --git a/tests/baselines/reference/privateInstanceMemberAccessibility.errors.txt b/tests/baselines/reference/privateInstanceMemberAccessibility.errors.txt index ae7dac2f18c8c..d91aa077fd6b1 100644 --- a/tests/baselines/reference/privateInstanceMemberAccessibility.errors.txt +++ b/tests/baselines/reference/privateInstanceMemberAccessibility.errors.txt @@ -3,7 +3,7 @@ tests/cases/conformance/classes/members/accessibility/privateInstanceMemberAcces tests/cases/conformance/classes/members/accessibility/privateInstanceMemberAccessibility.ts(6,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword. tests/cases/conformance/classes/members/accessibility/privateInstanceMemberAccessibility.ts(8,22): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword. tests/cases/conformance/classes/members/accessibility/privateInstanceMemberAccessibility.ts(10,15): error TS2304: Cannot find name 'super'. -tests/cases/conformance/classes/members/accessibility/privateInstanceMemberAccessibility.ts(12,12): error TS1005: ';' expected. +tests/cases/conformance/classes/members/accessibility/privateInstanceMemberAccessibility.ts(12,12): error TS1442: Missing '=' before default property value. ==== tests/cases/conformance/classes/members/accessibility/privateInstanceMemberAccessibility.ts (5 errors) ==== @@ -29,5 +29,5 @@ tests/cases/conformance/classes/members/accessibility/privateInstanceMemberAcces a: this.foo; // error ~ -!!! error TS1005: ';' expected. +!!! error TS1442: Missing '=' before default property value. } \ No newline at end of file diff --git a/tests/baselines/reference/reservedNamesInAliases.errors.txt b/tests/baselines/reference/reservedNamesInAliases.errors.txt index fc5ed8ae9c97d..0afac4f6229fa 100644 --- a/tests/baselines/reference/reservedNamesInAliases.errors.txt +++ b/tests/baselines/reference/reservedNamesInAliases.errors.txt @@ -3,7 +3,7 @@ tests/cases/conformance/types/typeAliases/reservedNamesInAliases.ts(3,6): error tests/cases/conformance/types/typeAliases/reservedNamesInAliases.ts(4,6): error TS2457: Type alias name cannot be 'boolean'. tests/cases/conformance/types/typeAliases/reservedNamesInAliases.ts(5,6): error TS2457: Type alias name cannot be 'string'. tests/cases/conformance/types/typeAliases/reservedNamesInAliases.ts(6,1): error TS2304: Cannot find name 'type'. -tests/cases/conformance/types/typeAliases/reservedNamesInAliases.ts(6,6): error TS1005: ';' expected. +tests/cases/conformance/types/typeAliases/reservedNamesInAliases.ts(6,6): error TS2457: Type alias name cannot be 'void'. tests/cases/conformance/types/typeAliases/reservedNamesInAliases.ts(6,11): error TS1109: Expression expected. tests/cases/conformance/types/typeAliases/reservedNamesInAliases.ts(6,13): error TS2693: 'I' only refers to a type, but is being used as a value here. tests/cases/conformance/types/typeAliases/reservedNamesInAliases.ts(7,6): error TS2457: Type alias name cannot be 'object'. @@ -27,7 +27,7 @@ tests/cases/conformance/types/typeAliases/reservedNamesInAliases.ts(7,6): error ~~~~ !!! error TS2304: Cannot find name 'type'. ~~~~ -!!! error TS1005: ';' expected. +!!! error TS2457: Type alias name cannot be 'void'. ~ !!! error TS1109: Expression expected. ~ diff --git a/tests/baselines/reference/reservedWords2.errors.txt b/tests/baselines/reference/reservedWords2.errors.txt index 599010b436872..18f594005c4e2 100644 --- a/tests/baselines/reference/reservedWords2.errors.txt +++ b/tests/baselines/reference/reservedWords2.errors.txt @@ -15,7 +15,7 @@ tests/cases/compiler/reservedWords2.ts(5,9): error TS2567: Enum declarations can tests/cases/compiler/reservedWords2.ts(5,10): error TS1359: Identifier expected. 'throw' is a reserved word that cannot be used here. tests/cases/compiler/reservedWords2.ts(5,18): error TS1005: '=>' expected. tests/cases/compiler/reservedWords2.ts(6,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -tests/cases/compiler/reservedWords2.ts(6,8): error TS1005: ';' expected. +tests/cases/compiler/reservedWords2.ts(6,8): error TS2819: Namespace name cannot be 'void'. tests/cases/compiler/reservedWords2.ts(7,11): error TS2300: Duplicate identifier '(Missing)'. tests/cases/compiler/reservedWords2.ts(7,11): error TS1005: ':' expected. tests/cases/compiler/reservedWords2.ts(7,19): error TS2300: Duplicate identifier '(Missing)'. @@ -77,7 +77,7 @@ tests/cases/compiler/reservedWords2.ts(12,17): error TS1138: Parameter declarati ~~~~~~ !!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ~~~~ -!!! error TS1005: ';' expected. +!!! error TS2819: Namespace name cannot be 'void'. var {while, return} = { while: 1, return: 2 }; !!! error TS2300: Duplicate identifier '(Missing)'. diff --git a/tests/baselines/reference/templateStringInModuleName.errors.txt b/tests/baselines/reference/templateStringInModuleName.errors.txt index 8b9a2a9bfa729..8540da04a01df 100644 --- a/tests/baselines/reference/templateStringInModuleName.errors.txt +++ b/tests/baselines/reference/templateStringInModuleName.errors.txt @@ -1,32 +1,26 @@ tests/cases/conformance/es6/templates/templateStringInModuleName.ts(1,1): error TS2304: Cannot find name 'declare'. -tests/cases/conformance/es6/templates/templateStringInModuleName.ts(1,9): error TS1005: ';' expected. tests/cases/conformance/es6/templates/templateStringInModuleName.ts(1,9): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -tests/cases/conformance/es6/templates/templateStringInModuleName.ts(1,21): error TS1005: ';' expected. +tests/cases/conformance/es6/templates/templateStringInModuleName.ts(1,16): error TS1443: Module declaration names may only use ' or " quoted strings. tests/cases/conformance/es6/templates/templateStringInModuleName.ts(4,1): error TS2304: Cannot find name 'declare'. -tests/cases/conformance/es6/templates/templateStringInModuleName.ts(4,9): error TS1005: ';' expected. tests/cases/conformance/es6/templates/templateStringInModuleName.ts(4,9): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -tests/cases/conformance/es6/templates/templateStringInModuleName.ts(4,24): error TS1005: ';' expected. +tests/cases/conformance/es6/templates/templateStringInModuleName.ts(4,16): error TS1443: Module declaration names may only use ' or " quoted strings. -==== tests/cases/conformance/es6/templates/templateStringInModuleName.ts (8 errors) ==== +==== tests/cases/conformance/es6/templates/templateStringInModuleName.ts (6 errors) ==== declare module `M1` { ~~~~~~~ !!! error TS2304: Cannot find name 'declare'. ~~~~~~ -!!! error TS1005: ';' expected. - ~~~~~~ !!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. - ~ -!!! error TS1005: ';' expected. + ~~~~ +!!! error TS1443: Module declaration names may only use ' or " quoted strings. } declare module `M${2}` { ~~~~~~~ !!! error TS2304: Cannot find name 'declare'. ~~~~~~ -!!! error TS1005: ';' expected. - ~~~~~~ !!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. - ~ -!!! error TS1005: ';' expected. + ~~~~~~~ +!!! error TS1443: Module declaration names may only use ' or " quoted strings. } \ No newline at end of file diff --git a/tests/baselines/reference/templateStringInModuleNameES6.errors.txt b/tests/baselines/reference/templateStringInModuleNameES6.errors.txt index fec19b2ec4470..9ef48a2c9fcd3 100644 --- a/tests/baselines/reference/templateStringInModuleNameES6.errors.txt +++ b/tests/baselines/reference/templateStringInModuleNameES6.errors.txt @@ -1,32 +1,26 @@ tests/cases/conformance/es6/templates/templateStringInModuleNameES6.ts(1,1): error TS2304: Cannot find name 'declare'. -tests/cases/conformance/es6/templates/templateStringInModuleNameES6.ts(1,9): error TS1005: ';' expected. tests/cases/conformance/es6/templates/templateStringInModuleNameES6.ts(1,9): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -tests/cases/conformance/es6/templates/templateStringInModuleNameES6.ts(1,21): error TS1005: ';' expected. +tests/cases/conformance/es6/templates/templateStringInModuleNameES6.ts(1,16): error TS1443: Module declaration names may only use ' or " quoted strings. tests/cases/conformance/es6/templates/templateStringInModuleNameES6.ts(4,1): error TS2304: Cannot find name 'declare'. -tests/cases/conformance/es6/templates/templateStringInModuleNameES6.ts(4,9): error TS1005: ';' expected. tests/cases/conformance/es6/templates/templateStringInModuleNameES6.ts(4,9): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -tests/cases/conformance/es6/templates/templateStringInModuleNameES6.ts(4,24): error TS1005: ';' expected. +tests/cases/conformance/es6/templates/templateStringInModuleNameES6.ts(4,16): error TS1443: Module declaration names may only use ' or " quoted strings. -==== tests/cases/conformance/es6/templates/templateStringInModuleNameES6.ts (8 errors) ==== +==== tests/cases/conformance/es6/templates/templateStringInModuleNameES6.ts (6 errors) ==== declare module `M1` { ~~~~~~~ !!! error TS2304: Cannot find name 'declare'. ~~~~~~ -!!! error TS1005: ';' expected. - ~~~~~~ !!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. - ~ -!!! error TS1005: ';' expected. + ~~~~ +!!! error TS1443: Module declaration names may only use ' or " quoted strings. } declare module `M${2}` { ~~~~~~~ !!! error TS2304: Cannot find name 'declare'. ~~~~~~ -!!! error TS1005: ';' expected. - ~~~~~~ !!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. - ~ -!!! error TS1005: ';' expected. + ~~~~~~~ +!!! error TS1443: Module declaration names may only use ' or " quoted strings. } \ No newline at end of file diff --git a/tests/baselines/reference/thisTypeInFunctionsNegative.errors.txt b/tests/baselines/reference/thisTypeInFunctionsNegative.errors.txt index b1812afa81739..a3a3efafaa6e2 100644 --- a/tests/baselines/reference/thisTypeInFunctionsNegative.errors.txt +++ b/tests/baselines/reference/thisTypeInFunctionsNegative.errors.txt @@ -86,8 +86,8 @@ tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(172,37): e tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(172,38): error TS1109: Expression expected. tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(172,39): error TS1005: ';' expected. tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(172,40): error TS1128: Declaration or statement expected. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(172,42): error TS1434: Unexpected keyword or identifier. tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(172,42): error TS2693: 'number' only refers to a type, but is being used as a value here. -tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(172,49): error TS1005: ';' expected. tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(175,23): error TS2730: An arrow function cannot have a 'this' parameter. tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(176,16): error TS2730: An arrow function cannot have a 'this' parameter. tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(177,19): error TS2730: An arrow function cannot have a 'this' parameter. @@ -422,9 +422,9 @@ tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(178,22): e ~ !!! error TS1128: Declaration or statement expected. ~~~~~~ +!!! error TS1434: Unexpected keyword or identifier. + ~~~~~~ !!! error TS2693: 'number' only refers to a type, but is being used as a value here. - ~ -!!! error TS1005: ';' expected. // can't name parameters 'this' in a lambda. c.explicitProperty = (this, m) => m + this.n; diff --git a/tests/baselines/reference/transpile/Generates expected syntactic diagnostics.errors.txt b/tests/baselines/reference/transpile/Generates expected syntactic diagnostics.errors.txt index 6fbdba6f2c6ce..c203977424625 100644 --- a/tests/baselines/reference/transpile/Generates expected syntactic diagnostics.errors.txt +++ b/tests/baselines/reference/transpile/Generates expected syntactic diagnostics.errors.txt @@ -1,7 +1,7 @@ -file.ts(1,3): error TS1005: ';' expected. +file.ts(1,1): error TS1434: Unexpected keyword or identifier. ==== file.ts (1 errors) ==== a b - ~ -!!! error TS1005: ';' expected. \ No newline at end of file + ~ +!!! error TS1434: Unexpected keyword or identifier. \ No newline at end of file diff --git a/tests/baselines/reference/transpile/Generates expected syntactic diagnostics.oldTranspile.errors.txt b/tests/baselines/reference/transpile/Generates expected syntactic diagnostics.oldTranspile.errors.txt index 6fbdba6f2c6ce..c203977424625 100644 --- a/tests/baselines/reference/transpile/Generates expected syntactic diagnostics.oldTranspile.errors.txt +++ b/tests/baselines/reference/transpile/Generates expected syntactic diagnostics.oldTranspile.errors.txt @@ -1,7 +1,7 @@ -file.ts(1,3): error TS1005: ';' expected. +file.ts(1,1): error TS1434: Unexpected keyword or identifier. ==== file.ts (1 errors) ==== a b - ~ -!!! error TS1005: ';' expected. \ No newline at end of file + ~ +!!! error TS1434: Unexpected keyword or identifier. \ No newline at end of file diff --git a/tests/baselines/reference/typeAssertions.errors.txt b/tests/baselines/reference/typeAssertions.errors.txt index 9d10ec17fe95d..f525a4be507ac 100644 --- a/tests/baselines/reference/typeAssertions.errors.txt +++ b/tests/baselines/reference/typeAssertions.errors.txt @@ -18,9 +18,9 @@ tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts(45,2): erro tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts(48,32): error TS2749: 'numOrStr' refers to a value, but is being used as a type here. Did you mean 'typeof numOrStr'? tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts(48,41): error TS1005: ')' expected. tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts(48,41): error TS2304: Cannot find name 'is'. -tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts(48,44): error TS1005: ';' expected. +tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts(48,44): error TS1434: Unexpected keyword or identifier. tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts(48,44): error TS2693: 'string' only refers to a type, but is being used as a value here. -tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts(48,50): error TS1005: ';' expected. +tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts(48,50): error TS1128: Declaration or statement expected. ==== tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts (18 errors) ==== @@ -111,11 +111,11 @@ tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts(48,50): err ~~ !!! error TS2304: Cannot find name 'is'. ~~~~~~ -!!! error TS1005: ';' expected. +!!! error TS1434: Unexpected keyword or identifier. ~~~~~~ !!! error TS2693: 'string' only refers to a type, but is being used as a value here. ~ -!!! error TS1005: ';' expected. +!!! error TS1128: Declaration or statement expected. } \ No newline at end of file diff --git a/tests/baselines/reference/typeGuardFunctionErrors.errors.txt b/tests/baselines/reference/typeGuardFunctionErrors.errors.txt index 443c556fe558b..df739464ffea5 100644 --- a/tests/baselines/reference/typeGuardFunctionErrors.errors.txt +++ b/tests/baselines/reference/typeGuardFunctionErrors.errors.txt @@ -2,8 +2,7 @@ tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(1,7): tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(14,5): error TS2322: Type 'string' is not assignable to type 'boolean'. tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(17,55): error TS2749: 'x' refers to a value, but is being used as a type here. Did you mean 'typeof x'? tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(17,57): error TS1144: '{' or ';' expected. -tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(17,60): error TS1005: ';' expected. -tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(17,62): error TS1005: ';' expected. +tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(17,60): error TS1434: Unexpected keyword or identifier. tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(21,33): error TS2749: 'x' refers to a value, but is being used as a type here. Did you mean 'typeof x'? tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(25,33): error TS1225: Cannot find parameter 'x'. tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(29,10): error TS2391: Function implementation is missing or not immediately following the declaration. @@ -37,8 +36,7 @@ tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(96,18) tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(96,21): error TS1005: ',' expected. tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(97,20): error TS2749: 'b' refers to a value, but is being used as a type here. Did you mean 'typeof b'? tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(97,22): error TS1144: '{' or ';' expected. -tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(97,25): error TS1005: ';' expected. -tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(97,27): error TS1005: ';' expected. +tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(97,25): error TS1434: Unexpected keyword or identifier. tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(103,25): error TS1228: A type predicate is only allowed in return type position for functions and methods. tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(104,9): error TS2322: Type 'boolean' is not assignable to type 'D'. tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(104,9): error TS2409: Return type of constructor signature must be assignable to the instance type of the class. @@ -48,7 +46,6 @@ tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(110,9) tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(115,18): error TS1228: A type predicate is only allowed in return type position for functions and methods. tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(119,22): error TS2304: Cannot find name 'p1'. tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(119,25): error TS1005: ';' expected. -tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(119,28): error TS1005: ';' expected. tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(120,1): error TS1128: Declaration or statement expected. tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(123,20): error TS1229: A type predicate cannot reference a rest parameter. tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(128,34): error TS1230: A type predicate cannot reference element 'p1' in a binding pattern. @@ -68,7 +65,7 @@ tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(166,45 tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(166,54): error TS2344: Type 'number' does not satisfy the constraint 'Foo'. -==== tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts (56 errors) ==== +==== tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts (53 errors) ==== class A { ~ !!! error TS2300: Duplicate identifier 'A'. @@ -95,9 +92,7 @@ tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(166,54 ~~ !!! error TS1144: '{' or ';' expected. ~ -!!! error TS1005: ';' expected. - ~ -!!! error TS1005: ';' expected. +!!! error TS1434: Unexpected keyword or identifier. return true; } @@ -242,9 +237,7 @@ tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(166,54 ~~ !!! error TS1144: '{' or ';' expected. ~ -!!! error TS1005: ';' expected. - ~ -!!! error TS1005: ';' expected. +!!! error TS1434: Unexpected keyword or identifier. return true; }; @@ -284,8 +277,6 @@ tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(166,54 ~~ !!! error TS2304: Cannot find name 'p1'. ~~ -!!! error TS1005: ';' expected. - ~ !!! error TS1005: ';' expected. } ~ diff --git a/tests/cases/compiler/commonMissingSemicolons.ts b/tests/cases/compiler/commonMissingSemicolons.ts new file mode 100644 index 0000000000000..197177c9f4bb5 --- /dev/null +++ b/tests/cases/compiler/commonMissingSemicolons.ts @@ -0,0 +1,81 @@ +// @noEmit: true +// @noTypesAndSymbols: true + +async function myAsyncFunction1() {} +asynd function myAsyncFunction2() {} +sasync function myAsyncFunction3() {} + +// Arrow functions don't (yet?) parse as nicely as standalone functions. +// Eventually it would be good to get them the same "did you mean" for typos such as "asyncd". +const myAsyncArrow1 = async () => 3; +const myAsyncArrow2 = asyncd () => 3; + +class MyClass1 {} +clasd MyClass2 {} +classs MyClass3 {} + +const myConst1 = 1; +consd myConst2 = 1; +constd myConst3 = 1; + +declare const myDeclareConst1: 1; +declared const myDeclareConst2: 1; +declare constd myDeclareConst3: 1; +declared constd myDeclareConst4: 1; +declareconst myDeclareConst5; + +function myFunction1() { } +functiond myFunction2() { } +function function() { } +functionMyFunction; + +interface myInterface1 { } +interfaced myInterface2 { } +interface interface { } +interface { } +interface void { } +interfaceMyInterface { } + +let let = 1; +let let1 = 1; +letd let2 = 1; +letMyLet; + +type type; +type type1 = {}; +type type2 = type; +type type3 = {}; +typed type4 = {} +typed type5 = type; +typeMyType; + +var myVar1 = 1; +vard myVar2 = 1; +varMyVar; + +class NoSemicolonClassA { + ['a'] = 0 + {} +} + +class NoSemicolonClassB { + ['a'] = 0 + {} +} + +class NoSemicolonClassC { + ['a'] = 0; + {} +} + +class NoSemicolonClassD { + ['a'] = 0 + ['b']() {} +} + +class NoSemicolonClassE { + ['a'] = 0 + ['b']() { + c: true + } +}