From 2c575dae27421f3e67cd4d33995ca630a2b992b0 Mon Sep 17 00:00:00 2001 From: Yui T Date: Tue, 9 Dec 2014 16:33:20 -0800 Subject: [PATCH 01/78] Move grammar checking: type parameters --- src/compiler/checker.ts | 50 ++++++++++++++++++- .../diagnosticInformationMap.generated.ts | 2 +- src/compiler/diagnosticMessages.json | 3 +- src/compiler/parser.ts | 7 --- .../typeParameterConstraints1.errors.txt | 2 +- 5 files changed, 53 insertions(+), 11 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 8c383368df2..d3d4ae2088e 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -164,6 +164,13 @@ module ts { var diagnostics: Diagnostic[] = []; var diagnosticsModified: boolean = false; + // Grammar checking + var sourceText: string = undefined; + var scanner: Scanner = undefined; + var hasParserError: boolean; + var grammarDiagnostics: Diagnostic[]; + var sourceFile: SourceFile; + function addDiagnostic(diagnostic: Diagnostic) { diagnostics.push(diagnostic); diagnosticsModified = true; @@ -7017,6 +7024,11 @@ module ts { // DECLARATION AND STATEMENT TYPE CHECKING function checkTypeParameter(node: TypeParameterDeclaration) { + // Grammar Checking + if (!hasParserError && node.expression) { + grammarErrorOnFirstToken(node.expression, Diagnostics.Type_expected); + } + checkSourceElement(node.constraint); if (fullTypeCheck) { checkTypeParameterHasIllegalReferencesInConstraint(node); @@ -8655,6 +8667,36 @@ module ts { return node; } + // Grammar checking helper functions + function scanToken(pos: number) { + var start = skipTrivia(sourceText, pos); + scanner.setTextPos(start); + scanner.scan(); + return start; + } + + function grammarErrorOnFirstToken(node: Node, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any): void { + var start = scanToken(node.pos); + diagnostics.push(createFileDiagnostic(sourceFile, start, scanner.getTextPos() - start, message, arg0, arg1, arg2)); + } + + function grammarErrorAfterFirstToken(node: Node, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any): void { + scanToken(node.pos); + diagnostics.push(createFileDiagnostic(sourceFile, scanner.getTextPos(), 0, message, arg0, arg1, arg2)); + } + + function grammarErrorOnNode(node: Node, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any): void { + var span = getErrorSpanForNode(node); + var start = span.end > span.pos ? skipTrivia(sourceFile.text, span.pos) : span.pos; + var length = span.end - start; + + diagnostics.push(createFileDiagnostic(sourceFile, start, length, message, arg0, arg1, arg2)); + } + + function grammarErrorAtPos(start: number, length: number, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any): void { + diagnostics.push(createFileDiagnostic(sourceFile, start, length, message, arg0, arg1, arg2)); + } + function checkImportDeclaration(node: ImportDeclaration) { checkCollisionWithCapturedThisVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); @@ -8909,6 +8951,12 @@ module ts { // Fully type check a source file and collect the relevant diagnostics. function checkSourceFile(node: SourceFile) { + sourceText = node.text; + scanner = createScanner(compilerOptions.target, /*skipTrivia*/ true, sourceText); + hasParserError = node.parseDiagnostics.length > 0 ? true : false; + sourceFile = node; + //grammarDiagnostics = []; + var links = getNodeLinks(node); if (!(links.flags & NodeCheckFlags.TypeChecked)) { emitExtends = false; @@ -9469,7 +9517,7 @@ module ts { return program.getDiagnostics(sourceFile).length !== 0 || hasEarlyErrors(sourceFile) || (compilerOptions.noEmitOnError && getDiagnostics(sourceFile).length !== 0); - } + } function hasEarlyErrors(sourceFile?: SourceFile): boolean { return forEach(getDiagnostics(sourceFile), d => d.isEarly); diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index 17dbae83bf2..5f54befb89b 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -73,7 +73,7 @@ module ts { Jump_target_cannot_cross_function_boundary: { code: 1107, category: DiagnosticCategory.Error, key: "Jump target cannot cross function boundary." }, A_return_statement_can_only_be_used_within_a_function_body: { code: 1108, category: DiagnosticCategory.Error, key: "A 'return' statement can only be used within a function body." }, Expression_expected: { code: 1109, category: DiagnosticCategory.Error, key: "Expression expected." }, - Type_expected: { code: 1110, category: DiagnosticCategory.Error, key: "Type expected." }, + Type_expected: { code: 1110, category: DiagnosticCategory.Error, key: "Type expected.", isEarly: true }, A_constructor_implementation_cannot_be_declared_in_an_ambient_context: { code: 1111, category: DiagnosticCategory.Error, key: "A constructor implementation cannot be declared in an ambient context." }, A_class_member_cannot_be_declared_optional: { code: 1112, category: DiagnosticCategory.Error, key: "A class member cannot be declared optional." }, A_default_clause_cannot_appear_more_than_once_in_a_switch_statement: { code: 1113, category: DiagnosticCategory.Error, key: "A 'default' clause cannot appear more than once in a 'switch' statement." }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index a06b71d460e..f694ccfc32f 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -285,7 +285,8 @@ }, "Type expected.": { "category": "Error", - "code": 1110 + "code": 1110, + "isEarly": true }, "A constructor implementation cannot be declared in an ambient context.": { "category": "Error", diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index d406b938d4e..58582964550 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -4679,7 +4679,6 @@ module ts { case SyntaxKind.TaggedTemplateExpression: return checkTaggedTemplateExpression(node); case SyntaxKind.ThrowStatement: return checkThrowStatement(node); case SyntaxKind.TupleType: return checkTupleType(node); - case SyntaxKind.TypeParameter: return checkTypeParameter(node); case SyntaxKind.TypeReference: return checkTypeReference(node); case SyntaxKind.VariableDeclaration: return checkVariableDeclaration(node); case SyntaxKind.VariableStatement: return checkVariableStatement(node); @@ -5727,12 +5726,6 @@ module ts { } } - function checkTypeParameter(node: TypeParameterDeclaration) { - if (node.expression) { - return grammarErrorOnFirstToken(node.expression, Diagnostics.Type_expected); - } - } - function checkTypeReference(node: TypeReferenceNode) { return checkTypeArguments(node.typeArguments); } diff --git a/tests/baselines/reference/typeParameterConstraints1.errors.txt b/tests/baselines/reference/typeParameterConstraints1.errors.txt index d2e1f505c83..f30fd4f6700 100644 --- a/tests/baselines/reference/typeParameterConstraints1.errors.txt +++ b/tests/baselines/reference/typeParameterConstraints1.errors.txt @@ -1,8 +1,8 @@ +tests/cases/compiler/typeParameterConstraints1.ts(6,25): error TS2304: Cannot find name 'hm'. tests/cases/compiler/typeParameterConstraints1.ts(8,25): error TS1110: Type expected. tests/cases/compiler/typeParameterConstraints1.ts(9,25): error TS1110: Type expected. tests/cases/compiler/typeParameterConstraints1.ts(10,26): error TS1110: Type expected. tests/cases/compiler/typeParameterConstraints1.ts(11,26): error TS1110: Type expected. -tests/cases/compiler/typeParameterConstraints1.ts(6,25): error TS2304: Cannot find name 'hm'. tests/cases/compiler/typeParameterConstraints1.ts(12,26): error TS2304: Cannot find name 'undefined'. From 949be0597fce1873c7dabe3584220f8a82d8f28d Mon Sep 17 00:00:00 2001 From: Yui T Date: Tue, 9 Dec 2014 16:33:20 -0800 Subject: [PATCH 02/78] Move grammar checking: type parameters --- src/compiler/checker.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index d3d4ae2088e..59481783661 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -168,7 +168,6 @@ module ts { var sourceText: string = undefined; var scanner: Scanner = undefined; var hasParserError: boolean; - var grammarDiagnostics: Diagnostic[]; var sourceFile: SourceFile; function addDiagnostic(diagnostic: Diagnostic) { @@ -8955,7 +8954,6 @@ module ts { scanner = createScanner(compilerOptions.target, /*skipTrivia*/ true, sourceText); hasParserError = node.parseDiagnostics.length > 0 ? true : false; sourceFile = node; - //grammarDiagnostics = []; var links = getNodeLinks(node); if (!(links.flags & NodeCheckFlags.TypeChecked)) { From afcf11545c7b24826322e01381737bcd58ff7af8 Mon Sep 17 00:00:00 2001 From: Yui T Date: Tue, 9 Dec 2014 16:33:20 -0800 Subject: [PATCH 03/78] Move grammar checking: type parameters --- src/compiler/checker.ts | 34 +++---------------- .../typeParameterConstraints1.errors.txt | 2 +- 2 files changed, 6 insertions(+), 30 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index d3d4ae2088e..d676b5faeaa 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -168,7 +168,6 @@ module ts { var sourceText: string = undefined; var scanner: Scanner = undefined; var hasParserError: boolean; - var grammarDiagnostics: Diagnostic[]; var sourceFile: SourceFile; function addDiagnostic(diagnostic: Diagnostic) { @@ -7026,7 +7025,8 @@ module ts { function checkTypeParameter(node: TypeParameterDeclaration) { // Grammar Checking if (!hasParserError && node.expression) { - grammarErrorOnFirstToken(node.expression, Diagnostics.Type_expected); + var sourceFile = getSourceFileOfNode(node); + grammarErrorOnNode(sourceFile, node.expression, Diagnostics.Type_expected); } checkSourceElement(node.constraint); @@ -8668,32 +8668,9 @@ module ts { } // Grammar checking helper functions - function scanToken(pos: number) { - var start = skipTrivia(sourceText, pos); - scanner.setTextPos(start); - scanner.scan(); - return start; - } - - function grammarErrorOnFirstToken(node: Node, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any): void { - var start = scanToken(node.pos); - diagnostics.push(createFileDiagnostic(sourceFile, start, scanner.getTextPos() - start, message, arg0, arg1, arg2)); - } - - function grammarErrorAfterFirstToken(node: Node, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any): void { - scanToken(node.pos); - diagnostics.push(createFileDiagnostic(sourceFile, scanner.getTextPos(), 0, message, arg0, arg1, arg2)); - } - - function grammarErrorOnNode(node: Node, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any): void { - var span = getErrorSpanForNode(node); - var start = span.end > span.pos ? skipTrivia(sourceFile.text, span.pos) : span.pos; - var length = span.end - start; - - diagnostics.push(createFileDiagnostic(sourceFile, start, length, message, arg0, arg1, arg2)); - } - - function grammarErrorAtPos(start: number, length: number, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any): void { + function grammarErrorOnNode(sourceFile: SourceFile, node: Node, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any): void { + var start = getFullWidth(node) === 0 ? node.pos : skipTrivia(sourceFile.text, node.pos); + var length = node.end - start; diagnostics.push(createFileDiagnostic(sourceFile, start, length, message, arg0, arg1, arg2)); } @@ -8955,7 +8932,6 @@ module ts { scanner = createScanner(compilerOptions.target, /*skipTrivia*/ true, sourceText); hasParserError = node.parseDiagnostics.length > 0 ? true : false; sourceFile = node; - //grammarDiagnostics = []; var links = getNodeLinks(node); if (!(links.flags & NodeCheckFlags.TypeChecked)) { diff --git a/tests/baselines/reference/typeParameterConstraints1.errors.txt b/tests/baselines/reference/typeParameterConstraints1.errors.txt index f30fd4f6700..44261e8d194 100644 --- a/tests/baselines/reference/typeParameterConstraints1.errors.txt +++ b/tests/baselines/reference/typeParameterConstraints1.errors.txt @@ -23,7 +23,7 @@ tests/cases/compiler/typeParameterConstraints1.ts(12,26): error TS2304: Cannot f ~ !!! error TS1110: Type expected. function foo10 (test: T) { } - ~ + ~~~ !!! error TS1110: Type expected. function foo11 (test: T) { } ~~~~ From 6a4d50d025f4ad7a7c7668c5de2c7d12a5bf806a Mon Sep 17 00:00:00 2001 From: Yui T Date: Tue, 9 Dec 2014 18:32:56 -0800 Subject: [PATCH 04/78] Address code review for moving grammar check of typeParameter --- src/compiler/checker.ts | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index d676b5faeaa..1e831600d7c 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -164,12 +164,6 @@ module ts { var diagnostics: Diagnostic[] = []; var diagnosticsModified: boolean = false; - // Grammar checking - var sourceText: string = undefined; - var scanner: Scanner = undefined; - var hasParserError: boolean; - var sourceFile: SourceFile; - function addDiagnostic(diagnostic: Diagnostic) { diagnostics.push(diagnostic); diagnosticsModified = true; @@ -7024,8 +7018,8 @@ module ts { function checkTypeParameter(node: TypeParameterDeclaration) { // Grammar Checking - if (!hasParserError && node.expression) { - var sourceFile = getSourceFileOfNode(node); + var sourceFile = getSourceFileOfNode(node); + if (node.expression && !hasParseDiagnostics(sourceFile)) { grammarErrorOnNode(sourceFile, node.expression, Diagnostics.Type_expected); } @@ -8668,6 +8662,10 @@ module ts { } // Grammar checking helper functions + function hasParseDiagnostics(sourceFile: SourceFile): boolean { + return sourceFile.parseDiagnostics.length > 0 ? true : false; + } + function grammarErrorOnNode(sourceFile: SourceFile, node: Node, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any): void { var start = getFullWidth(node) === 0 ? node.pos : skipTrivia(sourceFile.text, node.pos); var length = node.end - start; @@ -8928,11 +8926,6 @@ module ts { // Fully type check a source file and collect the relevant diagnostics. function checkSourceFile(node: SourceFile) { - sourceText = node.text; - scanner = createScanner(compilerOptions.target, /*skipTrivia*/ true, sourceText); - hasParserError = node.parseDiagnostics.length > 0 ? true : false; - sourceFile = node; - var links = getNodeLinks(node); if (!(links.flags & NodeCheckFlags.TypeChecked)) { emitExtends = false; From a94c51faee363345e28c8afbdd0ee0d4f7a76dbe Mon Sep 17 00:00:00 2001 From: yui T Date: Wed, 10 Dec 2014 11:26:24 -0800 Subject: [PATCH 05/78] Address code review for moving grammar check of typeParameter --- src/compiler/checker.ts | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 1e831600d7c..2ad07454a90 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -7018,9 +7018,9 @@ module ts { function checkTypeParameter(node: TypeParameterDeclaration) { // Grammar Checking - var sourceFile = getSourceFileOfNode(node); - if (node.expression && !hasParseDiagnostics(sourceFile)) { - grammarErrorOnNode(sourceFile, node.expression, Diagnostics.Type_expected); + if (node.expression) { + var sourceFile = getSourceFileOfNode(node); + grammarErrorOnFirstToken(sourceFile, node.expression, Diagnostics.Type_expected); } checkSourceElement(node.constraint); @@ -8666,10 +8666,12 @@ module ts { return sourceFile.parseDiagnostics.length > 0 ? true : false; } - function grammarErrorOnNode(sourceFile: SourceFile, node: Node, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any): void { - var start = getFullWidth(node) === 0 ? node.pos : skipTrivia(sourceFile.text, node.pos); - var length = node.end - start; - diagnostics.push(createFileDiagnostic(sourceFile, start, length, message, arg0, arg1, arg2)); + function grammarErrorOnFirstToken(sourceFile: SourceFile, node: Node, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any): void { + if (!hasParseDiagnostics(sourceFile)) { + var start = skipTrivia(sourceFile.text, node.pos); + var length = node.end - start; + diagnostics.push(createFileDiagnostic(sourceFile, start, length, message, arg0, arg1, arg2)); + } } function checkImportDeclaration(node: ImportDeclaration) { From 03f9203a42995ce35b02d1c57975e56b3307e6b6 Mon Sep 17 00:00:00 2001 From: Yui T Date: Wed, 10 Dec 2014 12:42:34 -0800 Subject: [PATCH 06/78] Move grammar checking: tuple type --- src/compiler/checker.ts | 32 +++++++++++++++++-- .../diagnosticInformationMap.generated.ts | 4 +-- src/compiler/diagnosticMessages.json | 6 ++-- src/compiler/parser.ts | 2 +- 4 files changed, 37 insertions(+), 7 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 2ad07454a90..fd79e04ad2e 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -7274,6 +7274,13 @@ module ts { } function checkTupleType(node: TupleTypeNode) { + // Grammar checking + var sourceFile = getSourceFileOfNode(node); + checkGrammarForDisallowedTrailingComma(sourceFile, node.elementTypes); + if (node.elementTypes.length === 0) { + grammarErrorOnNode(sourceFile, node, Diagnostics.A_tuple_type_element_list_cannot_be_empty); + } + forEach(node.elementTypes, checkSourceElement); } @@ -8661,7 +8668,15 @@ module ts { return node; } - // Grammar checking helper functions + // GRAMMAR CHECKING + function checkGrammarForDisallowedTrailingComma(sourceFile: SourceFile, list: NodeArray): void { + if (list && list.hasTrailingComma) { + var start = list.end - ",".length; + var end = list.end; + grammarErrorAtPos(sourceFile, start, end - start, Diagnostics.Trailing_comma_not_allowed); + } + } + function hasParseDiagnostics(sourceFile: SourceFile): boolean { return sourceFile.parseDiagnostics.length > 0 ? true : false; } @@ -8669,11 +8684,24 @@ module ts { function grammarErrorOnFirstToken(sourceFile: SourceFile, node: Node, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any): void { if (!hasParseDiagnostics(sourceFile)) { var start = skipTrivia(sourceFile.text, node.pos); - var length = node.end - start; + diagnostics.push(createFileDiagnostic(sourceFile, start, node.end - start, message, arg0, arg1, arg2)); + } + } + + function grammarErrorAtPos(sourceFile: SourceFile, start: number, length: number, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any): void { + if (!hasParseDiagnostics(sourceFile)) { diagnostics.push(createFileDiagnostic(sourceFile, start, length, message, arg0, arg1, arg2)); } } + function grammarErrorOnNode(sourceFile: SourceFile, node: Node, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any): void { + if (!hasParseDiagnostics(sourceFile)) { + var span = getErrorSpanForNode(node); + var start = span.end > span.pos ? skipTrivia(sourceFile.text, span.pos) : span.pos; + diagnostics.push(createFileDiagnostic(sourceFile, start, span.end - start, message, arg0, arg1, arg2)); + } + } + function checkImportDeclaration(node: ImportDeclaration) { checkCollisionWithCapturedThisVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index 5f54befb89b..795dc31d09c 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -6,7 +6,7 @@ module ts { Identifier_expected: { code: 1003, category: DiagnosticCategory.Error, key: "Identifier expected." }, _0_expected: { code: 1005, category: DiagnosticCategory.Error, key: "'{0}' expected." }, A_file_cannot_have_a_reference_to_itself: { code: 1006, category: DiagnosticCategory.Error, key: "A file cannot have a reference to itself." }, - Trailing_comma_not_allowed: { code: 1009, category: DiagnosticCategory.Error, key: "Trailing comma not allowed." }, + Trailing_comma_not_allowed: { code: 1009, category: DiagnosticCategory.Error, key: "Trailing comma not allowed.", isEarly: true }, Asterisk_Slash_expected: { code: 1010, category: DiagnosticCategory.Error, key: "'*/' expected." }, Unexpected_token: { code: 1012, category: DiagnosticCategory.Error, key: "Unexpected token." }, Catch_clause_parameter_cannot_have_a_type_annotation: { code: 1013, category: DiagnosticCategory.Error, key: "Catch clause parameter cannot have a type annotation." }, @@ -85,7 +85,7 @@ module ts { An_object_literal_cannot_have_property_and_accessor_with_the_same_name: { code: 1119, category: DiagnosticCategory.Error, key: "An object literal cannot have property and accessor with the same name." }, An_export_assignment_cannot_have_modifiers: { code: 1120, category: DiagnosticCategory.Error, key: "An export assignment cannot have modifiers." }, Octal_literals_are_not_allowed_in_strict_mode: { code: 1121, category: DiagnosticCategory.Error, key: "Octal literals are not allowed in strict mode." }, - A_tuple_type_element_list_cannot_be_empty: { code: 1122, category: DiagnosticCategory.Error, key: "A tuple type element list cannot be empty." }, + A_tuple_type_element_list_cannot_be_empty: { code: 1122, category: DiagnosticCategory.Error, key: "A tuple type element list cannot be empty.", isEarly: true }, Variable_declaration_list_cannot_be_empty: { code: 1123, category: DiagnosticCategory.Error, key: "Variable declaration list cannot be empty." }, Digit_expected: { code: 1124, category: DiagnosticCategory.Error, key: "Digit expected." }, Hexadecimal_digit_expected: { code: 1125, category: DiagnosticCategory.Error, key: "Hexadecimal digit expected." }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index f694ccfc32f..f3fc9b9b715 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -17,7 +17,8 @@ }, "Trailing comma not allowed.": { "category": "Error", - "code": 1009 + "code": 1009, + "isEarly": true }, "'*/' expected.": { "category": "Error", @@ -334,7 +335,8 @@ }, "A tuple type element list cannot be empty.": { "category": "Error", - "code": 1122 + "code": 1122, + "isEarly": true }, "Variable declaration list cannot be empty.": { "category": "Error", diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 58582964550..5b2b8ad0dad 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -4678,7 +4678,7 @@ module ts { case SyntaxKind.SwitchStatement: return checkSwitchStatement(node); case SyntaxKind.TaggedTemplateExpression: return checkTaggedTemplateExpression(node); case SyntaxKind.ThrowStatement: return checkThrowStatement(node); - case SyntaxKind.TupleType: return checkTupleType(node); + //case SyntaxKind.TupleType: return checkTupleType(node); case SyntaxKind.TypeReference: return checkTypeReference(node); case SyntaxKind.VariableDeclaration: return checkVariableDeclaration(node); case SyntaxKind.VariableStatement: return checkVariableStatement(node); From 073994ec5526b112c10ccdee6a3a02778415c40e Mon Sep 17 00:00:00 2001 From: Yui T Date: Wed, 10 Dec 2014 15:44:36 -0800 Subject: [PATCH 07/78] Addres code review --- src/compiler/binder.ts | 3 +++ src/compiler/checker.ts | 35 ++++++++++++++++++++++++----------- 2 files changed, 27 insertions(+), 11 deletions(-) diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index dfb5482b09c..a458779e52f 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -387,6 +387,9 @@ module ts { switch (node.kind) { case SyntaxKind.TypeParameter: bindDeclaration(node, SymbolFlags.TypeParameter, SymbolFlags.TypeParameterExcludes, /*isBlockScopeContainer*/ false); + if ((node).expression) { + (node).expression.parent = node; + } break; case SyntaxKind.Parameter: if (isBindingPattern((node).name)) { diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index fd79e04ad2e..f8280ffd230 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -7020,7 +7020,7 @@ module ts { // Grammar Checking if (node.expression) { var sourceFile = getSourceFileOfNode(node); - grammarErrorOnFirstToken(sourceFile, node.expression, Diagnostics.Type_expected); + grammarErrorOnFirstToken(node.expression, Diagnostics.Type_expected); } checkSourceElement(node.constraint); @@ -7275,10 +7275,9 @@ module ts { function checkTupleType(node: TupleTypeNode) { // Grammar checking - var sourceFile = getSourceFileOfNode(node); - checkGrammarForDisallowedTrailingComma(sourceFile, node.elementTypes); - if (node.elementTypes.length === 0) { - grammarErrorOnNode(sourceFile, node, Diagnostics.A_tuple_type_element_list_cannot_be_empty); + var hasErrorFromDisallowedTrailingComma = checkGrammarForDisallowedTrailingComma(node.elementTypes); + if (!hasErrorFromDisallowedTrailingComma && node.elementTypes.length === 0) { + grammarErrorOnNode(node, Diagnostics.A_tuple_type_element_list_cannot_be_empty); } forEach(node.elementTypes, checkSourceElement); @@ -8669,22 +8668,35 @@ module ts { } // GRAMMAR CHECKING - function checkGrammarForDisallowedTrailingComma(sourceFile: SourceFile, list: NodeArray): void { + function checkGrammarForDisallowedTrailingComma(list: NodeArray): boolean { if (list && list.hasTrailingComma) { var start = list.end - ",".length; var end = list.end; + var sourceFile = getSourceFileOfNode(list[0]); grammarErrorAtPos(sourceFile, start, end - start, Diagnostics.Trailing_comma_not_allowed); + return true; } } function hasParseDiagnostics(sourceFile: SourceFile): boolean { - return sourceFile.parseDiagnostics.length > 0 ? true : false; + return sourceFile.parseDiagnostics.length > 0; } - function grammarErrorOnFirstToken(sourceFile: SourceFile, node: Node, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any): void { + function scanToken(scanner: Scanner, pos: number) { + scanner.setTextPos(pos); + scanner.scan(); + var start = scanner.getTokenPos(); + scanner.setTextPos(start); + scanner.scan(); + return start; + } + + function grammarErrorOnFirstToken(node: Node, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any): void { + var sourceFile = getSourceFileOfNode(node); if (!hasParseDiagnostics(sourceFile)) { - var start = skipTrivia(sourceFile.text, node.pos); - diagnostics.push(createFileDiagnostic(sourceFile, start, node.end - start, message, arg0, arg1, arg2)); + var scanner = createScanner(compilerOptions.target, /*skipTrivia*/ true, sourceFile.text); + var start = scanToken(scanner, node.pos); + diagnostics.push(createFileDiagnostic(sourceFile, start, scanner.getTextPos() - start, message, arg0, arg1, arg2)); } } @@ -8694,7 +8706,8 @@ module ts { } } - function grammarErrorOnNode(sourceFile: SourceFile, node: Node, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any): void { + function grammarErrorOnNode(node: Node, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any): void { + var sourceFile = getSourceFileOfNode(node); if (!hasParseDiagnostics(sourceFile)) { var span = getErrorSpanForNode(node); var start = span.end > span.pos ? skipTrivia(sourceFile.text, span.pos) : span.pos; From 16693316e5b9df1a3f123fef0aa73a6f0f9a7ce8 Mon Sep 17 00:00:00 2001 From: Yui T Date: Wed, 10 Dec 2014 18:34:38 -0800 Subject: [PATCH 08/78] Add isEarly flag into error from grammar checking --- .../diagnosticInformationMap.generated.ts | 164 ++++++------ src/compiler/diagnosticMessages.json | 246 ++++++++++++------ 2 files changed, 246 insertions(+), 164 deletions(-) diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index 795dc31d09c..268451c9775 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -9,33 +9,33 @@ module ts { Trailing_comma_not_allowed: { code: 1009, category: DiagnosticCategory.Error, key: "Trailing comma not allowed.", isEarly: true }, Asterisk_Slash_expected: { code: 1010, category: DiagnosticCategory.Error, key: "'*/' expected." }, Unexpected_token: { code: 1012, category: DiagnosticCategory.Error, key: "Unexpected token." }, - Catch_clause_parameter_cannot_have_a_type_annotation: { code: 1013, category: DiagnosticCategory.Error, key: "Catch clause parameter cannot have a type annotation." }, - A_rest_parameter_must_be_last_in_a_parameter_list: { code: 1014, category: DiagnosticCategory.Error, key: "A rest parameter must be last in a parameter list." }, - Parameter_cannot_have_question_mark_and_initializer: { code: 1015, category: DiagnosticCategory.Error, key: "Parameter cannot have question mark and initializer." }, - A_required_parameter_cannot_follow_an_optional_parameter: { code: 1016, category: DiagnosticCategory.Error, key: "A required parameter cannot follow an optional parameter." }, - An_index_signature_cannot_have_a_rest_parameter: { code: 1017, category: DiagnosticCategory.Error, key: "An index signature cannot have a rest parameter." }, - An_index_signature_parameter_cannot_have_an_accessibility_modifier: { code: 1018, category: DiagnosticCategory.Error, key: "An index signature parameter cannot have an accessibility modifier." }, - An_index_signature_parameter_cannot_have_a_question_mark: { code: 1019, category: DiagnosticCategory.Error, key: "An index signature parameter cannot have a question mark." }, - An_index_signature_parameter_cannot_have_an_initializer: { code: 1020, category: DiagnosticCategory.Error, key: "An index signature parameter cannot have an initializer." }, - An_index_signature_must_have_a_type_annotation: { code: 1021, category: DiagnosticCategory.Error, key: "An index signature must have a type annotation." }, - An_index_signature_parameter_must_have_a_type_annotation: { code: 1022, category: DiagnosticCategory.Error, key: "An index signature parameter must have a type annotation." }, - An_index_signature_parameter_type_must_be_string_or_number: { code: 1023, category: DiagnosticCategory.Error, key: "An index signature parameter type must be 'string' or 'number'." }, + Catch_clause_parameter_cannot_have_a_type_annotation: { code: 1013, category: DiagnosticCategory.Error, key: "Catch clause parameter cannot have a type annotation.", isEarly: true }, + A_rest_parameter_must_be_last_in_a_parameter_list: { code: 1014, category: DiagnosticCategory.Error, key: "A rest parameter must be last in a parameter list.", isEarly: true }, + Parameter_cannot_have_question_mark_and_initializer: { code: 1015, category: DiagnosticCategory.Error, key: "Parameter cannot have question mark and initializer.", isEarly: true }, + A_required_parameter_cannot_follow_an_optional_parameter: { code: 1016, category: DiagnosticCategory.Error, key: "A required parameter cannot follow an optional parameter.", isEarly: true }, + An_index_signature_cannot_have_a_rest_parameter: { code: 1017, category: DiagnosticCategory.Error, key: "An index signature cannot have a rest parameter.", isEarly: true }, + An_index_signature_parameter_cannot_have_an_accessibility_modifier: { code: 1018, category: DiagnosticCategory.Error, key: "An index signature parameter cannot have an accessibility modifier.", isEarly: true }, + An_index_signature_parameter_cannot_have_a_question_mark: { code: 1019, category: DiagnosticCategory.Error, key: "An index signature parameter cannot have a question mark.", isEarly: true }, + An_index_signature_parameter_cannot_have_an_initializer: { code: 1020, category: DiagnosticCategory.Error, key: "An index signature parameter cannot have an initializer.", isEarly: true }, + An_index_signature_must_have_a_type_annotation: { code: 1021, category: DiagnosticCategory.Error, key: "An index signature must have a type annotation.", isEarly: true }, + An_index_signature_parameter_must_have_a_type_annotation: { code: 1022, category: DiagnosticCategory.Error, key: "An index signature parameter must have a type annotation.", isEarly: true }, + An_index_signature_parameter_type_must_be_string_or_number: { code: 1023, category: DiagnosticCategory.Error, key: "An index signature parameter type must be 'string' or 'number'.", isEarly: true }, A_class_or_interface_declaration_can_only_have_one_extends_clause: { code: 1024, category: DiagnosticCategory.Error, key: "A class or interface declaration can only have one 'extends' clause." }, An_extends_clause_must_precede_an_implements_clause: { code: 1025, category: DiagnosticCategory.Error, key: "An 'extends' clause must precede an 'implements' clause." }, A_class_can_only_extend_a_single_class: { code: 1026, category: DiagnosticCategory.Error, key: "A class can only extend a single class." }, A_class_declaration_can_only_have_one_implements_clause: { code: 1027, category: DiagnosticCategory.Error, key: "A class declaration can only have one 'implements' clause." }, - Accessibility_modifier_already_seen: { code: 1028, category: DiagnosticCategory.Error, key: "Accessibility modifier already seen." }, - _0_modifier_must_precede_1_modifier: { code: 1029, category: DiagnosticCategory.Error, key: "'{0}' modifier must precede '{1}' modifier." }, - _0_modifier_already_seen: { code: 1030, category: DiagnosticCategory.Error, key: "'{0}' modifier already seen." }, - _0_modifier_cannot_appear_on_a_class_element: { code: 1031, category: DiagnosticCategory.Error, key: "'{0}' modifier cannot appear on a class element." }, + Accessibility_modifier_already_seen: { code: 1028, category: DiagnosticCategory.Error, key: "Accessibility modifier already seen.", isEarly: true }, + _0_modifier_must_precede_1_modifier: { code: 1029, category: DiagnosticCategory.Error, key: "'{0}' modifier must precede '{1}' modifier.", isEarly: true }, + _0_modifier_already_seen: { code: 1030, category: DiagnosticCategory.Error, key: "'{0}' modifier already seen.", isEarly: true }, + _0_modifier_cannot_appear_on_a_class_element: { code: 1031, category: DiagnosticCategory.Error, key: "'{0}' modifier cannot appear on a class element.", isEarly: true }, An_interface_declaration_cannot_have_an_implements_clause: { code: 1032, category: DiagnosticCategory.Error, key: "An interface declaration cannot have an 'implements' clause." }, super_must_be_followed_by_an_argument_list_or_member_access: { code: 1034, category: DiagnosticCategory.Error, key: "'super' must be followed by an argument list or member access." }, - Only_ambient_modules_can_use_quoted_names: { code: 1035, category: DiagnosticCategory.Error, key: "Only ambient modules can use quoted names." }, - Statements_are_not_allowed_in_ambient_contexts: { code: 1036, category: DiagnosticCategory.Error, key: "Statements are not allowed in ambient contexts." }, - A_function_implementation_cannot_be_declared_in_an_ambient_context: { code: 1037, category: DiagnosticCategory.Error, key: "A function implementation cannot be declared in an ambient context." }, + Only_ambient_modules_can_use_quoted_names: { code: 1035, category: DiagnosticCategory.Error, key: "Only ambient modules can use quoted names.", isEarly: true }, + Statements_are_not_allowed_in_ambient_contexts: { code: 1036, category: DiagnosticCategory.Error, key: "Statements are not allowed in ambient contexts.", isEarly: true }, + A_function_implementation_cannot_be_declared_in_an_ambient_context: { code: 1037, category: DiagnosticCategory.Error, key: "A function implementation cannot be declared in an ambient context.", isEarly: true }, A_declare_modifier_cannot_be_used_in_an_already_ambient_context: { code: 1038, category: DiagnosticCategory.Error, key: "A 'declare' modifier cannot be used in an already ambient context." }, - Initializers_are_not_allowed_in_ambient_contexts: { code: 1039, category: DiagnosticCategory.Error, key: "Initializers are not allowed in ambient contexts." }, - _0_modifier_cannot_appear_on_a_module_element: { code: 1044, category: DiagnosticCategory.Error, key: "'{0}' modifier cannot appear on a module element." }, + Initializers_are_not_allowed_in_ambient_contexts: { code: 1039, category: DiagnosticCategory.Error, key: "Initializers are not allowed in ambient contexts.", isEarly: true }, + _0_modifier_cannot_appear_on_a_module_element: { code: 1044, category: DiagnosticCategory.Error, key: "'{0}' modifier cannot appear on a module element.", isEarly: true }, A_declare_modifier_cannot_be_used_with_an_interface_declaration: { code: 1045, category: DiagnosticCategory.Error, key: "A 'declare' modifier cannot be used with an interface declaration." }, A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file: { code: 1046, category: DiagnosticCategory.Error, key: "A 'declare' modifier is required for a top level declaration in a .d.ts file." }, A_rest_parameter_cannot_be_optional: { code: 1047, category: DiagnosticCategory.Error, key: "A rest parameter cannot be optional." }, @@ -43,50 +43,50 @@ module ts { A_set_accessor_must_have_exactly_one_parameter: { code: 1049, category: DiagnosticCategory.Error, key: "A 'set' accessor must have exactly one parameter." }, A_set_accessor_cannot_have_an_optional_parameter: { code: 1051, category: DiagnosticCategory.Error, key: "A 'set' accessor cannot have an optional parameter." }, A_set_accessor_parameter_cannot_have_an_initializer: { code: 1052, category: DiagnosticCategory.Error, key: "A 'set' accessor parameter cannot have an initializer." }, - A_set_accessor_cannot_have_rest_parameter: { code: 1053, category: DiagnosticCategory.Error, key: "A 'set' accessor cannot have rest parameter." }, - A_get_accessor_cannot_have_parameters: { code: 1054, category: DiagnosticCategory.Error, key: "A 'get' accessor cannot have parameters." }, - Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1056, category: DiagnosticCategory.Error, key: "Accessors are only available when targeting ECMAScript 5 and higher." }, - Enum_member_must_have_initializer: { code: 1061, category: DiagnosticCategory.Error, key: "Enum member must have initializer." }, - An_export_assignment_cannot_be_used_in_an_internal_module: { code: 1063, category: DiagnosticCategory.Error, key: "An export assignment cannot be used in an internal module." }, - Ambient_enum_elements_can_only_have_integer_literal_initializers: { code: 1066, category: DiagnosticCategory.Error, key: "Ambient enum elements can only have integer literal initializers." }, + A_set_accessor_cannot_have_rest_parameter: { code: 1053, category: DiagnosticCategory.Error, key: "A 'set' accessor cannot have rest parameter.", isEarly: true }, + A_get_accessor_cannot_have_parameters: { code: 1054, category: DiagnosticCategory.Error, key: "A 'get' accessor cannot have parameters.", isEarly: true }, + Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1056, category: DiagnosticCategory.Error, key: "Accessors are only available when targeting ECMAScript 5 and higher.", isEarly: true }, + Enum_member_must_have_initializer: { code: 1061, category: DiagnosticCategory.Error, key: "Enum member must have initializer.", isEarly: true }, + An_export_assignment_cannot_be_used_in_an_internal_module: { code: 1063, category: DiagnosticCategory.Error, key: "An export assignment cannot be used in an internal module.", isEarly: true }, + Ambient_enum_elements_can_only_have_integer_literal_initializers: { code: 1066, category: DiagnosticCategory.Error, key: "Ambient enum elements can only have integer literal initializers.", isEarly: true }, Unexpected_token_A_constructor_method_accessor_or_property_was_expected: { code: 1068, category: DiagnosticCategory.Error, key: "Unexpected token. A constructor, method, accessor, or property was expected." }, A_declare_modifier_cannot_be_used_with_an_import_declaration: { code: 1079, category: DiagnosticCategory.Error, key: "A 'declare' modifier cannot be used with an import declaration." }, Invalid_reference_directive_syntax: { code: 1084, category: DiagnosticCategory.Error, key: "Invalid 'reference' directive syntax." }, - Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher: { code: 1085, category: DiagnosticCategory.Error, key: "Octal literals are not available when targeting ECMAScript 5 and higher." }, - An_accessor_cannot_be_declared_in_an_ambient_context: { code: 1086, category: DiagnosticCategory.Error, key: "An accessor cannot be declared in an ambient context." }, - _0_modifier_cannot_appear_on_a_constructor_declaration: { code: 1089, category: DiagnosticCategory.Error, key: "'{0}' modifier cannot appear on a constructor declaration." }, - _0_modifier_cannot_appear_on_a_parameter: { code: 1090, category: DiagnosticCategory.Error, key: "'{0}' modifier cannot appear on a parameter." }, - Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement: { code: 1091, category: DiagnosticCategory.Error, key: "Only a single variable declaration is allowed in a 'for...in' statement." }, - Type_parameters_cannot_appear_on_a_constructor_declaration: { code: 1092, category: DiagnosticCategory.Error, key: "Type parameters cannot appear on a constructor declaration." }, - Type_annotation_cannot_appear_on_a_constructor_declaration: { code: 1093, category: DiagnosticCategory.Error, key: "Type annotation cannot appear on a constructor declaration." }, + Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher: { code: 1085, category: DiagnosticCategory.Error, key: "Octal literals are not available when targeting ECMAScript 5 and higher.", isEarly: true }, + An_accessor_cannot_be_declared_in_an_ambient_context: { code: 1086, category: DiagnosticCategory.Error, key: "An accessor cannot be declared in an ambient context.", isEarly: true }, + _0_modifier_cannot_appear_on_a_constructor_declaration: { code: 1089, category: DiagnosticCategory.Error, key: "'{0}' modifier cannot appear on a constructor declaration.", isEarly: true }, + _0_modifier_cannot_appear_on_a_parameter: { code: 1090, category: DiagnosticCategory.Error, key: "'{0}' modifier cannot appear on a parameter.", isEarly: true }, + Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement: { code: 1091, category: DiagnosticCategory.Error, key: "Only a single variable declaration is allowed in a 'for...in' statement.", isEarly: true }, + Type_parameters_cannot_appear_on_a_constructor_declaration: { code: 1092, category: DiagnosticCategory.Error, key: "Type parameters cannot appear on a constructor declaration.", isEarly: true }, + Type_annotation_cannot_appear_on_a_constructor_declaration: { code: 1093, category: DiagnosticCategory.Error, key: "Type annotation cannot appear on a constructor declaration.", isEarly: true }, An_accessor_cannot_have_type_parameters: { code: 1094, category: DiagnosticCategory.Error, key: "An accessor cannot have type parameters." }, A_set_accessor_cannot_have_a_return_type_annotation: { code: 1095, category: DiagnosticCategory.Error, key: "A 'set' accessor cannot have a return type annotation." }, - An_index_signature_must_have_exactly_one_parameter: { code: 1096, category: DiagnosticCategory.Error, key: "An index signature must have exactly one parameter." }, - _0_list_cannot_be_empty: { code: 1097, category: DiagnosticCategory.Error, key: "'{0}' list cannot be empty." }, - Type_parameter_list_cannot_be_empty: { code: 1098, category: DiagnosticCategory.Error, key: "Type parameter list cannot be empty." }, + An_index_signature_must_have_exactly_one_parameter: { code: 1096, category: DiagnosticCategory.Error, key: "An index signature must have exactly one parameter.", isEarly: true }, + _0_list_cannot_be_empty: { code: 1097, category: DiagnosticCategory.Error, key: "'{0}' list cannot be empty.", isEarly: true }, + Type_parameter_list_cannot_be_empty: { code: 1098, category: DiagnosticCategory.Error, key: "Type parameter list cannot be empty.", isEarly: true }, Type_argument_list_cannot_be_empty: { code: 1099, category: DiagnosticCategory.Error, key: "Type argument list cannot be empty." }, - Invalid_use_of_0_in_strict_mode: { code: 1100, category: DiagnosticCategory.Error, key: "Invalid use of '{0}' in strict mode." }, - with_statements_are_not_allowed_in_strict_mode: { code: 1101, category: DiagnosticCategory.Error, key: "'with' statements are not allowed in strict mode." }, - delete_cannot_be_called_on_an_identifier_in_strict_mode: { code: 1102, category: DiagnosticCategory.Error, key: "'delete' cannot be called on an identifier in strict mode." }, - A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement: { code: 1104, category: DiagnosticCategory.Error, key: "A 'continue' statement can only be used within an enclosing iteration statement." }, - A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement: { code: 1105, category: DiagnosticCategory.Error, key: "A 'break' statement can only be used within an enclosing iteration or switch statement." }, - Jump_target_cannot_cross_function_boundary: { code: 1107, category: DiagnosticCategory.Error, key: "Jump target cannot cross function boundary." }, - A_return_statement_can_only_be_used_within_a_function_body: { code: 1108, category: DiagnosticCategory.Error, key: "A 'return' statement can only be used within a function body." }, - Expression_expected: { code: 1109, category: DiagnosticCategory.Error, key: "Expression expected." }, + Invalid_use_of_0_in_strict_mode: { code: 1100, category: DiagnosticCategory.Error, key: "Invalid use of '{0}' in strict mode.", isEarly: true }, + with_statements_are_not_allowed_in_strict_mode: { code: 1101, category: DiagnosticCategory.Error, key: "'with' statements are not allowed in strict mode.", isEarly: true }, + delete_cannot_be_called_on_an_identifier_in_strict_mode: { code: 1102, category: DiagnosticCategory.Error, key: "'delete' cannot be called on an identifier in strict mode.", isEarly: true }, + A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement: { code: 1104, category: DiagnosticCategory.Error, key: "A 'continue' statement can only be used within an enclosing iteration statement.", isEarly: true }, + A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement: { code: 1105, category: DiagnosticCategory.Error, key: "A 'break' statement can only be used within an enclosing iteration or switch statement.", isEarly: true }, + Jump_target_cannot_cross_function_boundary: { code: 1107, category: DiagnosticCategory.Error, key: "Jump target cannot cross function boundary.", isEarly: true }, + A_return_statement_can_only_be_used_within_a_function_body: { code: 1108, category: DiagnosticCategory.Error, key: "A 'return' statement can only be used within a function body.", isEarly: true }, + Expression_expected: { code: 1109, category: DiagnosticCategory.Error, key: "Expression expected.", isEarly: true }, Type_expected: { code: 1110, category: DiagnosticCategory.Error, key: "Type expected.", isEarly: true }, - A_constructor_implementation_cannot_be_declared_in_an_ambient_context: { code: 1111, category: DiagnosticCategory.Error, key: "A constructor implementation cannot be declared in an ambient context." }, - A_class_member_cannot_be_declared_optional: { code: 1112, category: DiagnosticCategory.Error, key: "A class member cannot be declared optional." }, + A_constructor_implementation_cannot_be_declared_in_an_ambient_context: { code: 1111, category: DiagnosticCategory.Error, key: "A constructor implementation cannot be declared in an ambient context.", isEarly: true }, + A_class_member_cannot_be_declared_optional: { code: 1112, category: DiagnosticCategory.Error, key: "A class member cannot be declared optional.", isEarly: true }, A_default_clause_cannot_appear_more_than_once_in_a_switch_statement: { code: 1113, category: DiagnosticCategory.Error, key: "A 'default' clause cannot appear more than once in a 'switch' statement." }, - Duplicate_label_0: { code: 1114, category: DiagnosticCategory.Error, key: "Duplicate label '{0}'" }, - A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement: { code: 1115, category: DiagnosticCategory.Error, key: "A 'continue' statement can only jump to a label of an enclosing iteration statement." }, - A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement: { code: 1116, category: DiagnosticCategory.Error, key: "A 'break' statement can only jump to a label of an enclosing statement." }, - An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode: { code: 1117, category: DiagnosticCategory.Error, key: "An object literal cannot have multiple properties with the same name in strict mode." }, - An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name: { code: 1118, category: DiagnosticCategory.Error, key: "An object literal cannot have multiple get/set accessors with the same name." }, - An_object_literal_cannot_have_property_and_accessor_with_the_same_name: { code: 1119, category: DiagnosticCategory.Error, key: "An object literal cannot have property and accessor with the same name." }, - An_export_assignment_cannot_have_modifiers: { code: 1120, category: DiagnosticCategory.Error, key: "An export assignment cannot have modifiers." }, - Octal_literals_are_not_allowed_in_strict_mode: { code: 1121, category: DiagnosticCategory.Error, key: "Octal literals are not allowed in strict mode." }, + Duplicate_label_0: { code: 1114, category: DiagnosticCategory.Error, key: "Duplicate label '{0}'", isEarly: true }, + A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement: { code: 1115, category: DiagnosticCategory.Error, key: "A 'continue' statement can only jump to a label of an enclosing iteration statement.", isEarly: true }, + A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement: { code: 1116, category: DiagnosticCategory.Error, key: "A 'break' statement can only jump to a label of an enclosing statement.", isEarly: true }, + An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode: { code: 1117, category: DiagnosticCategory.Error, key: "An object literal cannot have multiple properties with the same name in strict mode.", isEarly: true }, + An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name: { code: 1118, category: DiagnosticCategory.Error, key: "An object literal cannot have multiple get/set accessors with the same name.", isEarly: true }, + An_object_literal_cannot_have_property_and_accessor_with_the_same_name: { code: 1119, category: DiagnosticCategory.Error, key: "An object literal cannot have property and accessor with the same name.", isEarly: true }, + An_export_assignment_cannot_have_modifiers: { code: 1120, category: DiagnosticCategory.Error, key: "An export assignment cannot have modifiers.", isEarly: true }, + Octal_literals_are_not_allowed_in_strict_mode: { code: 1121, category: DiagnosticCategory.Error, key: "Octal literals are not allowed in strict mode.", isEarly: true }, A_tuple_type_element_list_cannot_be_empty: { code: 1122, category: DiagnosticCategory.Error, key: "A tuple type element list cannot be empty.", isEarly: true }, - Variable_declaration_list_cannot_be_empty: { code: 1123, category: DiagnosticCategory.Error, key: "Variable declaration list cannot be empty." }, + Variable_declaration_list_cannot_be_empty: { code: 1123, category: DiagnosticCategory.Error, key: "Variable declaration list cannot be empty.", isEarly: true }, Digit_expected: { code: 1124, category: DiagnosticCategory.Error, key: "Digit expected." }, Hexadecimal_digit_expected: { code: 1125, category: DiagnosticCategory.Error, key: "Hexadecimal digit expected." }, Unexpected_end_of_text: { code: 1126, category: DiagnosticCategory.Error, key: "Unexpected end of text." }, @@ -98,52 +98,52 @@ module ts { Enum_member_expected: { code: 1132, category: DiagnosticCategory.Error, key: "Enum member expected." }, Type_reference_expected: { code: 1133, category: DiagnosticCategory.Error, key: "Type reference expected." }, Variable_declaration_expected: { code: 1134, category: DiagnosticCategory.Error, key: "Variable declaration expected." }, - Argument_expression_expected: { code: 1135, category: DiagnosticCategory.Error, key: "Argument expression expected." }, + Argument_expression_expected: { code: 1135, category: DiagnosticCategory.Error, key: "Argument expression expected.", isEarly: true }, Property_assignment_expected: { code: 1136, category: DiagnosticCategory.Error, key: "Property assignment expected." }, Expression_or_comma_expected: { code: 1137, category: DiagnosticCategory.Error, key: "Expression or comma expected." }, Parameter_declaration_expected: { code: 1138, category: DiagnosticCategory.Error, key: "Parameter declaration expected." }, Type_parameter_declaration_expected: { code: 1139, category: DiagnosticCategory.Error, key: "Type parameter declaration expected." }, Type_argument_expected: { code: 1140, category: DiagnosticCategory.Error, key: "Type argument expected." }, - String_literal_expected: { code: 1141, category: DiagnosticCategory.Error, key: "String literal expected." }, + String_literal_expected: { code: 1141, category: DiagnosticCategory.Error, key: "String literal expected.", isEarly: true }, Line_break_not_permitted_here: { code: 1142, category: DiagnosticCategory.Error, key: "Line break not permitted here." }, or_expected: { code: 1144, category: DiagnosticCategory.Error, key: "'{' or ';' expected." }, - Modifiers_not_permitted_on_index_signature_members: { code: 1145, category: DiagnosticCategory.Error, key: "Modifiers not permitted on index signature members." }, + Modifiers_not_permitted_on_index_signature_members: { code: 1145, category: DiagnosticCategory.Error, key: "Modifiers not permitted on index signature members.", isEarly: true }, Declaration_expected: { code: 1146, category: DiagnosticCategory.Error, key: "Declaration expected." }, - Import_declarations_in_an_internal_module_cannot_reference_an_external_module: { code: 1147, category: DiagnosticCategory.Error, key: "Import declarations in an internal module cannot reference an external module." }, + Import_declarations_in_an_internal_module_cannot_reference_an_external_module: { code: 1147, category: DiagnosticCategory.Error, key: "Import declarations in an internal module cannot reference an external module.", isEarly: true }, Cannot_compile_external_modules_unless_the_module_flag_is_provided: { code: 1148, category: DiagnosticCategory.Error, key: "Cannot compile external modules unless the '--module' flag is provided." }, Filename_0_differs_from_already_included_filename_1_only_in_casing: { code: 1149, category: DiagnosticCategory.Error, key: "Filename '{0}' differs from already included filename '{1}' only in casing" }, - new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead: { code: 1150, category: DiagnosticCategory.Error, key: "'new T[]' cannot be used to create an array. Use 'new Array()' instead." }, + new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead: { code: 1150, category: DiagnosticCategory.Error, key: "'new T[]' cannot be used to create an array. Use 'new Array()' instead.", isEarly: true }, var_let_or_const_expected: { code: 1152, category: DiagnosticCategory.Error, key: "'var', 'let' or 'const' expected." }, - let_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1153, category: DiagnosticCategory.Error, key: "'let' declarations are only available when targeting ECMAScript 6 and higher." }, - const_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1154, category: DiagnosticCategory.Error, key: "'const' declarations are only available when targeting ECMAScript 6 and higher." }, - const_declarations_must_be_initialized: { code: 1155, category: DiagnosticCategory.Error, key: "'const' declarations must be initialized" }, - const_declarations_can_only_be_declared_inside_a_block: { code: 1156, category: DiagnosticCategory.Error, key: "'const' declarations can only be declared inside a block." }, - let_declarations_can_only_be_declared_inside_a_block: { code: 1157, category: DiagnosticCategory.Error, key: "'let' declarations can only be declared inside a block." }, + let_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1153, category: DiagnosticCategory.Error, key: "'let' declarations are only available when targeting ECMAScript 6 and higher.", isEarly: true }, + const_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1154, category: DiagnosticCategory.Error, key: "'const' declarations are only available when targeting ECMAScript 6 and higher.", isEarly: true }, + const_declarations_must_be_initialized: { code: 1155, category: DiagnosticCategory.Error, key: "'const' declarations must be initialized", isEarly: true }, + const_declarations_can_only_be_declared_inside_a_block: { code: 1156, category: DiagnosticCategory.Error, key: "'const' declarations can only be declared inside a block.", isEarly: true }, + let_declarations_can_only_be_declared_inside_a_block: { code: 1157, category: DiagnosticCategory.Error, key: "'let' declarations can only be declared inside a block.", isEarly: true }, Tagged_templates_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1159, category: DiagnosticCategory.Error, key: "Tagged templates are only available when targeting ECMAScript 6 and higher." }, Unterminated_template_literal: { code: 1160, category: DiagnosticCategory.Error, key: "Unterminated template literal." }, Unterminated_regular_expression_literal: { code: 1161, category: DiagnosticCategory.Error, key: "Unterminated regular expression literal." }, An_object_member_cannot_be_declared_optional: { code: 1162, category: DiagnosticCategory.Error, key: "An object member cannot be declared optional." }, - yield_expression_must_be_contained_within_a_generator_declaration: { code: 1163, category: DiagnosticCategory.Error, key: "'yield' expression must be contained_within a generator declaration." }, - Computed_property_names_are_not_allowed_in_enums: { code: 1164, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in enums." }, - Computed_property_names_are_not_allowed_in_an_ambient_context: { code: 1165, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in an ambient context." }, - Computed_property_names_are_not_allowed_in_class_property_declarations: { code: 1166, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in class property declarations." }, - Computed_property_names_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1167, category: DiagnosticCategory.Error, key: "Computed property names are only available when targeting ECMAScript 6 and higher." }, - Computed_property_names_are_not_allowed_in_method_overloads: { code: 1168, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in method overloads." }, - Computed_property_names_are_not_allowed_in_interfaces: { code: 1169, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in interfaces." }, - Computed_property_names_are_not_allowed_in_type_literals: { code: 1170, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in type literals." }, + yield_expression_must_be_contained_within_a_generator_declaration: { code: 1163, category: DiagnosticCategory.Error, key: "'yield' expression must be contained_within a generator declaration.", isEarly: true }, + Computed_property_names_are_not_allowed_in_enums: { code: 1164, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in enums.", isEarly: true }, + Computed_property_names_are_not_allowed_in_an_ambient_context: { code: 1165, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in an ambient context.", isEarly: true }, + Computed_property_names_are_not_allowed_in_class_property_declarations: { code: 1166, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in class property declarations.", isEarly: true }, + Computed_property_names_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1167, category: DiagnosticCategory.Error, key: "Computed property names are only available when targeting ECMAScript 6 and higher.", isEarly: true }, + Computed_property_names_are_not_allowed_in_method_overloads: { code: 1168, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in method overloads.", isEarly: true }, + Computed_property_names_are_not_allowed_in_interfaces: { code: 1169, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in interfaces.", isEarly: true }, + Computed_property_names_are_not_allowed_in_type_literals: { code: 1170, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in type literals.", isEarly: true }, A_comma_expression_is_not_allowed_in_a_computed_property_name: { code: 1171, category: DiagnosticCategory.Error, key: "A comma expression is not allowed in a computed property name." }, - extends_clause_already_seen: { code: 1172, category: DiagnosticCategory.Error, key: "'extends' clause already seen." }, - extends_clause_must_precede_implements_clause: { code: 1173, category: DiagnosticCategory.Error, key: "'extends' clause must precede 'implements' clause." }, - Classes_can_only_extend_a_single_class: { code: 1174, category: DiagnosticCategory.Error, key: "Classes can only extend a single class." }, - implements_clause_already_seen: { code: 1175, category: DiagnosticCategory.Error, key: "'implements' clause already seen." }, - Interface_declaration_cannot_have_implements_clause: { code: 1176, category: DiagnosticCategory.Error, key: "Interface declaration cannot have 'implements' clause." }, + extends_clause_already_seen: { code: 1172, category: DiagnosticCategory.Error, key: "'extends' clause already seen.", isEarly: true }, + extends_clause_must_precede_implements_clause: { code: 1173, category: DiagnosticCategory.Error, key: "'extends' clause must precede 'implements' clause.", isEarly: true }, + Classes_can_only_extend_a_single_class: { code: 1174, category: DiagnosticCategory.Error, key: "Classes can only extend a single class.", isEarly: true }, + implements_clause_already_seen: { code: 1175, category: DiagnosticCategory.Error, key: "'implements' clause already seen.", isEarly: true }, + Interface_declaration_cannot_have_implements_clause: { code: 1176, category: DiagnosticCategory.Error, key: "Interface declaration cannot have 'implements' clause.", isEarly: true }, Binary_digit_expected: { code: 1177, category: DiagnosticCategory.Error, key: "Binary digit expected." }, Octal_digit_expected: { code: 1178, category: DiagnosticCategory.Error, key: "Octal digit expected." }, Unexpected_token_expected: { code: 1179, category: DiagnosticCategory.Error, key: "Unexpected token. '{' expected." }, Property_destructuring_pattern_expected: { code: 1180, category: DiagnosticCategory.Error, key: "Property destructuring pattern expected." }, Array_element_destructuring_pattern_expected: { code: 1181, category: DiagnosticCategory.Error, key: "Array element destructuring pattern expected." }, - A_destructuring_declaration_must_have_an_initializer: { code: 1182, category: DiagnosticCategory.Error, key: "A destructuring declaration must have an initializer." }, - Destructuring_declarations_are_not_allowed_in_ambient_contexts: { code: 1183, category: DiagnosticCategory.Error, key: "Destructuring declarations are not allowed in ambient contexts." }, + A_destructuring_declaration_must_have_an_initializer: { code: 1182, category: DiagnosticCategory.Error, key: "A destructuring declaration must have an initializer.", isEarly: true }, + Destructuring_declarations_are_not_allowed_in_ambient_contexts: { code: 1183, category: DiagnosticCategory.Error, key: "Destructuring declarations are not allowed in ambient contexts.", isEarly: true }, Duplicate_identifier_0: { code: 2300, category: DiagnosticCategory.Error, key: "Duplicate identifier '{0}'." }, Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: DiagnosticCategory.Error, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." }, Static_members_cannot_reference_class_type_parameters: { code: 2302, category: DiagnosticCategory.Error, key: "Static members cannot reference class type parameters." }, @@ -433,7 +433,7 @@ module ts { _0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7023, category: DiagnosticCategory.Error, key: "'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." }, Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7024, category: DiagnosticCategory.Error, key: "Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." }, You_cannot_rename_this_element: { code: 8000, category: DiagnosticCategory.Error, key: "You cannot rename this element." }, - yield_expressions_are_not_currently_supported: { code: 9000, category: DiagnosticCategory.Error, key: "'yield' expressions are not currently supported." }, - generators_are_not_currently_supported: { code: 9001, category: DiagnosticCategory.Error, key: "'generators' are not currently supported." }, + yield_expressions_are_not_currently_supported: { code: 9000, category: DiagnosticCategory.Error, key: "'yield' expressions are not currently supported.", isEarly: true }, + generators_are_not_currently_supported: { code: 9001, category: DiagnosticCategory.Error, key: "'generators' are not currently supported.", isEarly: true }, }; } \ No newline at end of file diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index f3fc9b9b715..03fad9f5ace 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -30,47 +30,58 @@ }, "Catch clause parameter cannot have a type annotation.": { "category": "Error", - "code": 1013 + "code": 1013, + "isEarly": true }, "A rest parameter must be last in a parameter list.": { "category": "Error", - "code": 1014 + "code": 1014, + "isEarly": true }, "Parameter cannot have question mark and initializer.": { "category": "Error", - "code": 1015 + "code": 1015, + "isEarly": true }, "A required parameter cannot follow an optional parameter.": { "category": "Error", - "code": 1016 + "code": 1016, + "isEarly": true }, "An index signature cannot have a rest parameter.": { "category": "Error", - "code": 1017 + "code": 1017, + "isEarly": true }, "An index signature parameter cannot have an accessibility modifier.": { "category": "Error", - "code": 1018 + "code": 1018, + "isEarly": true }, "An index signature parameter cannot have a question mark.": { "category": "Error", - "code": 1019 + "code": 1019, + "isEarly": true }, "An index signature parameter cannot have an initializer.": { "category": "Error", - "code": 1020 + "code": 1020, + "isEarly": true }, "An index signature must have a type annotation.": { "category": "Error", - "code": 1021 + "code": 1021, + "isEarly": true }, "An index signature parameter must have a type annotation.": { "category": "Error", - "code": 1022 + "code": 1022, + "isEarly": true }, "An index signature parameter type must be 'string' or 'number'.": { "category": "Error", - "code": 1023 + "code": 1023, + "isEarly": true }, "A class or interface declaration can only have one 'extends' clause.": { "category": "Error", @@ -90,19 +101,23 @@ }, "Accessibility modifier already seen.": { "category": "Error", - "code": 1028 + "code": 1028, + "isEarly": true }, "'{0}' modifier must precede '{1}' modifier.": { "category": "Error", - "code": 1029 + "code": 1029, + "isEarly": true }, "'{0}' modifier already seen.": { "category": "Error", - "code": 1030 + "code": 1030, + "isEarly": true }, "'{0}' modifier cannot appear on a class element.": { "category": "Error", - "code": 1031 + "code": 1031, + "isEarly": true }, "An interface declaration cannot have an 'implements' clause.": { "category": "Error", @@ -114,15 +129,18 @@ }, "Only ambient modules can use quoted names.": { "category": "Error", - "code": 1035 + "code": 1035, + "isEarly": true }, "Statements are not allowed in ambient contexts.": { "category": "Error", - "code": 1036 + "code": 1036, + "isEarly": true }, "A function implementation cannot be declared in an ambient context.": { "category": "Error", - "code": 1037 + "code": 1037, + "isEarly": true }, "A 'declare' modifier cannot be used in an already ambient context.": { "category": "Error", @@ -130,11 +148,13 @@ }, "Initializers are not allowed in ambient contexts.": { "category": "Error", - "code": 1039 + "code": 1039, + "isEarly": true }, "'{0}' modifier cannot appear on a module element.": { "category": "Error", - "code": 1044 + "code": 1044, + "isEarly": true }, "A 'declare' modifier cannot be used with an interface declaration.": { "category": "Error", @@ -166,27 +186,33 @@ }, "A 'set' accessor cannot have rest parameter.": { "category": "Error", - "code": 1053 + "code": 1053, + "isEarly": true }, "A 'get' accessor cannot have parameters.": { "category": "Error", - "code": 1054 + "code": 1054, + "isEarly": true }, "Accessors are only available when targeting ECMAScript 5 and higher.": { "category": "Error", - "code": 1056 + "code": 1056, + "isEarly": true }, "Enum member must have initializer.": { "category": "Error", - "code": 1061 + "code": 1061, + "isEarly": true }, "An export assignment cannot be used in an internal module.": { "category": "Error", - "code": 1063 + "code": 1063, + "isEarly": true }, "Ambient enum elements can only have integer literal initializers.": { "category": "Error", - "code": 1066 + "code": 1066, + "isEarly": true }, "Unexpected token. A constructor, method, accessor, or property was expected.": { "category": "Error", @@ -202,31 +228,38 @@ }, "Octal literals are not available when targeting ECMAScript 5 and higher.": { "category": "Error", - "code": 1085 + "code": 1085, + "isEarly": true }, "An accessor cannot be declared in an ambient context.": { "category": "Error", - "code": 1086 + "code": 1086, + "isEarly": true }, "'{0}' modifier cannot appear on a constructor declaration.": { "category": "Error", - "code": 1089 + "code": 1089, + "isEarly": true }, "'{0}' modifier cannot appear on a parameter.": { "category": "Error", - "code": 1090 + "code": 1090, + "isEarly": true }, "Only a single variable declaration is allowed in a 'for...in' statement.": { "category": "Error", - "code": 1091 + "code": 1091, + "isEarly": true }, "Type parameters cannot appear on a constructor declaration.": { "category": "Error", - "code": 1092 + "code": 1092, + "isEarly": true }, "Type annotation cannot appear on a constructor declaration.": { "category": "Error", - "code": 1093 + "code": 1093, + "isEarly": true }, "An accessor cannot have type parameters.": { "category": "Error", @@ -238,15 +271,18 @@ }, "An index signature must have exactly one parameter.": { "category": "Error", - "code": 1096 + "code": 1096, + "isEarly": true }, "'{0}' list cannot be empty.": { "category": "Error", - "code": 1097 + "code": 1097, + "isEarly": true }, "Type parameter list cannot be empty.": { "category": "Error", - "code": 1098 + "code": 1098, + "isEarly": true }, "Type argument list cannot be empty.": { "category": "Error", @@ -254,35 +290,43 @@ }, "Invalid use of '{0}' in strict mode.": { "category": "Error", - "code": 1100 + "code": 1100, + "isEarly": true }, "'with' statements are not allowed in strict mode.": { "category": "Error", - "code": 1101 + "code": 1101, + "isEarly": true }, "'delete' cannot be called on an identifier in strict mode.": { "category": "Error", - "code": 1102 + "code": 1102, + "isEarly": true }, "A 'continue' statement can only be used within an enclosing iteration statement.": { "category": "Error", - "code": 1104 + "code": 1104, + "isEarly": true }, "A 'break' statement can only be used within an enclosing iteration or switch statement.": { "category": "Error", - "code": 1105 + "code": 1105, + "isEarly": true }, "Jump target cannot cross function boundary.": { "category": "Error", - "code": 1107 + "code": 1107, + "isEarly": true }, "A 'return' statement can only be used within a function body.": { "category": "Error", - "code": 1108 + "code": 1108, + "isEarly": true }, "Expression expected.": { "category": "Error", - "code": 1109 + "code": 1109, + "isEarly": true }, "Type expected.": { "category": "Error", @@ -291,11 +335,13 @@ }, "A constructor implementation cannot be declared in an ambient context.": { "category": "Error", - "code": 1111 + "code": 1111, + "isEarly": true }, "A class member cannot be declared optional.": { "category": "Error", - "code": 1112 + "code": 1112, + "isEarly": true }, "A 'default' clause cannot appear more than once in a 'switch' statement.": { "category": "Error", @@ -303,35 +349,43 @@ }, "Duplicate label '{0}'": { "category": "Error", - "code": 1114 + "code": 1114, + "isEarly": true }, "A 'continue' statement can only jump to a label of an enclosing iteration statement.": { "category": "Error", - "code": 1115 + "code": 1115, + "isEarly": true }, "A 'break' statement can only jump to a label of an enclosing statement.": { "category": "Error", - "code": 1116 + "code": 1116, + "isEarly": true }, "An object literal cannot have multiple properties with the same name in strict mode.": { "category": "Error", - "code": 1117 + "code": 1117, + "isEarly": true }, "An object literal cannot have multiple get/set accessors with the same name.": { "category": "Error", - "code": 1118 + "code": 1118, + "isEarly": true }, "An object literal cannot have property and accessor with the same name.": { "category": "Error", - "code": 1119 + "code": 1119, + "isEarly": true }, "An export assignment cannot have modifiers.": { "category": "Error", - "code": 1120 + "code": 1120, + "isEarly": true }, "Octal literals are not allowed in strict mode.": { "category": "Error", - "code": 1121 + "code": 1121, + "isEarly": true }, "A tuple type element list cannot be empty.": { "category": "Error", @@ -340,7 +394,8 @@ }, "Variable declaration list cannot be empty.": { "category": "Error", - "code": 1123 + "code": 1123, + "isEarly": true }, "Digit expected.": { "category": "Error", @@ -388,7 +443,8 @@ }, "Argument expression expected.": { "category": "Error", - "code": 1135 + "code": 1135, + "isEarly": true }, "Property assignment expected.": { "category": "Error", @@ -412,7 +468,8 @@ }, "String literal expected.": { "category": "Error", - "code": 1141 + "code": 1141, + "isEarly": true }, "Line break not permitted here.": { "category": "Error", @@ -424,7 +481,8 @@ }, "Modifiers not permitted on index signature members.": { "category": "Error", - "code": 1145 + "code": 1145, + "isEarly": true }, "Declaration expected.": { "category": "Error", @@ -432,7 +490,8 @@ }, "Import declarations in an internal module cannot reference an external module.": { "category": "Error", - "code": 1147 + "code": 1147, + "isEarly": true }, "Cannot compile external modules unless the '--module' flag is provided.": { "category": "Error", @@ -444,7 +503,8 @@ }, "'new T[]' cannot be used to create an array. Use 'new Array()' instead.": { "category": "Error", - "code": 1150 + "code": 1150, + "isEarly": true }, "'var', 'let' or 'const' expected.": { "category": "Error", @@ -452,23 +512,28 @@ }, "'let' declarations are only available when targeting ECMAScript 6 and higher.": { "category": "Error", - "code": 1153 + "code": 1153, + "isEarly": true }, "'const' declarations are only available when targeting ECMAScript 6 and higher.": { "category": "Error", - "code": 1154 + "code": 1154, + "isEarly": true }, "'const' declarations must be initialized": { "category": "Error", - "code": 1155 + "code": 1155, + "isEarly": true }, "'const' declarations can only be declared inside a block.": { "category": "Error", - "code": 1156 + "code": 1156, + "isEarly": true }, "'let' declarations can only be declared inside a block.": { "category": "Error", - "code": 1157 + "code": 1157, + "isEarly": true }, "Tagged templates are only available when targeting ECMAScript 6 and higher.": { "category": "Error", @@ -489,35 +554,43 @@ "'yield' expression must be contained_within a generator declaration." : { "category": "Error", - "code": 1163 + "code": 1163, + "isEarly": true }, "Computed property names are not allowed in enums.": { "category": "Error", - "code": 1164 + "code": 1164, + "isEarly": true }, "Computed property names are not allowed in an ambient context.": { "category": "Error", - "code": 1165 + "code": 1165, + "isEarly": true }, "Computed property names are not allowed in class property declarations.": { "category": "Error", - "code": 1166 + "code": 1166, + "isEarly": true }, "Computed property names are only available when targeting ECMAScript 6 and higher.": { "category": "Error", - "code": 1167 + "code": 1167, + "isEarly": true }, "Computed property names are not allowed in method overloads.": { "category": "Error", - "code": 1168 + "code": 1168, + "isEarly": true }, "Computed property names are not allowed in interfaces.": { "category": "Error", - "code": 1169 + "code": 1169, + "isEarly": true }, "Computed property names are not allowed in type literals.": { "category": "Error", - "code": 1170 + "code": 1170, + "isEarly": true }, "A comma expression is not allowed in a computed property name.": { "category": "Error", @@ -525,23 +598,28 @@ }, "'extends' clause already seen.": { "category": "Error", - "code": 1172 + "code": 1172, + "isEarly": true }, "'extends' clause must precede 'implements' clause.": { "category": "Error", - "code": 1173 + "code": 1173, + "isEarly": true }, "Classes can only extend a single class.": { "category": "Error", - "code": 1174 + "code": 1174, + "isEarly": true }, "'implements' clause already seen.": { "category": "Error", - "code": 1175 + "code": 1175, + "isEarly": true }, "Interface declaration cannot have 'implements' clause.": { "category": "Error", - "code": 1176 + "code": 1176, + "isEarly": true }, "Binary digit expected.": { "category": "Error", @@ -565,11 +643,13 @@ }, "A destructuring declaration must have an initializer.": { "category": "Error", - "code": 1182 + "code": 1182, + "isEarly": true }, "Destructuring declarations are not allowed in ambient contexts.": { "category": "Error", - "code": 1183 + "code": 1183, + "isEarly": true }, "Duplicate identifier '{0}'.": { @@ -1737,10 +1817,12 @@ }, "'yield' expressions are not currently supported.": { "category": "Error", - "code": 9000 + "code": 9000, + "isEarly": true }, "'generators' are not currently supported.": { "category": "Error", - "code": 9001 + "code": 9001, + "isEarly": true } } From 31e49ed93eb447317f16485bba13af7c084b0980 Mon Sep 17 00:00:00 2001 From: Yui T Date: Wed, 10 Dec 2014 18:39:24 -0800 Subject: [PATCH 09/78] Move grammar checking: callSignature, constructorType, ConstructSignature, FunctionType, IndexSignature --- src/compiler/checker.ts | 325 +++++++++++++++--- src/compiler/parser.ts | 8 +- ...OptionalParameterAndInitializer.errors.txt | 4 +- ...eReferenceWithoutTypeArgument.d.errors.txt | 2 +- ...ypeReferenceWithoutTypeArgument.errors.txt | 2 +- ...peReferenceWithoutTypeArgument2.errors.txt | 2 +- ...peReferenceWithoutTypeArgument3.errors.txt | 2 +- tests/baselines/reference/giant.errors.txt | 32 +- ...SignatureMustHaveTypeAnnotation.errors.txt | 2 +- ...natureWithAccessibilityModifier.errors.txt | 12 +- .../reference/indexTypeCheck.errors.txt | 4 +- .../parserIndexSignature2.errors.txt | 6 +- .../reference/parserObjectType6.errors.txt | 2 +- .../typeParameterConstraints1.errors.txt | 2 +- 14 files changed, 314 insertions(+), 91 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index f8280ffd230..aff559c9261 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -8667,54 +8667,6 @@ module ts { return node; } - // GRAMMAR CHECKING - function checkGrammarForDisallowedTrailingComma(list: NodeArray): boolean { - if (list && list.hasTrailingComma) { - var start = list.end - ",".length; - var end = list.end; - var sourceFile = getSourceFileOfNode(list[0]); - grammarErrorAtPos(sourceFile, start, end - start, Diagnostics.Trailing_comma_not_allowed); - return true; - } - } - - function hasParseDiagnostics(sourceFile: SourceFile): boolean { - return sourceFile.parseDiagnostics.length > 0; - } - - function scanToken(scanner: Scanner, pos: number) { - scanner.setTextPos(pos); - scanner.scan(); - var start = scanner.getTokenPos(); - scanner.setTextPos(start); - scanner.scan(); - return start; - } - - function grammarErrorOnFirstToken(node: Node, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any): void { - var sourceFile = getSourceFileOfNode(node); - if (!hasParseDiagnostics(sourceFile)) { - var scanner = createScanner(compilerOptions.target, /*skipTrivia*/ true, sourceFile.text); - var start = scanToken(scanner, node.pos); - diagnostics.push(createFileDiagnostic(sourceFile, start, scanner.getTextPos() - start, message, arg0, arg1, arg2)); - } - } - - function grammarErrorAtPos(sourceFile: SourceFile, start: number, length: number, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any): void { - if (!hasParseDiagnostics(sourceFile)) { - diagnostics.push(createFileDiagnostic(sourceFile, start, length, message, arg0, arg1, arg2)); - } - } - - function grammarErrorOnNode(node: Node, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any): void { - var sourceFile = getSourceFileOfNode(node); - if (!hasParseDiagnostics(sourceFile)) { - var span = getErrorSpanForNode(node); - var start = span.end > span.pos ? skipTrivia(sourceFile.text, span.pos) : span.pos; - diagnostics.push(createFileDiagnostic(sourceFile, start, span.end - start, message, arg0, arg1, arg2)); - } - } - function checkImportDeclaration(node: ImportDeclaration) { checkCollisionWithCapturedThisVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); @@ -8803,7 +8755,12 @@ module ts { case SyntaxKind.ConstructorType: case SyntaxKind.CallSignature: case SyntaxKind.ConstructSignature: + // Grammar checking + checkGrammarSignatureDeclaration(node) + return checkSignatureDeclaration(node); case SyntaxKind.IndexSignature: + // Grammar checking + checkGrammarIndexSignature(node); return checkSignatureDeclaration(node); case SyntaxKind.MethodDeclaration: case SyntaxKind.MethodSignature: @@ -9682,6 +9639,278 @@ module ts { anyArrayType = createArrayType(anyType); } + + // GRAMMAR CHECKING + function checkModifiers(node: Node): boolean { + switch (node.kind) { + case SyntaxKind.GetAccessor: + case SyntaxKind.SetAccessor: + case SyntaxKind.Constructor: + case SyntaxKind.PropertyDeclaration: + case SyntaxKind.PropertySignature: + case SyntaxKind.MethodDeclaration: + case SyntaxKind.MethodSignature: + case SyntaxKind.IndexSignature: + case SyntaxKind.ClassDeclaration: + case SyntaxKind.InterfaceDeclaration: + case SyntaxKind.ModuleDeclaration: + case SyntaxKind.EnumDeclaration: + case SyntaxKind.ExportAssignment: + case SyntaxKind.VariableStatement: + case SyntaxKind.FunctionDeclaration: + case SyntaxKind.TypeAliasDeclaration: + case SyntaxKind.ImportDeclaration: + case SyntaxKind.Parameter: + break; + default: + return false; + } + + if (!node.modifiers) { + return; + } + + var lastStatic: Node, lastPrivate: Node, lastProtected: Node, lastDeclare: Node; + var flags = 0; + for (var i = 0, n = node.modifiers.length; i < n; i++) { + var modifier = node.modifiers[i]; + + switch (modifier.kind) { + case SyntaxKind.PublicKeyword: + case SyntaxKind.ProtectedKeyword: + case SyntaxKind.PrivateKeyword: + var text: string; + if (modifier.kind === SyntaxKind.PublicKeyword) { + text = "public"; + } + else if (modifier.kind === SyntaxKind.ProtectedKeyword) { + text = "protected"; + lastProtected = modifier; + } + else { + text = "private"; + lastPrivate = modifier; + } + + if (flags & NodeFlags.AccessibilityModifier) { + return grammarErrorOnNode(modifier, Diagnostics.Accessibility_modifier_already_seen); + } + else if (flags & NodeFlags.Static) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, text, "static"); + } + else if (node.parent.kind === SyntaxKind.ModuleBlock || node.parent.kind === SyntaxKind.SourceFile) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_module_element, text); + } + flags |= modifierToFlag(modifier.kind); + break; + + case SyntaxKind.StaticKeyword: + if (flags & NodeFlags.Static) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, "static"); + } + else if (node.parent.kind === SyntaxKind.ModuleBlock || node.parent.kind === SyntaxKind.SourceFile) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_module_element, "static"); + } + else if (node.kind === SyntaxKind.Parameter) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static"); + } + flags |= NodeFlags.Static; + lastStatic = modifier; + break; + + case SyntaxKind.ExportKeyword: + if (flags & NodeFlags.Export) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, "export"); + } + else if (flags & NodeFlags.Ambient) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "export", "declare"); + } + else if (node.parent.kind === SyntaxKind.ClassDeclaration) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_class_element, "export"); + } + else if (node.kind === SyntaxKind.Parameter) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export"); + } + flags |= NodeFlags.Export; + break; + + case SyntaxKind.DeclareKeyword: + // TODO (yuisu) : Bring back the parser grammar checking + break; + } + } + + if (node.kind === SyntaxKind.Constructor) { + if (flags & NodeFlags.Static) { + return grammarErrorOnNode(lastStatic, Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static"); + } + else if (flags & NodeFlags.Protected) { + return grammarErrorOnNode(lastProtected, Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "protected"); + } + else if (flags & NodeFlags.Private) { + return grammarErrorOnNode(lastPrivate, Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "private"); + } + } + else if (node.kind === SyntaxKind.ImportDeclaration && flags & NodeFlags.Ambient) { + return grammarErrorOnNode(lastDeclare, Diagnostics.A_declare_modifier_cannot_be_used_with_an_import_declaration, "declare"); + } + else if (node.kind === SyntaxKind.InterfaceDeclaration && flags & NodeFlags.Ambient) { + return grammarErrorOnNode(lastDeclare, Diagnostics.A_declare_modifier_cannot_be_used_with_an_interface_declaration, "declare"); + } + } + + function checkGrammarForDisallowedTrailingComma(list: NodeArray): boolean { + if (list && list.hasTrailingComma) { + var start = list.end - ",".length; + var end = list.end; + var sourceFile = getSourceFileOfNode(list[0]); + return grammarErrorAtPos(sourceFile, start, end - start, Diagnostics.Trailing_comma_not_allowed); + } + } + + function checkGrammarTypeParameterList(signatureDecl: SignatureDeclaration, typeParameters: NodeArray): boolean { + if (checkGrammarForDisallowedTrailingComma(typeParameters)) { + return true; + } + + if (typeParameters && typeParameters.length === 0) { + var start = typeParameters.pos - "<".length; + var sourceFile = getSourceFileOfNode(signatureDecl); + var end = skipTrivia(sourceFile.text, typeParameters.end) + ">".length; + return grammarErrorAtPos(sourceFile, start, end - start, Diagnostics.Type_parameter_list_cannot_be_empty); + } + } + + function checkGrammarParameterList(parameters: NodeArray) { + if (checkGrammarForDisallowedTrailingComma(parameters)) { + return true; + } + + var seenOptionalParameter = false; + var parameterCount = parameters.length; + + for (var i = 0; i < parameterCount; i++) { + var parameter = parameters[i]; + if (parameter.dotDotDotToken) { + if (i !== (parameterCount - 1)) { + return grammarErrorOnNode(parameter.dotDotDotToken, Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list); + } + + if (parameter.questionToken) { + return grammarErrorOnNode(parameter.questionToken, Diagnostics.A_rest_parameter_cannot_be_optional); + } + + if (parameter.initializer) { + return grammarErrorOnNode(parameter.name, Diagnostics.A_rest_parameter_cannot_have_an_initializer); + } + } + else if (parameter.questionToken || parameter.initializer) { + seenOptionalParameter = true; + + if (parameter.questionToken && parameter.initializer) { + return grammarErrorOnNode(parameter.name, Diagnostics.Parameter_cannot_have_question_mark_and_initializer); + } + } + else { + if (seenOptionalParameter) { + return grammarErrorOnNode(parameter.name, Diagnostics.A_required_parameter_cannot_follow_an_optional_parameter); + } + } + } + } + + function checkGrammarSignatureDeclaration(node: SignatureDeclaration) { + if (!checkGrammarTypeParameterList(node, node.typeParameters)) { + checkGrammarParameterList(node.parameters); + } + } + + function checkGrammarIndexSignatureParameters(node: SignatureDeclaration): boolean { + var parameter = node.parameters[0]; + if (node.parameters.length !== 1) { + if (parameter) { + return grammarErrorOnNode(parameter.name, Diagnostics.An_index_signature_must_have_exactly_one_parameter); + } + else { + return grammarErrorOnNode(node, Diagnostics.An_index_signature_must_have_exactly_one_parameter); + } + } + else if (parameter.dotDotDotToken) { + return grammarErrorOnNode(parameter.dotDotDotToken, Diagnostics.An_index_signature_cannot_have_a_rest_parameter); + } + else if (parameter.flags & NodeFlags.Modifier) { + return grammarErrorOnNode(parameter.name, Diagnostics.An_index_signature_parameter_cannot_have_an_accessibility_modifier); + } + else if (parameter.questionToken) { + return grammarErrorOnNode(parameter.questionToken, Diagnostics.An_index_signature_parameter_cannot_have_a_question_mark); + } + else if (parameter.initializer) { + return grammarErrorOnNode(parameter.name, Diagnostics.An_index_signature_parameter_cannot_have_an_initializer); + } + else if (!parameter.type) { + return grammarErrorOnNode(parameter.name, Diagnostics.An_index_signature_parameter_must_have_a_type_annotation); + } + else if (parameter.type.kind !== SyntaxKind.StringKeyword && parameter.type.kind !== SyntaxKind.NumberKeyword) { + return grammarErrorOnNode(parameter.name, Diagnostics.An_index_signature_parameter_type_must_be_string_or_number); + } + else if (!node.type) { + return grammarErrorOnNode(node, Diagnostics.An_index_signature_must_have_a_type_annotation); + } + } + + function checkGrammarForIndexSignatureModifier(node: SignatureDeclaration): void { + if (node.flags & NodeFlags.Modifier) { + grammarErrorOnFirstToken(node, Diagnostics.Modifiers_not_permitted_on_index_signature_members); + } + } + + function checkGrammarIndexSignature(node: SignatureDeclaration) { + var hasErrorFromCheckModifiersOrParameters = checkModifiers(node) ? true: checkGrammarIndexSignatureParameters(node); + if (!hasErrorFromCheckModifiersOrParameters) { + checkGrammarForIndexSignatureModifier(node); + } + } + + function hasParseDiagnostics(sourceFile: SourceFile): boolean { + return sourceFile.parseDiagnostics.length > 0; + } + + function scanToken(scanner: Scanner, pos: number) { + scanner.setTextPos(pos); + scanner.scan(); + var start = scanner.getTokenPos(); + scanner.setTextPos(start); + scanner.scan(); + return start; + } + + function grammarErrorOnFirstToken(node: Node, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any): boolean { + var sourceFile = getSourceFileOfNode(node); + if (!hasParseDiagnostics(sourceFile)) { + var scanner = createScanner(compilerOptions.target, /*skipTrivia*/ true, sourceFile.text); + var start = scanToken(scanner, node.pos); + diagnostics.push(createFileDiagnostic(sourceFile, start, scanner.getTextPos() - start, message, arg0, arg1, arg2)); + return true; + } + } + + function grammarErrorAtPos(sourceFile: SourceFile, start: number, length: number, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any): boolean { + if (!hasParseDiagnostics(sourceFile)) { + diagnostics.push(createFileDiagnostic(sourceFile, start, length, message, arg0, arg1, arg2)); + return true; + } + } + + function grammarErrorOnNode(node: Node, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any): boolean { + var sourceFile = getSourceFileOfNode(node); + if (!hasParseDiagnostics(sourceFile)) { + var span = getErrorSpanForNode(node); + var start = span.end > span.pos ? skipTrivia(sourceFile.text, span.pos) : span.pos; + diagnostics.push(createFileDiagnostic(sourceFile, start, span.end - start, message, arg0, arg1, arg2)); + return true; + } + } + initializeTypeChecker(); return checker; diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 5b2b8ad0dad..b0a544cb80c 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -1002,7 +1002,7 @@ module ts { return false; } - function modifierToFlag(token: SyntaxKind): NodeFlags { + export function modifierToFlag(token: SyntaxKind): NodeFlags { switch (token) { case SyntaxKind.StaticKeyword: return NodeFlags.Static; case SyntaxKind.PublicKeyword: return NodeFlags.Public; @@ -4626,10 +4626,6 @@ module ts { // Now do node specific checks. switch (nodeKind) { case SyntaxKind.ArrowFunction: - case SyntaxKind.CallSignature: - case SyntaxKind.ConstructorType: - case SyntaxKind.ConstructSignature: - case SyntaxKind.FunctionType: return checkAnySignatureDeclaration(node); case SyntaxKind.BreakStatement: case SyntaxKind.ContinueStatement: @@ -4655,7 +4651,6 @@ module ts { case SyntaxKind.FunctionExpression: return checkFunctionExpression(node); case SyntaxKind.GetAccessor: return checkGetAccessor(node); case SyntaxKind.HeritageClause: return checkHeritageClause(node); - case SyntaxKind.IndexSignature: return checkIndexSignature(node); case SyntaxKind.InterfaceDeclaration: return checkInterfaceDeclaration(node); case SyntaxKind.LabeledStatement: return checkLabeledStatement(node); case SyntaxKind.PropertyAssignment: return checkPropertyAssignment(node); @@ -5335,7 +5330,6 @@ module ts { case SyntaxKind.PropertySignature: case SyntaxKind.MethodDeclaration: case SyntaxKind.MethodSignature: - case SyntaxKind.IndexSignature: case SyntaxKind.ClassDeclaration: case SyntaxKind.InterfaceDeclaration: case SyntaxKind.ModuleDeclaration: diff --git a/tests/baselines/reference/callSignatureWithOptionalParameterAndInitializer.errors.txt b/tests/baselines/reference/callSignatureWithOptionalParameterAndInitializer.errors.txt index 35718ca9612..ecb1c877296 100644 --- a/tests/baselines/reference/callSignatureWithOptionalParameterAndInitializer.errors.txt +++ b/tests/baselines/reference/callSignatureWithOptionalParameterAndInitializer.errors.txt @@ -2,15 +2,15 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWith tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(4,22): error TS1015: Parameter cannot have question mark and initializer. tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(5,22): error TS1015: Parameter cannot have question mark and initializer. tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(15,9): error TS1015: Parameter cannot have question mark and initializer. -tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(23,6): error TS1015: Parameter cannot have question mark and initializer. tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(24,20): error TS1015: Parameter cannot have question mark and initializer. -tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(34,6): error TS1015: Parameter cannot have question mark and initializer. tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(35,9): error TS1015: Parameter cannot have question mark and initializer. tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(44,9): error TS1015: Parameter cannot have question mark and initializer. tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(45,32): error TS1015: Parameter cannot have question mark and initializer. tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(46,9): error TS1015: Parameter cannot have question mark and initializer. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(23,6): error TS1015: Parameter cannot have question mark and initializer. tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(23,6): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(24,20): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(34,6): error TS1015: Parameter cannot have question mark and initializer. tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(34,6): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(35,9): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(45,32): error TS2322: Type 'string' is not assignable to type 'number'. diff --git a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.d.errors.txt b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.d.errors.txt index f646ac4725e..6c98d419dec 100644 --- a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.d.errors.txt +++ b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.d.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.d.ts(12,19): error TS1023: An index signature parameter type must be 'string' or 'number'. tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.d.ts(8,16): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.d.ts(10,21): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.d.ts(11,22): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.d.ts(11,26): error TS2314: Generic type 'C' requires 1 type argument(s). +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.d.ts(12,19): error TS1023: An index signature parameter type must be 'string' or 'number'. tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.d.ts(12,22): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.d.ts(12,26): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.d.ts(14,23): error TS2314: Generic type 'C' requires 1 type argument(s). diff --git a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.errors.txt b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.errors.txt index a8627f3f18e..d57f3c2fc0d 100644 --- a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.errors.txt +++ b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(12,11): error TS1023: An index signature parameter type must be 'string' or 'number'. tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(8,8): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(10,13): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(11,14): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(11,18): error TS2314: Generic type 'C' requires 1 type argument(s). +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(12,11): error TS1023: An index signature parameter type must be 'string' or 'number'. tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(12,14): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(12,18): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(14,13): error TS2314: Generic type 'C' requires 1 type argument(s). diff --git a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.errors.txt b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.errors.txt index 1802d0385c4..745da9aa106 100644 --- a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.errors.txt +++ b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(12,11): error TS1023: An index signature parameter type must be 'string' or 'number'. tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(8,8): error TS2314: Generic type 'I' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(10,13): error TS2314: Generic type 'I' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(11,14): error TS2314: Generic type 'I' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(11,18): error TS2314: Generic type 'I' requires 1 type argument(s). +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(12,11): error TS1023: An index signature parameter type must be 'string' or 'number'. tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(12,14): error TS2314: Generic type 'I' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(12,18): error TS2314: Generic type 'I' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(14,13): error TS2314: Generic type 'I' requires 1 type argument(s). diff --git a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument3.errors.txt b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument3.errors.txt index 41774da0d00..1fec52356a2 100644 --- a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument3.errors.txt +++ b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument3.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument3.ts(12,19): error TS1023: An index signature parameter type must be 'string' or 'number'. tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument3.ts(8,16): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument3.ts(10,21): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument3.ts(11,22): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument3.ts(11,26): error TS2314: Generic type 'C' requires 1 type argument(s). +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument3.ts(12,19): error TS1023: An index signature parameter type must be 'string' or 'number'. tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument3.ts(12,22): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument3.ts(12,26): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument3.ts(14,23): error TS2314: Generic type 'C' requires 1 type argument(s). diff --git a/tests/baselines/reference/giant.errors.txt b/tests/baselines/reference/giant.errors.txt index f971c067768..782f10212bd 100644 --- a/tests/baselines/reference/giant.errors.txt +++ b/tests/baselines/reference/giant.errors.txt @@ -5,8 +5,6 @@ tests/cases/compiler/giant.ts(30,17): error TS1056: Accessors are only available tests/cases/compiler/giant.ts(34,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(36,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(61,5): error TS1169: Computed property names are not allowed in interfaces. -tests/cases/compiler/giant.ts(62,5): error TS1021: An index signature must have a type annotation. -tests/cases/compiler/giant.ts(63,6): error TS1096: An index signature must have exactly one parameter. tests/cases/compiler/giant.ts(88,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(90,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(92,21): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. @@ -14,8 +12,6 @@ tests/cases/compiler/giant.ts(94,21): error TS1056: Accessors are only available tests/cases/compiler/giant.ts(98,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(100,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(125,9): error TS1169: Computed property names are not allowed in interfaces. -tests/cases/compiler/giant.ts(126,9): error TS1021: An index signature must have a type annotation. -tests/cases/compiler/giant.ts(127,10): error TS1096: An index signature must have exactly one parameter. tests/cases/compiler/giant.ts(154,39): error TS1037: A function implementation cannot be declared in an ambient context. tests/cases/compiler/giant.ts(167,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(169,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. @@ -24,8 +20,6 @@ tests/cases/compiler/giant.ts(173,21): error TS1056: Accessors are only availabl tests/cases/compiler/giant.ts(177,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(179,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(204,9): error TS1169: Computed property names are not allowed in interfaces. -tests/cases/compiler/giant.ts(205,9): error TS1021: An index signature must have a type annotation. -tests/cases/compiler/giant.ts(206,10): error TS1096: An index signature must have exactly one parameter. tests/cases/compiler/giant.ts(233,39): error TS1037: A function implementation cannot be declared in an ambient context. tests/cases/compiler/giant.ts(238,35): error TS1037: A function implementation cannot be declared in an ambient context. tests/cases/compiler/giant.ts(240,24): error TS1111: A constructor implementation cannot be declared in an ambient context. @@ -55,8 +49,6 @@ tests/cases/compiler/giant.ts(288,17): error TS1056: Accessors are only availabl tests/cases/compiler/giant.ts(292,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(294,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(319,5): error TS1169: Computed property names are not allowed in interfaces. -tests/cases/compiler/giant.ts(320,5): error TS1021: An index signature must have a type annotation. -tests/cases/compiler/giant.ts(321,6): error TS1096: An index signature must have exactly one parameter. tests/cases/compiler/giant.ts(346,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(348,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(350,21): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. @@ -64,8 +56,6 @@ tests/cases/compiler/giant.ts(352,21): error TS1056: Accessors are only availabl tests/cases/compiler/giant.ts(356,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(358,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(383,9): error TS1169: Computed property names are not allowed in interfaces. -tests/cases/compiler/giant.ts(384,9): error TS1021: An index signature must have a type annotation. -tests/cases/compiler/giant.ts(385,10): error TS1096: An index signature must have exactly one parameter. tests/cases/compiler/giant.ts(412,39): error TS1037: A function implementation cannot be declared in an ambient context. tests/cases/compiler/giant.ts(425,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(427,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. @@ -74,8 +64,6 @@ tests/cases/compiler/giant.ts(431,21): error TS1056: Accessors are only availabl tests/cases/compiler/giant.ts(435,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(437,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(462,9): error TS1169: Computed property names are not allowed in interfaces. -tests/cases/compiler/giant.ts(463,9): error TS1021: An index signature must have a type annotation. -tests/cases/compiler/giant.ts(464,10): error TS1096: An index signature must have exactly one parameter. tests/cases/compiler/giant.ts(491,39): error TS1037: A function implementation cannot be declared in an ambient context. tests/cases/compiler/giant.ts(496,35): error TS1037: A function implementation cannot be declared in an ambient context. tests/cases/compiler/giant.ts(498,24): error TS1111: A constructor implementation cannot be declared in an ambient context. @@ -121,8 +109,6 @@ tests/cases/compiler/giant.ts(558,24): error TS1111: A constructor implementatio tests/cases/compiler/giant.ts(561,21): error TS1037: A function implementation cannot be declared in an ambient context. tests/cases/compiler/giant.ts(563,21): error TS1037: A function implementation cannot be declared in an ambient context. tests/cases/compiler/giant.ts(587,9): error TS1169: Computed property names are not allowed in interfaces. -tests/cases/compiler/giant.ts(588,9): error TS1021: An index signature must have a type annotation. -tests/cases/compiler/giant.ts(589,10): error TS1096: An index signature must have exactly one parameter. tests/cases/compiler/giant.ts(606,22): error TS1037: A function implementation cannot be declared in an ambient context. tests/cases/compiler/giant.ts(606,25): error TS1036: Statements are not allowed in ambient contexts. tests/cases/compiler/giant.ts(611,30): error TS1037: A function implementation cannot be declared in an ambient context. @@ -138,8 +124,6 @@ tests/cases/compiler/giant.ts(623,24): error TS1111: A constructor implementatio tests/cases/compiler/giant.ts(626,21): error TS1037: A function implementation cannot be declared in an ambient context. tests/cases/compiler/giant.ts(628,21): error TS1037: A function implementation cannot be declared in an ambient context. tests/cases/compiler/giant.ts(653,9): error TS1169: Computed property names are not allowed in interfaces. -tests/cases/compiler/giant.ts(654,9): error TS1021: An index signature must have a type annotation. -tests/cases/compiler/giant.ts(655,10): error TS1096: An index signature must have exactly one parameter. tests/cases/compiler/giant.ts(672,22): error TS1037: A function implementation cannot be declared in an ambient context. tests/cases/compiler/giant.ts(672,25): error TS1036: Statements are not allowed in ambient contexts. tests/cases/compiler/giant.ts(676,30): error TS1037: A function implementation cannot be declared in an ambient context. @@ -156,6 +140,8 @@ tests/cases/compiler/giant.ts(33,12): error TS2300: Duplicate identifier 'tsF'. tests/cases/compiler/giant.ts(34,16): error TS2300: Duplicate identifier 'tsF'. tests/cases/compiler/giant.ts(35,12): error TS2300: Duplicate identifier 'tgF'. tests/cases/compiler/giant.ts(36,16): error TS2300: Duplicate identifier 'tgF'. +tests/cases/compiler/giant.ts(62,5): error TS1021: An index signature must have a type annotation. +tests/cases/compiler/giant.ts(63,6): error TS1096: An index signature must have exactly one parameter. tests/cases/compiler/giant.ts(76,5): error TS2386: Overload signatures must all be optional or required. tests/cases/compiler/giant.ts(87,16): error TS2300: Duplicate identifier 'pgF'. tests/cases/compiler/giant.ts(88,20): error TS2300: Duplicate identifier 'pgF'. @@ -169,6 +155,8 @@ tests/cases/compiler/giant.ts(97,16): error TS2300: Duplicate identifier 'tsF'. tests/cases/compiler/giant.ts(98,20): error TS2300: Duplicate identifier 'tsF'. tests/cases/compiler/giant.ts(99,16): error TS2300: Duplicate identifier 'tgF'. tests/cases/compiler/giant.ts(100,20): error TS2300: Duplicate identifier 'tgF'. +tests/cases/compiler/giant.ts(126,9): error TS1021: An index signature must have a type annotation. +tests/cases/compiler/giant.ts(127,10): error TS1096: An index signature must have exactly one parameter. tests/cases/compiler/giant.ts(140,9): error TS2386: Overload signatures must all be optional or required. tests/cases/compiler/giant.ts(166,16): error TS2300: Duplicate identifier 'pgF'. tests/cases/compiler/giant.ts(167,20): error TS2300: Duplicate identifier 'pgF'. @@ -182,6 +170,8 @@ tests/cases/compiler/giant.ts(176,16): error TS2300: Duplicate identifier 'tsF'. tests/cases/compiler/giant.ts(177,20): error TS2300: Duplicate identifier 'tsF'. tests/cases/compiler/giant.ts(178,16): error TS2300: Duplicate identifier 'tgF'. tests/cases/compiler/giant.ts(179,20): error TS2300: Duplicate identifier 'tgF'. +tests/cases/compiler/giant.ts(205,9): error TS1021: An index signature must have a type annotation. +tests/cases/compiler/giant.ts(206,10): error TS1096: An index signature must have exactly one parameter. tests/cases/compiler/giant.ts(219,9): error TS2386: Overload signatures must all be optional or required. tests/cases/compiler/giant.ts(245,16): error TS2300: Duplicate identifier 'pgF'. tests/cases/compiler/giant.ts(246,20): error TS2300: Duplicate identifier 'pgF'. @@ -207,6 +197,8 @@ tests/cases/compiler/giant.ts(291,12): error TS2300: Duplicate identifier 'tsF'. tests/cases/compiler/giant.ts(292,16): error TS2300: Duplicate identifier 'tsF'. tests/cases/compiler/giant.ts(293,12): error TS2300: Duplicate identifier 'tgF'. tests/cases/compiler/giant.ts(294,16): error TS2300: Duplicate identifier 'tgF'. +tests/cases/compiler/giant.ts(320,5): error TS1021: An index signature must have a type annotation. +tests/cases/compiler/giant.ts(321,6): error TS1096: An index signature must have exactly one parameter. tests/cases/compiler/giant.ts(334,5): error TS2386: Overload signatures must all be optional or required. tests/cases/compiler/giant.ts(345,16): error TS2300: Duplicate identifier 'pgF'. tests/cases/compiler/giant.ts(346,20): error TS2300: Duplicate identifier 'pgF'. @@ -220,6 +212,8 @@ tests/cases/compiler/giant.ts(355,16): error TS2300: Duplicate identifier 'tsF'. tests/cases/compiler/giant.ts(356,20): error TS2300: Duplicate identifier 'tsF'. tests/cases/compiler/giant.ts(357,16): error TS2300: Duplicate identifier 'tgF'. tests/cases/compiler/giant.ts(358,20): error TS2300: Duplicate identifier 'tgF'. +tests/cases/compiler/giant.ts(384,9): error TS1021: An index signature must have a type annotation. +tests/cases/compiler/giant.ts(385,10): error TS1096: An index signature must have exactly one parameter. tests/cases/compiler/giant.ts(398,9): error TS2386: Overload signatures must all be optional or required. tests/cases/compiler/giant.ts(424,16): error TS2300: Duplicate identifier 'pgF'. tests/cases/compiler/giant.ts(425,20): error TS2300: Duplicate identifier 'pgF'. @@ -233,6 +227,8 @@ tests/cases/compiler/giant.ts(434,16): error TS2300: Duplicate identifier 'tsF'. tests/cases/compiler/giant.ts(435,20): error TS2300: Duplicate identifier 'tsF'. tests/cases/compiler/giant.ts(436,16): error TS2300: Duplicate identifier 'tgF'. tests/cases/compiler/giant.ts(437,20): error TS2300: Duplicate identifier 'tgF'. +tests/cases/compiler/giant.ts(463,9): error TS1021: An index signature must have a type annotation. +tests/cases/compiler/giant.ts(464,10): error TS1096: An index signature must have exactly one parameter. tests/cases/compiler/giant.ts(477,9): error TS2386: Overload signatures must all be optional or required. tests/cases/compiler/giant.ts(503,16): error TS2300: Duplicate identifier 'pgF'. tests/cases/compiler/giant.ts(504,20): error TS2300: Duplicate identifier 'pgF'. @@ -258,7 +254,11 @@ tests/cases/compiler/giant.ts(549,12): error TS2300: Duplicate identifier 'tsF'. tests/cases/compiler/giant.ts(550,16): error TS2300: Duplicate identifier 'tsF'. tests/cases/compiler/giant.ts(551,12): error TS2300: Duplicate identifier 'tgF'. tests/cases/compiler/giant.ts(552,16): error TS2300: Duplicate identifier 'tgF'. +tests/cases/compiler/giant.ts(588,9): error TS1021: An index signature must have a type annotation. +tests/cases/compiler/giant.ts(589,10): error TS1096: An index signature must have exactly one parameter. tests/cases/compiler/giant.ts(602,9): error TS2386: Overload signatures must all be optional or required. +tests/cases/compiler/giant.ts(654,9): error TS1021: An index signature must have a type annotation. +tests/cases/compiler/giant.ts(655,10): error TS1096: An index signature must have exactly one parameter. tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all be optional or required. diff --git a/tests/baselines/reference/indexSignatureMustHaveTypeAnnotation.errors.txt b/tests/baselines/reference/indexSignatureMustHaveTypeAnnotation.errors.txt index 294282d1e9e..7d348b2cdbc 100644 --- a/tests/baselines/reference/indexSignatureMustHaveTypeAnnotation.errors.txt +++ b/tests/baselines/reference/indexSignatureMustHaveTypeAnnotation.errors.txt @@ -1,6 +1,6 @@ tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(2,5): error TS1169: Computed property names are not allowed in interfaces. -tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(3,5): error TS1021: An index signature must have a type annotation. tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(7,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(3,5): error TS1021: An index signature must have a type annotation. tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(12,5): error TS1021: An index signature must have a type annotation. diff --git a/tests/baselines/reference/indexSignatureWithAccessibilityModifier.errors.txt b/tests/baselines/reference/indexSignatureWithAccessibilityModifier.errors.txt index 6c836e268d6..84577dd5cae 100644 --- a/tests/baselines/reference/indexSignatureWithAccessibilityModifier.errors.txt +++ b/tests/baselines/reference/indexSignatureWithAccessibilityModifier.errors.txt @@ -1,22 +1,22 @@ -tests/cases/compiler/indexSignatureWithAccessibilityModifier.ts(2,13): error TS1018: An index signature parameter cannot have an accessibility modifier. -tests/cases/compiler/indexSignatureWithAccessibilityModifier.ts(6,13): error TS1018: An index signature parameter cannot have an accessibility modifier. tests/cases/compiler/indexSignatureWithAccessibilityModifier.ts(2,6): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/compiler/indexSignatureWithAccessibilityModifier.ts(2,13): error TS1018: An index signature parameter cannot have an accessibility modifier. tests/cases/compiler/indexSignatureWithAccessibilityModifier.ts(6,6): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/compiler/indexSignatureWithAccessibilityModifier.ts(6,13): error TS1018: An index signature parameter cannot have an accessibility modifier. ==== tests/cases/compiler/indexSignatureWithAccessibilityModifier.ts (4 errors) ==== interface I { [public x: string]: string; - ~ -!!! error TS1018: An index signature parameter cannot have an accessibility modifier. ~~~~~~~~~~~~~~~~ !!! error TS2369: A parameter property is only allowed in a constructor implementation. + ~ +!!! error TS1018: An index signature parameter cannot have an accessibility modifier. } class C { [public x: string]: string - ~ -!!! error TS1018: An index signature parameter cannot have an accessibility modifier. ~~~~~~~~~~~~~~~~ !!! error TS2369: A parameter property is only allowed in a constructor implementation. + ~ +!!! error TS1018: An index signature parameter cannot have an accessibility modifier. } \ No newline at end of file diff --git a/tests/baselines/reference/indexTypeCheck.errors.txt b/tests/baselines/reference/indexTypeCheck.errors.txt index efa02c3ff1f..03d0e2ce8ed 100644 --- a/tests/baselines/reference/indexTypeCheck.errors.txt +++ b/tests/baselines/reference/indexTypeCheck.errors.txt @@ -1,10 +1,10 @@ tests/cases/compiler/indexTypeCheck.ts(2,2): error TS1021: An index signature must have a type annotation. tests/cases/compiler/indexTypeCheck.ts(3,2): error TS1021: An index signature must have a type annotation. -tests/cases/compiler/indexTypeCheck.ts(32,3): error TS1096: An index signature must have exactly one parameter. -tests/cases/compiler/indexTypeCheck.ts(36,3): error TS1023: An index signature parameter type must be 'string' or 'number'. tests/cases/compiler/indexTypeCheck.ts(17,2): error TS2413: Numeric index type 'number' is not assignable to string index type 'string'. tests/cases/compiler/indexTypeCheck.ts(22,2): error TS2413: Numeric index type 'Orange' is not assignable to string index type 'Yellow'. tests/cases/compiler/indexTypeCheck.ts(27,2): error TS2413: Numeric index type 'number' is not assignable to string index type 'string'. +tests/cases/compiler/indexTypeCheck.ts(32,3): error TS1096: An index signature must have exactly one parameter. +tests/cases/compiler/indexTypeCheck.ts(36,3): error TS1023: An index signature parameter type must be 'string' or 'number'. tests/cases/compiler/indexTypeCheck.ts(51,1): error TS2342: An index expression argument must be of type 'string', 'number', or 'any'. diff --git a/tests/baselines/reference/parserIndexSignature2.errors.txt b/tests/baselines/reference/parserIndexSignature2.errors.txt index 8e221bdce2c..398cebebea8 100644 --- a/tests/baselines/reference/parserIndexSignature2.errors.txt +++ b/tests/baselines/reference/parserIndexSignature2.errors.txt @@ -1,12 +1,12 @@ -tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature2.ts(2,11): error TS1018: An index signature parameter cannot have an accessibility modifier. tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature2.ts(2,4): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature2.ts(2,11): error TS1018: An index signature parameter cannot have an accessibility modifier. ==== tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature2.ts (2 errors) ==== interface I { [public a] - ~ -!!! error TS1018: An index signature parameter cannot have an accessibility modifier. ~~~~~~~~ !!! error TS2369: A parameter property is only allowed in a constructor implementation. + ~ +!!! error TS1018: An index signature parameter cannot have an accessibility modifier. } \ No newline at end of file diff --git a/tests/baselines/reference/parserObjectType6.errors.txt b/tests/baselines/reference/parserObjectType6.errors.txt index afdc6b8f4d8..90841d046a6 100644 --- a/tests/baselines/reference/parserObjectType6.errors.txt +++ b/tests/baselines/reference/parserObjectType6.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/parser/ecmascript5/ObjectTypes/parserObjectType6.ts(3,4): error TS1096: An index signature must have exactly one parameter. tests/cases/conformance/parser/ecmascript5/ObjectTypes/parserObjectType6.ts(2,7): error TS2304: Cannot find name 'B'. +tests/cases/conformance/parser/ecmascript5/ObjectTypes/parserObjectType6.ts(3,4): error TS1096: An index signature must have exactly one parameter. ==== tests/cases/conformance/parser/ecmascript5/ObjectTypes/parserObjectType6.ts (2 errors) ==== diff --git a/tests/baselines/reference/typeParameterConstraints1.errors.txt b/tests/baselines/reference/typeParameterConstraints1.errors.txt index 44261e8d194..f30fd4f6700 100644 --- a/tests/baselines/reference/typeParameterConstraints1.errors.txt +++ b/tests/baselines/reference/typeParameterConstraints1.errors.txt @@ -23,7 +23,7 @@ tests/cases/compiler/typeParameterConstraints1.ts(12,26): error TS2304: Cannot f ~ !!! error TS1110: Type expected. function foo10 (test: T) { } - ~~~ + ~ !!! error TS1110: Type expected. function foo11 (test: T) { } ~~~~ From 408d6f3ea30a90180f725721ab70320112a79bd5 Mon Sep 17 00:00:00 2001 From: Yui T Date: Wed, 10 Dec 2014 19:30:09 -0800 Subject: [PATCH 10/78] Address code review --- src/compiler/binder.ts | 3 --- src/compiler/checker.ts | 3 --- src/compiler/parser.ts | 3 ++- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index a458779e52f..dfb5482b09c 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -387,9 +387,6 @@ module ts { switch (node.kind) { case SyntaxKind.TypeParameter: bindDeclaration(node, SymbolFlags.TypeParameter, SymbolFlags.TypeParameterExcludes, /*isBlockScopeContainer*/ false); - if ((node).expression) { - (node).expression.parent = node; - } break; case SyntaxKind.Parameter: if (isBindingPattern((node).name)) { diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index aff559c9261..867161968e4 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -7019,7 +7019,6 @@ module ts { function checkTypeParameter(node: TypeParameterDeclaration) { // Grammar Checking if (node.expression) { - var sourceFile = getSourceFileOfNode(node); grammarErrorOnFirstToken(node.expression, Diagnostics.Type_expected); } @@ -9879,8 +9878,6 @@ module ts { scanner.setTextPos(pos); scanner.scan(); var start = scanner.getTokenPos(); - scanner.setTextPos(start); - scanner.scan(); return start; } diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index b0a544cb80c..dfce57dba3a 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -255,7 +255,8 @@ module ts { child((node).right); case SyntaxKind.TypeParameter: return child((node).name) || - child((node).constraint); + child((node).constraint) || + child((node).expression); case SyntaxKind.Parameter: case SyntaxKind.PropertyDeclaration: case SyntaxKind.PropertySignature: From 7cdf75e1a819a383aa7f1d5b8a5a9ad40382b2ab Mon Sep 17 00:00:00 2001 From: Yui T Date: Wed, 10 Dec 2014 21:37:05 -0800 Subject: [PATCH 11/78] Move grammar checking: Arrow function --- src/compiler/checker.ts | 11 +++++++---- src/compiler/diagnosticInformationMap.generated.ts | 2 +- src/compiler/diagnosticMessages.json | 3 ++- src/compiler/parser.ts | 2 -- tests/baselines/reference/ArrowFunction2.errors.txt | 6 +++--- ...tureWithOptionalParameterAndInitializer.errors.txt | 4 ++-- .../fatarrowfunctionsOptionalArgsErrors4.errors.txt | 2 +- .../reference/parserX_ArrowFunction2.errors.txt | 6 +++--- ...estParameterWithoutAnnotationIsAnyArray.errors.txt | 2 +- .../restParametersOfNonArrayTypes.errors.txt | 2 +- .../restParametersOfNonArrayTypes2.errors.txt | 4 ++-- .../restParametersWithArrayTypeAnnotations.errors.txt | 4 ++-- 12 files changed, 25 insertions(+), 23 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 867161968e4..288a74c46a1 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -6992,7 +6992,10 @@ module ts { case SyntaxKind.ParenthesizedExpression: return checkExpression((node).expression); case SyntaxKind.FunctionExpression: + return checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); case SyntaxKind.ArrowFunction: + // Grammar checking + checkGrammarSignatureDeclaration(node); return checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); case SyntaxKind.TypeOfExpression: return checkTypeOfExpression(node); @@ -9767,7 +9770,7 @@ module ts { } } - function checkGrammarTypeParameterList(signatureDecl: SignatureDeclaration, typeParameters: NodeArray): boolean { + function checkGrammarTypeParameterList(signatureDecl: SignatureDeclaration | Expression, typeParameters: NodeArray): boolean { if (checkGrammarForDisallowedTrailingComma(typeParameters)) { return true; } @@ -9818,9 +9821,9 @@ module ts { } } - function checkGrammarSignatureDeclaration(node: SignatureDeclaration) { - if (!checkGrammarTypeParameterList(node, node.typeParameters)) { - checkGrammarParameterList(node.parameters); + function checkGrammarSignatureDeclaration(node: SignatureDeclaration | Expression) { + if (!checkGrammarTypeParameterList(node, (node).typeParameters)) { + checkGrammarParameterList((node).parameters); } } diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index 268451c9775..f8d0fdfaa96 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -38,7 +38,7 @@ module ts { _0_modifier_cannot_appear_on_a_module_element: { code: 1044, category: DiagnosticCategory.Error, key: "'{0}' modifier cannot appear on a module element.", isEarly: true }, A_declare_modifier_cannot_be_used_with_an_interface_declaration: { code: 1045, category: DiagnosticCategory.Error, key: "A 'declare' modifier cannot be used with an interface declaration." }, A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file: { code: 1046, category: DiagnosticCategory.Error, key: "A 'declare' modifier is required for a top level declaration in a .d.ts file." }, - A_rest_parameter_cannot_be_optional: { code: 1047, category: DiagnosticCategory.Error, key: "A rest parameter cannot be optional." }, + A_rest_parameter_cannot_be_optional: { code: 1047, category: DiagnosticCategory.Error, key: "A rest parameter cannot be optional.", isEarly: true }, A_rest_parameter_cannot_have_an_initializer: { code: 1048, category: DiagnosticCategory.Error, key: "A rest parameter cannot have an initializer." }, A_set_accessor_must_have_exactly_one_parameter: { code: 1049, category: DiagnosticCategory.Error, key: "A 'set' accessor must have exactly one parameter." }, A_set_accessor_cannot_have_an_optional_parameter: { code: 1051, category: DiagnosticCategory.Error, key: "A 'set' accessor cannot have an optional parameter." }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 03fad9f5ace..f384157169e 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -166,7 +166,8 @@ }, "A rest parameter cannot be optional.": { "category": "Error", - "code": 1047 + "code": 1047, + "isEarly": true }, "A rest parameter cannot have an initializer.": { "category": "Error", diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index dfce57dba3a..d25a28f8b7f 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -4626,8 +4626,6 @@ module ts { function checkNode(node: Node, nodeKind: SyntaxKind): boolean { // Now do node specific checks. switch (nodeKind) { - case SyntaxKind.ArrowFunction: - return checkAnySignatureDeclaration(node); case SyntaxKind.BreakStatement: case SyntaxKind.ContinueStatement: return checkBreakOrContinueStatement(node); diff --git a/tests/baselines/reference/ArrowFunction2.errors.txt b/tests/baselines/reference/ArrowFunction2.errors.txt index 26e1f336cb6..3b9ba21f15a 100644 --- a/tests/baselines/reference/ArrowFunction2.errors.txt +++ b/tests/baselines/reference/ArrowFunction2.errors.txt @@ -1,12 +1,12 @@ -tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArrowFunctions/ArrowFunction2.ts(1,14): error TS1009: Trailing comma not allowed. tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArrowFunctions/ArrowFunction2.ts(1,13): error TS2304: Cannot find name 'b'. +tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArrowFunctions/ArrowFunction2.ts(1,14): error TS1009: Trailing comma not allowed. ==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArrowFunctions/ArrowFunction2.ts (2 errors) ==== var v = (a: b,) => { - ~ -!!! error TS1009: Trailing comma not allowed. ~ !!! error TS2304: Cannot find name 'b'. + ~ +!!! error TS1009: Trailing comma not allowed. }; \ No newline at end of file diff --git a/tests/baselines/reference/callSignatureWithOptionalParameterAndInitializer.errors.txt b/tests/baselines/reference/callSignatureWithOptionalParameterAndInitializer.errors.txt index ecb1c877296..eec5ea18afc 100644 --- a/tests/baselines/reference/callSignatureWithOptionalParameterAndInitializer.errors.txt +++ b/tests/baselines/reference/callSignatureWithOptionalParameterAndInitializer.errors.txt @@ -1,12 +1,11 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(3,14): error TS1015: Parameter cannot have question mark and initializer. tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(4,22): error TS1015: Parameter cannot have question mark and initializer. -tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(5,22): error TS1015: Parameter cannot have question mark and initializer. tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(15,9): error TS1015: Parameter cannot have question mark and initializer. tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(24,20): error TS1015: Parameter cannot have question mark and initializer. tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(35,9): error TS1015: Parameter cannot have question mark and initializer. tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(44,9): error TS1015: Parameter cannot have question mark and initializer. tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(45,32): error TS1015: Parameter cannot have question mark and initializer. -tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(46,9): error TS1015: Parameter cannot have question mark and initializer. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(5,22): error TS1015: Parameter cannot have question mark and initializer. tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(23,6): error TS1015: Parameter cannot have question mark and initializer. tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(23,6): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(24,20): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. @@ -14,6 +13,7 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWith tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(34,6): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(35,9): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(45,32): error TS2322: Type 'string' is not assignable to type 'number'. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(46,9): error TS1015: Parameter cannot have question mark and initializer. ==== tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts (16 errors) ==== diff --git a/tests/baselines/reference/fatarrowfunctionsOptionalArgsErrors4.errors.txt b/tests/baselines/reference/fatarrowfunctionsOptionalArgsErrors4.errors.txt index 8de0eb92a02..fe9df3c2fb3 100644 --- a/tests/baselines/reference/fatarrowfunctionsOptionalArgsErrors4.errors.txt +++ b/tests/baselines/reference/fatarrowfunctionsOptionalArgsErrors4.errors.txt @@ -3,9 +3,9 @@ tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors4.ts(2,15): error TS1015 tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors4.ts(3,21): error TS1015: Parameter cannot have question mark and initializer. tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors4.ts(4,7): error TS1015: Parameter cannot have question mark and initializer. tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors4.ts(4,39): error TS1015: Parameter cannot have question mark and initializer. +tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors4.ts(6,5): error TS2304: Cannot find name 'foo'. tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors4.ts(17,10): error TS1015: Parameter cannot have question mark and initializer. tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors4.ts(19,13): error TS1015: Parameter cannot have question mark and initializer. -tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors4.ts(6,5): error TS2304: Cannot find name 'foo'. ==== tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors4.ts (8 errors) ==== diff --git a/tests/baselines/reference/parserX_ArrowFunction2.errors.txt b/tests/baselines/reference/parserX_ArrowFunction2.errors.txt index e5b45cef1d0..20b4cb45e45 100644 --- a/tests/baselines/reference/parserX_ArrowFunction2.errors.txt +++ b/tests/baselines/reference/parserX_ArrowFunction2.errors.txt @@ -1,12 +1,12 @@ -tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArrowFunctions/parserX_ArrowFunction2.ts(1,14): error TS1009: Trailing comma not allowed. tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArrowFunctions/parserX_ArrowFunction2.ts(1,13): error TS2304: Cannot find name 'b'. +tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArrowFunctions/parserX_ArrowFunction2.ts(1,14): error TS1009: Trailing comma not allowed. ==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArrowFunctions/parserX_ArrowFunction2.ts (2 errors) ==== var v = (a: b,) => { - ~ -!!! error TS1009: Trailing comma not allowed. ~ !!! error TS2304: Cannot find name 'b'. + ~ +!!! error TS1009: Trailing comma not allowed. }; \ No newline at end of file diff --git a/tests/baselines/reference/restParameterWithoutAnnotationIsAnyArray.errors.txt b/tests/baselines/reference/restParameterWithoutAnnotationIsAnyArray.errors.txt index 0177f1e9a1c..6685d5fe69f 100644 --- a/tests/baselines/reference/restParameterWithoutAnnotationIsAnyArray.errors.txt +++ b/tests/baselines/reference/restParameterWithoutAnnotationIsAnyArray.errors.txt @@ -1,6 +1,6 @@ -tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParameterWithoutAnnotationIsAnyArray.ts(5,11): error TS1014: A rest parameter must be last in a parameter list. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParameterWithoutAnnotationIsAnyArray.ts(13,9): error TS1014: A rest parameter must be last in a parameter list. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParameterWithoutAnnotationIsAnyArray.ts(23,21): error TS1014: A rest parameter must be last in a parameter list. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParameterWithoutAnnotationIsAnyArray.ts(5,11): error TS1014: A rest parameter must be last in a parameter list. ==== tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParameterWithoutAnnotationIsAnyArray.ts (3 errors) ==== diff --git a/tests/baselines/reference/restParametersOfNonArrayTypes.errors.txt b/tests/baselines/reference/restParametersOfNonArrayTypes.errors.txt index 12cbd865d1c..df16e72ea79 100644 --- a/tests/baselines/reference/restParametersOfNonArrayTypes.errors.txt +++ b/tests/baselines/reference/restParametersOfNonArrayTypes.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes.ts(5,11): error TS1014: A rest parameter must be last in a parameter list. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes.ts(13,9): error TS1014: A rest parameter must be last in a parameter list. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes.ts(23,21): error TS1014: A rest parameter must be last in a parameter list. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes.ts(3,14): error TS2370: A rest parameter must be of an array type. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes.ts(4,22): error TS2370: A rest parameter must be of an array type. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes.ts(5,11): error TS1014: A rest parameter must be last in a parameter list. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes.ts(5,11): error TS2370: A rest parameter must be of an array type. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes.ts(5,23): error TS2370: A rest parameter must be of an array type. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes.ts(8,9): error TS2370: A rest parameter must be of an array type. diff --git a/tests/baselines/reference/restParametersOfNonArrayTypes2.errors.txt b/tests/baselines/reference/restParametersOfNonArrayTypes2.errors.txt index eef052e5cdf..b70c7fb467d 100644 --- a/tests/baselines/reference/restParametersOfNonArrayTypes2.errors.txt +++ b/tests/baselines/reference/restParametersOfNonArrayTypes2.errors.txt @@ -1,11 +1,10 @@ -tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(9,11): error TS1014: A rest parameter must be last in a parameter list. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(17,9): error TS1014: A rest parameter must be last in a parameter list. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(27,21): error TS1014: A rest parameter must be last in a parameter list. -tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(36,11): error TS1014: A rest parameter must be last in a parameter list. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(44,9): error TS1014: A rest parameter must be last in a parameter list. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(54,21): error TS1014: A rest parameter must be last in a parameter list. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(7,14): error TS2370: A rest parameter must be of an array type. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(8,22): error TS2370: A rest parameter must be of an array type. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(9,11): error TS1014: A rest parameter must be last in a parameter list. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(9,11): error TS2370: A rest parameter must be of an array type. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(9,26): error TS2370: A rest parameter must be of an array type. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(12,9): error TS2370: A rest parameter must be of an array type. @@ -20,6 +19,7 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfN tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(28,9): error TS2370: A rest parameter must be of an array type. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(34,15): error TS2370: A rest parameter must be of an array type. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(35,23): error TS2370: A rest parameter must be of an array type. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(36,11): error TS1014: A rest parameter must be last in a parameter list. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(36,11): error TS2370: A rest parameter must be of an array type. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(36,35): error TS2370: A rest parameter must be of an array type. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(39,9): error TS2370: A rest parameter must be of an array type. diff --git a/tests/baselines/reference/restParametersWithArrayTypeAnnotations.errors.txt b/tests/baselines/reference/restParametersWithArrayTypeAnnotations.errors.txt index 06b2caefb9d..05075fc6175 100644 --- a/tests/baselines/reference/restParametersWithArrayTypeAnnotations.errors.txt +++ b/tests/baselines/reference/restParametersWithArrayTypeAnnotations.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersWithArrayTypeAnnotations.ts(5,11): error TS1014: A rest parameter must be last in a parameter list. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersWithArrayTypeAnnotations.ts(13,9): error TS1014: A rest parameter must be last in a parameter list. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersWithArrayTypeAnnotations.ts(23,21): error TS1014: A rest parameter must be last in a parameter list. -tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersWithArrayTypeAnnotations.ts(32,11): error TS1014: A rest parameter must be last in a parameter list. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersWithArrayTypeAnnotations.ts(40,9): error TS1014: A rest parameter must be last in a parameter list. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersWithArrayTypeAnnotations.ts(50,21): error TS1014: A rest parameter must be last in a parameter list. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersWithArrayTypeAnnotations.ts(5,11): error TS1014: A rest parameter must be last in a parameter list. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersWithArrayTypeAnnotations.ts(32,11): error TS1014: A rest parameter must be last in a parameter list. ==== tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersWithArrayTypeAnnotations.ts (6 errors) ==== From 547e1296f8ecb686b6f993efbf9bd2163dbb52c4 Mon Sep 17 00:00:00 2001 From: Yui T Date: Wed, 10 Dec 2014 21:37:05 -0800 Subject: [PATCH 12/78] Move grammar checking: Arrow function --- src/compiler/checker.ts | 13 ++++++++----- src/compiler/diagnosticInformationMap.generated.ts | 2 +- src/compiler/diagnosticMessages.json | 3 ++- src/compiler/parser.ts | 2 -- tests/baselines/reference/ArrowFunction2.errors.txt | 6 +++--- ...reWithOptionalParameterAndInitializer.errors.txt | 4 ++-- .../fatarrowfunctionsOptionalArgsErrors4.errors.txt | 2 +- .../reference/parserX_ArrowFunction2.errors.txt | 6 +++--- ...tParameterWithoutAnnotationIsAnyArray.errors.txt | 2 +- .../restParametersOfNonArrayTypes.errors.txt | 2 +- .../restParametersOfNonArrayTypes2.errors.txt | 4 ++-- ...estParametersWithArrayTypeAnnotations.errors.txt | 4 ++-- 12 files changed, 26 insertions(+), 24 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 867161968e4..7e749dfe07b 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -6992,7 +6992,10 @@ module ts { case SyntaxKind.ParenthesizedExpression: return checkExpression((node).expression); case SyntaxKind.FunctionExpression: + return checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); case SyntaxKind.ArrowFunction: + // Grammar checking + checkGrammarSignatureDeclarationOrArrowFunction(node); return checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); case SyntaxKind.TypeOfExpression: return checkTypeOfExpression(node); @@ -8755,7 +8758,7 @@ module ts { case SyntaxKind.CallSignature: case SyntaxKind.ConstructSignature: // Grammar checking - checkGrammarSignatureDeclaration(node) + checkGrammarSignatureDeclarationOrArrowFunction(node) return checkSignatureDeclaration(node); case SyntaxKind.IndexSignature: // Grammar checking @@ -9767,7 +9770,7 @@ module ts { } } - function checkGrammarTypeParameterList(signatureDecl: SignatureDeclaration, typeParameters: NodeArray): boolean { + function checkGrammarTypeParameterList(signatureDecl: SignatureDeclaration | Expression, typeParameters: NodeArray): boolean { if (checkGrammarForDisallowedTrailingComma(typeParameters)) { return true; } @@ -9818,9 +9821,9 @@ module ts { } } - function checkGrammarSignatureDeclaration(node: SignatureDeclaration) { - if (!checkGrammarTypeParameterList(node, node.typeParameters)) { - checkGrammarParameterList(node.parameters); + function checkGrammarSignatureDeclarationOrArrowFunction(node: SignatureDeclaration | FunctionExpression) { + if (!checkGrammarTypeParameterList(node, (node).typeParameters)) { + checkGrammarParameterList((node).parameters); } } diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index 268451c9775..f8d0fdfaa96 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -38,7 +38,7 @@ module ts { _0_modifier_cannot_appear_on_a_module_element: { code: 1044, category: DiagnosticCategory.Error, key: "'{0}' modifier cannot appear on a module element.", isEarly: true }, A_declare_modifier_cannot_be_used_with_an_interface_declaration: { code: 1045, category: DiagnosticCategory.Error, key: "A 'declare' modifier cannot be used with an interface declaration." }, A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file: { code: 1046, category: DiagnosticCategory.Error, key: "A 'declare' modifier is required for a top level declaration in a .d.ts file." }, - A_rest_parameter_cannot_be_optional: { code: 1047, category: DiagnosticCategory.Error, key: "A rest parameter cannot be optional." }, + A_rest_parameter_cannot_be_optional: { code: 1047, category: DiagnosticCategory.Error, key: "A rest parameter cannot be optional.", isEarly: true }, A_rest_parameter_cannot_have_an_initializer: { code: 1048, category: DiagnosticCategory.Error, key: "A rest parameter cannot have an initializer." }, A_set_accessor_must_have_exactly_one_parameter: { code: 1049, category: DiagnosticCategory.Error, key: "A 'set' accessor must have exactly one parameter." }, A_set_accessor_cannot_have_an_optional_parameter: { code: 1051, category: DiagnosticCategory.Error, key: "A 'set' accessor cannot have an optional parameter." }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 03fad9f5ace..f384157169e 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -166,7 +166,8 @@ }, "A rest parameter cannot be optional.": { "category": "Error", - "code": 1047 + "code": 1047, + "isEarly": true }, "A rest parameter cannot have an initializer.": { "category": "Error", diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index dfce57dba3a..d25a28f8b7f 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -4626,8 +4626,6 @@ module ts { function checkNode(node: Node, nodeKind: SyntaxKind): boolean { // Now do node specific checks. switch (nodeKind) { - case SyntaxKind.ArrowFunction: - return checkAnySignatureDeclaration(node); case SyntaxKind.BreakStatement: case SyntaxKind.ContinueStatement: return checkBreakOrContinueStatement(node); diff --git a/tests/baselines/reference/ArrowFunction2.errors.txt b/tests/baselines/reference/ArrowFunction2.errors.txt index 26e1f336cb6..3b9ba21f15a 100644 --- a/tests/baselines/reference/ArrowFunction2.errors.txt +++ b/tests/baselines/reference/ArrowFunction2.errors.txt @@ -1,12 +1,12 @@ -tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArrowFunctions/ArrowFunction2.ts(1,14): error TS1009: Trailing comma not allowed. tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArrowFunctions/ArrowFunction2.ts(1,13): error TS2304: Cannot find name 'b'. +tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArrowFunctions/ArrowFunction2.ts(1,14): error TS1009: Trailing comma not allowed. ==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArrowFunctions/ArrowFunction2.ts (2 errors) ==== var v = (a: b,) => { - ~ -!!! error TS1009: Trailing comma not allowed. ~ !!! error TS2304: Cannot find name 'b'. + ~ +!!! error TS1009: Trailing comma not allowed. }; \ No newline at end of file diff --git a/tests/baselines/reference/callSignatureWithOptionalParameterAndInitializer.errors.txt b/tests/baselines/reference/callSignatureWithOptionalParameterAndInitializer.errors.txt index ecb1c877296..eec5ea18afc 100644 --- a/tests/baselines/reference/callSignatureWithOptionalParameterAndInitializer.errors.txt +++ b/tests/baselines/reference/callSignatureWithOptionalParameterAndInitializer.errors.txt @@ -1,12 +1,11 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(3,14): error TS1015: Parameter cannot have question mark and initializer. tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(4,22): error TS1015: Parameter cannot have question mark and initializer. -tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(5,22): error TS1015: Parameter cannot have question mark and initializer. tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(15,9): error TS1015: Parameter cannot have question mark and initializer. tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(24,20): error TS1015: Parameter cannot have question mark and initializer. tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(35,9): error TS1015: Parameter cannot have question mark and initializer. tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(44,9): error TS1015: Parameter cannot have question mark and initializer. tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(45,32): error TS1015: Parameter cannot have question mark and initializer. -tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(46,9): error TS1015: Parameter cannot have question mark and initializer. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(5,22): error TS1015: Parameter cannot have question mark and initializer. tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(23,6): error TS1015: Parameter cannot have question mark and initializer. tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(23,6): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(24,20): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. @@ -14,6 +13,7 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWith tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(34,6): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(35,9): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(45,32): error TS2322: Type 'string' is not assignable to type 'number'. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(46,9): error TS1015: Parameter cannot have question mark and initializer. ==== tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts (16 errors) ==== diff --git a/tests/baselines/reference/fatarrowfunctionsOptionalArgsErrors4.errors.txt b/tests/baselines/reference/fatarrowfunctionsOptionalArgsErrors4.errors.txt index 8de0eb92a02..fe9df3c2fb3 100644 --- a/tests/baselines/reference/fatarrowfunctionsOptionalArgsErrors4.errors.txt +++ b/tests/baselines/reference/fatarrowfunctionsOptionalArgsErrors4.errors.txt @@ -3,9 +3,9 @@ tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors4.ts(2,15): error TS1015 tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors4.ts(3,21): error TS1015: Parameter cannot have question mark and initializer. tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors4.ts(4,7): error TS1015: Parameter cannot have question mark and initializer. tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors4.ts(4,39): error TS1015: Parameter cannot have question mark and initializer. +tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors4.ts(6,5): error TS2304: Cannot find name 'foo'. tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors4.ts(17,10): error TS1015: Parameter cannot have question mark and initializer. tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors4.ts(19,13): error TS1015: Parameter cannot have question mark and initializer. -tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors4.ts(6,5): error TS2304: Cannot find name 'foo'. ==== tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors4.ts (8 errors) ==== diff --git a/tests/baselines/reference/parserX_ArrowFunction2.errors.txt b/tests/baselines/reference/parserX_ArrowFunction2.errors.txt index e5b45cef1d0..20b4cb45e45 100644 --- a/tests/baselines/reference/parserX_ArrowFunction2.errors.txt +++ b/tests/baselines/reference/parserX_ArrowFunction2.errors.txt @@ -1,12 +1,12 @@ -tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArrowFunctions/parserX_ArrowFunction2.ts(1,14): error TS1009: Trailing comma not allowed. tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArrowFunctions/parserX_ArrowFunction2.ts(1,13): error TS2304: Cannot find name 'b'. +tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArrowFunctions/parserX_ArrowFunction2.ts(1,14): error TS1009: Trailing comma not allowed. ==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArrowFunctions/parserX_ArrowFunction2.ts (2 errors) ==== var v = (a: b,) => { - ~ -!!! error TS1009: Trailing comma not allowed. ~ !!! error TS2304: Cannot find name 'b'. + ~ +!!! error TS1009: Trailing comma not allowed. }; \ No newline at end of file diff --git a/tests/baselines/reference/restParameterWithoutAnnotationIsAnyArray.errors.txt b/tests/baselines/reference/restParameterWithoutAnnotationIsAnyArray.errors.txt index 0177f1e9a1c..6685d5fe69f 100644 --- a/tests/baselines/reference/restParameterWithoutAnnotationIsAnyArray.errors.txt +++ b/tests/baselines/reference/restParameterWithoutAnnotationIsAnyArray.errors.txt @@ -1,6 +1,6 @@ -tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParameterWithoutAnnotationIsAnyArray.ts(5,11): error TS1014: A rest parameter must be last in a parameter list. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParameterWithoutAnnotationIsAnyArray.ts(13,9): error TS1014: A rest parameter must be last in a parameter list. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParameterWithoutAnnotationIsAnyArray.ts(23,21): error TS1014: A rest parameter must be last in a parameter list. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParameterWithoutAnnotationIsAnyArray.ts(5,11): error TS1014: A rest parameter must be last in a parameter list. ==== tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParameterWithoutAnnotationIsAnyArray.ts (3 errors) ==== diff --git a/tests/baselines/reference/restParametersOfNonArrayTypes.errors.txt b/tests/baselines/reference/restParametersOfNonArrayTypes.errors.txt index 12cbd865d1c..df16e72ea79 100644 --- a/tests/baselines/reference/restParametersOfNonArrayTypes.errors.txt +++ b/tests/baselines/reference/restParametersOfNonArrayTypes.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes.ts(5,11): error TS1014: A rest parameter must be last in a parameter list. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes.ts(13,9): error TS1014: A rest parameter must be last in a parameter list. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes.ts(23,21): error TS1014: A rest parameter must be last in a parameter list. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes.ts(3,14): error TS2370: A rest parameter must be of an array type. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes.ts(4,22): error TS2370: A rest parameter must be of an array type. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes.ts(5,11): error TS1014: A rest parameter must be last in a parameter list. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes.ts(5,11): error TS2370: A rest parameter must be of an array type. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes.ts(5,23): error TS2370: A rest parameter must be of an array type. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes.ts(8,9): error TS2370: A rest parameter must be of an array type. diff --git a/tests/baselines/reference/restParametersOfNonArrayTypes2.errors.txt b/tests/baselines/reference/restParametersOfNonArrayTypes2.errors.txt index eef052e5cdf..b70c7fb467d 100644 --- a/tests/baselines/reference/restParametersOfNonArrayTypes2.errors.txt +++ b/tests/baselines/reference/restParametersOfNonArrayTypes2.errors.txt @@ -1,11 +1,10 @@ -tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(9,11): error TS1014: A rest parameter must be last in a parameter list. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(17,9): error TS1014: A rest parameter must be last in a parameter list. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(27,21): error TS1014: A rest parameter must be last in a parameter list. -tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(36,11): error TS1014: A rest parameter must be last in a parameter list. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(44,9): error TS1014: A rest parameter must be last in a parameter list. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(54,21): error TS1014: A rest parameter must be last in a parameter list. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(7,14): error TS2370: A rest parameter must be of an array type. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(8,22): error TS2370: A rest parameter must be of an array type. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(9,11): error TS1014: A rest parameter must be last in a parameter list. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(9,11): error TS2370: A rest parameter must be of an array type. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(9,26): error TS2370: A rest parameter must be of an array type. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(12,9): error TS2370: A rest parameter must be of an array type. @@ -20,6 +19,7 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfN tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(28,9): error TS2370: A rest parameter must be of an array type. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(34,15): error TS2370: A rest parameter must be of an array type. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(35,23): error TS2370: A rest parameter must be of an array type. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(36,11): error TS1014: A rest parameter must be last in a parameter list. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(36,11): error TS2370: A rest parameter must be of an array type. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(36,35): error TS2370: A rest parameter must be of an array type. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(39,9): error TS2370: A rest parameter must be of an array type. diff --git a/tests/baselines/reference/restParametersWithArrayTypeAnnotations.errors.txt b/tests/baselines/reference/restParametersWithArrayTypeAnnotations.errors.txt index 06b2caefb9d..05075fc6175 100644 --- a/tests/baselines/reference/restParametersWithArrayTypeAnnotations.errors.txt +++ b/tests/baselines/reference/restParametersWithArrayTypeAnnotations.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersWithArrayTypeAnnotations.ts(5,11): error TS1014: A rest parameter must be last in a parameter list. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersWithArrayTypeAnnotations.ts(13,9): error TS1014: A rest parameter must be last in a parameter list. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersWithArrayTypeAnnotations.ts(23,21): error TS1014: A rest parameter must be last in a parameter list. -tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersWithArrayTypeAnnotations.ts(32,11): error TS1014: A rest parameter must be last in a parameter list. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersWithArrayTypeAnnotations.ts(40,9): error TS1014: A rest parameter must be last in a parameter list. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersWithArrayTypeAnnotations.ts(50,21): error TS1014: A rest parameter must be last in a parameter list. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersWithArrayTypeAnnotations.ts(5,11): error TS1014: A rest parameter must be last in a parameter list. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersWithArrayTypeAnnotations.ts(32,11): error TS1014: A rest parameter must be last in a parameter list. ==== tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersWithArrayTypeAnnotations.ts (6 errors) ==== From b31981c6e98521ced0c42a4eef75312929d0f8e0 Mon Sep 17 00:00:00 2001 From: Yui T Date: Thu, 11 Dec 2014 11:35:51 -0800 Subject: [PATCH 13/78] Address code review --- src/compiler/checker.ts | 29 ++++++++++++++++------------- src/compiler/parser.ts | 1 - 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 7e749dfe07b..e5bd7828432 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -6397,6 +6397,11 @@ module ts { function checkFunctionExpressionOrObjectLiteralMethod(node: FunctionExpression | MethodDeclaration, contextualMapper?: TypeMapper): Type { Debug.assert(node.kind !== SyntaxKind.MethodDeclaration || isObjectLiteralMethod(node)); + // Grammar checking + if (node.kind === SyntaxKind.ArrowFunction) { + checkGrammarFunctionLikeDeclaration(node); + } + // The identityMapper object is used to indicate that function expressions are wildcards if (contextualMapper === identityMapper) { return anyFunctionType; @@ -6992,10 +6997,7 @@ module ts { case SyntaxKind.ParenthesizedExpression: return checkExpression((node).expression); case SyntaxKind.FunctionExpression: - return checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); case SyntaxKind.ArrowFunction: - // Grammar checking - checkGrammarSignatureDeclarationOrArrowFunction(node); return checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); case SyntaxKind.TypeOfExpression: return checkTypeOfExpression(node); @@ -7021,7 +7023,7 @@ module ts { function checkTypeParameter(node: TypeParameterDeclaration) { // Grammar Checking - if (node.expression) { + if (!checkGrammarModifiers(node) && node.expression) { grammarErrorOnFirstToken(node.expression, Diagnostics.Type_expected); } @@ -8758,7 +8760,7 @@ module ts { case SyntaxKind.CallSignature: case SyntaxKind.ConstructSignature: // Grammar checking - checkGrammarSignatureDeclarationOrArrowFunction(node) + checkGrammarFunctionLikeDeclaration(node) return checkSignatureDeclaration(node); case SyntaxKind.IndexSignature: // Grammar checking @@ -9643,7 +9645,7 @@ module ts { // GRAMMAR CHECKING - function checkModifiers(node: Node): boolean { + function checkGrammarModifiers(node: Node): boolean { switch (node.kind) { case SyntaxKind.GetAccessor: case SyntaxKind.SetAccessor: @@ -9770,14 +9772,14 @@ module ts { } } - function checkGrammarTypeParameterList(signatureDecl: SignatureDeclaration | Expression, typeParameters: NodeArray): boolean { + function checkGrammarTypeParameterList(node: FunctionLikeDeclaration, typeParameters: NodeArray): boolean { if (checkGrammarForDisallowedTrailingComma(typeParameters)) { return true; } if (typeParameters && typeParameters.length === 0) { var start = typeParameters.pos - "<".length; - var sourceFile = getSourceFileOfNode(signatureDecl); + var sourceFile = getSourceFileOfNode(node); var end = skipTrivia(sourceFile.text, typeParameters.end) + ">".length; return grammarErrorAtPos(sourceFile, start, end - start, Diagnostics.Type_parameter_list_cannot_be_empty); } @@ -9821,9 +9823,10 @@ module ts { } } - function checkGrammarSignatureDeclarationOrArrowFunction(node: SignatureDeclaration | FunctionExpression) { - if (!checkGrammarTypeParameterList(node, (node).typeParameters)) { - checkGrammarParameterList((node).parameters); + function checkGrammarFunctionLikeDeclaration(node: FunctionLikeDeclaration) { + var hasGrammarErrorFromCheckModifierOrTypeParameterList = checkGrammarModifiers(node) ? true : checkGrammarTypeParameterList(node, node.typeParameters); + if (!hasGrammarErrorFromCheckModifierOrTypeParameterList) { + checkGrammarParameterList(node.parameters); } } @@ -9867,8 +9870,8 @@ module ts { } function checkGrammarIndexSignature(node: SignatureDeclaration) { - var hasErrorFromCheckModifiersOrParameters = checkModifiers(node) ? true: checkGrammarIndexSignatureParameters(node); - if (!hasErrorFromCheckModifiersOrParameters) { + var hasGrammarErrorFromCheckModifiersOrParameters = checkGrammarModifiers(node) ? true: checkGrammarIndexSignatureParameters(node); + if (!hasGrammarErrorFromCheckModifiersOrParameters) { checkGrammarForIndexSignatureModifier(node); } } diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index d25a28f8b7f..7e6d8c7a226 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -4672,7 +4672,6 @@ module ts { case SyntaxKind.SwitchStatement: return checkSwitchStatement(node); case SyntaxKind.TaggedTemplateExpression: return checkTaggedTemplateExpression(node); case SyntaxKind.ThrowStatement: return checkThrowStatement(node); - //case SyntaxKind.TupleType: return checkTupleType(node); case SyntaxKind.TypeReference: return checkTypeReference(node); case SyntaxKind.VariableDeclaration: return checkVariableDeclaration(node); case SyntaxKind.VariableStatement: return checkVariableStatement(node); From 969824439151320c536e2125c2b4d841fe171beb Mon Sep 17 00:00:00 2001 From: Yui T Date: Thu, 11 Dec 2014 12:06:21 -0800 Subject: [PATCH 14/78] Move grammar checking: callExpression, newExpression --- src/compiler/checker.ts | 37 +++++++++++++++++++ .../diagnosticInformationMap.generated.ts | 2 +- src/compiler/diagnosticMessages.json | 3 +- src/compiler/parser.ts | 6 +-- 4 files changed, 43 insertions(+), 5 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index e5bd7828432..c293bebd745 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -6248,6 +6248,12 @@ module ts { } function checkCallExpression(node: CallExpression): Type { + // Grammar checking + var hasGrammarErrorFromCheckModifierOrTypeArguments = checkGrammarModifiers(node) ? true : checkGrammarTypeArguments(node, node.typeArguments); + if (!hasGrammarErrorFromCheckModifierOrTypeArguments) { + checkGrammarArguments(node, node.arguments); + } + var signature = getResolvedSignature(node); if (node.expression.kind === SyntaxKind.SuperKeyword) { return voidType; @@ -9876,6 +9882,37 @@ module ts { } } + function checkGrammarForAtLeastOneTypeArgument(node: CallExpression, typeArguments: NodeArray): boolean { + if (typeArguments && typeArguments.length === 0) { + var sourceFile = getSourceFileOfNode(node); + var start = typeArguments.pos - "<".length; + var end = skipTrivia(sourceFile.text, typeArguments.end) + ">".length; + return grammarErrorAtPos(sourceFile, start, end - start, Diagnostics.Type_argument_list_cannot_be_empty); + } + } + + function checkGrammarTypeArguments(node: CallExpression, typeArguments: NodeArray): boolean { + return checkGrammarForDisallowedTrailingComma(typeArguments) || + checkGrammarForAtLeastOneTypeArgument(node, typeArguments); + } + + function checkGrammarForOmittedArgument(node: CallExpression, arguments: NodeArray): boolean { + if (arguments) { + var sourceFile = getSourceFileOfNode(node); + for (var i = 0, n = arguments.length; i < n; i++) { + var arg = arguments[i]; + if (arg.kind === SyntaxKind.OmittedExpression) { + return grammarErrorAtPos(sourceFile, arg.pos, 0, Diagnostics.Argument_expression_expected); + } + } + } + } + + function checkGrammarArguments(node: CallExpression, arguments: NodeArray): boolean { + return checkGrammarForDisallowedTrailingComma(arguments) || + checkGrammarForOmittedArgument(node, arguments); + } + function hasParseDiagnostics(sourceFile: SourceFile): boolean { return sourceFile.parseDiagnostics.length > 0; } diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index f8d0fdfaa96..c9977d2cc1e 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -64,7 +64,7 @@ module ts { An_index_signature_must_have_exactly_one_parameter: { code: 1096, category: DiagnosticCategory.Error, key: "An index signature must have exactly one parameter.", isEarly: true }, _0_list_cannot_be_empty: { code: 1097, category: DiagnosticCategory.Error, key: "'{0}' list cannot be empty.", isEarly: true }, Type_parameter_list_cannot_be_empty: { code: 1098, category: DiagnosticCategory.Error, key: "Type parameter list cannot be empty.", isEarly: true }, - Type_argument_list_cannot_be_empty: { code: 1099, category: DiagnosticCategory.Error, key: "Type argument list cannot be empty." }, + Type_argument_list_cannot_be_empty: { code: 1099, category: DiagnosticCategory.Error, key: "Type argument list cannot be empty.", isEarly: true }, Invalid_use_of_0_in_strict_mode: { code: 1100, category: DiagnosticCategory.Error, key: "Invalid use of '{0}' in strict mode.", isEarly: true }, with_statements_are_not_allowed_in_strict_mode: { code: 1101, category: DiagnosticCategory.Error, key: "'with' statements are not allowed in strict mode.", isEarly: true }, delete_cannot_be_called_on_an_identifier_in_strict_mode: { code: 1102, category: DiagnosticCategory.Error, key: "'delete' cannot be called on an identifier in strict mode.", isEarly: true }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index f384157169e..7caf3619cea 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -287,7 +287,8 @@ }, "Type argument list cannot be empty.": { "category": "Error", - "code": 1099 + "code": 1099, + "isEarly": true }, "Invalid use of '{0}' in strict mode.": { "category": "Error", diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 7e6d8c7a226..a07b9856d70 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -4629,9 +4629,9 @@ module ts { case SyntaxKind.BreakStatement: case SyntaxKind.ContinueStatement: return checkBreakOrContinueStatement(node); - case SyntaxKind.CallExpression: - case SyntaxKind.NewExpression: - return checkCallOrNewExpression(node); + //case SyntaxKind.CallExpression: + //case SyntaxKind.NewExpression: + //return checkCallOrNewExpression(node); case SyntaxKind.EnumDeclaration: return checkEnumDeclaration(node); case SyntaxKind.BinaryExpression: return checkBinaryExpression(node); From 907d1d001b0dfd128e8787b6ee7a13a75df750c6 Mon Sep 17 00:00:00 2001 From: Yui T Date: Thu, 11 Dec 2014 12:06:21 -0800 Subject: [PATCH 15/78] Move grammar checking: callExpression, newExpression --- src/compiler/checker.ts | 37 +++++++++++++++++++ .../diagnosticInformationMap.generated.ts | 2 +- src/compiler/diagnosticMessages.json | 3 +- src/compiler/parser.ts | 6 +-- .../emptyTypeArgumentList.errors.txt | 8 ++-- .../emptyTypeArgumentListWithNew.errors.txt | 8 ++-- .../reference/missingArgument1.errors.txt | 6 +-- ...rserErrorRecovery_ArgumentList5.errors.txt | 6 +-- ...trailingSeparatorInFunctionCall.errors.txt | 14 +++---- 9 files changed, 64 insertions(+), 26 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index e5bd7828432..c293bebd745 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -6248,6 +6248,12 @@ module ts { } function checkCallExpression(node: CallExpression): Type { + // Grammar checking + var hasGrammarErrorFromCheckModifierOrTypeArguments = checkGrammarModifiers(node) ? true : checkGrammarTypeArguments(node, node.typeArguments); + if (!hasGrammarErrorFromCheckModifierOrTypeArguments) { + checkGrammarArguments(node, node.arguments); + } + var signature = getResolvedSignature(node); if (node.expression.kind === SyntaxKind.SuperKeyword) { return voidType; @@ -9876,6 +9882,37 @@ module ts { } } + function checkGrammarForAtLeastOneTypeArgument(node: CallExpression, typeArguments: NodeArray): boolean { + if (typeArguments && typeArguments.length === 0) { + var sourceFile = getSourceFileOfNode(node); + var start = typeArguments.pos - "<".length; + var end = skipTrivia(sourceFile.text, typeArguments.end) + ">".length; + return grammarErrorAtPos(sourceFile, start, end - start, Diagnostics.Type_argument_list_cannot_be_empty); + } + } + + function checkGrammarTypeArguments(node: CallExpression, typeArguments: NodeArray): boolean { + return checkGrammarForDisallowedTrailingComma(typeArguments) || + checkGrammarForAtLeastOneTypeArgument(node, typeArguments); + } + + function checkGrammarForOmittedArgument(node: CallExpression, arguments: NodeArray): boolean { + if (arguments) { + var sourceFile = getSourceFileOfNode(node); + for (var i = 0, n = arguments.length; i < n; i++) { + var arg = arguments[i]; + if (arg.kind === SyntaxKind.OmittedExpression) { + return grammarErrorAtPos(sourceFile, arg.pos, 0, Diagnostics.Argument_expression_expected); + } + } + } + } + + function checkGrammarArguments(node: CallExpression, arguments: NodeArray): boolean { + return checkGrammarForDisallowedTrailingComma(arguments) || + checkGrammarForOmittedArgument(node, arguments); + } + function hasParseDiagnostics(sourceFile: SourceFile): boolean { return sourceFile.parseDiagnostics.length > 0; } diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index f8d0fdfaa96..c9977d2cc1e 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -64,7 +64,7 @@ module ts { An_index_signature_must_have_exactly_one_parameter: { code: 1096, category: DiagnosticCategory.Error, key: "An index signature must have exactly one parameter.", isEarly: true }, _0_list_cannot_be_empty: { code: 1097, category: DiagnosticCategory.Error, key: "'{0}' list cannot be empty.", isEarly: true }, Type_parameter_list_cannot_be_empty: { code: 1098, category: DiagnosticCategory.Error, key: "Type parameter list cannot be empty.", isEarly: true }, - Type_argument_list_cannot_be_empty: { code: 1099, category: DiagnosticCategory.Error, key: "Type argument list cannot be empty." }, + Type_argument_list_cannot_be_empty: { code: 1099, category: DiagnosticCategory.Error, key: "Type argument list cannot be empty.", isEarly: true }, Invalid_use_of_0_in_strict_mode: { code: 1100, category: DiagnosticCategory.Error, key: "Invalid use of '{0}' in strict mode.", isEarly: true }, with_statements_are_not_allowed_in_strict_mode: { code: 1101, category: DiagnosticCategory.Error, key: "'with' statements are not allowed in strict mode.", isEarly: true }, delete_cannot_be_called_on_an_identifier_in_strict_mode: { code: 1102, category: DiagnosticCategory.Error, key: "'delete' cannot be called on an identifier in strict mode.", isEarly: true }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index f384157169e..7caf3619cea 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -287,7 +287,8 @@ }, "Type argument list cannot be empty.": { "category": "Error", - "code": 1099 + "code": 1099, + "isEarly": true }, "Invalid use of '{0}' in strict mode.": { "category": "Error", diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 7e6d8c7a226..a07b9856d70 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -4629,9 +4629,9 @@ module ts { case SyntaxKind.BreakStatement: case SyntaxKind.ContinueStatement: return checkBreakOrContinueStatement(node); - case SyntaxKind.CallExpression: - case SyntaxKind.NewExpression: - return checkCallOrNewExpression(node); + //case SyntaxKind.CallExpression: + //case SyntaxKind.NewExpression: + //return checkCallOrNewExpression(node); case SyntaxKind.EnumDeclaration: return checkEnumDeclaration(node); case SyntaxKind.BinaryExpression: return checkBinaryExpression(node); diff --git a/tests/baselines/reference/emptyTypeArgumentList.errors.txt b/tests/baselines/reference/emptyTypeArgumentList.errors.txt index 51efea14cb1..9f252b127a1 100644 --- a/tests/baselines/reference/emptyTypeArgumentList.errors.txt +++ b/tests/baselines/reference/emptyTypeArgumentList.errors.txt @@ -1,11 +1,11 @@ -tests/cases/compiler/emptyTypeArgumentList.ts(2,4): error TS1099: Type argument list cannot be empty. tests/cases/compiler/emptyTypeArgumentList.ts(2,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/emptyTypeArgumentList.ts(2,4): error TS1099: Type argument list cannot be empty. ==== tests/cases/compiler/emptyTypeArgumentList.ts (2 errors) ==== function foo() { } foo<>(); - ~~ -!!! error TS1099: Type argument list cannot be empty. ~~~~~~~ -!!! error TS2346: Supplied parameters do not match any signature of call target. \ No newline at end of file +!!! error TS2346: Supplied parameters do not match any signature of call target. + ~~ +!!! error TS1099: Type argument list cannot be empty. \ No newline at end of file diff --git a/tests/baselines/reference/emptyTypeArgumentListWithNew.errors.txt b/tests/baselines/reference/emptyTypeArgumentListWithNew.errors.txt index 538d0abb264..799e35d0d47 100644 --- a/tests/baselines/reference/emptyTypeArgumentListWithNew.errors.txt +++ b/tests/baselines/reference/emptyTypeArgumentListWithNew.errors.txt @@ -1,11 +1,11 @@ -tests/cases/compiler/emptyTypeArgumentListWithNew.ts(2,8): error TS1099: Type argument list cannot be empty. tests/cases/compiler/emptyTypeArgumentListWithNew.ts(2,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/emptyTypeArgumentListWithNew.ts(2,8): error TS1099: Type argument list cannot be empty. ==== tests/cases/compiler/emptyTypeArgumentListWithNew.ts (2 errors) ==== class foo { } new foo<>(); - ~~ -!!! error TS1099: Type argument list cannot be empty. ~~~~~~~~~~~ -!!! error TS2346: Supplied parameters do not match any signature of call target. \ No newline at end of file +!!! error TS2346: Supplied parameters do not match any signature of call target. + ~~ +!!! error TS1099: Type argument list cannot be empty. \ No newline at end of file diff --git a/tests/baselines/reference/missingArgument1.errors.txt b/tests/baselines/reference/missingArgument1.errors.txt index 02911e3c9b5..ba2bb0892f2 100644 --- a/tests/baselines/reference/missingArgument1.errors.txt +++ b/tests/baselines/reference/missingArgument1.errors.txt @@ -1,16 +1,16 @@ -tests/cases/compiler/missingArgument1.ts(1,7): error TS1135: Argument expression expected. tests/cases/compiler/missingArgument1.ts(1,1): error TS2304: Cannot find name 'foo'. tests/cases/compiler/missingArgument1.ts(1,5): error TS2304: Cannot find name 'a'. +tests/cases/compiler/missingArgument1.ts(1,7): error TS1135: Argument expression expected. tests/cases/compiler/missingArgument1.ts(1,8): error TS2304: Cannot find name 'b'. ==== tests/cases/compiler/missingArgument1.ts (4 errors) ==== foo(a,,b); - -!!! error TS1135: Argument expression expected. ~~~ !!! error TS2304: Cannot find name 'foo'. ~ !!! error TS2304: Cannot find name 'a'. + +!!! error TS1135: Argument expression expected. ~ !!! error TS2304: Cannot find name 'b'. \ No newline at end of file diff --git a/tests/baselines/reference/parserErrorRecovery_ArgumentList5.errors.txt b/tests/baselines/reference/parserErrorRecovery_ArgumentList5.errors.txt index 7188df192b8..5113807faa8 100644 --- a/tests/baselines/reference/parserErrorRecovery_ArgumentList5.errors.txt +++ b/tests/baselines/reference/parserErrorRecovery_ArgumentList5.errors.txt @@ -1,16 +1,16 @@ -tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArgumentLists/parserErrorRecovery_ArgumentList5.ts(2,9): error TS1009: Trailing comma not allowed. tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArgumentLists/parserErrorRecovery_ArgumentList5.ts(2,4): error TS2304: Cannot find name 'bar'. tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArgumentLists/parserErrorRecovery_ArgumentList5.ts(2,8): error TS2304: Cannot find name 'a'. +tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArgumentLists/parserErrorRecovery_ArgumentList5.ts(2,9): error TS1009: Trailing comma not allowed. ==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArgumentLists/parserErrorRecovery_ArgumentList5.ts (3 errors) ==== function foo() { bar(a,) - ~ -!!! error TS1009: Trailing comma not allowed. ~~~ !!! error TS2304: Cannot find name 'bar'. ~ !!! error TS2304: Cannot find name 'a'. + ~ +!!! error TS1009: Trailing comma not allowed. return; } \ No newline at end of file diff --git a/tests/baselines/reference/trailingSeparatorInFunctionCall.errors.txt b/tests/baselines/reference/trailingSeparatorInFunctionCall.errors.txt index 986f2dedf6e..76e09a1a4de 100644 --- a/tests/baselines/reference/trailingSeparatorInFunctionCall.errors.txt +++ b/tests/baselines/reference/trailingSeparatorInFunctionCall.errors.txt @@ -1,7 +1,7 @@ -tests/cases/compiler/trailingSeparatorInFunctionCall.ts(4,7): error TS1009: Trailing comma not allowed. -tests/cases/compiler/trailingSeparatorInFunctionCall.ts(9,8): error TS1009: Trailing comma not allowed. tests/cases/compiler/trailingSeparatorInFunctionCall.ts(4,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/trailingSeparatorInFunctionCall.ts(4,7): error TS1009: Trailing comma not allowed. tests/cases/compiler/trailingSeparatorInFunctionCall.ts(9,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/trailingSeparatorInFunctionCall.ts(9,8): error TS1009: Trailing comma not allowed. ==== tests/cases/compiler/trailingSeparatorInFunctionCall.ts (4 errors) ==== @@ -9,16 +9,16 @@ tests/cases/compiler/trailingSeparatorInFunctionCall.ts(9,1): error TS2346: Supp } f(1, 2, ); - ~ -!!! error TS1009: Trailing comma not allowed. ~~~~~~~~~ !!! error TS2346: Supplied parameters do not match any signature of call target. + ~ +!!! error TS1009: Trailing comma not allowed. function f2(x: T, y: T) { } f2(1, 2, ); - ~ -!!! error TS1009: Trailing comma not allowed. ~~~~~~~~~~ -!!! error TS2346: Supplied parameters do not match any signature of call target. \ No newline at end of file +!!! error TS2346: Supplied parameters do not match any signature of call target. + ~ +!!! error TS1009: Trailing comma not allowed. \ No newline at end of file From c23b6a66e22170dfcfd0351fc788e0a2bdad3ecd Mon Sep 17 00:00:00 2001 From: Yui T Date: Thu, 11 Dec 2014 12:55:27 -0800 Subject: [PATCH 16/78] Address code review: move checkGrammarAnySignature into checkSignatureDeclaration --- src/compiler/checker.ts | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index c293bebd745..0e47a56501b 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -6405,7 +6405,7 @@ module ts { // Grammar checking if (node.kind === SyntaxKind.ArrowFunction) { - checkGrammarFunctionLikeDeclaration(node); + checkGrammarAnySignatureDeclaration(node); } // The identityMapper object is used to indicate that function expressions are wildcards @@ -7058,6 +7058,16 @@ module ts { } function checkSignatureDeclaration(node: SignatureDeclaration) { + // Grammar checking + if (node.kind === SyntaxKind.IndexSignature) { + checkGrammarIndexSignature(node); + } + // TODO (yuisu): Remove this check in else-if when SyntaxKind.Construct is moved and ambient context is handled + else if (node.kind === SyntaxKind.FunctionType || node.kind === SyntaxKind.ConstructorType || + node.kind === SyntaxKind.CallSignature || node.kind === SyntaxKind.ConstructSignature){ + checkGrammarAnySignatureDeclaration(node); + } + checkTypeParameters(node.typeParameters); forEach(node.parameters, checkParameter); if (node.type) { @@ -8765,12 +8775,8 @@ module ts { case SyntaxKind.ConstructorType: case SyntaxKind.CallSignature: case SyntaxKind.ConstructSignature: - // Grammar checking - checkGrammarFunctionLikeDeclaration(node) return checkSignatureDeclaration(node); case SyntaxKind.IndexSignature: - // Grammar checking - checkGrammarIndexSignature(node); return checkSignatureDeclaration(node); case SyntaxKind.MethodDeclaration: case SyntaxKind.MethodSignature: @@ -9829,7 +9835,7 @@ module ts { } } - function checkGrammarFunctionLikeDeclaration(node: FunctionLikeDeclaration) { + function checkGrammarAnySignatureDeclaration(node: FunctionLikeDeclaration) { var hasGrammarErrorFromCheckModifierOrTypeParameterList = checkGrammarModifiers(node) ? true : checkGrammarTypeParameterList(node, node.typeParameters); if (!hasGrammarErrorFromCheckModifierOrTypeParameterList) { checkGrammarParameterList(node.parameters); From d8621069c1dc7823e18306ee6808e30db92c7933 Mon Sep 17 00:00:00 2001 From: Yui T Date: Thu, 11 Dec 2014 12:55:27 -0800 Subject: [PATCH 17/78] Address code review: move checkGrammarAnySignature into checkSignatureDeclaration --- src/compiler/checker.ts | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index c293bebd745..8e89eb51343 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -6248,11 +6248,8 @@ module ts { } function checkCallExpression(node: CallExpression): Type { - // Grammar checking - var hasGrammarErrorFromCheckModifierOrTypeArguments = checkGrammarModifiers(node) ? true : checkGrammarTypeArguments(node, node.typeArguments); - if (!hasGrammarErrorFromCheckModifierOrTypeArguments) { - checkGrammarArguments(node, node.arguments); - } + // Grammar checking; stop grammar-checking if checkGrammarTypeArguments return true + checkGrammarTypeArguments(node, node.typeArguments) || checkGrammarArguments(node, node.arguments); var signature = getResolvedSignature(node); if (node.expression.kind === SyntaxKind.SuperKeyword) { @@ -6405,7 +6402,7 @@ module ts { // Grammar checking if (node.kind === SyntaxKind.ArrowFunction) { - checkGrammarFunctionLikeDeclaration(node); + checkGrammarAnySignatureDeclaration(node); } // The identityMapper object is used to indicate that function expressions are wildcards @@ -7058,6 +7055,16 @@ module ts { } function checkSignatureDeclaration(node: SignatureDeclaration) { + // Grammar checking + if (node.kind === SyntaxKind.IndexSignature) { + checkGrammarIndexSignature(node); + } + // TODO (yuisu): Remove this check in else-if when SyntaxKind.Construct is moved and ambient context is handled + else if (node.kind === SyntaxKind.FunctionType || node.kind === SyntaxKind.ConstructorType || + node.kind === SyntaxKind.CallSignature || node.kind === SyntaxKind.ConstructSignature){ + checkGrammarAnySignatureDeclaration(node); + } + checkTypeParameters(node.typeParameters); forEach(node.parameters, checkParameter); if (node.type) { @@ -8765,12 +8772,8 @@ module ts { case SyntaxKind.ConstructorType: case SyntaxKind.CallSignature: case SyntaxKind.ConstructSignature: - // Grammar checking - checkGrammarFunctionLikeDeclaration(node) return checkSignatureDeclaration(node); case SyntaxKind.IndexSignature: - // Grammar checking - checkGrammarIndexSignature(node); return checkSignatureDeclaration(node); case SyntaxKind.MethodDeclaration: case SyntaxKind.MethodSignature: @@ -9829,11 +9832,9 @@ module ts { } } - function checkGrammarFunctionLikeDeclaration(node: FunctionLikeDeclaration) { - var hasGrammarErrorFromCheckModifierOrTypeParameterList = checkGrammarModifiers(node) ? true : checkGrammarTypeParameterList(node, node.typeParameters); - if (!hasGrammarErrorFromCheckModifierOrTypeParameterList) { - checkGrammarParameterList(node.parameters); - } + function checkGrammarAnySignatureDeclaration(node: FunctionLikeDeclaration) { + // Prevent cascading error by short-circuit + checkGrammarModifiers(node) || checkGrammarTypeParameterList(node, node.typeParameters) || checkGrammarParameterList(node.parameters); } function checkGrammarIndexSignatureParameters(node: SignatureDeclaration): boolean { @@ -9876,10 +9877,8 @@ module ts { } function checkGrammarIndexSignature(node: SignatureDeclaration) { - var hasGrammarErrorFromCheckModifiersOrParameters = checkGrammarModifiers(node) ? true: checkGrammarIndexSignatureParameters(node); - if (!hasGrammarErrorFromCheckModifiersOrParameters) { - checkGrammarForIndexSignatureModifier(node); - } + // Prevent cascading error by short-circuit + checkGrammarModifiers(node) || checkGrammarIndexSignatureParameters(node) || checkGrammarForIndexSignatureModifier(node); } function checkGrammarForAtLeastOneTypeArgument(node: CallExpression, typeArguments: NodeArray): boolean { From 0d99f1afd5fb36ab62d288bbe333c704c9badc2e Mon Sep 17 00:00:00 2001 From: Yui T Date: Thu, 11 Dec 2014 14:09:49 -0800 Subject: [PATCH 18/78] Move grammar checking: binaryExpression --- src/compiler/checker.ts | 20 ++++++++++++++++++++ src/compiler/parser.ts | 8 ++++---- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 8e89eb51343..c1fe11dc638 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -6710,6 +6710,19 @@ module ts { } function checkBinaryExpression(node: BinaryExpression, contextualMapper?: TypeMapper) { + // Grammar checking + if (!checkGrammarModifiers(node)) { + if (node.parserContextFlags & ParserContextFlags.StrictMode) { + if (isLeftHandSideExpression(node.left) && isAssignmentOperator(node.operator)) { + if (isEvalOrArgumentsIdentifier(node.left)) { + // ECMA 262 (Annex C) The identifier eval or arguments may not appear as the LeftHandSideExpression of an + // Assignment operator(11.13) or of a PostfixExpression(11.3) + reportGrammarErrorOfInvalidUseInStrictMode(node.left); + } + } + } + } + var operator = node.operator; if (operator === SyntaxKind.EqualsToken && (node.left.kind === SyntaxKind.ObjectLiteralExpression || node.left.kind === SyntaxKind.ArrayLiteralExpression)) { return checkDestructuringAssignment(node.left, checkExpression(node.right, contextualMapper), contextualMapper); @@ -9950,6 +9963,13 @@ module ts { } } + function reportGrammarErrorOfInvalidUseInStrictMode(node: Identifier): boolean { + // declarationNameToString cannot be used here since it uses a backreference to 'parent' that is not yet set + var sourceText = getSourceFileOfNode(node).text; + var name = sourceText.substring(skipTrivia(sourceText, node.pos), node.end); + return grammarErrorOnNode(node, Diagnostics.Invalid_use_of_0_in_strict_mode, name); + } + initializeTypeChecker(); return checker; diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index a07b9856d70..c1ebc5abd4e 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -178,7 +178,7 @@ module ts { return node.kind === SyntaxKind.ExpressionStatement && (node).expression.kind === SyntaxKind.StringLiteral; } - function isEvalOrArgumentsIdentifier(node: Node): boolean { + export function isEvalOrArgumentsIdentifier(node: Node): boolean { return node.kind === SyntaxKind.Identifier && (node).text && ((node).text === "eval" || (node).text === "arguments"); @@ -4533,7 +4533,7 @@ module ts { } } - function isLeftHandSideExpression(expr: Expression): boolean { + export function isLeftHandSideExpression(expr: Expression): boolean { if (expr) { switch (expr.kind) { case SyntaxKind.PropertyAccessExpression: @@ -4563,7 +4563,7 @@ module ts { return false; } - function isAssignmentOperator(token: SyntaxKind): boolean { + export function isAssignmentOperator(token: SyntaxKind): boolean { return token >= SyntaxKind.FirstAssignment && token <= SyntaxKind.LastAssignment; } @@ -4634,7 +4634,7 @@ module ts { //return checkCallOrNewExpression(node); case SyntaxKind.EnumDeclaration: return checkEnumDeclaration(node); - case SyntaxKind.BinaryExpression: return checkBinaryExpression(node); + //case SyntaxKind.BinaryExpression: return checkBinaryExpression(node); case SyntaxKind.BindingElement: return checkBindingElement(node); case SyntaxKind.CatchClause: return checkCatchClause(node); case SyntaxKind.ClassDeclaration: return checkClassDeclaration(node); From b34a453cd4b4ec063f35ba7b9d3faea82d94d54e Mon Sep 17 00:00:00 2001 From: Yui T Date: Thu, 11 Dec 2014 14:35:55 -0800 Subject: [PATCH 19/78] Move grammar checking: bindingElement --- src/compiler/checker.ts | 16 +++++++++++++++- src/compiler/parser.ts | 2 +- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index c1fe11dc638..1cff181c76c 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -7895,6 +7895,12 @@ module ts { // Check variable, parameter, or property declaration function checkVariableLikeDeclaration(node: VariableLikeDeclaration) { + // Grammar checking + // TODO (yuisu) : Revisit this check once move all grammar checking + if (node.kind === SyntaxKind.BindingElement) { + checkGrammarBindingElement(node); + } + checkSourceElement(node.type); // For a computed property, just check the initializer and exit if (hasComputedNameButNotSymbol(node)) { @@ -9761,7 +9767,7 @@ module ts { break; case SyntaxKind.DeclareKeyword: - // TODO (yuisu) : Bring back the parser grammar checking + // TODO (yuisu) : Revisit this once moving ambient Context into type checking break; } } @@ -9925,6 +9931,14 @@ module ts { checkGrammarForOmittedArgument(node, arguments); } + function checkGrammarBindingElement(node: BindingElement) { + if (!checkGrammarModifiers(node) && (node.parserContextFlags & ParserContextFlags.StrictMode && isEvalOrArgumentsIdentifier(node.name))) { + // It is a SyntaxError if a VariableDeclaration or VariableDeclarationNoIn occurs within strict code + // and its Identifier is eval or arguments + reportGrammarErrorOfInvalidUseInStrictMode(node.name); + } + } + function hasParseDiagnostics(sourceFile: SourceFile): boolean { return sourceFile.parseDiagnostics.length > 0; } diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index c1ebc5abd4e..5d3ac16d7ab 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -4635,7 +4635,7 @@ module ts { case SyntaxKind.EnumDeclaration: return checkEnumDeclaration(node); //case SyntaxKind.BinaryExpression: return checkBinaryExpression(node); - case SyntaxKind.BindingElement: return checkBindingElement(node); + //case SyntaxKind.BindingElement: return checkBindingElement(node); case SyntaxKind.CatchClause: return checkCatchClause(node); case SyntaxKind.ClassDeclaration: return checkClassDeclaration(node); case SyntaxKind.ComputedPropertyName: return checkComputedPropertyName(node); From f13308be31254e48611df64668b3c044a003cf3c Mon Sep 17 00:00:00 2001 From: Yui T Date: Thu, 11 Dec 2014 14:53:30 -0800 Subject: [PATCH 20/78] Move grammar checking: catchCaluse --- src/compiler/checker.ts | 19 ++++++++++++++++++- src/compiler/parser.ts | 2 +- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 1cff181c76c..97ea6c1fba4 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -8095,7 +8095,11 @@ module ts { function checkTryStatement(node: TryStatement) { checkBlock(node.tryBlock); - if (node.catchClause) checkBlock(node.catchClause.block); + if (node.catchClause) { + // Grammar checking + checkGrammarCatchClause(node.catchClause); + checkBlock(node.catchClause.block); + } if (node.finallyBlock) checkBlock(node.finallyBlock); } @@ -9939,6 +9943,19 @@ module ts { } } + function checkGrammarCatchClause(node: CatchClause) { + if (node.type) { + var sourceFile = getSourceFileOfNode(node); + var colonStart = skipTrivia(sourceFile.text, node.name.end); + grammarErrorAtPos(sourceFile, colonStart, ":".length, Diagnostics.Catch_clause_parameter_cannot_have_a_type_annotation); + } + if (node.parserContextFlags & ParserContextFlags.StrictMode && isEvalOrArgumentsIdentifier(node.name)) { + // It is a SyntaxError if a TryStatement with a Catch occurs within strict code and the Identifier of the + // Catch production is eval or arguments + reportGrammarErrorOfInvalidUseInStrictMode(node.name); + } + } + function hasParseDiagnostics(sourceFile: SourceFile): boolean { return sourceFile.parseDiagnostics.length > 0; } diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 5d3ac16d7ab..f1edf8911bd 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -4636,7 +4636,7 @@ module ts { case SyntaxKind.EnumDeclaration: return checkEnumDeclaration(node); //case SyntaxKind.BinaryExpression: return checkBinaryExpression(node); //case SyntaxKind.BindingElement: return checkBindingElement(node); - case SyntaxKind.CatchClause: return checkCatchClause(node); + //case SyntaxKind.CatchClause: return checkCatchClause(node); case SyntaxKind.ClassDeclaration: return checkClassDeclaration(node); case SyntaxKind.ComputedPropertyName: return checkComputedPropertyName(node); case SyntaxKind.Constructor: return checkConstructor(node); From 414a4a22950cb6c3b3a7bfd324c6230e710c4bc9 Mon Sep 17 00:00:00 2001 From: Yui T Date: Thu, 11 Dec 2014 15:38:24 -0800 Subject: [PATCH 21/78] Address code review --- src/compiler/checker.ts | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 97ea6c1fba4..67057d1a215 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -6402,7 +6402,7 @@ module ts { // Grammar checking if (node.kind === SyntaxKind.ArrowFunction) { - checkGrammarAnySignatureDeclaration(node); + checkGrammarFunctionLikeDeclaration(node); } // The identityMapper object is used to indicate that function expressions are wildcards @@ -6711,14 +6711,12 @@ module ts { function checkBinaryExpression(node: BinaryExpression, contextualMapper?: TypeMapper) { // Grammar checking - if (!checkGrammarModifiers(node)) { - if (node.parserContextFlags & ParserContextFlags.StrictMode) { - if (isLeftHandSideExpression(node.left) && isAssignmentOperator(node.operator)) { - if (isEvalOrArgumentsIdentifier(node.left)) { - // ECMA 262 (Annex C) The identifier eval or arguments may not appear as the LeftHandSideExpression of an - // Assignment operator(11.13) or of a PostfixExpression(11.3) - reportGrammarErrorOfInvalidUseInStrictMode(node.left); - } + if (node.parserContextFlags & ParserContextFlags.StrictMode) { + if (isLeftHandSideExpression(node.left) && isAssignmentOperator(node.operator)) { + if (isEvalOrArgumentsIdentifier(node.left)) { + // ECMA 262 (Annex C) The identifier eval or arguments may not appear as the LeftHandSideExpression of an + // Assignment operator(11.13) or of a PostfixExpression(11.3) + reportGrammarErrorOfInvalidUseInStrictMode(node.left); } } } @@ -7039,7 +7037,7 @@ module ts { function checkTypeParameter(node: TypeParameterDeclaration) { // Grammar Checking - if (!checkGrammarModifiers(node) && node.expression) { + if (node.expression) { grammarErrorOnFirstToken(node.expression, Diagnostics.Type_expected); } @@ -7075,7 +7073,7 @@ module ts { // TODO (yuisu): Remove this check in else-if when SyntaxKind.Construct is moved and ambient context is handled else if (node.kind === SyntaxKind.FunctionType || node.kind === SyntaxKind.ConstructorType || node.kind === SyntaxKind.CallSignature || node.kind === SyntaxKind.ConstructSignature){ - checkGrammarAnySignatureDeclaration(node); + checkGrammarFunctionLikeDeclaration(node); } checkTypeParameters(node.typeParameters); @@ -9855,7 +9853,7 @@ module ts { } } - function checkGrammarAnySignatureDeclaration(node: FunctionLikeDeclaration) { + function checkGrammarFunctionLikeDeclaration(node: FunctionLikeDeclaration) { // Prevent cascading error by short-circuit checkGrammarModifiers(node) || checkGrammarTypeParameterList(node, node.typeParameters) || checkGrammarParameterList(node.parameters); } @@ -9936,10 +9934,10 @@ module ts { } function checkGrammarBindingElement(node: BindingElement) { - if (!checkGrammarModifiers(node) && (node.parserContextFlags & ParserContextFlags.StrictMode && isEvalOrArgumentsIdentifier(node.name))) { - // It is a SyntaxError if a VariableDeclaration or VariableDeclarationNoIn occurs within strict code - // and its Identifier is eval or arguments - reportGrammarErrorOfInvalidUseInStrictMode(node.name); + if (node.parserContextFlags & ParserContextFlags.StrictMode && isEvalOrArgumentsIdentifier(node.name)) { + // It is a SyntaxError if a VariableDeclaration or VariableDeclarationNoIn occurs within strict code + // and its Identifier is eval or arguments + reportGrammarErrorOfInvalidUseInStrictMode(node.name); } } @@ -9995,9 +9993,9 @@ module ts { } function reportGrammarErrorOfInvalidUseInStrictMode(node: Identifier): boolean { - // declarationNameToString cannot be used here since it uses a backreference to 'parent' that is not yet set - var sourceText = getSourceFileOfNode(node).text; - var name = sourceText.substring(skipTrivia(sourceText, node.pos), node.end); + //var sourceText = getSourceFileOfNode(node).text; + //var name = sourceText.substring(skipTrivia(sourceText, node.pos), node.end); + var name = declarationNameToString(node); return grammarErrorOnNode(node, Diagnostics.Invalid_use_of_0_in_strict_mode, name); } From 4c91ae0040679ec14c383ac4f7ca9e4419ebf874 Mon Sep 17 00:00:00 2001 From: Yui T Date: Thu, 11 Dec 2014 15:44:52 -0800 Subject: [PATCH 22/78] Move checkGrammarCatchClause into checkTryStatement --- src/compiler/checker.ts | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 67057d1a215..9e24ff87890 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -8093,10 +8093,20 @@ module ts { function checkTryStatement(node: TryStatement) { checkBlock(node.tryBlock); - if (node.catchClause) { + var catchClause = node.catchClause; + if (catchClause) { // Grammar checking - checkGrammarCatchClause(node.catchClause); - checkBlock(node.catchClause.block); + if (catchClause.type) { + var sourceFile = getSourceFileOfNode(node); + var colonStart = skipTrivia(sourceFile.text, catchClause.name.end); + grammarErrorAtPos(sourceFile, colonStart, ":".length, Diagnostics.Catch_clause_parameter_cannot_have_a_type_annotation); + } + if (node.parserContextFlags & ParserContextFlags.StrictMode && isEvalOrArgumentsIdentifier(catchClause.name)) { + // It is a SyntaxError if a TryStatement with a Catch occurs within strict code and the Identifier of the + // Catch production is eval or arguments + reportGrammarErrorOfInvalidUseInStrictMode(catchClause.name); + } + checkBlock(catchClause.block); } if (node.finallyBlock) checkBlock(node.finallyBlock); } @@ -9941,19 +9951,6 @@ module ts { } } - function checkGrammarCatchClause(node: CatchClause) { - if (node.type) { - var sourceFile = getSourceFileOfNode(node); - var colonStart = skipTrivia(sourceFile.text, node.name.end); - grammarErrorAtPos(sourceFile, colonStart, ":".length, Diagnostics.Catch_clause_parameter_cannot_have_a_type_annotation); - } - if (node.parserContextFlags & ParserContextFlags.StrictMode && isEvalOrArgumentsIdentifier(node.name)) { - // It is a SyntaxError if a TryStatement with a Catch occurs within strict code and the Identifier of the - // Catch production is eval or arguments - reportGrammarErrorOfInvalidUseInStrictMode(node.name); - } - } - function hasParseDiagnostics(sourceFile: SourceFile): boolean { return sourceFile.parseDiagnostics.length > 0; } From 279aa3946772948f1efccf94c144ad9d353c9d33 Mon Sep 17 00:00:00 2001 From: Yui T Date: Thu, 11 Dec 2014 16:26:27 -0800 Subject: [PATCH 23/78] Move grammar checking: classDeclaration; there are still errors from checking declare keyword and grammar checking of moduleDeclaration --- src/compiler/checker.ts | 39 +++++++++++++++++++ src/compiler/parser.ts | 4 +- ...ModuleWithStatementsOfEveryKind.errors.txt | 18 ++++----- .../reference/parser618973.errors.txt | 6 +-- .../parserClassDeclaration1.errors.txt | 6 +-- .../parserClassDeclaration2.errors.txt | 6 +-- .../parserClassDeclaration3.errors.txt | 6 +-- .../parserClassDeclaration4.errors.txt | 6 +-- .../parserClassDeclaration5.errors.txt | 6 +-- .../parserClassDeclaration6.errors.txt | 6 +-- 10 files changed, 71 insertions(+), 32 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 9e24ff87890..ed34679e794 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -8213,6 +8213,45 @@ module ts { } function checkClassDeclaration(node: ClassDeclaration) { + // Grammar checking + var seenExtendsClause = false; + var seenImplementsClause = false; + + if (!checkGrammarModifiers(node) && node.heritageClauses) { + for (var i = 0, n = node.heritageClauses.length; i < n; i++) { + Debug.assert(i <= 2); + var heritageClause = node.heritageClauses[i]; + + if (heritageClause.token === SyntaxKind.ExtendsKeyword) { + if (seenExtendsClause) { + grammarErrorOnFirstToken(heritageClause, Diagnostics.extends_clause_already_seen) + break; + } + + if (seenImplementsClause) { + grammarErrorOnFirstToken(heritageClause, Diagnostics.extends_clause_must_precede_implements_clause); + break; + } + + if (heritageClause.types.length > 1) { + grammarErrorOnFirstToken(heritageClause.types[1], Diagnostics.Classes_can_only_extend_a_single_class); + break; + } + + seenExtendsClause = true; + } + else { + Debug.assert(heritageClause.token === SyntaxKind.ImplementsKeyword); + if (seenImplementsClause) { + grammarErrorOnFirstToken(heritageClause, Diagnostics.implements_clause_already_seen); + break; + } + + seenImplementsClause = true; + } + } + } + checkTypeNameIsReserved(node.name, Diagnostics.Class_name_cannot_be_0); checkTypeParameters(node.typeParameters); checkCollisionWithCapturedThisVariable(node, node.name); diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index f1edf8911bd..14346dc312c 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -4637,7 +4637,7 @@ module ts { //case SyntaxKind.BinaryExpression: return checkBinaryExpression(node); //case SyntaxKind.BindingElement: return checkBindingElement(node); //case SyntaxKind.CatchClause: return checkCatchClause(node); - case SyntaxKind.ClassDeclaration: return checkClassDeclaration(node); + //case SyntaxKind.ClassDeclaration: return checkClassDeclaration(node); case SyntaxKind.ComputedPropertyName: return checkComputedPropertyName(node); case SyntaxKind.Constructor: return checkConstructor(node); case SyntaxKind.DeleteExpression: return checkDeleteExpression( node); @@ -5328,7 +5328,7 @@ module ts { case SyntaxKind.PropertySignature: case SyntaxKind.MethodDeclaration: case SyntaxKind.MethodSignature: - case SyntaxKind.ClassDeclaration: + //case SyntaxKind.ClassDeclaration: case SyntaxKind.InterfaceDeclaration: case SyntaxKind.ModuleDeclaration: case SyntaxKind.EnumDeclaration: diff --git a/tests/baselines/reference/invalidModuleWithStatementsOfEveryKind.errors.txt b/tests/baselines/reference/invalidModuleWithStatementsOfEveryKind.errors.txt index 101ee0124cc..09647b56771 100644 --- a/tests/baselines/reference/invalidModuleWithStatementsOfEveryKind.errors.txt +++ b/tests/baselines/reference/invalidModuleWithStatementsOfEveryKind.errors.txt @@ -1,24 +1,24 @@ +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(13,5): error TS1044: 'public' modifier cannot appear on a module element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(19,5): error TS1044: 'public' modifier cannot appear on a module element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(25,5): error TS1044: 'public' modifier cannot appear on a module element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(38,5): error TS1044: 'private' modifier cannot appear on a module element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(44,5): error TS1044: 'private' modifier cannot appear on a module element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(50,5): error TS1044: 'private' modifier cannot appear on a module element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(64,5): error TS1044: 'static' modifier cannot appear on a module element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(70,5): error TS1044: 'static' modifier cannot appear on a module element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(76,5): error TS1044: 'static' modifier cannot appear on a module element. tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(4,5): error TS1044: 'public' modifier cannot appear on a module element. tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(6,5): error TS1044: 'public' modifier cannot appear on a module element. tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(12,5): error TS1044: 'public' modifier cannot appear on a module element. -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(13,5): error TS1044: 'public' modifier cannot appear on a module element. tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(15,5): error TS1044: 'public' modifier cannot appear on a module element. -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(19,5): error TS1044: 'public' modifier cannot appear on a module element. -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(25,5): error TS1044: 'public' modifier cannot appear on a module element. tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(29,5): error TS1044: 'private' modifier cannot appear on a module element. tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(31,5): error TS1044: 'private' modifier cannot appear on a module element. tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(37,5): error TS1044: 'private' modifier cannot appear on a module element. -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(38,5): error TS1044: 'private' modifier cannot appear on a module element. tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(40,5): error TS1044: 'private' modifier cannot appear on a module element. -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(44,5): error TS1044: 'private' modifier cannot appear on a module element. -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(50,5): error TS1044: 'private' modifier cannot appear on a module element. tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(55,5): error TS1044: 'static' modifier cannot appear on a module element. tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(57,5): error TS1044: 'static' modifier cannot appear on a module element. tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(63,5): error TS1044: 'static' modifier cannot appear on a module element. -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(64,5): error TS1044: 'static' modifier cannot appear on a module element. tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(66,5): error TS1044: 'static' modifier cannot appear on a module element. -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(70,5): error TS1044: 'static' modifier cannot appear on a module element. -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(76,5): error TS1044: 'static' modifier cannot appear on a module element. ==== tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts (21 errors) ==== diff --git a/tests/baselines/reference/parser618973.errors.txt b/tests/baselines/reference/parser618973.errors.txt index 83cbfb3eb67..3aa4abcfd70 100644 --- a/tests/baselines/reference/parser618973.errors.txt +++ b/tests/baselines/reference/parser618973.errors.txt @@ -1,13 +1,13 @@ -tests/cases/conformance/parser/ecmascript5/RegressionTests/parser618973.ts(1,8): error TS1030: 'export' modifier already seen. tests/cases/conformance/parser/ecmascript5/RegressionTests/parser618973.ts(1,21): error TS1148: Cannot compile external modules unless the '--module' flag is provided. +tests/cases/conformance/parser/ecmascript5/RegressionTests/parser618973.ts(1,8): error TS1030: 'export' modifier already seen. ==== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser618973.ts (2 errors) ==== export export class Foo { - ~~~~~~ -!!! error TS1030: 'export' modifier already seen. ~~~ !!! error TS1148: Cannot compile external modules unless the '--module' flag is provided. + ~~~~~~ +!!! error TS1030: 'export' modifier already seen. public Bar() { } } \ No newline at end of file diff --git a/tests/baselines/reference/parserClassDeclaration1.errors.txt b/tests/baselines/reference/parserClassDeclaration1.errors.txt index 5d148f9c5f6..21ecc68d526 100644 --- a/tests/baselines/reference/parserClassDeclaration1.errors.txt +++ b/tests/baselines/reference/parserClassDeclaration1.errors.txt @@ -1,11 +1,11 @@ -tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration1.ts(1,19): error TS1172: 'extends' clause already seen. tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration1.ts(1,17): error TS2304: Cannot find name 'A'. +tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration1.ts(1,19): error TS1172: 'extends' clause already seen. ==== tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration1.ts (2 errors) ==== class C extends A extends B { - ~~~~~~~ -!!! error TS1172: 'extends' clause already seen. ~ !!! error TS2304: Cannot find name 'A'. + ~~~~~~~ +!!! error TS1172: 'extends' clause already seen. } \ No newline at end of file diff --git a/tests/baselines/reference/parserClassDeclaration2.errors.txt b/tests/baselines/reference/parserClassDeclaration2.errors.txt index 31887698f3d..18b4e2a0ff2 100644 --- a/tests/baselines/reference/parserClassDeclaration2.errors.txt +++ b/tests/baselines/reference/parserClassDeclaration2.errors.txt @@ -1,11 +1,11 @@ -tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration2.ts(1,22): error TS1175: 'implements' clause already seen. tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration2.ts(1,20): error TS2304: Cannot find name 'A'. +tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration2.ts(1,22): error TS1175: 'implements' clause already seen. ==== tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration2.ts (2 errors) ==== class C implements A implements B { - ~~~~~~~~~~ -!!! error TS1175: 'implements' clause already seen. ~ !!! error TS2304: Cannot find name 'A'. + ~~~~~~~~~~ +!!! error TS1175: 'implements' clause already seen. } \ No newline at end of file diff --git a/tests/baselines/reference/parserClassDeclaration3.errors.txt b/tests/baselines/reference/parserClassDeclaration3.errors.txt index 38cac10f4df..83a3dc7713a 100644 --- a/tests/baselines/reference/parserClassDeclaration3.errors.txt +++ b/tests/baselines/reference/parserClassDeclaration3.errors.txt @@ -1,14 +1,14 @@ -tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration3.ts(1,22): error TS1173: 'extends' clause must precede 'implements' clause. tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration3.ts(1,20): error TS2304: Cannot find name 'A'. +tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration3.ts(1,22): error TS1173: 'extends' clause must precede 'implements' clause. tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration3.ts(1,30): error TS2304: Cannot find name 'B'. ==== tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration3.ts (3 errors) ==== class C implements A extends B { - ~~~~~~~ -!!! error TS1173: 'extends' clause must precede 'implements' clause. ~ !!! error TS2304: Cannot find name 'A'. + ~~~~~~~ +!!! error TS1173: 'extends' clause must precede 'implements' clause. ~ !!! error TS2304: Cannot find name 'B'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserClassDeclaration4.errors.txt b/tests/baselines/reference/parserClassDeclaration4.errors.txt index 27808412228..b285c13fec5 100644 --- a/tests/baselines/reference/parserClassDeclaration4.errors.txt +++ b/tests/baselines/reference/parserClassDeclaration4.errors.txt @@ -1,14 +1,14 @@ -tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration4.ts(1,32): error TS1172: 'extends' clause already seen. tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration4.ts(1,17): error TS2304: Cannot find name 'A'. tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration4.ts(1,30): error TS2304: Cannot find name 'B'. +tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration4.ts(1,32): error TS1172: 'extends' clause already seen. ==== tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration4.ts (3 errors) ==== class C extends A implements B extends C { - ~~~~~~~ -!!! error TS1172: 'extends' clause already seen. ~ !!! error TS2304: Cannot find name 'A'. ~ !!! error TS2304: Cannot find name 'B'. + ~~~~~~~ +!!! error TS1172: 'extends' clause already seen. } \ No newline at end of file diff --git a/tests/baselines/reference/parserClassDeclaration5.errors.txt b/tests/baselines/reference/parserClassDeclaration5.errors.txt index 8cd90d61dee..fca4b0f8fdf 100644 --- a/tests/baselines/reference/parserClassDeclaration5.errors.txt +++ b/tests/baselines/reference/parserClassDeclaration5.errors.txt @@ -1,14 +1,14 @@ -tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration5.ts(1,32): error TS1175: 'implements' clause already seen. tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration5.ts(1,17): error TS2304: Cannot find name 'A'. tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration5.ts(1,30): error TS2304: Cannot find name 'B'. +tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration5.ts(1,32): error TS1175: 'implements' clause already seen. ==== tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration5.ts (3 errors) ==== class C extends A implements B implements C { - ~~~~~~~~~~ -!!! error TS1175: 'implements' clause already seen. ~ !!! error TS2304: Cannot find name 'A'. ~ !!! error TS2304: Cannot find name 'B'. + ~~~~~~~~~~ +!!! error TS1175: 'implements' clause already seen. } \ No newline at end of file diff --git a/tests/baselines/reference/parserClassDeclaration6.errors.txt b/tests/baselines/reference/parserClassDeclaration6.errors.txt index af0139d4fe1..b7b42463e1f 100644 --- a/tests/baselines/reference/parserClassDeclaration6.errors.txt +++ b/tests/baselines/reference/parserClassDeclaration6.errors.txt @@ -1,11 +1,11 @@ -tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration6.ts(1,20): error TS1174: Classes can only extend a single class. tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration6.ts(1,17): error TS2304: Cannot find name 'A'. +tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration6.ts(1,20): error TS1174: Classes can only extend a single class. ==== tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration6.ts (2 errors) ==== class C extends A, B { - ~ -!!! error TS1174: Classes can only extend a single class. ~ !!! error TS2304: Cannot find name 'A'. + ~ +!!! error TS1174: Classes can only extend a single class. } \ No newline at end of file From 6251127152d8837391c91f86b4cc6e1ad153b6dc Mon Sep 17 00:00:00 2001 From: Yui T Date: Fri, 12 Dec 2014 00:11:59 -0800 Subject: [PATCH 24/78] Move grammar checking : computedPropertyName; there is still error from grammar check on ambient context and generator --- src/compiler/checker.ts | 18 ++++++++++++++++++ src/compiler/parser.ts | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index ed34679e794..8d930bbfb72 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -5357,6 +5357,14 @@ module ts { var properties: SymbolTable = {}; var contextualType = getContextualType(node); var typeFlags: TypeFlags; + + // Grammar checking for computedPropertyName + forEach(node.properties, property => { + if (property.name && property.name.kind === SyntaxKind.ComputedPropertyName) { + checkGrammarComputedPropertyName(property.name); + } + }); + for (var id in members) { if (hasProperty(members, id)) { var member = members[id]; @@ -5405,6 +5413,7 @@ module ts { properties[member.name] = member; } } + var stringIndexType = getIndexType(IndexKind.String); var numberIndexType = getIndexType(IndexKind.Number); var result = createAnonymousType(node.symbol, properties, emptyArray, emptyArray, stringIndexType, numberIndexType); @@ -9990,6 +9999,15 @@ module ts { } } + function checkGrammarComputedPropertyName(node: ComputedPropertyName): void { + if (compilerOptions.target < ScriptTarget.ES6) { + grammarErrorOnNode(node, Diagnostics.Computed_property_names_are_only_available_when_targeting_ECMAScript_6_and_higher); + } + else if (node.expression.kind === SyntaxKind.BinaryExpression && (node.expression).operator === SyntaxKind.CommaToken) { + grammarErrorOnNode(node.expression, Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name); + } + } + function hasParseDiagnostics(sourceFile: SourceFile): boolean { return sourceFile.parseDiagnostics.length > 0; } diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 14346dc312c..2d0e085f7f1 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -4638,7 +4638,7 @@ module ts { //case SyntaxKind.BindingElement: return checkBindingElement(node); //case SyntaxKind.CatchClause: return checkCatchClause(node); //case SyntaxKind.ClassDeclaration: return checkClassDeclaration(node); - case SyntaxKind.ComputedPropertyName: return checkComputedPropertyName(node); + //case SyntaxKind.ComputedPropertyName: return checkComputedPropertyName(node); case SyntaxKind.Constructor: return checkConstructor(node); case SyntaxKind.DeleteExpression: return checkDeleteExpression( node); case SyntaxKind.ElementAccessExpression: return checkElementAccessExpression(node); From 04c9cbfbd4805e50323cc0d8f299133ed87d7eed Mon Sep 17 00:00:00 2001 From: Yui T Date: Fri, 12 Dec 2014 10:13:47 -0800 Subject: [PATCH 25/78] Address code review --- src/compiler/checker.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 8d930bbfb72..91f806e0518 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -5360,7 +5360,7 @@ module ts { // Grammar checking for computedPropertyName forEach(node.properties, property => { - if (property.name && property.name.kind === SyntaxKind.ComputedPropertyName) { + if (property.name.kind === SyntaxKind.ComputedPropertyName) { checkGrammarComputedPropertyName(property.name); } }); From 867e2a8b6f0e76207cbae1e903e1500c8199a44e Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Thu, 11 Dec 2014 16:49:24 -0800 Subject: [PATCH 26/78] Disable computed properties in TypeScript 1.4 Conflicts: src/compiler/diagnosticInformationMap.generated.ts src/compiler/diagnosticMessages.json --- .../diagnosticInformationMap.generated.ts | 1 + src/compiler/diagnosticMessages.json | 4 ++ src/compiler/parser.ts | 4 ++ .../FunctionDeclaration8_es6.errors.txt | 4 +- .../computedPropertyNames1.errors.txt | 13 +++++ .../reference/computedPropertyNames1.js | 14 ------ .../reference/computedPropertyNames1.types | 12 ----- .../computedPropertyNames2.errors.txt | 20 +++++++- .../reference/computedPropertyNames2.js | 48 ------------------- .../computedPropertyNames3.errors.txt | 20 +++++++- .../reference/computedPropertyNames3.js | 47 ------------------ ...omputedPropertyNamesOnOverloads.errors.txt | 5 +- .../parserComputedPropertyName12.errors.txt | 9 ++++ .../reference/parserComputedPropertyName12.js | 13 ----- .../parserComputedPropertyName12.types | 7 --- .../parserComputedPropertyName17.errors.txt | 7 +++ .../reference/parserComputedPropertyName17.js | 6 --- .../parserComputedPropertyName17.types | 7 --- .../parserComputedPropertyName2.errors.txt | 7 +++ .../reference/parserComputedPropertyName2.js | 5 -- .../parserComputedPropertyName2.types | 6 --- .../parserComputedPropertyName24.errors.txt | 9 ++++ .../reference/parserComputedPropertyName24.js | 17 ------- .../parserComputedPropertyName24.types | 8 ---- .../parserComputedPropertyName3.errors.txt | 7 +++ .../reference/parserComputedPropertyName3.js | 6 --- .../parserComputedPropertyName3.types | 6 --- .../parserComputedPropertyName35.errors.txt | 6 +-- .../parserComputedPropertyName37.errors.txt | 9 ++++ .../reference/parserComputedPropertyName37.js | 9 ---- .../parserComputedPropertyName37.types | 9 ---- .../parserComputedPropertyName38.errors.txt | 9 ++++ .../reference/parserComputedPropertyName38.js | 13 ----- .../parserComputedPropertyName38.types | 7 --- .../parserComputedPropertyName4.errors.txt | 7 +++ .../reference/parserComputedPropertyName4.js | 6 --- .../parserComputedPropertyName4.types | 6 --- .../parserComputedPropertyName40.errors.txt | 9 ++++ .../reference/parserComputedPropertyName40.js | 13 ----- .../parserComputedPropertyName40.types | 8 ---- .../parserComputedPropertyName41.errors.txt | 9 ++++ .../reference/parserComputedPropertyName41.js | 9 ---- .../parserComputedPropertyName41.types | 9 ---- .../parserComputedPropertyName6.errors.txt | 10 ++++ .../reference/parserComputedPropertyName6.js | 5 -- .../parserComputedPropertyName6.types | 9 ---- .../parserES5ComputedPropertyName2.errors.txt | 4 +- .../parserES5ComputedPropertyName3.errors.txt | 4 +- .../parserES5ComputedPropertyName4.errors.txt | 4 +- 49 files changed, 167 insertions(+), 319 deletions(-) create mode 100644 tests/baselines/reference/computedPropertyNames1.errors.txt delete mode 100644 tests/baselines/reference/computedPropertyNames1.js delete mode 100644 tests/baselines/reference/computedPropertyNames1.types delete mode 100644 tests/baselines/reference/computedPropertyNames2.js delete mode 100644 tests/baselines/reference/computedPropertyNames3.js create mode 100644 tests/baselines/reference/parserComputedPropertyName12.errors.txt delete mode 100644 tests/baselines/reference/parserComputedPropertyName12.js delete mode 100644 tests/baselines/reference/parserComputedPropertyName12.types create mode 100644 tests/baselines/reference/parserComputedPropertyName17.errors.txt delete mode 100644 tests/baselines/reference/parserComputedPropertyName17.js delete mode 100644 tests/baselines/reference/parserComputedPropertyName17.types create mode 100644 tests/baselines/reference/parserComputedPropertyName2.errors.txt delete mode 100644 tests/baselines/reference/parserComputedPropertyName2.js delete mode 100644 tests/baselines/reference/parserComputedPropertyName2.types create mode 100644 tests/baselines/reference/parserComputedPropertyName24.errors.txt delete mode 100644 tests/baselines/reference/parserComputedPropertyName24.js delete mode 100644 tests/baselines/reference/parserComputedPropertyName24.types create mode 100644 tests/baselines/reference/parserComputedPropertyName3.errors.txt delete mode 100644 tests/baselines/reference/parserComputedPropertyName3.js delete mode 100644 tests/baselines/reference/parserComputedPropertyName3.types create mode 100644 tests/baselines/reference/parserComputedPropertyName37.errors.txt delete mode 100644 tests/baselines/reference/parserComputedPropertyName37.js delete mode 100644 tests/baselines/reference/parserComputedPropertyName37.types create mode 100644 tests/baselines/reference/parserComputedPropertyName38.errors.txt delete mode 100644 tests/baselines/reference/parserComputedPropertyName38.js delete mode 100644 tests/baselines/reference/parserComputedPropertyName38.types create mode 100644 tests/baselines/reference/parserComputedPropertyName4.errors.txt delete mode 100644 tests/baselines/reference/parserComputedPropertyName4.js delete mode 100644 tests/baselines/reference/parserComputedPropertyName4.types create mode 100644 tests/baselines/reference/parserComputedPropertyName40.errors.txt delete mode 100644 tests/baselines/reference/parserComputedPropertyName40.js delete mode 100644 tests/baselines/reference/parserComputedPropertyName40.types create mode 100644 tests/baselines/reference/parserComputedPropertyName41.errors.txt delete mode 100644 tests/baselines/reference/parserComputedPropertyName41.js delete mode 100644 tests/baselines/reference/parserComputedPropertyName41.types create mode 100644 tests/baselines/reference/parserComputedPropertyName6.errors.txt delete mode 100644 tests/baselines/reference/parserComputedPropertyName6.js delete mode 100644 tests/baselines/reference/parserComputedPropertyName6.types diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index c9977d2cc1e..60f7dd8588d 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -435,5 +435,6 @@ module ts { You_cannot_rename_this_element: { code: 8000, category: DiagnosticCategory.Error, key: "You cannot rename this element." }, yield_expressions_are_not_currently_supported: { code: 9000, category: DiagnosticCategory.Error, key: "'yield' expressions are not currently supported.", isEarly: true }, generators_are_not_currently_supported: { code: 9001, category: DiagnosticCategory.Error, key: "'generators' are not currently supported.", isEarly: true }, + Computed_property_names_are_not_currently_supported: { code: 9002, category: DiagnosticCategory.Error, key: "Computed property names are not currently supported.", isEarly: true }, }; } \ No newline at end of file diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 7caf3619cea..eb8cf807c97 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1826,5 +1826,9 @@ "category": "Error", "code": 9001, "isEarly": true + }, + "Computed property names are not currently supported.": { + "category": "Error", + "code": 9002, } } diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 2d0e085f7f1..7f8d766cc93 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -5552,6 +5552,10 @@ module ts { } function checkComputedPropertyName(node: ComputedPropertyName) { + // Since computed properties are not supported in the type checker, disallow them in TypeScript 1.4 + // Once full support is added, remove this error. + return grammarErrorOnNode(node, Diagnostics.Computed_property_names_are_not_currently_supported); + if (languageVersion < ScriptTarget.ES6) { return grammarErrorOnNode(node, Diagnostics.Computed_property_names_are_only_available_when_targeting_ECMAScript_6_and_higher); } diff --git a/tests/baselines/reference/FunctionDeclaration8_es6.errors.txt b/tests/baselines/reference/FunctionDeclaration8_es6.errors.txt index 5232c8f1608..08d151203c9 100644 --- a/tests/baselines/reference/FunctionDeclaration8_es6.errors.txt +++ b/tests/baselines/reference/FunctionDeclaration8_es6.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8_es6.ts(1,11): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8_es6.ts(1,11): error TS9002: Computed property names are not currently supported. ==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8_es6.ts (1 errors) ==== var v = { [yield]: foo } ~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. \ No newline at end of file +!!! error TS9002: Computed property names are not currently supported. \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames1.errors.txt b/tests/baselines/reference/computedPropertyNames1.errors.txt new file mode 100644 index 00000000000..02abbcd6b2d --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames1.errors.txt @@ -0,0 +1,13 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames1.ts(2,9): error TS9002: Computed property names are not currently supported. +tests/cases/conformance/es6/computedProperties/computedPropertyNames1.ts(3,9): error TS9002: Computed property names are not currently supported. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames1.ts (2 errors) ==== + var v = { + get [0 + 1]() { return 0 }, + ~~~~~~~ +!!! error TS9002: Computed property names are not currently supported. + set [0 + 1](v: string) { } //No error + ~~~~~~~ +!!! error TS9002: Computed property names are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames1.js b/tests/baselines/reference/computedPropertyNames1.js deleted file mode 100644 index 8f3e448d698..00000000000 --- a/tests/baselines/reference/computedPropertyNames1.js +++ /dev/null @@ -1,14 +0,0 @@ -//// [computedPropertyNames1.ts] -var v = { - get [0 + 1]() { return 0 }, - set [0 + 1](v: string) { } //No error -} - -//// [computedPropertyNames1.js] -var v = { - get [0 + 1]() { - return 0; - }, - set [0 + 1](v) { - } //No error -}; diff --git a/tests/baselines/reference/computedPropertyNames1.types b/tests/baselines/reference/computedPropertyNames1.types deleted file mode 100644 index b44aa3c69d0..00000000000 --- a/tests/baselines/reference/computedPropertyNames1.types +++ /dev/null @@ -1,12 +0,0 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames1.ts === -var v = { ->v : {} ->{ get [0 + 1]() { return 0 }, set [0 + 1](v: string) { } //No error} : {} - - get [0 + 1]() { return 0 }, ->0 + 1 : number - - set [0 + 1](v: string) { } //No error ->0 + 1 : number ->v : string -} diff --git a/tests/baselines/reference/computedPropertyNames2.errors.txt b/tests/baselines/reference/computedPropertyNames2.errors.txt index d0fd1de4576..e7cc84a8f6e 100644 --- a/tests/baselines/reference/computedPropertyNames2.errors.txt +++ b/tests/baselines/reference/computedPropertyNames2.errors.txt @@ -1,19 +1,37 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts(4,5): error TS9002: Computed property names are not currently supported. +tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts(5,12): error TS9002: Computed property names are not currently supported. +tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts(6,9): error TS9002: Computed property names are not currently supported. +tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts(7,9): error TS9002: Computed property names are not currently supported. +tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts(8,16): error TS9002: Computed property names are not currently supported. +tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts(9,16): error TS9002: Computed property names are not currently supported. tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts(6,9): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts(8,16): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts (2 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts (8 errors) ==== var methodName = "method"; var accessorName = "accessor"; class C { [methodName]() { } + ~~~~~~~~~~~~ +!!! error TS9002: Computed property names are not currently supported. static [methodName]() { } + ~~~~~~~~~~~~ +!!! error TS9002: Computed property names are not currently supported. get [accessorName]() { } ~~~~~~~~~~~~~~ +!!! error TS9002: Computed property names are not currently supported. + ~~~~~~~~~~~~~~ !!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. set [accessorName](v) { } + ~~~~~~~~~~~~~~ +!!! error TS9002: Computed property names are not currently supported. static get [accessorName]() { } ~~~~~~~~~~~~~~ +!!! error TS9002: Computed property names are not currently supported. + ~~~~~~~~~~~~~~ !!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. static set [accessorName](v) { } + ~~~~~~~~~~~~~~ +!!! error TS9002: Computed property names are not currently supported. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames2.js b/tests/baselines/reference/computedPropertyNames2.js deleted file mode 100644 index 78d53ef94fc..00000000000 --- a/tests/baselines/reference/computedPropertyNames2.js +++ /dev/null @@ -1,48 +0,0 @@ -//// [computedPropertyNames2.ts] -var methodName = "method"; -var accessorName = "accessor"; -class C { - [methodName]() { } - static [methodName]() { } - get [accessorName]() { } - set [accessorName](v) { } - static get [accessorName]() { } - static set [accessorName](v) { } -} - -//// [computedPropertyNames2.js] -var methodName = "method"; -var accessorName = "accessor"; -var C = (function () { - function C() { - } - C.prototype[methodName] = function () { - }; - C[methodName] = function () { - }; - Object.defineProperty(C.prototype, accessorName, { - get: function () { - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(C.prototype, accessorName, { - set: function (v) { - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(C, accessorName, { - get: function () { - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(C, accessorName, { - set: function (v) { - }, - enumerable: true, - configurable: true - }); - return C; -})(); diff --git a/tests/baselines/reference/computedPropertyNames3.errors.txt b/tests/baselines/reference/computedPropertyNames3.errors.txt index 37a4ddaf1c0..a1d6e09421b 100644 --- a/tests/baselines/reference/computedPropertyNames3.errors.txt +++ b/tests/baselines/reference/computedPropertyNames3.errors.txt @@ -1,18 +1,36 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(3,5): error TS9002: Computed property names are not currently supported. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(4,12): error TS9002: Computed property names are not currently supported. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(5,9): error TS9002: Computed property names are not currently supported. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(6,9): error TS9002: Computed property names are not currently supported. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(7,16): error TS9002: Computed property names are not currently supported. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(8,16): error TS9002: Computed property names are not currently supported. tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(5,9): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(7,16): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts (2 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts (8 errors) ==== var id; class C { [0 + 1]() { } + ~~~~~~~ +!!! error TS9002: Computed property names are not currently supported. static [() => { }]() { } + ~~~~~~~~~~~ +!!! error TS9002: Computed property names are not currently supported. get [delete id]() { } ~~~~~~~~~~~ +!!! error TS9002: Computed property names are not currently supported. + ~~~~~~~~~~~ !!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. set [[0, 1]](v) { } + ~~~~~~~~ +!!! error TS9002: Computed property names are not currently supported. static get [""]() { } ~~~~~~~~~~~~ +!!! error TS9002: Computed property names are not currently supported. + ~~~~~~~~~~~~ !!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. static set [id.toString()](v) { } + ~~~~~~~~~~~~~~~ +!!! error TS9002: Computed property names are not currently supported. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames3.js b/tests/baselines/reference/computedPropertyNames3.js deleted file mode 100644 index fbd76bf48fc..00000000000 --- a/tests/baselines/reference/computedPropertyNames3.js +++ /dev/null @@ -1,47 +0,0 @@ -//// [computedPropertyNames3.ts] -var id; -class C { - [0 + 1]() { } - static [() => { }]() { } - get [delete id]() { } - set [[0, 1]](v) { } - static get [""]() { } - static set [id.toString()](v) { } -} - -//// [computedPropertyNames3.js] -var id; -var C = (function () { - function C() { - } - C.prototype[0 + 1] = function () { - }; - C[function () { - }] = function () { - }; - Object.defineProperty(C.prototype, delete id, { - get: function () { - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(C.prototype, [0, 1], { - set: function (v) { - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(C, "", { - get: function () { - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(C, id.toString(), { - set: function (v) { - }, - enumerable: true, - configurable: true - }); - return C; -})(); diff --git a/tests/baselines/reference/computedPropertyNamesOnOverloads.errors.txt b/tests/baselines/reference/computedPropertyNamesOnOverloads.errors.txt index b3c2957a13f..6329ab39f0f 100644 --- a/tests/baselines/reference/computedPropertyNamesOnOverloads.errors.txt +++ b/tests/baselines/reference/computedPropertyNamesOnOverloads.errors.txt @@ -1,8 +1,9 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads.ts(4,5): error TS1168: Computed property names are not allowed in method overloads. tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads.ts(5,5): error TS1168: Computed property names are not allowed in method overloads. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads.ts(6,5): error TS9002: Computed property names are not currently supported. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads.ts (2 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads.ts (3 errors) ==== var methodName = "method"; var accessorName = "accessor"; class C { @@ -13,4 +14,6 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads. ~~~~~~~~~~~~ !!! error TS1168: Computed property names are not allowed in method overloads. [methodName](v?: string) { } + ~~~~~~~~~~~~ +!!! error TS9002: Computed property names are not currently supported. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName12.errors.txt b/tests/baselines/reference/parserComputedPropertyName12.errors.txt new file mode 100644 index 00000000000..c028275369d --- /dev/null +++ b/tests/baselines/reference/parserComputedPropertyName12.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName12.ts(2,4): error TS9002: Computed property names are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName12.ts (1 errors) ==== + class C { + [e]() { } + ~~~ +!!! error TS9002: Computed property names are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName12.js b/tests/baselines/reference/parserComputedPropertyName12.js deleted file mode 100644 index 96e62b626e7..00000000000 --- a/tests/baselines/reference/parserComputedPropertyName12.js +++ /dev/null @@ -1,13 +0,0 @@ -//// [parserComputedPropertyName12.ts] -class C { - [e]() { } -} - -//// [parserComputedPropertyName12.js] -var C = (function () { - function C() { - } - C.prototype[e] = function () { - }; - return C; -})(); diff --git a/tests/baselines/reference/parserComputedPropertyName12.types b/tests/baselines/reference/parserComputedPropertyName12.types deleted file mode 100644 index fcc96bc4d51..00000000000 --- a/tests/baselines/reference/parserComputedPropertyName12.types +++ /dev/null @@ -1,7 +0,0 @@ -=== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName12.ts === -class C { ->C : C - - [e]() { } ->e : unknown -} diff --git a/tests/baselines/reference/parserComputedPropertyName17.errors.txt b/tests/baselines/reference/parserComputedPropertyName17.errors.txt new file mode 100644 index 00000000000..f8b1a4866e8 --- /dev/null +++ b/tests/baselines/reference/parserComputedPropertyName17.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName17.ts(1,15): error TS9002: Computed property names are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName17.ts (1 errors) ==== + var v = { set [e](v) { } } + ~~~ +!!! error TS9002: Computed property names are not currently supported. \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName17.js b/tests/baselines/reference/parserComputedPropertyName17.js deleted file mode 100644 index 98d61ab8bca..00000000000 --- a/tests/baselines/reference/parserComputedPropertyName17.js +++ /dev/null @@ -1,6 +0,0 @@ -//// [parserComputedPropertyName17.ts] -var v = { set [e](v) { } } - -//// [parserComputedPropertyName17.js] -var v = { set [e](v) { -} }; diff --git a/tests/baselines/reference/parserComputedPropertyName17.types b/tests/baselines/reference/parserComputedPropertyName17.types deleted file mode 100644 index 8ae109dda37..00000000000 --- a/tests/baselines/reference/parserComputedPropertyName17.types +++ /dev/null @@ -1,7 +0,0 @@ -=== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName17.ts === -var v = { set [e](v) { } } ->v : {} ->{ set [e](v) { } } : {} ->e : unknown ->v : any - diff --git a/tests/baselines/reference/parserComputedPropertyName2.errors.txt b/tests/baselines/reference/parserComputedPropertyName2.errors.txt new file mode 100644 index 00000000000..9eb6cdd6004 --- /dev/null +++ b/tests/baselines/reference/parserComputedPropertyName2.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName2.ts(1,11): error TS9002: Computed property names are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName2.ts (1 errors) ==== + var v = { [e]: 1 }; + ~~~ +!!! error TS9002: Computed property names are not currently supported. \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName2.js b/tests/baselines/reference/parserComputedPropertyName2.js deleted file mode 100644 index f3c41f963f5..00000000000 --- a/tests/baselines/reference/parserComputedPropertyName2.js +++ /dev/null @@ -1,5 +0,0 @@ -//// [parserComputedPropertyName2.ts] -var v = { [e]: 1 }; - -//// [parserComputedPropertyName2.js] -var v = { [e]: 1 }; diff --git a/tests/baselines/reference/parserComputedPropertyName2.types b/tests/baselines/reference/parserComputedPropertyName2.types deleted file mode 100644 index 8e533282e28..00000000000 --- a/tests/baselines/reference/parserComputedPropertyName2.types +++ /dev/null @@ -1,6 +0,0 @@ -=== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName2.ts === -var v = { [e]: 1 }; ->v : {} ->{ [e]: 1 } : {} ->e : unknown - diff --git a/tests/baselines/reference/parserComputedPropertyName24.errors.txt b/tests/baselines/reference/parserComputedPropertyName24.errors.txt new file mode 100644 index 00000000000..fa7280a93e7 --- /dev/null +++ b/tests/baselines/reference/parserComputedPropertyName24.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName24.ts(2,9): error TS9002: Computed property names are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName24.ts (1 errors) ==== + class C { + set [e](v) { } + ~~~ +!!! error TS9002: Computed property names are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName24.js b/tests/baselines/reference/parserComputedPropertyName24.js deleted file mode 100644 index 0b9467fb26d..00000000000 --- a/tests/baselines/reference/parserComputedPropertyName24.js +++ /dev/null @@ -1,17 +0,0 @@ -//// [parserComputedPropertyName24.ts] -class C { - set [e](v) { } -} - -//// [parserComputedPropertyName24.js] -var C = (function () { - function C() { - } - Object.defineProperty(C.prototype, e, { - set: function (v) { - }, - enumerable: true, - configurable: true - }); - return C; -})(); diff --git a/tests/baselines/reference/parserComputedPropertyName24.types b/tests/baselines/reference/parserComputedPropertyName24.types deleted file mode 100644 index d2de5244057..00000000000 --- a/tests/baselines/reference/parserComputedPropertyName24.types +++ /dev/null @@ -1,8 +0,0 @@ -=== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName24.ts === -class C { ->C : C - - set [e](v) { } ->e : unknown ->v : any -} diff --git a/tests/baselines/reference/parserComputedPropertyName3.errors.txt b/tests/baselines/reference/parserComputedPropertyName3.errors.txt new file mode 100644 index 00000000000..b13f453cb89 --- /dev/null +++ b/tests/baselines/reference/parserComputedPropertyName3.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName3.ts(1,11): error TS9002: Computed property names are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName3.ts (1 errors) ==== + var v = { [e]() { } }; + ~~~ +!!! error TS9002: Computed property names are not currently supported. \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName3.js b/tests/baselines/reference/parserComputedPropertyName3.js deleted file mode 100644 index 2e73fe87d3a..00000000000 --- a/tests/baselines/reference/parserComputedPropertyName3.js +++ /dev/null @@ -1,6 +0,0 @@ -//// [parserComputedPropertyName3.ts] -var v = { [e]() { } }; - -//// [parserComputedPropertyName3.js] -var v = { [e]() { -} }; diff --git a/tests/baselines/reference/parserComputedPropertyName3.types b/tests/baselines/reference/parserComputedPropertyName3.types deleted file mode 100644 index 8a5cfafbd40..00000000000 --- a/tests/baselines/reference/parserComputedPropertyName3.types +++ /dev/null @@ -1,6 +0,0 @@ -=== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName3.ts === -var v = { [e]() { } }; ->v : {} ->{ [e]() { } } : {} ->e : unknown - diff --git a/tests/baselines/reference/parserComputedPropertyName35.errors.txt b/tests/baselines/reference/parserComputedPropertyName35.errors.txt index e603d1c73fd..d68f0eb1ec7 100644 --- a/tests/baselines/reference/parserComputedPropertyName35.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName35.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName35.ts(2,6): error TS1171: A comma expression is not allowed in a computed property name. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName35.ts(2,5): error TS9002: Computed property names are not currently supported. ==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName35.ts (1 errors) ==== var x = { [0, 1]: { } - ~~~~ -!!! error TS1171: A comma expression is not allowed in a computed property name. + ~~~~~~ +!!! error TS9002: Computed property names are not currently supported. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName37.errors.txt b/tests/baselines/reference/parserComputedPropertyName37.errors.txt new file mode 100644 index 00000000000..fa1acd5dbe0 --- /dev/null +++ b/tests/baselines/reference/parserComputedPropertyName37.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName37.ts(2,5): error TS9002: Computed property names are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName37.ts (1 errors) ==== + var v = { + [public]: 0 + ~~~~~~~~ +!!! error TS9002: Computed property names are not currently supported. + }; \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName37.js b/tests/baselines/reference/parserComputedPropertyName37.js deleted file mode 100644 index eb16d5ade37..00000000000 --- a/tests/baselines/reference/parserComputedPropertyName37.js +++ /dev/null @@ -1,9 +0,0 @@ -//// [parserComputedPropertyName37.ts] -var v = { - [public]: 0 -}; - -//// [parserComputedPropertyName37.js] -var v = { - [public]: 0 -}; diff --git a/tests/baselines/reference/parserComputedPropertyName37.types b/tests/baselines/reference/parserComputedPropertyName37.types deleted file mode 100644 index ebcd0ca276c..00000000000 --- a/tests/baselines/reference/parserComputedPropertyName37.types +++ /dev/null @@ -1,9 +0,0 @@ -=== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName37.ts === -var v = { ->v : {} ->{ [public]: 0} : {} - - [public]: 0 ->public : unknown - -}; diff --git a/tests/baselines/reference/parserComputedPropertyName38.errors.txt b/tests/baselines/reference/parserComputedPropertyName38.errors.txt new file mode 100644 index 00000000000..910a907ee0f --- /dev/null +++ b/tests/baselines/reference/parserComputedPropertyName38.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName38.ts(2,5): error TS9002: Computed property names are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName38.ts (1 errors) ==== + class C { + [public]() { } + ~~~~~~~~ +!!! error TS9002: Computed property names are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName38.js b/tests/baselines/reference/parserComputedPropertyName38.js deleted file mode 100644 index 487ff4078fd..00000000000 --- a/tests/baselines/reference/parserComputedPropertyName38.js +++ /dev/null @@ -1,13 +0,0 @@ -//// [parserComputedPropertyName38.ts] -class C { - [public]() { } -} - -//// [parserComputedPropertyName38.js] -var C = (function () { - function C() { - } - C.prototype[public] = function () { - }; - return C; -})(); diff --git a/tests/baselines/reference/parserComputedPropertyName38.types b/tests/baselines/reference/parserComputedPropertyName38.types deleted file mode 100644 index c77b9fcc67f..00000000000 --- a/tests/baselines/reference/parserComputedPropertyName38.types +++ /dev/null @@ -1,7 +0,0 @@ -=== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName38.ts === -class C { ->C : C - - [public]() { } ->public : unknown -} diff --git a/tests/baselines/reference/parserComputedPropertyName4.errors.txt b/tests/baselines/reference/parserComputedPropertyName4.errors.txt new file mode 100644 index 00000000000..c1137b15872 --- /dev/null +++ b/tests/baselines/reference/parserComputedPropertyName4.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName4.ts(1,15): error TS9002: Computed property names are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName4.ts (1 errors) ==== + var v = { get [e]() { } }; + ~~~ +!!! error TS9002: Computed property names are not currently supported. \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName4.js b/tests/baselines/reference/parserComputedPropertyName4.js deleted file mode 100644 index a88545566e6..00000000000 --- a/tests/baselines/reference/parserComputedPropertyName4.js +++ /dev/null @@ -1,6 +0,0 @@ -//// [parserComputedPropertyName4.ts] -var v = { get [e]() { } }; - -//// [parserComputedPropertyName4.js] -var v = { get [e]() { -} }; diff --git a/tests/baselines/reference/parserComputedPropertyName4.types b/tests/baselines/reference/parserComputedPropertyName4.types deleted file mode 100644 index 32a1b44efeb..00000000000 --- a/tests/baselines/reference/parserComputedPropertyName4.types +++ /dev/null @@ -1,6 +0,0 @@ -=== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName4.ts === -var v = { get [e]() { } }; ->v : {} ->{ get [e]() { } } : {} ->e : unknown - diff --git a/tests/baselines/reference/parserComputedPropertyName40.errors.txt b/tests/baselines/reference/parserComputedPropertyName40.errors.txt new file mode 100644 index 00000000000..93be0ad51b7 --- /dev/null +++ b/tests/baselines/reference/parserComputedPropertyName40.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName40.ts(2,5): error TS9002: Computed property names are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName40.ts (1 errors) ==== + class C { + [a ? "" : ""]() {} + ~~~~~~~~~~~~~ +!!! error TS9002: Computed property names are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName40.js b/tests/baselines/reference/parserComputedPropertyName40.js deleted file mode 100644 index 5f6381360fc..00000000000 --- a/tests/baselines/reference/parserComputedPropertyName40.js +++ /dev/null @@ -1,13 +0,0 @@ -//// [parserComputedPropertyName40.ts] -class C { - [a ? "" : ""]() {} -} - -//// [parserComputedPropertyName40.js] -var C = (function () { - function C() { - } - C.prototype[a ? "" : ""] = function () { - }; - return C; -})(); diff --git a/tests/baselines/reference/parserComputedPropertyName40.types b/tests/baselines/reference/parserComputedPropertyName40.types deleted file mode 100644 index 1b0b3ae49f0..00000000000 --- a/tests/baselines/reference/parserComputedPropertyName40.types +++ /dev/null @@ -1,8 +0,0 @@ -=== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName40.ts === -class C { ->C : C - - [a ? "" : ""]() {} ->a ? "" : "" : string ->a : unknown -} diff --git a/tests/baselines/reference/parserComputedPropertyName41.errors.txt b/tests/baselines/reference/parserComputedPropertyName41.errors.txt new file mode 100644 index 00000000000..eb5e9a9ebbf --- /dev/null +++ b/tests/baselines/reference/parserComputedPropertyName41.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName41.ts(2,5): error TS9002: Computed property names are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName41.ts (1 errors) ==== + var v = { + [0 in []]: true + ~~~~~~~~~ +!!! error TS9002: Computed property names are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName41.js b/tests/baselines/reference/parserComputedPropertyName41.js deleted file mode 100644 index b19cc3e7b3f..00000000000 --- a/tests/baselines/reference/parserComputedPropertyName41.js +++ /dev/null @@ -1,9 +0,0 @@ -//// [parserComputedPropertyName41.ts] -var v = { - [0 in []]: true -} - -//// [parserComputedPropertyName41.js] -var v = { - [0 in []]: true -}; diff --git a/tests/baselines/reference/parserComputedPropertyName41.types b/tests/baselines/reference/parserComputedPropertyName41.types deleted file mode 100644 index 468a44e6b9e..00000000000 --- a/tests/baselines/reference/parserComputedPropertyName41.types +++ /dev/null @@ -1,9 +0,0 @@ -=== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName41.ts === -var v = { ->v : {} ->{ [0 in []]: true} : {} - - [0 in []]: true ->0 in [] : boolean ->[] : undefined[] -} diff --git a/tests/baselines/reference/parserComputedPropertyName6.errors.txt b/tests/baselines/reference/parserComputedPropertyName6.errors.txt new file mode 100644 index 00000000000..893bf3da719 --- /dev/null +++ b/tests/baselines/reference/parserComputedPropertyName6.errors.txt @@ -0,0 +1,10 @@ +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName6.ts(1,11): error TS9002: Computed property names are not currently supported. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName6.ts(1,19): error TS9002: Computed property names are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName6.ts (2 errors) ==== + var v = { [e]: 1, [e + e]: 2 }; + ~~~ +!!! error TS9002: Computed property names are not currently supported. + ~~~~~~~ +!!! error TS9002: Computed property names are not currently supported. \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName6.js b/tests/baselines/reference/parserComputedPropertyName6.js deleted file mode 100644 index b60ad66a9d8..00000000000 --- a/tests/baselines/reference/parserComputedPropertyName6.js +++ /dev/null @@ -1,5 +0,0 @@ -//// [parserComputedPropertyName6.ts] -var v = { [e]: 1, [e + e]: 2 }; - -//// [parserComputedPropertyName6.js] -var v = { [e]: 1, [e + e]: 2 }; diff --git a/tests/baselines/reference/parserComputedPropertyName6.types b/tests/baselines/reference/parserComputedPropertyName6.types deleted file mode 100644 index 5fa7e79c32c..00000000000 --- a/tests/baselines/reference/parserComputedPropertyName6.types +++ /dev/null @@ -1,9 +0,0 @@ -=== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName6.ts === -var v = { [e]: 1, [e + e]: 2 }; ->v : {} ->{ [e]: 1, [e + e]: 2 } : {} ->e : unknown ->e + e : any ->e : unknown ->e : unknown - diff --git a/tests/baselines/reference/parserES5ComputedPropertyName2.errors.txt b/tests/baselines/reference/parserES5ComputedPropertyName2.errors.txt index dc7d7e7ba30..7b6b74b8fd8 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName2.errors.txt +++ b/tests/baselines/reference/parserES5ComputedPropertyName2.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName2.ts(1,11): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName2.ts(1,11): error TS9002: Computed property names are not currently supported. ==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName2.ts (1 errors) ==== var v = { [e]: 1 }; ~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. \ No newline at end of file +!!! error TS9002: Computed property names are not currently supported. \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ComputedPropertyName3.errors.txt b/tests/baselines/reference/parserES5ComputedPropertyName3.errors.txt index 376c1a29ae4..669fd190265 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName3.errors.txt +++ b/tests/baselines/reference/parserES5ComputedPropertyName3.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName3.ts(1,11): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName3.ts(1,11): error TS9002: Computed property names are not currently supported. ==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName3.ts (1 errors) ==== var v = { [e]() { } }; ~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. \ No newline at end of file +!!! error TS9002: Computed property names are not currently supported. \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ComputedPropertyName4.errors.txt b/tests/baselines/reference/parserES5ComputedPropertyName4.errors.txt index e0b816f157c..af0c6e858ad 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName4.errors.txt +++ b/tests/baselines/reference/parserES5ComputedPropertyName4.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName4.ts(1,15): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName4.ts(1,15): error TS9002: Computed property names are not currently supported. ==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName4.ts (1 errors) ==== var v = { get [e]() { } }; ~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. \ No newline at end of file +!!! error TS9002: Computed property names are not currently supported. \ No newline at end of file From 8be44f111c874270bbd59744271dee4ec4e00038 Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Thu, 11 Dec 2014 17:22:22 -0800 Subject: [PATCH 27/78] Don't quote the word 'generators' in error messages Conflicts: src/compiler/diagnosticInformationMap.generated.ts --- src/compiler/diagnosticInformationMap.generated.ts | 6 +++--- src/compiler/diagnosticMessages.json | 2 +- src/compiler/parser.ts | 2 +- .../reference/FunctionDeclaration10_es6.errors.txt | 4 ++-- .../reference/FunctionDeclaration11_es6.errors.txt | 4 ++-- .../reference/FunctionDeclaration13_es6.errors.txt | 4 ++-- .../baselines/reference/FunctionDeclaration1_es6.errors.txt | 4 ++-- .../baselines/reference/FunctionDeclaration6_es6.errors.txt | 4 ++-- .../baselines/reference/FunctionDeclaration7_es6.errors.txt | 4 ++-- .../baselines/reference/FunctionDeclaration9_es6.errors.txt | 4 ++-- .../baselines/reference/FunctionExpression1_es6.errors.txt | 4 ++-- .../baselines/reference/FunctionExpression2_es6.errors.txt | 4 ++-- .../reference/FunctionPropertyAssignments1_es6.errors.txt | 4 ++-- .../reference/FunctionPropertyAssignments5_es6.errors.txt | 4 ++-- .../reference/MemberFunctionDeclaration1_es6.errors.txt | 4 ++-- .../reference/MemberFunctionDeclaration2_es6.errors.txt | 4 ++-- .../reference/MemberFunctionDeclaration3_es6.errors.txt | 4 ++-- .../reference/MemberFunctionDeclaration7_es6.errors.txt | 4 ++-- tests/baselines/reference/YieldExpression10_es6.errors.txt | 4 ++-- tests/baselines/reference/YieldExpression11_es6.errors.txt | 4 ++-- tests/baselines/reference/YieldExpression13_es6.errors.txt | 4 ++-- tests/baselines/reference/YieldExpression16_es6.errors.txt | 4 ++-- tests/baselines/reference/YieldExpression19_es6.errors.txt | 4 ++-- tests/baselines/reference/YieldExpression3_es6.errors.txt | 4 ++-- tests/baselines/reference/YieldExpression4_es6.errors.txt | 4 ++-- tests/baselines/reference/YieldExpression6_es6.errors.txt | 4 ++-- tests/baselines/reference/YieldExpression7_es6.errors.txt | 4 ++-- tests/baselines/reference/YieldExpression8_es6.errors.txt | 4 ++-- tests/baselines/reference/YieldExpression9_es6.errors.txt | 4 ++-- .../reference/templateStringInYieldKeyword.errors.txt | 4 ++-- .../templateStringWithEmbeddedYieldKeywordES6.errors.txt | 4 ++-- tests/baselines/reference/yieldExpression1.errors.txt | 4 ++-- 32 files changed, 63 insertions(+), 63 deletions(-) diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index 60f7dd8588d..9d277bbe549 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -433,8 +433,8 @@ module ts { _0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7023, category: DiagnosticCategory.Error, key: "'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." }, Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7024, category: DiagnosticCategory.Error, key: "Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." }, You_cannot_rename_this_element: { code: 8000, category: DiagnosticCategory.Error, key: "You cannot rename this element." }, - yield_expressions_are_not_currently_supported: { code: 9000, category: DiagnosticCategory.Error, key: "'yield' expressions are not currently supported.", isEarly: true }, - generators_are_not_currently_supported: { code: 9001, category: DiagnosticCategory.Error, key: "'generators' are not currently supported.", isEarly: true }, - Computed_property_names_are_not_currently_supported: { code: 9002, category: DiagnosticCategory.Error, key: "Computed property names are not currently supported.", isEarly: true }, + yield_expressions_are_not_currently_supported: { code: 9000, category: DiagnosticCategory.Error, key: "'yield' expressions are not currently supported." }, + Generators_are_not_currently_supported: { code: 9001, category: DiagnosticCategory.Error, key: "Generators are not currently supported." }, + Computed_property_names_are_not_currently_supported: { code: 9002, category: DiagnosticCategory.Error, key: "Computed property names are not currently supported." }, }; } \ No newline at end of file diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index eb8cf807c97..599009c6c82 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1822,7 +1822,7 @@ "code": 9000, "isEarly": true }, - "'generators' are not currently supported.": { + "Generators are not currently supported.": { "category": "Error", "code": 9001, "isEarly": true diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 7f8d766cc93..7ff154a43ed 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -5060,7 +5060,7 @@ module ts { function checkForGenerator(node: FunctionLikeDeclaration) { if (node.asteriskToken) { - return grammarErrorOnNode(node.asteriskToken, Diagnostics.generators_are_not_currently_supported); + return grammarErrorOnNode(node.asteriskToken, Diagnostics.Generators_are_not_currently_supported); } } diff --git a/tests/baselines/reference/FunctionDeclaration10_es6.errors.txt b/tests/baselines/reference/FunctionDeclaration10_es6.errors.txt index 8c1585c2ec6..8c6b09c82d6 100644 --- a/tests/baselines/reference/FunctionDeclaration10_es6.errors.txt +++ b/tests/baselines/reference/FunctionDeclaration10_es6.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration10_es6.ts(1,10): error TS9001: 'generators' are not currently supported. +tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration10_es6.ts(1,10): error TS9001: Generators are not currently supported. ==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration10_es6.ts (1 errors) ==== function * foo(a = yield => yield) { ~ -!!! error TS9001: 'generators' are not currently supported. +!!! error TS9001: Generators are not currently supported. } \ No newline at end of file diff --git a/tests/baselines/reference/FunctionDeclaration11_es6.errors.txt b/tests/baselines/reference/FunctionDeclaration11_es6.errors.txt index ae307281b75..1dd8c3f6a1b 100644 --- a/tests/baselines/reference/FunctionDeclaration11_es6.errors.txt +++ b/tests/baselines/reference/FunctionDeclaration11_es6.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration11_es6.ts(1,10): error TS9001: 'generators' are not currently supported. +tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration11_es6.ts(1,10): error TS9001: Generators are not currently supported. ==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration11_es6.ts (1 errors) ==== function * yield() { ~ -!!! error TS9001: 'generators' are not currently supported. +!!! error TS9001: Generators are not currently supported. } \ No newline at end of file diff --git a/tests/baselines/reference/FunctionDeclaration13_es6.errors.txt b/tests/baselines/reference/FunctionDeclaration13_es6.errors.txt index 50b6b15d708..a46097e8a1a 100644 --- a/tests/baselines/reference/FunctionDeclaration13_es6.errors.txt +++ b/tests/baselines/reference/FunctionDeclaration13_es6.errors.txt @@ -1,11 +1,11 @@ -tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration13_es6.ts(1,10): error TS9001: 'generators' are not currently supported. +tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration13_es6.ts(1,10): error TS9001: Generators are not currently supported. tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration13_es6.ts(3,11): error TS2304: Cannot find name 'yield'. ==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration13_es6.ts (2 errors) ==== function * foo() { ~ -!!! error TS9001: 'generators' are not currently supported. +!!! error TS9001: Generators are not currently supported. // Legal to use 'yield' in a type context. var v: yield; ~~~~~ diff --git a/tests/baselines/reference/FunctionDeclaration1_es6.errors.txt b/tests/baselines/reference/FunctionDeclaration1_es6.errors.txt index b2fdfba350a..71b09983939 100644 --- a/tests/baselines/reference/FunctionDeclaration1_es6.errors.txt +++ b/tests/baselines/reference/FunctionDeclaration1_es6.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration1_es6.ts(1,10): error TS9001: 'generators' are not currently supported. +tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration1_es6.ts(1,10): error TS9001: Generators are not currently supported. ==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration1_es6.ts (1 errors) ==== function * foo() { ~ -!!! error TS9001: 'generators' are not currently supported. +!!! error TS9001: Generators are not currently supported. } \ No newline at end of file diff --git a/tests/baselines/reference/FunctionDeclaration6_es6.errors.txt b/tests/baselines/reference/FunctionDeclaration6_es6.errors.txt index 657a227822d..b5ea3f494a7 100644 --- a/tests/baselines/reference/FunctionDeclaration6_es6.errors.txt +++ b/tests/baselines/reference/FunctionDeclaration6_es6.errors.txt @@ -1,11 +1,11 @@ -tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration6_es6.ts(1,9): error TS9001: 'generators' are not currently supported. +tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration6_es6.ts(1,9): error TS9001: Generators are not currently supported. tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration6_es6.ts(1,18): error TS2304: Cannot find name 'yield'. ==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration6_es6.ts (2 errors) ==== function*foo(a = yield) { ~ -!!! error TS9001: 'generators' are not currently supported. +!!! error TS9001: Generators are not currently supported. ~~~~~ !!! error TS2304: Cannot find name 'yield'. } \ No newline at end of file diff --git a/tests/baselines/reference/FunctionDeclaration7_es6.errors.txt b/tests/baselines/reference/FunctionDeclaration7_es6.errors.txt index f81fd628eb7..71aff1e2488 100644 --- a/tests/baselines/reference/FunctionDeclaration7_es6.errors.txt +++ b/tests/baselines/reference/FunctionDeclaration7_es6.errors.txt @@ -1,11 +1,11 @@ -tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration7_es6.ts(1,9): error TS9001: 'generators' are not currently supported. +tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration7_es6.ts(1,9): error TS9001: Generators are not currently supported. tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration7_es6.ts(3,20): error TS2304: Cannot find name 'yield'. ==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration7_es6.ts (2 errors) ==== function*bar() { ~ -!!! error TS9001: 'generators' are not currently supported. +!!! error TS9001: Generators are not currently supported. // 'yield' here is an identifier, and not a yield expression. function*foo(a = yield) { ~~~~~ diff --git a/tests/baselines/reference/FunctionDeclaration9_es6.errors.txt b/tests/baselines/reference/FunctionDeclaration9_es6.errors.txt index 7d51bf56ca4..8de32cf0a00 100644 --- a/tests/baselines/reference/FunctionDeclaration9_es6.errors.txt +++ b/tests/baselines/reference/FunctionDeclaration9_es6.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts(1,10): error TS9001: 'generators' are not currently supported. +tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts(1,10): error TS9001: Generators are not currently supported. ==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts (1 errors) ==== function * foo() { ~ -!!! error TS9001: 'generators' are not currently supported. +!!! error TS9001: Generators are not currently supported. var v = { [yield]: foo } } \ No newline at end of file diff --git a/tests/baselines/reference/FunctionExpression1_es6.errors.txt b/tests/baselines/reference/FunctionExpression1_es6.errors.txt index 10ac3379228..979178fd4b7 100644 --- a/tests/baselines/reference/FunctionExpression1_es6.errors.txt +++ b/tests/baselines/reference/FunctionExpression1_es6.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/functionExpressions/FunctionExpression1_es6.ts(1,18): error TS9001: 'generators' are not currently supported. +tests/cases/conformance/es6/functionExpressions/FunctionExpression1_es6.ts(1,18): error TS9001: Generators are not currently supported. ==== tests/cases/conformance/es6/functionExpressions/FunctionExpression1_es6.ts (1 errors) ==== var v = function * () { } ~ -!!! error TS9001: 'generators' are not currently supported. \ No newline at end of file +!!! error TS9001: Generators are not currently supported. \ No newline at end of file diff --git a/tests/baselines/reference/FunctionExpression2_es6.errors.txt b/tests/baselines/reference/FunctionExpression2_es6.errors.txt index a95cffcdbeb..ab27947d7c5 100644 --- a/tests/baselines/reference/FunctionExpression2_es6.errors.txt +++ b/tests/baselines/reference/FunctionExpression2_es6.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/functionExpressions/FunctionExpression2_es6.ts(1,18): error TS9001: 'generators' are not currently supported. +tests/cases/conformance/es6/functionExpressions/FunctionExpression2_es6.ts(1,18): error TS9001: Generators are not currently supported. ==== tests/cases/conformance/es6/functionExpressions/FunctionExpression2_es6.ts (1 errors) ==== var v = function * foo() { } ~ -!!! error TS9001: 'generators' are not currently supported. \ No newline at end of file +!!! error TS9001: Generators are not currently supported. \ No newline at end of file diff --git a/tests/baselines/reference/FunctionPropertyAssignments1_es6.errors.txt b/tests/baselines/reference/FunctionPropertyAssignments1_es6.errors.txt index 53b2a016317..bbabbc97463 100644 --- a/tests/baselines/reference/FunctionPropertyAssignments1_es6.errors.txt +++ b/tests/baselines/reference/FunctionPropertyAssignments1_es6.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments1_es6.ts(1,11): error TS9001: 'generators' are not currently supported. +tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments1_es6.ts(1,11): error TS9001: Generators are not currently supported. ==== tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments1_es6.ts (1 errors) ==== var v = { *foo() { } } ~ -!!! error TS9001: 'generators' are not currently supported. \ No newline at end of file +!!! error TS9001: Generators are not currently supported. \ No newline at end of file diff --git a/tests/baselines/reference/FunctionPropertyAssignments5_es6.errors.txt b/tests/baselines/reference/FunctionPropertyAssignments5_es6.errors.txt index b3415c27f29..393ede66a60 100644 --- a/tests/baselines/reference/FunctionPropertyAssignments5_es6.errors.txt +++ b/tests/baselines/reference/FunctionPropertyAssignments5_es6.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts(1,11): error TS9001: 'generators' are not currently supported. +tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts(1,11): error TS9001: Generators are not currently supported. ==== tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts (1 errors) ==== var v = { *[foo()]() { } } ~ -!!! error TS9001: 'generators' are not currently supported. \ No newline at end of file +!!! error TS9001: Generators are not currently supported. \ No newline at end of file diff --git a/tests/baselines/reference/MemberFunctionDeclaration1_es6.errors.txt b/tests/baselines/reference/MemberFunctionDeclaration1_es6.errors.txt index f50934ea705..9d4e312ed22 100644 --- a/tests/baselines/reference/MemberFunctionDeclaration1_es6.errors.txt +++ b/tests/baselines/reference/MemberFunctionDeclaration1_es6.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration1_es6.ts(2,4): error TS9001: 'generators' are not currently supported. +tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration1_es6.ts(2,4): error TS9001: Generators are not currently supported. ==== tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration1_es6.ts (1 errors) ==== class C { *foo() { } ~ -!!! error TS9001: 'generators' are not currently supported. +!!! error TS9001: Generators are not currently supported. } \ No newline at end of file diff --git a/tests/baselines/reference/MemberFunctionDeclaration2_es6.errors.txt b/tests/baselines/reference/MemberFunctionDeclaration2_es6.errors.txt index 667e0e5e58d..6373c800994 100644 --- a/tests/baselines/reference/MemberFunctionDeclaration2_es6.errors.txt +++ b/tests/baselines/reference/MemberFunctionDeclaration2_es6.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration2_es6.ts(2,11): error TS9001: 'generators' are not currently supported. +tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration2_es6.ts(2,11): error TS9001: Generators are not currently supported. ==== tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration2_es6.ts (1 errors) ==== class C { public * foo() { } ~ -!!! error TS9001: 'generators' are not currently supported. +!!! error TS9001: Generators are not currently supported. } \ No newline at end of file diff --git a/tests/baselines/reference/MemberFunctionDeclaration3_es6.errors.txt b/tests/baselines/reference/MemberFunctionDeclaration3_es6.errors.txt index b61137f1f3d..b43e266e2a5 100644 --- a/tests/baselines/reference/MemberFunctionDeclaration3_es6.errors.txt +++ b/tests/baselines/reference/MemberFunctionDeclaration3_es6.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration3_es6.ts(2,4): error TS9001: 'generators' are not currently supported. +tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration3_es6.ts(2,4): error TS9001: Generators are not currently supported. ==== tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration3_es6.ts (1 errors) ==== class C { *[foo]() { } ~ -!!! error TS9001: 'generators' are not currently supported. +!!! error TS9001: Generators are not currently supported. } \ No newline at end of file diff --git a/tests/baselines/reference/MemberFunctionDeclaration7_es6.errors.txt b/tests/baselines/reference/MemberFunctionDeclaration7_es6.errors.txt index 40afaf5bc65..ea87da50ed3 100644 --- a/tests/baselines/reference/MemberFunctionDeclaration7_es6.errors.txt +++ b/tests/baselines/reference/MemberFunctionDeclaration7_es6.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration7_es6.ts(2,4): error TS9001: 'generators' are not currently supported. +tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration7_es6.ts(2,4): error TS9001: Generators are not currently supported. ==== tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration7_es6.ts (1 errors) ==== class C { *foo() { } ~ -!!! error TS9001: 'generators' are not currently supported. +!!! error TS9001: Generators are not currently supported. } \ No newline at end of file diff --git a/tests/baselines/reference/YieldExpression10_es6.errors.txt b/tests/baselines/reference/YieldExpression10_es6.errors.txt index e2e52a0c5be..41d6bb5bf24 100644 --- a/tests/baselines/reference/YieldExpression10_es6.errors.txt +++ b/tests/baselines/reference/YieldExpression10_es6.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/es6/yieldExpressions/YieldExpression10_es6.ts(1,11): error TS9001: 'generators' are not currently supported. +tests/cases/conformance/es6/yieldExpressions/YieldExpression10_es6.ts(1,11): error TS9001: Generators are not currently supported. ==== tests/cases/conformance/es6/yieldExpressions/YieldExpression10_es6.ts (1 errors) ==== var v = { * foo() { ~ -!!! error TS9001: 'generators' are not currently supported. +!!! error TS9001: Generators are not currently supported. yield(foo); } } diff --git a/tests/baselines/reference/YieldExpression11_es6.errors.txt b/tests/baselines/reference/YieldExpression11_es6.errors.txt index 534d8b17bf2..eea108619bc 100644 --- a/tests/baselines/reference/YieldExpression11_es6.errors.txt +++ b/tests/baselines/reference/YieldExpression11_es6.errors.txt @@ -1,11 +1,11 @@ -tests/cases/conformance/es6/yieldExpressions/YieldExpression11_es6.ts(2,3): error TS9001: 'generators' are not currently supported. +tests/cases/conformance/es6/yieldExpressions/YieldExpression11_es6.ts(2,3): error TS9001: Generators are not currently supported. ==== tests/cases/conformance/es6/yieldExpressions/YieldExpression11_es6.ts (1 errors) ==== class C { *foo() { ~ -!!! error TS9001: 'generators' are not currently supported. +!!! error TS9001: Generators are not currently supported. yield(foo); } } \ No newline at end of file diff --git a/tests/baselines/reference/YieldExpression13_es6.errors.txt b/tests/baselines/reference/YieldExpression13_es6.errors.txt index 1d2cd4e3c25..185fb2f6193 100644 --- a/tests/baselines/reference/YieldExpression13_es6.errors.txt +++ b/tests/baselines/reference/YieldExpression13_es6.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/yieldExpressions/YieldExpression13_es6.ts(1,9): error TS9001: 'generators' are not currently supported. +tests/cases/conformance/es6/yieldExpressions/YieldExpression13_es6.ts(1,9): error TS9001: Generators are not currently supported. ==== tests/cases/conformance/es6/yieldExpressions/YieldExpression13_es6.ts (1 errors) ==== function* foo() { yield } ~ -!!! error TS9001: 'generators' are not currently supported. \ No newline at end of file +!!! error TS9001: Generators are not currently supported. \ No newline at end of file diff --git a/tests/baselines/reference/YieldExpression16_es6.errors.txt b/tests/baselines/reference/YieldExpression16_es6.errors.txt index 1963539d4a8..54536a7d4fe 100644 --- a/tests/baselines/reference/YieldExpression16_es6.errors.txt +++ b/tests/baselines/reference/YieldExpression16_es6.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/es6/yieldExpressions/YieldExpression16_es6.ts(1,9): error TS9001: 'generators' are not currently supported. +tests/cases/conformance/es6/yieldExpressions/YieldExpression16_es6.ts(1,9): error TS9001: Generators are not currently supported. ==== tests/cases/conformance/es6/yieldExpressions/YieldExpression16_es6.ts (1 errors) ==== function* foo() { ~ -!!! error TS9001: 'generators' are not currently supported. +!!! error TS9001: Generators are not currently supported. function bar() { yield foo; } diff --git a/tests/baselines/reference/YieldExpression19_es6.errors.txt b/tests/baselines/reference/YieldExpression19_es6.errors.txt index a427ab18f70..81cf0e2063c 100644 --- a/tests/baselines/reference/YieldExpression19_es6.errors.txt +++ b/tests/baselines/reference/YieldExpression19_es6.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/es6/yieldExpressions/YieldExpression19_es6.ts(1,9): error TS9001: 'generators' are not currently supported. +tests/cases/conformance/es6/yieldExpressions/YieldExpression19_es6.ts(1,9): error TS9001: Generators are not currently supported. ==== tests/cases/conformance/es6/yieldExpressions/YieldExpression19_es6.ts (1 errors) ==== function*foo() { ~ -!!! error TS9001: 'generators' are not currently supported. +!!! error TS9001: Generators are not currently supported. function bar() { function* quux() { yield(foo); diff --git a/tests/baselines/reference/YieldExpression3_es6.errors.txt b/tests/baselines/reference/YieldExpression3_es6.errors.txt index 9983eefc9a6..91da79fbb53 100644 --- a/tests/baselines/reference/YieldExpression3_es6.errors.txt +++ b/tests/baselines/reference/YieldExpression3_es6.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/es6/yieldExpressions/YieldExpression3_es6.ts(1,9): error TS9001: 'generators' are not currently supported. +tests/cases/conformance/es6/yieldExpressions/YieldExpression3_es6.ts(1,9): error TS9001: Generators are not currently supported. ==== tests/cases/conformance/es6/yieldExpressions/YieldExpression3_es6.ts (1 errors) ==== function* foo() { ~ -!!! error TS9001: 'generators' are not currently supported. +!!! error TS9001: Generators are not currently supported. yield yield } \ No newline at end of file diff --git a/tests/baselines/reference/YieldExpression4_es6.errors.txt b/tests/baselines/reference/YieldExpression4_es6.errors.txt index 58d1326ba59..ca7ed3d354c 100644 --- a/tests/baselines/reference/YieldExpression4_es6.errors.txt +++ b/tests/baselines/reference/YieldExpression4_es6.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/es6/yieldExpressions/YieldExpression4_es6.ts(1,9): error TS9001: 'generators' are not currently supported. +tests/cases/conformance/es6/yieldExpressions/YieldExpression4_es6.ts(1,9): error TS9001: Generators are not currently supported. ==== tests/cases/conformance/es6/yieldExpressions/YieldExpression4_es6.ts (1 errors) ==== function* foo() { ~ -!!! error TS9001: 'generators' are not currently supported. +!!! error TS9001: Generators are not currently supported. yield; yield; } \ No newline at end of file diff --git a/tests/baselines/reference/YieldExpression6_es6.errors.txt b/tests/baselines/reference/YieldExpression6_es6.errors.txt index 5ef38d249d5..d8ce78a300f 100644 --- a/tests/baselines/reference/YieldExpression6_es6.errors.txt +++ b/tests/baselines/reference/YieldExpression6_es6.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/es6/yieldExpressions/YieldExpression6_es6.ts(1,9): error TS9001: 'generators' are not currently supported. +tests/cases/conformance/es6/yieldExpressions/YieldExpression6_es6.ts(1,9): error TS9001: Generators are not currently supported. ==== tests/cases/conformance/es6/yieldExpressions/YieldExpression6_es6.ts (1 errors) ==== function* foo() { ~ -!!! error TS9001: 'generators' are not currently supported. +!!! error TS9001: Generators are not currently supported. yield*foo } \ No newline at end of file diff --git a/tests/baselines/reference/YieldExpression7_es6.errors.txt b/tests/baselines/reference/YieldExpression7_es6.errors.txt index 11914f6fbb4..87b15ac9f71 100644 --- a/tests/baselines/reference/YieldExpression7_es6.errors.txt +++ b/tests/baselines/reference/YieldExpression7_es6.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/es6/yieldExpressions/YieldExpression7_es6.ts(1,9): error TS9001: 'generators' are not currently supported. +tests/cases/conformance/es6/yieldExpressions/YieldExpression7_es6.ts(1,9): error TS9001: Generators are not currently supported. ==== tests/cases/conformance/es6/yieldExpressions/YieldExpression7_es6.ts (1 errors) ==== function* foo() { ~ -!!! error TS9001: 'generators' are not currently supported. +!!! error TS9001: Generators are not currently supported. yield foo } \ No newline at end of file diff --git a/tests/baselines/reference/YieldExpression8_es6.errors.txt b/tests/baselines/reference/YieldExpression8_es6.errors.txt index 591c1fade08..77bd03382aa 100644 --- a/tests/baselines/reference/YieldExpression8_es6.errors.txt +++ b/tests/baselines/reference/YieldExpression8_es6.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/es6/yieldExpressions/YieldExpression8_es6.ts(2,9): error TS9001: 'generators' are not currently supported. +tests/cases/conformance/es6/yieldExpressions/YieldExpression8_es6.ts(2,9): error TS9001: Generators are not currently supported. tests/cases/conformance/es6/yieldExpressions/YieldExpression8_es6.ts(1,1): error TS2304: Cannot find name 'yield'. @@ -8,6 +8,6 @@ tests/cases/conformance/es6/yieldExpressions/YieldExpression8_es6.ts(1,1): error !!! error TS2304: Cannot find name 'yield'. function* foo() { ~ -!!! error TS9001: 'generators' are not currently supported. +!!! error TS9001: Generators are not currently supported. yield(foo); } \ No newline at end of file diff --git a/tests/baselines/reference/YieldExpression9_es6.errors.txt b/tests/baselines/reference/YieldExpression9_es6.errors.txt index 108028d2282..ae1b105903a 100644 --- a/tests/baselines/reference/YieldExpression9_es6.errors.txt +++ b/tests/baselines/reference/YieldExpression9_es6.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/es6/yieldExpressions/YieldExpression9_es6.ts(1,17): error TS9001: 'generators' are not currently supported. +tests/cases/conformance/es6/yieldExpressions/YieldExpression9_es6.ts(1,17): error TS9001: Generators are not currently supported. ==== tests/cases/conformance/es6/yieldExpressions/YieldExpression9_es6.ts (1 errors) ==== var v = function*() { ~ -!!! error TS9001: 'generators' are not currently supported. +!!! error TS9001: Generators are not currently supported. yield(foo); } \ No newline at end of file diff --git a/tests/baselines/reference/templateStringInYieldKeyword.errors.txt b/tests/baselines/reference/templateStringInYieldKeyword.errors.txt index b12b552d5f0..24d64d8f29e 100644 --- a/tests/baselines/reference/templateStringInYieldKeyword.errors.txt +++ b/tests/baselines/reference/templateStringInYieldKeyword.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/es6/templates/templateStringInYieldKeyword.ts(1,9): error TS9001: 'generators' are not currently supported. +tests/cases/conformance/es6/templates/templateStringInYieldKeyword.ts(1,9): error TS9001: Generators are not currently supported. ==== tests/cases/conformance/es6/templates/templateStringInYieldKeyword.ts (1 errors) ==== function* gen() { ~ -!!! error TS9001: 'generators' are not currently supported. +!!! error TS9001: Generators are not currently supported. // Once this is supported, the inner expression does not need to be parenthesized. var x = yield `abc${ x }def`; } diff --git a/tests/baselines/reference/templateStringWithEmbeddedYieldKeywordES6.errors.txt b/tests/baselines/reference/templateStringWithEmbeddedYieldKeywordES6.errors.txt index 5270e79679e..20542cb12b7 100644 --- a/tests/baselines/reference/templateStringWithEmbeddedYieldKeywordES6.errors.txt +++ b/tests/baselines/reference/templateStringWithEmbeddedYieldKeywordES6.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/es6/templates/templateStringWithEmbeddedYieldKeywordES6.ts(1,9): error TS9001: 'generators' are not currently supported. +tests/cases/conformance/es6/templates/templateStringWithEmbeddedYieldKeywordES6.ts(1,9): error TS9001: Generators are not currently supported. ==== tests/cases/conformance/es6/templates/templateStringWithEmbeddedYieldKeywordES6.ts (1 errors) ==== function* gen() { ~ -!!! error TS9001: 'generators' are not currently supported. +!!! error TS9001: Generators are not currently supported. // Once this is supported, yield *must* be parenthesized. var x = `abc${ yield 10 }def`; } diff --git a/tests/baselines/reference/yieldExpression1.errors.txt b/tests/baselines/reference/yieldExpression1.errors.txt index ecac77698c5..33d9c1bf62e 100644 --- a/tests/baselines/reference/yieldExpression1.errors.txt +++ b/tests/baselines/reference/yieldExpression1.errors.txt @@ -1,9 +1,9 @@ -tests/cases/compiler/yieldExpression1.ts(1,9): error TS9001: 'generators' are not currently supported. +tests/cases/compiler/yieldExpression1.ts(1,9): error TS9001: Generators are not currently supported. ==== tests/cases/compiler/yieldExpression1.ts (1 errors) ==== function* foo() { ~ -!!! error TS9001: 'generators' are not currently supported. +!!! error TS9001: Generators are not currently supported. yield } \ No newline at end of file From 00449d80a3868bfee70bcea8807a899119a1ee7b Mon Sep 17 00:00:00 2001 From: Yui T Date: Fri, 12 Dec 2014 12:47:19 -0800 Subject: [PATCH 28/78] Merge disallow computed property grammar error; there are still errors from generator and the fact that other grammar check haven't moved yet --- src/compiler/checker.ts | 16 ++++++++++++++++ .../diagnosticInformationMap.generated.ts | 6 +++--- src/compiler/diagnosticMessages.json | 1 + .../reference/computedPropertyNames2.errors.txt | 12 ++++++------ .../reference/computedPropertyNames3.errors.txt | 12 ++++++------ 5 files changed, 32 insertions(+), 15 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 91f806e0518..154293870fa 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -7155,6 +7155,11 @@ module ts { } function checkMethodDeclaration(node: MethodDeclaration) { + // Grammar checking + if (node.name.kind === SyntaxKind.ComputedPropertyName) { + checkGrammarComputedPropertyName(node.name); + } + checkFunctionLikeDeclaration(node); } @@ -7242,6 +7247,11 @@ module ts { } function checkAccessorDeclaration(node: AccessorDeclaration) { + // Grammar checking + if (node.name.kind === SyntaxKind.ComputedPropertyName) { + checkGrammarComputedPropertyName(node.name); + } + if (fullTypeCheck) { if (node.kind === SyntaxKind.GetAccessor) { if (!isInAmbientContext(node) && node.body && !(bodyContainsAReturnStatement(node.body) || bodyContainsSingleThrowStatement(node.body))) { @@ -10000,12 +10010,18 @@ module ts { } function checkGrammarComputedPropertyName(node: ComputedPropertyName): void { + // Since computed properties are not supported in the type checker, disallow them in TypeScript 1.4 + // Once full support is added, remove this error. + grammarErrorOnNode(node, Diagnostics.Computed_property_names_are_not_currently_supported); + + /* TODO (jfreeman) if (compilerOptions.target < ScriptTarget.ES6) { grammarErrorOnNode(node, Diagnostics.Computed_property_names_are_only_available_when_targeting_ECMAScript_6_and_higher); } else if (node.expression.kind === SyntaxKind.BinaryExpression && (node.expression).operator === SyntaxKind.CommaToken) { grammarErrorOnNode(node.expression, Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name); } + */ } function hasParseDiagnostics(sourceFile: SourceFile): boolean { diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index 9d277bbe549..f955683dbff 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -433,8 +433,8 @@ module ts { _0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7023, category: DiagnosticCategory.Error, key: "'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." }, Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7024, category: DiagnosticCategory.Error, key: "Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." }, You_cannot_rename_this_element: { code: 8000, category: DiagnosticCategory.Error, key: "You cannot rename this element." }, - yield_expressions_are_not_currently_supported: { code: 9000, category: DiagnosticCategory.Error, key: "'yield' expressions are not currently supported." }, - Generators_are_not_currently_supported: { code: 9001, category: DiagnosticCategory.Error, key: "Generators are not currently supported." }, - Computed_property_names_are_not_currently_supported: { code: 9002, category: DiagnosticCategory.Error, key: "Computed property names are not currently supported." }, + yield_expressions_are_not_currently_supported: { code: 9000, category: DiagnosticCategory.Error, key: "'yield' expressions are not currently supported.", isEarly: true }, + Generators_are_not_currently_supported: { code: 9001, category: DiagnosticCategory.Error, key: "Generators are not currently supported.", isEarly: true }, + Computed_property_names_are_not_currently_supported: { code: 9002, category: DiagnosticCategory.Error, key: "Computed property names are not currently supported.", isEarly: true }, }; } \ No newline at end of file diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 599009c6c82..261fc77db36 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1830,5 +1830,6 @@ "Computed property names are not currently supported.": { "category": "Error", "code": 9002, + "isEarly": true } } diff --git a/tests/baselines/reference/computedPropertyNames2.errors.txt b/tests/baselines/reference/computedPropertyNames2.errors.txt index e7cc84a8f6e..3dd4ac01d5f 100644 --- a/tests/baselines/reference/computedPropertyNames2.errors.txt +++ b/tests/baselines/reference/computedPropertyNames2.errors.txt @@ -1,11 +1,11 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts(4,5): error TS9002: Computed property names are not currently supported. tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts(5,12): error TS9002: Computed property names are not currently supported. +tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts(6,9): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts(6,9): error TS9002: Computed property names are not currently supported. tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts(7,9): error TS9002: Computed property names are not currently supported. +tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts(8,16): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts(8,16): error TS9002: Computed property names are not currently supported. tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts(9,16): error TS9002: Computed property names are not currently supported. -tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts(6,9): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. -tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts(8,16): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. ==== tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts (8 errors) ==== @@ -20,17 +20,17 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts(8,16): !!! error TS9002: Computed property names are not currently supported. get [accessorName]() { } ~~~~~~~~~~~~~~ -!!! error TS9002: Computed property names are not currently supported. - ~~~~~~~~~~~~~~ !!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. + ~~~~~~~~~~~~~~ +!!! error TS9002: Computed property names are not currently supported. set [accessorName](v) { } ~~~~~~~~~~~~~~ !!! error TS9002: Computed property names are not currently supported. static get [accessorName]() { } ~~~~~~~~~~~~~~ -!!! error TS9002: Computed property names are not currently supported. - ~~~~~~~~~~~~~~ !!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. + ~~~~~~~~~~~~~~ +!!! error TS9002: Computed property names are not currently supported. static set [accessorName](v) { } ~~~~~~~~~~~~~~ !!! error TS9002: Computed property names are not currently supported. diff --git a/tests/baselines/reference/computedPropertyNames3.errors.txt b/tests/baselines/reference/computedPropertyNames3.errors.txt index a1d6e09421b..084a1f8889f 100644 --- a/tests/baselines/reference/computedPropertyNames3.errors.txt +++ b/tests/baselines/reference/computedPropertyNames3.errors.txt @@ -1,11 +1,11 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(3,5): error TS9002: Computed property names are not currently supported. tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(4,12): error TS9002: Computed property names are not currently supported. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(5,9): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(5,9): error TS9002: Computed property names are not currently supported. tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(6,9): error TS9002: Computed property names are not currently supported. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(7,16): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(7,16): error TS9002: Computed property names are not currently supported. tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(8,16): error TS9002: Computed property names are not currently supported. -tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(5,9): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. -tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(7,16): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. ==== tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts (8 errors) ==== @@ -19,17 +19,17 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(7,16): !!! error TS9002: Computed property names are not currently supported. get [delete id]() { } ~~~~~~~~~~~ -!!! error TS9002: Computed property names are not currently supported. - ~~~~~~~~~~~ !!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. + ~~~~~~~~~~~ +!!! error TS9002: Computed property names are not currently supported. set [[0, 1]](v) { } ~~~~~~~~ !!! error TS9002: Computed property names are not currently supported. static get [""]() { } ~~~~~~~~~~~~ -!!! error TS9002: Computed property names are not currently supported. - ~~~~~~~~~~~~ !!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. + ~~~~~~~~~~~~ +!!! error TS9002: Computed property names are not currently supported. static set [id.toString()](v) { } ~~~~~~~~~~~~~~~ !!! error TS9002: Computed property names are not currently supported. From 90e1d4244f5a3084411f2828e000b07d51a00e9f Mon Sep 17 00:00:00 2001 From: Yui T Date: Fri, 12 Dec 2014 12:59:00 -0800 Subject: [PATCH 29/78] Move grammar check: deleteExpression --- src/compiler/checker.ts | 7 +++++++ src/compiler/parser.ts | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 154293870fa..a451fcfb80a 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -6555,6 +6555,13 @@ module ts { } function checkDeleteExpression(node: DeleteExpression): Type { + // Grammar checking + if (node.parserContextFlags & ParserContextFlags.StrictMode && node.expression.kind === SyntaxKind.Identifier) { + // When a delete operator occurs within strict mode code, a SyntaxError is thrown if its + // UnaryExpression is a direct reference to a variable, function argument, or function name + grammarErrorOnNode(node.expression, Diagnostics.delete_cannot_be_called_on_an_identifier_in_strict_mode); + } + var operandType = checkExpression(node.expression); return booleanType; } diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 7ff154a43ed..6e393fcc8fc 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -4640,7 +4640,7 @@ module ts { //case SyntaxKind.ClassDeclaration: return checkClassDeclaration(node); //case SyntaxKind.ComputedPropertyName: return checkComputedPropertyName(node); case SyntaxKind.Constructor: return checkConstructor(node); - case SyntaxKind.DeleteExpression: return checkDeleteExpression( node); + //case SyntaxKind.DeleteExpression: return checkDeleteExpression( node); case SyntaxKind.ElementAccessExpression: return checkElementAccessExpression(node); case SyntaxKind.ExportAssignment: return checkExportAssignment(node); case SyntaxKind.ExternalModuleReference: return checkExternalModuleReference(node); From afc04c8db88dc2692067aecebee3bbb04aa7d054 Mon Sep 17 00:00:00 2001 From: Yui T Date: Fri, 12 Dec 2014 13:16:19 -0800 Subject: [PATCH 30/78] Move type checking: elementAccessExpression; there are still errors from not moving other grammar checking into type checker --- src/compiler/checker.ts | 15 ++++++++++++ src/compiler/parser.ts | 2 +- .../reference/badArrayIndex.errors.txt | 8 +++---- ...annotInvokeNewOnErrorExpression.errors.txt | 8 +++---- .../reference/createArray.errors.txt | 18 +++++++------- .../baselines/reference/libMembers.errors.txt | 2 +- ...rserObjectCreationArrayLiteral1.errors.txt | 8 +++---- ...rserObjectCreationArrayLiteral3.errors.txt | 8 +++---- .../reference/parserRealSource10.errors.txt | 24 +++++++++---------- .../reference/parserRealSource11.errors.txt | 6 ++--- .../reference/parserRealSource7.errors.txt | 6 ++--- .../reference/parserRealSource9.errors.txt | 6 ++--- 12 files changed, 63 insertions(+), 48 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index a451fcfb80a..490b1ae9182 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -5555,6 +5555,21 @@ module ts { } function checkIndexedAccess(node: ElementAccessExpression): Type { + // Grammar checking + if (!node.argumentExpression) { + var sourceFile = getSourceFile(node); + if (node.parent.kind === SyntaxKind.NewExpression && (node.parent).expression === node) { + var start = skipTrivia(sourceFile.text, node.expression.end); + var end = node.end; + grammarErrorAtPos(sourceFile, start, end - start, Diagnostics.new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead); + } + else { + var start = node.end - "]".length; + var end = node.end; + grammarErrorAtPos(sourceFile, start, end - start, Diagnostics.Expression_expected); + } + } + // Obtain base constraint such that we can bail out if the constraint is an unknown type var objectType = getApparentType(checkExpression(node.expression)); var indexType = node.argumentExpression ? checkExpression(node.argumentExpression) : unknownType; diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 6e393fcc8fc..a26d928bf1c 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -4641,7 +4641,7 @@ module ts { //case SyntaxKind.ComputedPropertyName: return checkComputedPropertyName(node); case SyntaxKind.Constructor: return checkConstructor(node); //case SyntaxKind.DeleteExpression: return checkDeleteExpression( node); - case SyntaxKind.ElementAccessExpression: return checkElementAccessExpression(node); + //case SyntaxKind.ElementAccessExpression: return checkElementAccessExpression(node); case SyntaxKind.ExportAssignment: return checkExportAssignment(node); case SyntaxKind.ExternalModuleReference: return checkExternalModuleReference(node); case SyntaxKind.ForInStatement: return checkForInStatement(node); diff --git a/tests/baselines/reference/badArrayIndex.errors.txt b/tests/baselines/reference/badArrayIndex.errors.txt index 818870f6c26..4830ff1f693 100644 --- a/tests/baselines/reference/badArrayIndex.errors.txt +++ b/tests/baselines/reference/badArrayIndex.errors.txt @@ -1,10 +1,10 @@ -tests/cases/compiler/badArrayIndex.ts(1,22): error TS1109: Expression expected. tests/cases/compiler/badArrayIndex.ts(1,15): error TS2304: Cannot find name 'number'. +tests/cases/compiler/badArrayIndex.ts(1,22): error TS1109: Expression expected. ==== tests/cases/compiler/badArrayIndex.ts (2 errors) ==== var results = number[]; - ~ -!!! error TS1109: Expression expected. ~~~~~~ -!!! error TS2304: Cannot find name 'number'. \ No newline at end of file +!!! error TS2304: Cannot find name 'number'. + ~ +!!! error TS1109: Expression expected. \ No newline at end of file diff --git a/tests/baselines/reference/cannotInvokeNewOnErrorExpression.errors.txt b/tests/baselines/reference/cannotInvokeNewOnErrorExpression.errors.txt index cfb9287cdbc..fab981a8571 100644 --- a/tests/baselines/reference/cannotInvokeNewOnErrorExpression.errors.txt +++ b/tests/baselines/reference/cannotInvokeNewOnErrorExpression.errors.txt @@ -1,5 +1,5 @@ -tests/cases/compiler/cannotInvokeNewOnErrorExpression.ts(5,21): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. tests/cases/compiler/cannotInvokeNewOnErrorExpression.ts(5,15): error TS2339: Property 'ClassA' does not exist on type 'typeof M'. +tests/cases/compiler/cannotInvokeNewOnErrorExpression.ts(5,21): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. ==== tests/cases/compiler/cannotInvokeNewOnErrorExpression.ts (2 errors) ==== @@ -8,7 +8,7 @@ tests/cases/compiler/cannotInvokeNewOnErrorExpression.ts(5,15): error TS2339: Pr class ClassA {} } var t = new M.ClassA[]; - ~~ -!!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. ~~~~~~ -!!! error TS2339: Property 'ClassA' does not exist on type 'typeof M'. \ No newline at end of file +!!! error TS2339: Property 'ClassA' does not exist on type 'typeof M'. + ~~ +!!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. \ No newline at end of file diff --git a/tests/baselines/reference/createArray.errors.txt b/tests/baselines/reference/createArray.errors.txt index 6f79c4b47d2..31f6b880030 100644 --- a/tests/baselines/reference/createArray.errors.txt +++ b/tests/baselines/reference/createArray.errors.txt @@ -1,18 +1,18 @@ +tests/cases/compiler/createArray.ts(1,12): error TS2304: Cannot find name 'number'. tests/cases/compiler/createArray.ts(1,18): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. tests/cases/compiler/createArray.ts(6,6): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. -tests/cases/compiler/createArray.ts(7,19): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. -tests/cases/compiler/createArray.ts(8,18): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. -tests/cases/compiler/createArray.ts(1,12): error TS2304: Cannot find name 'number'. tests/cases/compiler/createArray.ts(7,12): error TS2304: Cannot find name 'boolean'. +tests/cases/compiler/createArray.ts(7,19): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. tests/cases/compiler/createArray.ts(8,12): error TS2304: Cannot find name 'string'. +tests/cases/compiler/createArray.ts(8,18): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. ==== tests/cases/compiler/createArray.ts (7 errors) ==== var na=new number[]; - ~~ -!!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. ~~~~~~ !!! error TS2304: Cannot find name 'number'. + ~~ +!!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. class C { } @@ -21,15 +21,15 @@ tests/cases/compiler/createArray.ts(8,12): error TS2304: Cannot find name 'strin ~~ !!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. var ba=new boolean[]; - ~~ -!!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. ~~~~~~~ !!! error TS2304: Cannot find name 'boolean'. - var sa=new string[]; - ~~ + ~~ !!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. + var sa=new string[]; ~~~~~~ !!! error TS2304: Cannot find name 'string'. + ~~ +!!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. function f(s:string):number { return 0; } if (ba[14]) { diff --git a/tests/baselines/reference/libMembers.errors.txt b/tests/baselines/reference/libMembers.errors.txt index a6af67821b3..4b025b9a95b 100644 --- a/tests/baselines/reference/libMembers.errors.txt +++ b/tests/baselines/reference/libMembers.errors.txt @@ -1,5 +1,5 @@ -tests/cases/compiler/libMembers.ts(9,16): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. tests/cases/compiler/libMembers.ts(4,3): error TS2339: Property 'subby' does not exist on type 'string'. +tests/cases/compiler/libMembers.ts(9,16): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. tests/cases/compiler/libMembers.ts(12,15): error TS2339: Property 'prototype' does not exist on type 'C'. diff --git a/tests/baselines/reference/parserObjectCreationArrayLiteral1.errors.txt b/tests/baselines/reference/parserObjectCreationArrayLiteral1.errors.txt index 04be3a6d041..051d2357635 100644 --- a/tests/baselines/reference/parserObjectCreationArrayLiteral1.errors.txt +++ b/tests/baselines/reference/parserObjectCreationArrayLiteral1.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/parser/ecmascript5/parserObjectCreationArrayLiteral1.ts(1,8): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. tests/cases/conformance/parser/ecmascript5/parserObjectCreationArrayLiteral1.ts(1,5): error TS2304: Cannot find name 'Foo'. +tests/cases/conformance/parser/ecmascript5/parserObjectCreationArrayLiteral1.ts(1,8): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. ==== tests/cases/conformance/parser/ecmascript5/parserObjectCreationArrayLiteral1.ts (2 errors) ==== new Foo[]; - ~~ -!!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. ~~~ -!!! error TS2304: Cannot find name 'Foo'. \ No newline at end of file +!!! error TS2304: Cannot find name 'Foo'. + ~~ +!!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. \ No newline at end of file diff --git a/tests/baselines/reference/parserObjectCreationArrayLiteral3.errors.txt b/tests/baselines/reference/parserObjectCreationArrayLiteral3.errors.txt index 89f861cfcdb..b7d18f471da 100644 --- a/tests/baselines/reference/parserObjectCreationArrayLiteral3.errors.txt +++ b/tests/baselines/reference/parserObjectCreationArrayLiteral3.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/parser/ecmascript5/parserObjectCreationArrayLiteral3.ts(1,8): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. tests/cases/conformance/parser/ecmascript5/parserObjectCreationArrayLiteral3.ts(1,5): error TS2304: Cannot find name 'Foo'. +tests/cases/conformance/parser/ecmascript5/parserObjectCreationArrayLiteral3.ts(1,8): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. ==== tests/cases/conformance/parser/ecmascript5/parserObjectCreationArrayLiteral3.ts (2 errors) ==== new Foo[](); - ~~ -!!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. ~~~ -!!! error TS2304: Cannot find name 'Foo'. \ No newline at end of file +!!! error TS2304: Cannot find name 'Foo'. + ~~ +!!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. \ No newline at end of file diff --git a/tests/baselines/reference/parserRealSource10.errors.txt b/tests/baselines/reference/parserRealSource10.errors.txt index aabafd751e7..b3c40202c4f 100644 --- a/tests/baselines/reference/parserRealSource10.errors.txt +++ b/tests/baselines/reference/parserRealSource10.errors.txt @@ -1,12 +1,11 @@ tests/cases/conformance/parser/ecmascript5/parserRealSource10.ts(4,1): error TS6053: File 'tests/cases/conformance/parser/ecmascript5/typescript.ts' not found. tests/cases/conformance/parser/ecmascript5/parserRealSource10.ts(127,42): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. -tests/cases/conformance/parser/ecmascript5/parserRealSource10.ts(128,42): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. -tests/cases/conformance/parser/ecmascript5/parserRealSource10.ts(129,47): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. -tests/cases/conformance/parser/ecmascript5/parserRealSource10.ts(130,42): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. -tests/cases/conformance/parser/ecmascript5/parserRealSource10.ts(449,40): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. tests/cases/conformance/parser/ecmascript5/parserRealSource10.ts(128,36): error TS2304: Cannot find name 'string'. +tests/cases/conformance/parser/ecmascript5/parserRealSource10.ts(128,42): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. tests/cases/conformance/parser/ecmascript5/parserRealSource10.ts(129,41): error TS2304: Cannot find name 'number'. +tests/cases/conformance/parser/ecmascript5/parserRealSource10.ts(129,47): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. tests/cases/conformance/parser/ecmascript5/parserRealSource10.ts(130,35): error TS2304: Cannot find name 'boolean'. +tests/cases/conformance/parser/ecmascript5/parserRealSource10.ts(130,42): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. tests/cases/conformance/parser/ecmascript5/parserRealSource10.ts(179,54): error TS2304: Cannot find name 'ErrorRecoverySet'. tests/cases/conformance/parser/ecmascript5/parserRealSource10.ts(184,28): error TS2304: Cannot find name 'ErrorRecoverySet'. tests/cases/conformance/parser/ecmascript5/parserRealSource10.ts(188,34): error TS2304: Cannot find name 'NodeType'. @@ -340,6 +339,7 @@ tests/cases/conformance/parser/ecmascript5/parserRealSource10.ts(312,128): error tests/cases/conformance/parser/ecmascript5/parserRealSource10.ts(312,149): error TS2304: Cannot find name 'ErrorRecoverySet'. tests/cases/conformance/parser/ecmascript5/parserRealSource10.ts(355,52): error TS2304: Cannot find name 'NodeType'. tests/cases/conformance/parser/ecmascript5/parserRealSource10.ts(356,53): error TS2304: Cannot find name 'NodeType'. +tests/cases/conformance/parser/ecmascript5/parserRealSource10.ts(449,40): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. ==== tests/cases/conformance/parser/ecmascript5/parserRealSource10.ts (342 errors) ==== @@ -475,20 +475,20 @@ tests/cases/conformance/parser/ecmascript5/parserRealSource10.ts(356,53): error ~~ !!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. export var nodeTypeTable = new string[]; - ~~ -!!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. ~~~~~~ !!! error TS2304: Cannot find name 'string'. - export var nodeTypeToTokTable = new number[]; - ~~ -!!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. - ~~~~~~ -!!! error TS2304: Cannot find name 'number'. - export var noRegexTable = new boolean[]; ~~ !!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. + export var nodeTypeToTokTable = new number[]; + ~~~~~~ +!!! error TS2304: Cannot find name 'number'. + ~~ +!!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. + export var noRegexTable = new boolean[]; ~~~~~~~ !!! error TS2304: Cannot find name 'boolean'. + ~~ +!!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. noRegexTable[TokenID.Identifier] = true; noRegexTable[TokenID.StringLiteral] = true; diff --git a/tests/baselines/reference/parserRealSource11.errors.txt b/tests/baselines/reference/parserRealSource11.errors.txt index 966da980097..dc314c8d3e2 100644 --- a/tests/baselines/reference/parserRealSource11.errors.txt +++ b/tests/baselines/reference/parserRealSource11.errors.txt @@ -1,8 +1,5 @@ tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(4,1): error TS6053: File 'tests/cases/conformance/parser/ecmascript5/typescript.ts' not found. -tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(193,40): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(867,29): error TS1015: Parameter cannot have question mark and initializer. -tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(1009,45): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. -tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(1024,47): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(13,22): error TS2304: Cannot find name 'Type'. tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(14,24): error TS2304: Cannot find name 'ASTFlags'. tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(17,38): error TS2304: Cannot find name 'CompilerDiagnostics'. @@ -44,6 +41,7 @@ tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(151,57): error tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(155,26): error TS2304: Cannot find name 'NodeType'. tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(184,19): error TS2304: Cannot find name 'NodeType'. tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(192,32): error TS2304: Cannot find name 'SymbolScope'. +tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(193,40): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(196,19): error TS2304: Cannot find name 'NodeType'. tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(199,42): error TS2304: Cannot find name 'ControlFlowContext'. tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(219,33): error TS2304: Cannot find name 'NodeType'. @@ -252,7 +250,9 @@ tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(1004,44): error tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(1004,67): error TS2304: Cannot find name 'FncFlags'. tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(1005,57): error TS2304: Cannot find name 'FncFlags'. tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(1007,47): error TS2304: Cannot find name 'Symbol'. +tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(1009,45): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(1022,32): error TS2304: Cannot find name 'Symbol'. +tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(1024,47): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(1032,36): error TS2304: Cannot find name 'ControlFlowContext'. tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(1033,29): error TS2304: Cannot find name 'BasicBlock'. tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(1034,28): error TS2304: Cannot find name 'BasicBlock'. diff --git a/tests/baselines/reference/parserRealSource7.errors.txt b/tests/baselines/reference/parserRealSource7.errors.txt index 7fddac2c467..7945e5d7034 100644 --- a/tests/baselines/reference/parserRealSource7.errors.txt +++ b/tests/baselines/reference/parserRealSource7.errors.txt @@ -1,8 +1,8 @@ tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(4,1): error TS6053: File 'tests/cases/conformance/parser/ecmascript5/typescript.ts' not found. -tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(16,45): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(12,38): error TS2304: Cannot find name 'ASTList'. tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(12,62): error TS2304: Cannot find name 'TypeLink'. tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(16,37): error TS2304: Cannot find name 'TypeLink'. +tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(16,45): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(21,36): error TS2304: Cannot find name 'TypeLink'. tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(29,29): error TS2304: Cannot find name 'Type'. tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(29,45): error TS2304: Cannot find name 'TypeDeclaration'. @@ -326,10 +326,10 @@ tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(828,13): error T var len = bases.members.length; if (baseTypeLinks == null) { baseTypeLinks = new TypeLink[]; - ~~ -!!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. ~~~~~~~~ !!! error TS2304: Cannot find name 'TypeLink'. + ~~ +!!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. } for (var i = 0; i < len; i++) { var baseExpr = bases.members[i]; diff --git a/tests/baselines/reference/parserRealSource9.errors.txt b/tests/baselines/reference/parserRealSource9.errors.txt index 1880a72f189..9d89848ff20 100644 --- a/tests/baselines/reference/parserRealSource9.errors.txt +++ b/tests/baselines/reference/parserRealSource9.errors.txt @@ -1,10 +1,10 @@ tests/cases/conformance/parser/ecmascript5/parserRealSource9.ts(4,1): error TS6053: File 'tests/cases/conformance/parser/ecmascript5/typescript.ts' not found. -tests/cases/conformance/parser/ecmascript5/parserRealSource9.ts(12,39): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. tests/cases/conformance/parser/ecmascript5/parserRealSource9.ts(8,38): error TS2304: Cannot find name 'TypeChecker'. tests/cases/conformance/parser/ecmascript5/parserRealSource9.ts(9,48): error TS2304: Cannot find name 'TypeLink'. tests/cases/conformance/parser/ecmascript5/parserRealSource9.ts(9,67): error TS2304: Cannot find name 'SymbolScope'. tests/cases/conformance/parser/ecmascript5/parserRealSource9.ts(10,30): error TS2304: Cannot find name 'Type'. tests/cases/conformance/parser/ecmascript5/parserRealSource9.ts(12,35): error TS2304: Cannot find name 'Type'. +tests/cases/conformance/parser/ecmascript5/parserRealSource9.ts(12,39): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. tests/cases/conformance/parser/ecmascript5/parserRealSource9.ts(29,36): error TS2304: Cannot find name 'SymbolScope'. tests/cases/conformance/parser/ecmascript5/parserRealSource9.ts(29,55): error TS2304: Cannot find name 'Type'. tests/cases/conformance/parser/ecmascript5/parserRealSource9.ts(67,54): error TS2304: Cannot find name 'SignatureGroup'. @@ -56,10 +56,10 @@ tests/cases/conformance/parser/ecmascript5/parserRealSource9.ts(200,48): error T !!! error TS2304: Cannot find name 'Type'. if (typeLinks) { extendsList = new Type[]; - ~~ -!!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. ~~~~ !!! error TS2304: Cannot find name 'Type'. + ~~ +!!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. for (var i = 0, len = typeLinks.length; i < len; i++) { var typeLink = typeLinks[i]; this.checker.resolvingBases = true; From 49bc20a05ff1005f46489685a5664427047e745c Mon Sep 17 00:00:00 2001 From: Yui T Date: Fri, 12 Dec 2014 13:32:01 -0800 Subject: [PATCH 31/78] Move grammar checking: exportAssignment; there are still errors from incomplete grammar migration --- src/compiler/checker.ts | 5 +++++ src/compiler/parser.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 490b1ae9182..6f81b879885 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -8861,6 +8861,11 @@ module ts { } function checkExportAssignment(node: ExportAssignment) { + // Grammar checking + if (node.flags & NodeFlags.Modifier) { + grammarErrorOnFirstToken(node, Diagnostics.An_export_assignment_cannot_have_modifiers); + } + var container = node.parent; if (container.kind !== SyntaxKind.SourceFile) { // In a module, the immediate parent will be a block, so climb up one more parent diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index a26d928bf1c..2aacbe5ab04 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -4642,7 +4642,7 @@ module ts { case SyntaxKind.Constructor: return checkConstructor(node); //case SyntaxKind.DeleteExpression: return checkDeleteExpression( node); //case SyntaxKind.ElementAccessExpression: return checkElementAccessExpression(node); - case SyntaxKind.ExportAssignment: return checkExportAssignment(node); + //case SyntaxKind.ExportAssignment: return checkExportAssignment(node); case SyntaxKind.ExternalModuleReference: return checkExternalModuleReference(node); case SyntaxKind.ForInStatement: return checkForInStatement(node); case SyntaxKind.ForStatement: return checkForStatement(node); From ae4b5dc842fa042485c2e275170d4ff6e714357c Mon Sep 17 00:00:00 2001 From: Yui T Date: Fri, 12 Dec 2014 14:02:32 -0800 Subject: [PATCH 32/78] Move grammar checking: externalModuleReferences; there are still errors from incomplete grammar checking migration --- src/compiler/checker.ts | 10 ++++++++-- src/compiler/parser.ts | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 6f81b879885..e3123a54c51 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -468,6 +468,13 @@ module ts { if (!links.target) { links.target = resolvingSymbol; var node = getDeclarationOfKind(symbol, SyntaxKind.ImportDeclaration); + // Grammar checking + if (node.moduleReference.kind === SyntaxKind.ExternalModuleReference) { + if ((node.moduleReference).expression.kind !== SyntaxKind.StringLiteral) { + grammarErrorOnNode((node.moduleReference).expression, Diagnostics.String_literal_expected); + } + } + var target = node.moduleReference.kind === SyntaxKind.ExternalModuleReference ? resolveExternalModuleName(node, getExternalModuleImportDeclarationExpression(node)) : getSymbolOfPartOfRightHandSideOfImport(node.moduleReference, node); @@ -10040,15 +10047,14 @@ module ts { // Since computed properties are not supported in the type checker, disallow them in TypeScript 1.4 // Once full support is added, remove this error. grammarErrorOnNode(node, Diagnostics.Computed_property_names_are_not_currently_supported); + return; - /* TODO (jfreeman) if (compilerOptions.target < ScriptTarget.ES6) { grammarErrorOnNode(node, Diagnostics.Computed_property_names_are_only_available_when_targeting_ECMAScript_6_and_higher); } else if (node.expression.kind === SyntaxKind.BinaryExpression && (node.expression).operator === SyntaxKind.CommaToken) { grammarErrorOnNode(node.expression, Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name); } - */ } function hasParseDiagnostics(sourceFile: SourceFile): boolean { diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 2aacbe5ab04..ed30af4301b 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -4643,7 +4643,7 @@ module ts { //case SyntaxKind.DeleteExpression: return checkDeleteExpression( node); //case SyntaxKind.ElementAccessExpression: return checkElementAccessExpression(node); //case SyntaxKind.ExportAssignment: return checkExportAssignment(node); - case SyntaxKind.ExternalModuleReference: return checkExternalModuleReference(node); + //case SyntaxKind.ExternalModuleReference: return checkExternalModuleReference(node); case SyntaxKind.ForInStatement: return checkForInStatement(node); case SyntaxKind.ForStatement: return checkForStatement(node); case SyntaxKind.FunctionDeclaration: return checkFunctionDeclaration(node); From 56cf566f892e92a18b35f788783674e2e47b21f6 Mon Sep 17 00:00:00 2001 From: Yui T Date: Fri, 12 Dec 2014 15:10:01 -0800 Subject: [PATCH 33/78] Move grammar checking: functionExpression --- src/compiler/checker.ts | 23 +++++++++++++++---- src/compiler/parser.ts | 2 +- ...eterWithoutAnnotationIsAnyArray.errors.txt | 2 +- .../restParametersOfNonArrayTypes.errors.txt | 2 +- .../restParametersOfNonArrayTypes2.errors.txt | 4 ++-- ...ametersWithArrayTypeAnnotations.errors.txt | 4 ++-- 6 files changed, 26 insertions(+), 11 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index e3123a54c51..a0fde165f66 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -6432,8 +6432,9 @@ module ts { Debug.assert(node.kind !== SyntaxKind.MethodDeclaration || isObjectLiteralMethod(node)); // Grammar checking - if (node.kind === SyntaxKind.ArrowFunction) { - checkGrammarFunctionLikeDeclaration(node); + var hasGrammarError = checkGrammarFunctionLikeDeclaration(node); + if (!hasGrammarError && node.kind === SyntaxKind.FunctionExpression) { + checkGrammarFunctionName(node.name) || checkGrammarForGenerator(node); } // The identityMapper object is used to indicate that function expressions are wildcards @@ -9955,9 +9956,9 @@ module ts { } } - function checkGrammarFunctionLikeDeclaration(node: FunctionLikeDeclaration) { + function checkGrammarFunctionLikeDeclaration(node: FunctionLikeDeclaration): boolean { // Prevent cascading error by short-circuit - checkGrammarModifiers(node) || checkGrammarTypeParameterList(node, node.typeParameters) || checkGrammarParameterList(node.parameters); + return checkGrammarModifiers(node) || checkGrammarTypeParameterList(node, node.typeParameters) || checkGrammarParameterList(node.parameters); } function checkGrammarIndexSignatureParameters(node: SignatureDeclaration): boolean { @@ -10057,6 +10058,20 @@ module ts { } } + function checkGrammarForGenerator(node: FunctionLikeDeclaration) { + if (node.asteriskToken) { + return grammarErrorOnNode(node.asteriskToken, Diagnostics.Generators_are_not_currently_supported); + } + } + + function checkGrammarFunctionName(name: Node) { + if (name && name.parserContextFlags & ParserContextFlags.StrictMode && isEvalOrArgumentsIdentifier(name)) { + // It is a SyntaxError to use within strict mode code the identifiers eval or arguments as the + // Identifier of a FunctionLikeDeclaration or FunctionExpression or as a formal parameter name(13.1) + return reportGrammarErrorOfInvalidUseInStrictMode(name); + } + } + function hasParseDiagnostics(sourceFile: SourceFile): boolean { return sourceFile.parseDiagnostics.length > 0; } diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index ed30af4301b..c67d0e90ae4 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -4647,7 +4647,7 @@ module ts { case SyntaxKind.ForInStatement: return checkForInStatement(node); case SyntaxKind.ForStatement: return checkForStatement(node); case SyntaxKind.FunctionDeclaration: return checkFunctionDeclaration(node); - case SyntaxKind.FunctionExpression: return checkFunctionExpression(node); + //case SyntaxKind.FunctionExpression: return checkFunctionExpression(node); case SyntaxKind.GetAccessor: return checkGetAccessor(node); case SyntaxKind.HeritageClause: return checkHeritageClause(node); case SyntaxKind.InterfaceDeclaration: return checkInterfaceDeclaration(node); diff --git a/tests/baselines/reference/restParameterWithoutAnnotationIsAnyArray.errors.txt b/tests/baselines/reference/restParameterWithoutAnnotationIsAnyArray.errors.txt index 6685d5fe69f..72614738ed9 100644 --- a/tests/baselines/reference/restParameterWithoutAnnotationIsAnyArray.errors.txt +++ b/tests/baselines/reference/restParameterWithoutAnnotationIsAnyArray.errors.txt @@ -1,6 +1,6 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParameterWithoutAnnotationIsAnyArray.ts(13,9): error TS1014: A rest parameter must be last in a parameter list. -tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParameterWithoutAnnotationIsAnyArray.ts(23,21): error TS1014: A rest parameter must be last in a parameter list. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParameterWithoutAnnotationIsAnyArray.ts(5,11): error TS1014: A rest parameter must be last in a parameter list. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParameterWithoutAnnotationIsAnyArray.ts(23,21): error TS1014: A rest parameter must be last in a parameter list. ==== tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParameterWithoutAnnotationIsAnyArray.ts (3 errors) ==== diff --git a/tests/baselines/reference/restParametersOfNonArrayTypes.errors.txt b/tests/baselines/reference/restParametersOfNonArrayTypes.errors.txt index df16e72ea79..6c3c8f5fe19 100644 --- a/tests/baselines/reference/restParametersOfNonArrayTypes.errors.txt +++ b/tests/baselines/reference/restParametersOfNonArrayTypes.errors.txt @@ -1,5 +1,4 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes.ts(13,9): error TS1014: A rest parameter must be last in a parameter list. -tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes.ts(23,21): error TS1014: A rest parameter must be last in a parameter list. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes.ts(3,14): error TS2370: A rest parameter must be of an array type. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes.ts(4,22): error TS2370: A rest parameter must be of an array type. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes.ts(5,11): error TS1014: A rest parameter must be last in a parameter list. @@ -12,6 +11,7 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfN tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes.ts(17,6): error TS2370: A rest parameter must be of an array type. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes.ts(18,9): error TS2370: A rest parameter must be of an array type. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes.ts(22,9): error TS2370: A rest parameter must be of an array type. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes.ts(23,21): error TS1014: A rest parameter must be last in a parameter list. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes.ts(23,21): error TS2370: A rest parameter must be of an array type. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes.ts(23,35): error TS2370: A rest parameter must be of an array type. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes.ts(24,9): error TS2370: A rest parameter must be of an array type. diff --git a/tests/baselines/reference/restParametersOfNonArrayTypes2.errors.txt b/tests/baselines/reference/restParametersOfNonArrayTypes2.errors.txt index b70c7fb467d..aeae6846dcc 100644 --- a/tests/baselines/reference/restParametersOfNonArrayTypes2.errors.txt +++ b/tests/baselines/reference/restParametersOfNonArrayTypes2.errors.txt @@ -1,7 +1,5 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(17,9): error TS1014: A rest parameter must be last in a parameter list. -tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(27,21): error TS1014: A rest parameter must be last in a parameter list. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(44,9): error TS1014: A rest parameter must be last in a parameter list. -tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(54,21): error TS1014: A rest parameter must be last in a parameter list. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(7,14): error TS2370: A rest parameter must be of an array type. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(8,22): error TS2370: A rest parameter must be of an array type. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(9,11): error TS1014: A rest parameter must be last in a parameter list. @@ -14,6 +12,7 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfN tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(21,6): error TS2370: A rest parameter must be of an array type. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(22,9): error TS2370: A rest parameter must be of an array type. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(26,9): error TS2370: A rest parameter must be of an array type. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(27,21): error TS1014: A rest parameter must be last in a parameter list. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(27,21): error TS2370: A rest parameter must be of an array type. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(27,36): error TS2370: A rest parameter must be of an array type. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(28,9): error TS2370: A rest parameter must be of an array type. @@ -29,6 +28,7 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfN tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(48,6): error TS2370: A rest parameter must be of an array type. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(49,9): error TS2370: A rest parameter must be of an array type. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(53,9): error TS2370: A rest parameter must be of an array type. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(54,21): error TS1014: A rest parameter must be last in a parameter list. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(54,21): error TS2370: A rest parameter must be of an array type. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(54,45): error TS2370: A rest parameter must be of an array type. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(55,9): error TS2370: A rest parameter must be of an array type. diff --git a/tests/baselines/reference/restParametersWithArrayTypeAnnotations.errors.txt b/tests/baselines/reference/restParametersWithArrayTypeAnnotations.errors.txt index 05075fc6175..bd813e8fc55 100644 --- a/tests/baselines/reference/restParametersWithArrayTypeAnnotations.errors.txt +++ b/tests/baselines/reference/restParametersWithArrayTypeAnnotations.errors.txt @@ -1,9 +1,9 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersWithArrayTypeAnnotations.ts(13,9): error TS1014: A rest parameter must be last in a parameter list. -tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersWithArrayTypeAnnotations.ts(23,21): error TS1014: A rest parameter must be last in a parameter list. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersWithArrayTypeAnnotations.ts(40,9): error TS1014: A rest parameter must be last in a parameter list. -tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersWithArrayTypeAnnotations.ts(50,21): error TS1014: A rest parameter must be last in a parameter list. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersWithArrayTypeAnnotations.ts(5,11): error TS1014: A rest parameter must be last in a parameter list. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersWithArrayTypeAnnotations.ts(23,21): error TS1014: A rest parameter must be last in a parameter list. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersWithArrayTypeAnnotations.ts(32,11): error TS1014: A rest parameter must be last in a parameter list. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersWithArrayTypeAnnotations.ts(50,21): error TS1014: A rest parameter must be last in a parameter list. ==== tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersWithArrayTypeAnnotations.ts (6 errors) ==== From 5b98eba3d8e2f7ef0119b14088e6460300e8eaee Mon Sep 17 00:00:00 2001 From: Yui T Date: Fri, 12 Dec 2014 15:10:35 -0800 Subject: [PATCH 34/78] Address code review; check class heritage clause into its own function --- src/compiler/checker.ts | 78 ++++++++++++++++++++++------------------- 1 file changed, 41 insertions(+), 37 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index a0fde165f66..97c39dd8aaf 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -8263,43 +8263,7 @@ module ts { function checkClassDeclaration(node: ClassDeclaration) { // Grammar checking - var seenExtendsClause = false; - var seenImplementsClause = false; - - if (!checkGrammarModifiers(node) && node.heritageClauses) { - for (var i = 0, n = node.heritageClauses.length; i < n; i++) { - Debug.assert(i <= 2); - var heritageClause = node.heritageClauses[i]; - - if (heritageClause.token === SyntaxKind.ExtendsKeyword) { - if (seenExtendsClause) { - grammarErrorOnFirstToken(heritageClause, Diagnostics.extends_clause_already_seen) - break; - } - - if (seenImplementsClause) { - grammarErrorOnFirstToken(heritageClause, Diagnostics.extends_clause_must_precede_implements_clause); - break; - } - - if (heritageClause.types.length > 1) { - grammarErrorOnFirstToken(heritageClause.types[1], Diagnostics.Classes_can_only_extend_a_single_class); - break; - } - - seenExtendsClause = true; - } - else { - Debug.assert(heritageClause.token === SyntaxKind.ImplementsKeyword); - if (seenImplementsClause) { - grammarErrorOnFirstToken(heritageClause, Diagnostics.implements_clause_already_seen); - break; - } - - seenImplementsClause = true; - } - } - } + checkGrammarClassDeclarationHeritageClauses(node); checkTypeNameIsReserved(node.name, Diagnostics.Class_name_cannot_be_0); checkTypeParameters(node.typeParameters); @@ -10044,6 +10008,46 @@ module ts { } } + function checkGrammarClassDeclarationHeritageClauses(node: ClassDeclaration) { + var seenExtendsClause = false; + var seenImplementsClause = false; + + if (!checkGrammarModifiers(node) && node.heritageClauses) { + for (var i = 0, n = node.heritageClauses.length; i < n; i++) { + Debug.assert(i <= 2); + var heritageClause = node.heritageClauses[i]; + + if (heritageClause.token === SyntaxKind.ExtendsKeyword) { + if (seenExtendsClause) { + grammarErrorOnFirstToken(heritageClause, Diagnostics.extends_clause_already_seen) + break; + } + + if (seenImplementsClause) { + grammarErrorOnFirstToken(heritageClause, Diagnostics.extends_clause_must_precede_implements_clause); + break; + } + + if (heritageClause.types.length > 1) { + grammarErrorOnFirstToken(heritageClause.types[1], Diagnostics.Classes_can_only_extend_a_single_class); + break; + } + + seenExtendsClause = true; + } + else { + Debug.assert(heritageClause.token === SyntaxKind.ImplementsKeyword); + if (seenImplementsClause) { + grammarErrorOnFirstToken(heritageClause, Diagnostics.implements_clause_already_seen); + break; + } + + seenImplementsClause = true; + } + } + } + } + function checkGrammarComputedPropertyName(node: ComputedPropertyName): void { // Since computed properties are not supported in the type checker, disallow them in TypeScript 1.4 // Once full support is added, remove this error. From 3903a650623a5420132a2a3db01b552a3c504dc8 Mon Sep 17 00:00:00 2001 From: Yui T Date: Fri, 12 Dec 2014 15:52:27 -0800 Subject: [PATCH 35/78] Move grammar check: InterfaceDeclaration, HeritageClause --- src/compiler/checker.ts | 46 +++++++++++++++++++ src/compiler/parser.ts | 4 +- ...interfaceThatInheritsFromItself.errors.txt | 2 +- ...very_ExtendsOrImplementsClause2.errors.txt | 6 +-- ...very_ExtendsOrImplementsClause4.errors.txt | 6 +-- ...very_ExtendsOrImplementsClause5.errors.txt | 12 ++--- .../parserInterfaceDeclaration1.errors.txt | 6 +-- 7 files changed, 64 insertions(+), 18 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 97c39dd8aaf..8c4cfeec5fa 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -8468,6 +8468,9 @@ module ts { } function checkInterfaceDeclaration(node: InterfaceDeclaration) { + // Grammar checking + checkGrammarInterfaceDeclaration(node); + checkTypeParameters(node.typeParameters); if (fullTypeCheck) { checkTypeNameIsReserved(node.name, Diagnostics.Interface_name_cannot_be_0); @@ -10008,6 +10011,18 @@ module ts { } } + function checkGrammarHeritageClause(node: HeritageClause): boolean { + var types = node.types; + if (checkGrammarForDisallowedTrailingComma(types)) { + return true; + } + var listType = tokenToString(node.token); + if (types && types.length === 0) { + var sourceFile = getSourceFileOfNode(node); + return grammarErrorAtPos(sourceFile, types.pos, 0, Diagnostics._0_list_cannot_be_empty, listType) + } + } + function checkGrammarClassDeclarationHeritageClauses(node: ClassDeclaration) { var seenExtendsClause = false; var seenImplementsClause = false; @@ -10044,10 +10059,41 @@ module ts { seenImplementsClause = true; } + + // Grammar checking heritageClause inside class declaration + checkGrammarHeritageClause(heritageClause); } } } + function checkGrammarInterfaceDeclaration(node: InterfaceDeclaration) { + var seenExtendsClause = false; + + if (node.heritageClauses) { + for (var i = 0, n = node.heritageClauses.length; i < n; i++) { + Debug.assert(i <= 1); + var heritageClause = node.heritageClauses[i]; + + if (heritageClause.token === SyntaxKind.ExtendsKeyword) { + if (seenExtendsClause) { + return grammarErrorOnFirstToken(heritageClause, Diagnostics.extends_clause_already_seen); + } + + seenExtendsClause = true; + } + else { + Debug.assert(heritageClause.token === SyntaxKind.ImplementsKeyword); + return grammarErrorOnFirstToken(heritageClause, Diagnostics.Interface_declaration_cannot_have_implements_clause); + } + + // Grammar checking heritageClause inside class declaration + checkGrammarHeritageClause(heritageClause); + } + } + + return false; + } + function checkGrammarComputedPropertyName(node: ComputedPropertyName): void { // Since computed properties are not supported in the type checker, disallow them in TypeScript 1.4 // Once full support is added, remove this error. diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index c67d0e90ae4..7fb859f750a 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -4649,8 +4649,8 @@ module ts { case SyntaxKind.FunctionDeclaration: return checkFunctionDeclaration(node); //case SyntaxKind.FunctionExpression: return checkFunctionExpression(node); case SyntaxKind.GetAccessor: return checkGetAccessor(node); - case SyntaxKind.HeritageClause: return checkHeritageClause(node); - case SyntaxKind.InterfaceDeclaration: return checkInterfaceDeclaration(node); + //case SyntaxKind.HeritageClause: return checkHeritageClause(node); + //case SyntaxKind.InterfaceDeclaration: return checkInterfaceDeclaration(node); case SyntaxKind.LabeledStatement: return checkLabeledStatement(node); case SyntaxKind.PropertyAssignment: return checkPropertyAssignment(node); case SyntaxKind.MethodDeclaration: diff --git a/tests/baselines/reference/interfaceThatInheritsFromItself.errors.txt b/tests/baselines/reference/interfaceThatInheritsFromItself.errors.txt index 440650717bd..b1e47347117 100644 --- a/tests/baselines/reference/interfaceThatInheritsFromItself.errors.txt +++ b/tests/baselines/reference/interfaceThatInheritsFromItself.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/interfaces/interfaceDeclarations/interfaceThatInheritsFromItself.ts(10,15): error TS1176: Interface declaration cannot have 'implements' clause. tests/cases/conformance/interfaces/interfaceDeclarations/interfaceThatInheritsFromItself.ts(1,11): error TS2310: Type 'Foo' recursively references itself as a base type. tests/cases/conformance/interfaces/interfaceDeclarations/interfaceThatInheritsFromItself.ts(4,11): error TS2310: Type 'Foo2' recursively references itself as a base type. tests/cases/conformance/interfaces/interfaceDeclarations/interfaceThatInheritsFromItself.ts(7,11): error TS2310: Type 'Foo3' recursively references itself as a base type. +tests/cases/conformance/interfaces/interfaceDeclarations/interfaceThatInheritsFromItself.ts(10,15): error TS1176: Interface declaration cannot have 'implements' clause. ==== tests/cases/conformance/interfaces/interfaceDeclarations/interfaceThatInheritsFromItself.ts (4 errors) ==== diff --git a/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause2.errors.txt b/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause2.errors.txt index 9e4d8b76d75..c3aee20c780 100644 --- a/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause2.errors.txt +++ b/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause2.errors.txt @@ -1,11 +1,11 @@ -tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ExtendsOrImplementsClauses/parserErrorRecovery_ExtendsOrImplementsClause2.ts(1,18): error TS1009: Trailing comma not allowed. tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ExtendsOrImplementsClauses/parserErrorRecovery_ExtendsOrImplementsClause2.ts(1,17): error TS2304: Cannot find name 'A'. +tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ExtendsOrImplementsClauses/parserErrorRecovery_ExtendsOrImplementsClause2.ts(1,18): error TS1009: Trailing comma not allowed. ==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ExtendsOrImplementsClauses/parserErrorRecovery_ExtendsOrImplementsClause2.ts (2 errors) ==== class C extends A, { - ~ -!!! error TS1009: Trailing comma not allowed. ~ !!! error TS2304: Cannot find name 'A'. + ~ +!!! error TS1009: Trailing comma not allowed. } \ No newline at end of file diff --git a/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause4.errors.txt b/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause4.errors.txt index 6d637831c45..aaf5b803267 100644 --- a/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause4.errors.txt +++ b/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause4.errors.txt @@ -1,11 +1,11 @@ -tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ExtendsOrImplementsClauses/parserErrorRecovery_ExtendsOrImplementsClause4.ts(1,29): error TS1097: 'implements' list cannot be empty. tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ExtendsOrImplementsClauses/parserErrorRecovery_ExtendsOrImplementsClause4.ts(1,17): error TS2304: Cannot find name 'A'. +tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ExtendsOrImplementsClauses/parserErrorRecovery_ExtendsOrImplementsClause4.ts(1,29): error TS1097: 'implements' list cannot be empty. ==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ExtendsOrImplementsClauses/parserErrorRecovery_ExtendsOrImplementsClause4.ts (2 errors) ==== class C extends A implements { - -!!! error TS1097: 'implements' list cannot be empty. ~ !!! error TS2304: Cannot find name 'A'. + +!!! error TS1097: 'implements' list cannot be empty. } \ No newline at end of file diff --git a/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause5.errors.txt b/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause5.errors.txt index 7ffab4742f3..e1ab30fe5f1 100644 --- a/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause5.errors.txt +++ b/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause5.errors.txt @@ -1,17 +1,17 @@ -tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ExtendsOrImplementsClauses/parserErrorRecovery_ExtendsOrImplementsClause5.ts(1,18): error TS1009: Trailing comma not allowed. -tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ExtendsOrImplementsClauses/parserErrorRecovery_ExtendsOrImplementsClause5.ts(1,32): error TS1009: Trailing comma not allowed. tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ExtendsOrImplementsClauses/parserErrorRecovery_ExtendsOrImplementsClause5.ts(1,17): error TS2304: Cannot find name 'A'. +tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ExtendsOrImplementsClauses/parserErrorRecovery_ExtendsOrImplementsClause5.ts(1,18): error TS1009: Trailing comma not allowed. tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ExtendsOrImplementsClauses/parserErrorRecovery_ExtendsOrImplementsClause5.ts(1,31): error TS2304: Cannot find name 'B'. +tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ExtendsOrImplementsClauses/parserErrorRecovery_ExtendsOrImplementsClause5.ts(1,32): error TS1009: Trailing comma not allowed. ==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ExtendsOrImplementsClauses/parserErrorRecovery_ExtendsOrImplementsClause5.ts (4 errors) ==== class C extends A, implements B, { - ~ -!!! error TS1009: Trailing comma not allowed. - ~ -!!! error TS1009: Trailing comma not allowed. ~ !!! error TS2304: Cannot find name 'A'. + ~ +!!! error TS1009: Trailing comma not allowed. ~ !!! error TS2304: Cannot find name 'B'. + ~ +!!! error TS1009: Trailing comma not allowed. } \ No newline at end of file diff --git a/tests/baselines/reference/parserInterfaceDeclaration1.errors.txt b/tests/baselines/reference/parserInterfaceDeclaration1.errors.txt index 8c8f317b11a..a85b21e6db6 100644 --- a/tests/baselines/reference/parserInterfaceDeclaration1.errors.txt +++ b/tests/baselines/reference/parserInterfaceDeclaration1.errors.txt @@ -1,11 +1,11 @@ -tests/cases/conformance/parser/ecmascript5/InterfaceDeclarations/parserInterfaceDeclaration1.ts(1,23): error TS1172: 'extends' clause already seen. tests/cases/conformance/parser/ecmascript5/InterfaceDeclarations/parserInterfaceDeclaration1.ts(1,21): error TS2304: Cannot find name 'A'. +tests/cases/conformance/parser/ecmascript5/InterfaceDeclarations/parserInterfaceDeclaration1.ts(1,23): error TS1172: 'extends' clause already seen. ==== tests/cases/conformance/parser/ecmascript5/InterfaceDeclarations/parserInterfaceDeclaration1.ts (2 errors) ==== interface I extends A extends B { - ~~~~~~~ -!!! error TS1172: 'extends' clause already seen. ~ !!! error TS2304: Cannot find name 'A'. + ~~~~~~~ +!!! error TS1172: 'extends' clause already seen. } \ No newline at end of file From ee1f19efca361230dc08ceaf6ecbe0adebfbbec2 Mon Sep 17 00:00:00 2001 From: Yui T Date: Fri, 12 Dec 2014 16:27:43 -0800 Subject: [PATCH 36/78] Move grammar checking: labelStatement --- src/compiler/checker.ts | 15 +++++++++++++++ src/compiler/parser.ts | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 8c4cfeec5fa..da5df9f2efe 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -8131,6 +8131,21 @@ module ts { } function checkLabeledStatement(node: LabeledStatement) { + // ensure that label is unique + // Grammar checking + var current = node.parent; + while (current) { + if (isAnyFunction(current)) { + break; + } + if (current.kind === SyntaxKind.LabeledStatement && (current).label.text === node.label.text) { + var sourceFile = getSourceFileOfNode(node); + grammarErrorOnNode(node.label, Diagnostics.Duplicate_label_0, getTextOfNodeFromSourceText(sourceFile.text, node.label)); + break; + } + current = current.parent; + } + checkSourceElement(node.statement); } diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 7fb859f750a..ebd8cc88505 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -4651,7 +4651,7 @@ module ts { case SyntaxKind.GetAccessor: return checkGetAccessor(node); //case SyntaxKind.HeritageClause: return checkHeritageClause(node); //case SyntaxKind.InterfaceDeclaration: return checkInterfaceDeclaration(node); - case SyntaxKind.LabeledStatement: return checkLabeledStatement(node); + //case SyntaxKind.LabeledStatement: return checkLabeledStatement(node); case SyntaxKind.PropertyAssignment: return checkPropertyAssignment(node); case SyntaxKind.MethodDeclaration: case SyntaxKind.MethodSignature: From c5b9c07542374e472e9854d9149611054ab9f05e Mon Sep 17 00:00:00 2001 From: Yui T Date: Fri, 12 Dec 2014 17:00:35 -0800 Subject: [PATCH 37/78] Move grammar checking: propertyAssignment; there are still errors from incomplete grammar migration --- src/compiler/checker.ts | 9 +++++++++ src/compiler/diagnosticInformationMap.generated.ts | 2 +- src/compiler/diagnosticMessages.json | 3 ++- src/compiler/parser.ts | 2 +- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index da5df9f2efe..7b99f32e839 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -5378,6 +5378,9 @@ module ts { if (member.flags & SymbolFlags.Property || isObjectLiteralMethod(member.declarations[0])) { var memberDecl = member.declarations[0]; if (memberDecl.kind === SyntaxKind.PropertyAssignment) { + // Grammar checking + checkGrammarForInvalidQuestionMark(memberDecl,(memberDecl).questionToken, Diagnostics.An_object_member_cannot_be_declared_optional); + var type = checkExpression((memberDecl).initializer, contextualMapper); } else if (memberDecl.kind === SyntaxKind.MethodDeclaration) { @@ -10137,6 +10140,12 @@ module ts { } } + function checkGrammarForInvalidQuestionMark(node: Declaration, questionToken: Node, message: DiagnosticMessage): boolean { + if (questionToken) { + return grammarErrorOnNode(questionToken, message); + } + } + function hasParseDiagnostics(sourceFile: SourceFile): boolean { return sourceFile.parseDiagnostics.length > 0; } diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index f955683dbff..c9bf3883200 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -122,7 +122,7 @@ module ts { Tagged_templates_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1159, category: DiagnosticCategory.Error, key: "Tagged templates are only available when targeting ECMAScript 6 and higher." }, Unterminated_template_literal: { code: 1160, category: DiagnosticCategory.Error, key: "Unterminated template literal." }, Unterminated_regular_expression_literal: { code: 1161, category: DiagnosticCategory.Error, key: "Unterminated regular expression literal." }, - An_object_member_cannot_be_declared_optional: { code: 1162, category: DiagnosticCategory.Error, key: "An object member cannot be declared optional." }, + An_object_member_cannot_be_declared_optional: { code: 1162, category: DiagnosticCategory.Error, key: "An object member cannot be declared optional.", isEarly: true }, yield_expression_must_be_contained_within_a_generator_declaration: { code: 1163, category: DiagnosticCategory.Error, key: "'yield' expression must be contained_within a generator declaration.", isEarly: true }, Computed_property_names_are_not_allowed_in_enums: { code: 1164, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in enums.", isEarly: true }, Computed_property_names_are_not_allowed_in_an_ambient_context: { code: 1165, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in an ambient context.", isEarly: true }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 261fc77db36..240661277ee 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -551,7 +551,8 @@ }, "An object member cannot be declared optional.": { "category": "Error", - "code": 1162 + "code": 1162, + "isEarly": true }, "'yield' expression must be contained_within a generator declaration." : { diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index ebd8cc88505..1674af935ca 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -4652,7 +4652,7 @@ module ts { //case SyntaxKind.HeritageClause: return checkHeritageClause(node); //case SyntaxKind.InterfaceDeclaration: return checkInterfaceDeclaration(node); //case SyntaxKind.LabeledStatement: return checkLabeledStatement(node); - case SyntaxKind.PropertyAssignment: return checkPropertyAssignment(node); + //case SyntaxKind.PropertyAssignment: return checkPropertyAssignment(node); case SyntaxKind.MethodDeclaration: case SyntaxKind.MethodSignature: return checkMethod(node); From 2cf51e4639af6722dbb8e41525c97a6fef5c4dde Mon Sep 17 00:00:00 2001 From: Yui T Date: Sat, 13 Dec 2014 13:55:16 -0800 Subject: [PATCH 38/78] Move grammar checking: objectLiteralExpression; there are still error from incomplete grammar migration --- src/compiler/checker.ts | 81 +++++++++++++++++-- src/compiler/parser.ts | 2 +- .../duplicateObjectLiteralProperty.errors.txt | 2 +- ...duplicatePropertiesInStrictMode.errors.txt | 2 +- .../twoAccessorsWithSameName.errors.txt | 2 +- 5 files changed, 78 insertions(+), 11 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 7b99f32e839..513e47e0747 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -5360,18 +5360,14 @@ module ts { } function checkObjectLiteral(node: ObjectLiteralExpression, contextualMapper?: TypeMapper): Type { + // Grammar checking + checkGrammarObjectLiteralExpression(node); + var members = node.symbol.members; var properties: SymbolTable = {}; var contextualType = getContextualType(node); var typeFlags: TypeFlags; - // Grammar checking for computedPropertyName - forEach(node.properties, property => { - if (property.name.kind === SyntaxKind.ComputedPropertyName) { - checkGrammarComputedPropertyName(property.name); - } - }); - for (var id in members) { if (hasProperty(members, id)) { var member = members[id]; @@ -10146,6 +10142,77 @@ module ts { } } + function checkGrammarObjectLiteralExpression(node: ObjectLiteralExpression) { + var seen: Map = {}; + var Property = 1; + var GetAccessor = 2; + var SetAccesor = 4; + var GetOrSetAccessor = GetAccessor | SetAccesor; + var inStrictMode = (node.parserContextFlags & ParserContextFlags.StrictMode) !== 0; + + for (var i = 0, n = node.properties.length; i < n; i++) { + var prop = node.properties[i]; + var name = prop.name; + if (prop.kind === SyntaxKind.OmittedExpression || name.kind === SyntaxKind.ComputedPropertyName) { + continue; + } + + // ECMA-262 11.1.5 Object Initialiser + // If previous is not undefined then throw a SyntaxError exception if any of the following conditions are true + // a.This production is contained in strict code and IsDataDescriptor(previous) is true and + // IsDataDescriptor(propId.descriptor) is true. + // b.IsDataDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true. + // c.IsAccessorDescriptor(previous) is true and IsDataDescriptor(propId.descriptor) is true. + // d.IsAccessorDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true + // and either both previous and propId.descriptor have[[Get]] fields or both previous and propId.descriptor have[[Set]] fields + var currentKind: number; + if (prop.kind === SyntaxKind.PropertyAssignment || + prop.kind === SyntaxKind.ShorthandPropertyAssignment || + prop.kind === SyntaxKind.MethodDeclaration) { + currentKind = Property; + } + else if (prop.kind === SyntaxKind.GetAccessor) { + currentKind = GetAccessor; + } + else if (prop.kind === SyntaxKind.SetAccessor) { + currentKind = SetAccesor; + } + else { + Debug.fail("Unexpected syntax kind:" + prop.kind); + } + + if (!hasProperty(seen, (name).text)) { + seen[(name).text] = currentKind; + } + else { + var existingKind = seen[(name).text]; + if (currentKind === Property && existingKind === Property) { + if (inStrictMode) { + grammarErrorOnNode(name, Diagnostics.An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode); + } + } + else if ((currentKind & GetOrSetAccessor) && (existingKind & GetOrSetAccessor)) { + if (existingKind !== GetOrSetAccessor && currentKind !== existingKind) { + seen[(name).text] = currentKind | existingKind; + } + else { + return grammarErrorOnNode(name, Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name); + } + } + else { + return grammarErrorOnNode(name, Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name); + } + } + } + + // Grammar checking for computedPropertName + forEach(node.properties, prop => { + if (prop.name.kind === SyntaxKind.ComputedPropertyName) { + checkGrammarComputedPropertyName(prop.name); + } + }); + } + function hasParseDiagnostics(sourceFile: SourceFile): boolean { return sourceFile.parseDiagnostics.length > 0; } diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 1674af935ca..a740c5f9cb4 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -4657,7 +4657,7 @@ module ts { case SyntaxKind.MethodSignature: return checkMethod(node); case SyntaxKind.ModuleDeclaration: return checkModuleDeclaration(node); - case SyntaxKind.ObjectLiteralExpression: return checkObjectLiteralExpression(node); + //case SyntaxKind.ObjectLiteralExpression: return checkObjectLiteralExpression(node); case SyntaxKind.NumericLiteral: return checkNumericLiteral(node); case SyntaxKind.Parameter: return checkParameter(node); case SyntaxKind.PostfixUnaryExpression: return checkPostfixUnaryExpression(node); diff --git a/tests/baselines/reference/duplicateObjectLiteralProperty.errors.txt b/tests/baselines/reference/duplicateObjectLiteralProperty.errors.txt index 05dfdc82404..0dd5febe496 100644 --- a/tests/baselines/reference/duplicateObjectLiteralProperty.errors.txt +++ b/tests/baselines/reference/duplicateObjectLiteralProperty.errors.txt @@ -1,4 +1,3 @@ -tests/cases/compiler/duplicateObjectLiteralProperty.ts(16,9): error TS1118: An object literal cannot have multiple get/set accessors with the same name. tests/cases/compiler/duplicateObjectLiteralProperty.ts(2,5): error TS2300: Duplicate identifier 'a'. tests/cases/compiler/duplicateObjectLiteralProperty.ts(4,5): error TS2300: Duplicate identifier 'a'. tests/cases/compiler/duplicateObjectLiteralProperty.ts(5,5): error TS2300: Duplicate identifier '\u0061'. @@ -7,6 +6,7 @@ tests/cases/compiler/duplicateObjectLiteralProperty.ts(7,9): error TS2300: Dupli tests/cases/compiler/duplicateObjectLiteralProperty.ts(8,9): error TS2300: Duplicate identifier '"c"'. tests/cases/compiler/duplicateObjectLiteralProperty.ts(14,9): error TS2300: Duplicate identifier 'a'. tests/cases/compiler/duplicateObjectLiteralProperty.ts(15,9): error TS2300: Duplicate identifier 'a'. +tests/cases/compiler/duplicateObjectLiteralProperty.ts(16,9): error TS1118: An object literal cannot have multiple get/set accessors with the same name. tests/cases/compiler/duplicateObjectLiteralProperty.ts(16,9): error TS2300: Duplicate identifier 'a'. diff --git a/tests/baselines/reference/duplicatePropertiesInStrictMode.errors.txt b/tests/baselines/reference/duplicatePropertiesInStrictMode.errors.txt index 6ae8518677d..b3d868dbe7e 100644 --- a/tests/baselines/reference/duplicatePropertiesInStrictMode.errors.txt +++ b/tests/baselines/reference/duplicatePropertiesInStrictMode.errors.txt @@ -1,5 +1,5 @@ -tests/cases/compiler/duplicatePropertiesInStrictMode.ts(4,3): error TS1117: An object literal cannot have multiple properties with the same name in strict mode. tests/cases/compiler/duplicatePropertiesInStrictMode.ts(3,3): error TS2300: Duplicate identifier 'x'. +tests/cases/compiler/duplicatePropertiesInStrictMode.ts(4,3): error TS1117: An object literal cannot have multiple properties with the same name in strict mode. tests/cases/compiler/duplicatePropertiesInStrictMode.ts(4,3): error TS2300: Duplicate identifier 'x'. diff --git a/tests/baselines/reference/twoAccessorsWithSameName.errors.txt b/tests/baselines/reference/twoAccessorsWithSameName.errors.txt index 73261bfa072..2909db66af1 100644 --- a/tests/baselines/reference/twoAccessorsWithSameName.errors.txt +++ b/tests/baselines/reference/twoAccessorsWithSameName.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/classes/propertyMemberDeclarations/twoAccessorsWithSameName.ts(24,9): error TS1118: An object literal cannot have multiple get/set accessors with the same name. tests/cases/conformance/classes/propertyMemberDeclarations/twoAccessorsWithSameName.ts(2,9): error TS2300: Duplicate identifier 'x'. tests/cases/conformance/classes/propertyMemberDeclarations/twoAccessorsWithSameName.ts(3,9): error TS2300: Duplicate identifier 'x'. tests/cases/conformance/classes/propertyMemberDeclarations/twoAccessorsWithSameName.ts(7,9): error TS2300: Duplicate identifier 'x'. tests/cases/conformance/classes/propertyMemberDeclarations/twoAccessorsWithSameName.ts(8,9): error TS2300: Duplicate identifier 'x'. tests/cases/conformance/classes/propertyMemberDeclarations/twoAccessorsWithSameName.ts(19,9): error TS2300: Duplicate identifier 'x'. +tests/cases/conformance/classes/propertyMemberDeclarations/twoAccessorsWithSameName.ts(24,9): error TS1118: An object literal cannot have multiple get/set accessors with the same name. tests/cases/conformance/classes/propertyMemberDeclarations/twoAccessorsWithSameName.ts(24,9): error TS2300: Duplicate identifier 'x'. From 747eb7268d19abc1e90e5dd3200444ae72d376cb Mon Sep 17 00:00:00 2001 From: Yui T Date: Sat, 13 Dec 2014 14:08:27 -0800 Subject: [PATCH 39/78] Move garmmar checking: numericLiteral; there are still error from incomplete migration --- src/compiler/checker.ts | 15 ++++++++++++++- src/compiler/parser.ts | 2 +- tests/baselines/reference/literals.errors.txt | 4 ++-- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 513e47e0747..e3d78092282 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -7009,6 +7009,19 @@ module ts { return type; } + function checkNumericLiteral(node: LiteralExpression): Type { + // Grammar checking + if (node.flags & NodeFlags.OctalLiteral) { + if (node.parserContextFlags & ParserContextFlags.StrictMode) { + grammarErrorOnNode(node, Diagnostics.Octal_literals_are_not_allowed_in_strict_mode); + } + else if (compilerOptions.target >= ScriptTarget.ES5) { + grammarErrorOnNode(node, Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher); + } + } + return numberType; + } + function checkExpressionWorker(node: Expression, contextualMapper: TypeMapper): Type { switch (node.kind) { case SyntaxKind.Identifier: @@ -7023,7 +7036,7 @@ module ts { case SyntaxKind.FalseKeyword: return booleanType; case SyntaxKind.NumericLiteral: - return numberType; + return checkNumericLiteral(node); case SyntaxKind.TemplateExpression: return checkTemplateExpression(node); case SyntaxKind.StringLiteral: diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index a740c5f9cb4..22028913157 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -4658,7 +4658,7 @@ module ts { return checkMethod(node); case SyntaxKind.ModuleDeclaration: return checkModuleDeclaration(node); //case SyntaxKind.ObjectLiteralExpression: return checkObjectLiteralExpression(node); - case SyntaxKind.NumericLiteral: return checkNumericLiteral(node); + //case SyntaxKind.NumericLiteral: return checkNumericLiteral(node); case SyntaxKind.Parameter: return checkParameter(node); case SyntaxKind.PostfixUnaryExpression: return checkPostfixUnaryExpression(node); case SyntaxKind.PrefixUnaryExpression: return checkPrefixUnaryExpression(node); diff --git a/tests/baselines/reference/literals.errors.txt b/tests/baselines/reference/literals.errors.txt index f33d26af7a4..d43e89bb4db 100644 --- a/tests/baselines/reference/literals.errors.txt +++ b/tests/baselines/reference/literals.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/expressions/literals/literals.ts(20,9): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. -tests/cases/conformance/expressions/literals/literals.ts(25,10): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. tests/cases/conformance/expressions/literals/literals.ts(9,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/literals/literals.ts(9,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/literals/literals.ts(10,9): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/literals/literals.ts(10,21): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/literals/literals.ts(20,9): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/literals/literals.ts(25,10): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. ==== tests/cases/conformance/expressions/literals/literals.ts (6 errors) ==== From fe92b5e736778ad8552205257ae9ca8d64dbd862 Mon Sep 17 00:00:00 2001 From: Yui T Date: Sat, 13 Dec 2014 20:57:38 -0800 Subject: [PATCH 40/78] Move grammar checking: parameter; there are still errors from incomplete grammar migration --- src/compiler/checker.ts | 10 ++++++++++ src/compiler/parser.ts | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index e3d78092282..3252c2e72f2 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -7101,6 +7101,16 @@ module ts { } function checkParameter(node: ParameterDeclaration) { + // Grammar checking + // It is a SyntaxError if the Identifier "eval" or the Identifier "arguments" occurs as the + // Identifier in a PropertySetParameterList of a PropertyAssignment that is contained in strict code + // or if its FunctionBody is strict code(11.1.5). + // It is a SyntaxError if the identifier eval or arguments appears within a FormalParameterList of a + // strict mode FunctionLikeDeclaration or FunctionExpression(13.1) + if (!checkGrammarModifiers(node) && (node.parserContextFlags & ParserContextFlags.StrictMode && isEvalOrArgumentsIdentifier(node.name))) { + reportGrammarErrorOfInvalidUseInStrictMode(node.name); + } + checkVariableLikeDeclaration(node); var func = getContainingFunction(node); if (node.flags & (NodeFlags.Public | NodeFlags.Private | NodeFlags.Protected)) { diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 22028913157..3f4482b0f69 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -4659,7 +4659,7 @@ module ts { case SyntaxKind.ModuleDeclaration: return checkModuleDeclaration(node); //case SyntaxKind.ObjectLiteralExpression: return checkObjectLiteralExpression(node); //case SyntaxKind.NumericLiteral: return checkNumericLiteral(node); - case SyntaxKind.Parameter: return checkParameter(node); + //case SyntaxKind.Parameter: return checkParameter(node); case SyntaxKind.PostfixUnaryExpression: return checkPostfixUnaryExpression(node); case SyntaxKind.PrefixUnaryExpression: return checkPrefixUnaryExpression(node); case SyntaxKind.PropertyDeclaration: @@ -5337,7 +5337,7 @@ module ts { case SyntaxKind.FunctionDeclaration: case SyntaxKind.TypeAliasDeclaration: case SyntaxKind.ImportDeclaration: - case SyntaxKind.Parameter: + //case SyntaxKind.Parameter: break; default: return false; From 94d4ac28f98bbb20d9dafb20144f8345149c154d Mon Sep 17 00:00:00 2001 From: Yui T Date: Sun, 14 Dec 2014 11:12:45 -0800 Subject: [PATCH 41/78] Move grammar checking: postfixUnaryExpression --- src/compiler/checker.ts | 8 ++++++++ src/compiler/parser.ts | 2 +- .../reference/unaryOperatorsInStrictMode.errors.txt | 8 ++++---- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 3252c2e72f2..d9911b97133 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -6622,6 +6622,14 @@ module ts { } function checkPostfixUnaryExpression(node: PostfixUnaryExpression): Type { + // Grammar checking + // The identifier eval or arguments may not appear as the LeftHandSideExpression of an + // Assignment operator(11.13) or of a PostfixExpression(11.3) or as the UnaryExpression + // operated upon by a Prefix Increment(11.4.4) or a Prefix Decrement(11.4.5) operator. + if (node.parserContextFlags & ParserContextFlags.StrictMode && isEvalOrArgumentsIdentifier(node.operand)) { + reportGrammarErrorOfInvalidUseInStrictMode(node.operand); + } + var operandType = checkExpression(node.operand); var ok = checkArithmeticOperandType(node.operand, operandType, Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); if (ok) { diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 3f4482b0f69..efa31e19d34 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -4660,7 +4660,7 @@ module ts { //case SyntaxKind.ObjectLiteralExpression: return checkObjectLiteralExpression(node); //case SyntaxKind.NumericLiteral: return checkNumericLiteral(node); //case SyntaxKind.Parameter: return checkParameter(node); - case SyntaxKind.PostfixUnaryExpression: return checkPostfixUnaryExpression(node); + //case SyntaxKind.PostfixUnaryExpression: return checkPostfixUnaryExpression(node); case SyntaxKind.PrefixUnaryExpression: return checkPrefixUnaryExpression(node); case SyntaxKind.PropertyDeclaration: case SyntaxKind.PropertySignature: diff --git a/tests/baselines/reference/unaryOperatorsInStrictMode.errors.txt b/tests/baselines/reference/unaryOperatorsInStrictMode.errors.txt index 34fb760e320..24af4e340a4 100644 --- a/tests/baselines/reference/unaryOperatorsInStrictMode.errors.txt +++ b/tests/baselines/reference/unaryOperatorsInStrictMode.errors.txt @@ -2,17 +2,17 @@ tests/cases/compiler/unaryOperatorsInStrictMode.ts(3,3): error TS1100: Invalid u tests/cases/compiler/unaryOperatorsInStrictMode.ts(4,3): error TS1100: Invalid use of 'eval' in strict mode. tests/cases/compiler/unaryOperatorsInStrictMode.ts(5,3): error TS1100: Invalid use of 'arguments' in strict mode. tests/cases/compiler/unaryOperatorsInStrictMode.ts(6,3): error TS1100: Invalid use of 'arguments' in strict mode. -tests/cases/compiler/unaryOperatorsInStrictMode.ts(7,1): error TS1100: Invalid use of 'eval' in strict mode. -tests/cases/compiler/unaryOperatorsInStrictMode.ts(8,1): error TS1100: Invalid use of 'eval' in strict mode. -tests/cases/compiler/unaryOperatorsInStrictMode.ts(9,1): error TS1100: Invalid use of 'arguments' in strict mode. -tests/cases/compiler/unaryOperatorsInStrictMode.ts(10,1): error TS1100: Invalid use of 'arguments' in strict mode. tests/cases/compiler/unaryOperatorsInStrictMode.ts(3,3): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. tests/cases/compiler/unaryOperatorsInStrictMode.ts(4,3): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. tests/cases/compiler/unaryOperatorsInStrictMode.ts(5,3): error TS2304: Cannot find name 'arguments'. tests/cases/compiler/unaryOperatorsInStrictMode.ts(6,3): error TS2304: Cannot find name 'arguments'. +tests/cases/compiler/unaryOperatorsInStrictMode.ts(7,1): error TS1100: Invalid use of 'eval' in strict mode. tests/cases/compiler/unaryOperatorsInStrictMode.ts(7,1): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/compiler/unaryOperatorsInStrictMode.ts(8,1): error TS1100: Invalid use of 'eval' in strict mode. tests/cases/compiler/unaryOperatorsInStrictMode.ts(8,1): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/compiler/unaryOperatorsInStrictMode.ts(9,1): error TS1100: Invalid use of 'arguments' in strict mode. tests/cases/compiler/unaryOperatorsInStrictMode.ts(9,1): error TS2304: Cannot find name 'arguments'. +tests/cases/compiler/unaryOperatorsInStrictMode.ts(10,1): error TS1100: Invalid use of 'arguments' in strict mode. tests/cases/compiler/unaryOperatorsInStrictMode.ts(10,1): error TS2304: Cannot find name 'arguments'. From e852f3379cd49f910f913899747f345138d4886b Mon Sep 17 00:00:00 2001 From: Yui T Date: Sun, 14 Dec 2014 11:29:54 -0800 Subject: [PATCH 42/78] Move grammar checking: prefixUnaryExpression; There are still error from incomplete migration --- src/compiler/checker.ts | 10 ++++++++++ src/compiler/parser.ts | 2 +- .../reference/unaryOperatorsInStrictMode.errors.txt | 6 +++--- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index d9911b97133..defdde238fb 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -6599,6 +6599,16 @@ module ts { } function checkPrefixUnaryExpression(node: PrefixUnaryExpression): Type { + // Grammar checking + if (node.parserContextFlags & ParserContextFlags.StrictMode) { + // The identifier eval or arguments may not appear as the LeftHandSideExpression of an + // Assignment operator(11.13) or of a PostfixExpression(11.3) or as the UnaryExpression + // operated upon by a Prefix Increment(11.4.4) or a Prefix Decrement(11.4.5) operator + if ((node.operator === SyntaxKind.PlusPlusToken || node.operator === SyntaxKind.MinusMinusToken) && isEvalOrArgumentsIdentifier(node.operand)) { + reportGrammarErrorOfInvalidUseInStrictMode(node.operand); + } + } + var operandType = checkExpression(node.operand); switch (node.operator) { case SyntaxKind.PlusToken: diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index efa31e19d34..f24bb111db9 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -4661,7 +4661,7 @@ module ts { //case SyntaxKind.NumericLiteral: return checkNumericLiteral(node); //case SyntaxKind.Parameter: return checkParameter(node); //case SyntaxKind.PostfixUnaryExpression: return checkPostfixUnaryExpression(node); - case SyntaxKind.PrefixUnaryExpression: return checkPrefixUnaryExpression(node); + //case SyntaxKind.PrefixUnaryExpression: return checkPrefixUnaryExpression(node); case SyntaxKind.PropertyDeclaration: case SyntaxKind.PropertySignature: return checkProperty(node); diff --git a/tests/baselines/reference/unaryOperatorsInStrictMode.errors.txt b/tests/baselines/reference/unaryOperatorsInStrictMode.errors.txt index 24af4e340a4..53263e7c2e1 100644 --- a/tests/baselines/reference/unaryOperatorsInStrictMode.errors.txt +++ b/tests/baselines/reference/unaryOperatorsInStrictMode.errors.txt @@ -1,10 +1,10 @@ tests/cases/compiler/unaryOperatorsInStrictMode.ts(3,3): error TS1100: Invalid use of 'eval' in strict mode. -tests/cases/compiler/unaryOperatorsInStrictMode.ts(4,3): error TS1100: Invalid use of 'eval' in strict mode. -tests/cases/compiler/unaryOperatorsInStrictMode.ts(5,3): error TS1100: Invalid use of 'arguments' in strict mode. -tests/cases/compiler/unaryOperatorsInStrictMode.ts(6,3): error TS1100: Invalid use of 'arguments' in strict mode. tests/cases/compiler/unaryOperatorsInStrictMode.ts(3,3): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/compiler/unaryOperatorsInStrictMode.ts(4,3): error TS1100: Invalid use of 'eval' in strict mode. tests/cases/compiler/unaryOperatorsInStrictMode.ts(4,3): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/compiler/unaryOperatorsInStrictMode.ts(5,3): error TS1100: Invalid use of 'arguments' in strict mode. tests/cases/compiler/unaryOperatorsInStrictMode.ts(5,3): error TS2304: Cannot find name 'arguments'. +tests/cases/compiler/unaryOperatorsInStrictMode.ts(6,3): error TS1100: Invalid use of 'arguments' in strict mode. tests/cases/compiler/unaryOperatorsInStrictMode.ts(6,3): error TS2304: Cannot find name 'arguments'. tests/cases/compiler/unaryOperatorsInStrictMode.ts(7,1): error TS1100: Invalid use of 'eval' in strict mode. tests/cases/compiler/unaryOperatorsInStrictMode.ts(7,1): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. From eadcc06fa33ee217ea87b05b7f436d00677f4188 Mon Sep 17 00:00:00 2001 From: Yui T Date: Sun, 14 Dec 2014 15:18:54 -0800 Subject: [PATCH 43/78] Move grammar checking: returnStatement; there are still error from incomplet grammar migration --- src/compiler/checker.ts | 28 +++++++++++++++++++ src/compiler/parser.ts | 2 +- .../reference/parserNotRegex1.errors.txt | 2 +- .../reference/parserWithStatement2.errors.txt | 2 +- 4 files changed, 31 insertions(+), 3 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index defdde238fb..298eebc1a5a 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -8126,6 +8126,20 @@ module ts { } function checkReturnStatement(node: ReturnStatement) { + // Grammar checking + var parent = node.parent; + var inFunctionBlock = false; + while (parent && parent.kind !== SyntaxKind.SourceFile) { + inFunctionBlock = isFunctionBlock(parent); + if (inFunctionBlock) { + break; + } + parent = parent.parent; + } + if (!inFunctionBlock) { + grammarErrorOnFirstToken(node, Diagnostics.A_return_statement_can_only_be_used_within_a_function_body); + } + if (node.expression) { var func = getContainingFunction(node); if (func) { @@ -8149,6 +8163,20 @@ module ts { } function checkWithStatement(node: WithStatement) { + // Grammar checking + if (node.statement.kind === SyntaxKind.ReturnStatement) { + // Grammar check for invalid use of return statement + grammarErrorOnFirstToken(node.statement, Diagnostics.A_return_statement_can_only_be_used_within_a_function_body); + } + else if (node.statement.kind === SyntaxKind.Block) { + forEach((node.statement).statements, statement => { + if (statement.kind === SyntaxKind.ReturnStatement) { + // Grammar check for invalid use of return statement + grammarErrorOnFirstToken(node.statement, Diagnostics.A_return_statement_can_only_be_used_within_a_function_body); + } + }); + } + checkExpression(node.expression); error(node.expression, Diagnostics.All_symbols_within_a_with_block_will_be_resolved_to_any); } diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index f24bb111db9..ed0aec3c501 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -4665,7 +4665,7 @@ module ts { case SyntaxKind.PropertyDeclaration: case SyntaxKind.PropertySignature: return checkProperty(node); - case SyntaxKind.ReturnStatement: return checkReturnStatement(node); + //case SyntaxKind.ReturnStatement: return checkReturnStatement(node); case SyntaxKind.SetAccessor: return checkSetAccessor(node); case SyntaxKind.SourceFile: return checkSourceFile(node); case SyntaxKind.ShorthandPropertyAssignment: return checkShorthandPropertyAssignment(node); diff --git a/tests/baselines/reference/parserNotRegex1.errors.txt b/tests/baselines/reference/parserNotRegex1.errors.txt index 9e592541fd0..7eb06157dfc 100644 --- a/tests/baselines/reference/parserNotRegex1.errors.txt +++ b/tests/baselines/reference/parserNotRegex1.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/parser/ecmascript5/parserNotRegex1.ts(3,5): error TS1108: A 'return' statement can only be used within a function body. tests/cases/conformance/parser/ecmascript5/parserNotRegex1.ts(1,7): error TS2304: Cannot find name 'a'. +tests/cases/conformance/parser/ecmascript5/parserNotRegex1.ts(3,5): error TS1108: A 'return' statement can only be used within a function body. ==== tests/cases/conformance/parser/ecmascript5/parserNotRegex1.ts (2 errors) ==== diff --git a/tests/baselines/reference/parserWithStatement2.errors.txt b/tests/baselines/reference/parserWithStatement2.errors.txt index 47ad0c8a920..c2d4b2efa96 100644 --- a/tests/baselines/reference/parserWithStatement2.errors.txt +++ b/tests/baselines/reference/parserWithStatement2.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserWithStatement2.ts(2,3): error TS1108: A 'return' statement can only be used within a function body. tests/cases/conformance/parser/ecmascript5/Statements/parserWithStatement2.ts(1,7): error TS2410: All symbols within a 'with' block will be resolved to 'any'. +tests/cases/conformance/parser/ecmascript5/Statements/parserWithStatement2.ts(2,3): error TS1108: A 'return' statement can only be used within a function body. ==== tests/cases/conformance/parser/ecmascript5/Statements/parserWithStatement2.ts (2 errors) ==== From 1cc0d184bb9a9483c65d810e085eaf04b4288c92 Mon Sep 17 00:00:00 2001 From: Yui T Date: Sun, 14 Dec 2014 19:14:02 -0800 Subject: [PATCH 44/78] Move grammar checking: shorthandPropertyAssignment; Add more parser test; there are still errors from incomplete migration --- src/compiler/checker.ts | 5 ++++- src/compiler/parser.ts | 2 +- .../parserShorthandPropertyAssignment1.errors.txt | 12 ++++++++++++ .../parserShorthandPropertyAssignment2.errors.txt | 7 +++++++ .../parserShorthandPropertyAssignment3.errors.txt | 7 +++++++ .../parserShorthandPropertyAssignment4.errors.txt | 7 +++++++ .../parserShorthandPropertyAssignment5.errors.txt | 8 ++++++++ .../parserShorthandPropertyAssignment1.ts | 3 +++ .../parserShorthandPropertyAssignment2.ts | 1 + .../parserShorthandPropertyAssignment3.ts | 1 + .../parserShorthandPropertyAssignment4.ts | 1 + .../parserShorthandPropertyAssignment5.ts | 2 ++ 12 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 tests/baselines/reference/parserShorthandPropertyAssignment1.errors.txt create mode 100644 tests/baselines/reference/parserShorthandPropertyAssignment2.errors.txt create mode 100644 tests/baselines/reference/parserShorthandPropertyAssignment3.errors.txt create mode 100644 tests/baselines/reference/parserShorthandPropertyAssignment4.errors.txt create mode 100644 tests/baselines/reference/parserShorthandPropertyAssignment5.errors.txt create mode 100644 tests/cases/conformance/parser/ecmascript6/ShorthandPropertyAssignment/parserShorthandPropertyAssignment1.ts create mode 100644 tests/cases/conformance/parser/ecmascript6/ShorthandPropertyAssignment/parserShorthandPropertyAssignment2.ts create mode 100644 tests/cases/conformance/parser/ecmascript6/ShorthandPropertyAssignment/parserShorthandPropertyAssignment3.ts create mode 100644 tests/cases/conformance/parser/ecmascript6/ShorthandPropertyAssignment/parserShorthandPropertyAssignment4.ts create mode 100644 tests/cases/conformance/parser/ecmascript6/ShorthandPropertyAssignment/parserShorthandPropertyAssignment5.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 298eebc1a5a..8fe31a0c5ce 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -10274,11 +10274,14 @@ module ts { } } - // Grammar checking for computedPropertName + // Grammar checking for computedPropertName and shorthandPropertyAssignment forEach(node.properties, prop => { if (prop.name.kind === SyntaxKind.ComputedPropertyName) { checkGrammarComputedPropertyName(prop.name); } + else if (prop.kind === SyntaxKind.ShorthandPropertyAssignment) { + checkGrammarForInvalidQuestionMark(prop, (prop).questionToken, Diagnostics.An_object_member_cannot_be_declared_optional); + } }); } diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index ed0aec3c501..fa2df653765 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -4668,7 +4668,7 @@ module ts { //case SyntaxKind.ReturnStatement: return checkReturnStatement(node); case SyntaxKind.SetAccessor: return checkSetAccessor(node); case SyntaxKind.SourceFile: return checkSourceFile(node); - case SyntaxKind.ShorthandPropertyAssignment: return checkShorthandPropertyAssignment(node); + //case SyntaxKind.ShorthandPropertyAssignment: return checkShorthandPropertyAssignment(node); case SyntaxKind.SwitchStatement: return checkSwitchStatement(node); case SyntaxKind.TaggedTemplateExpression: return checkTaggedTemplateExpression(node); case SyntaxKind.ThrowStatement: return checkThrowStatement(node); diff --git a/tests/baselines/reference/parserShorthandPropertyAssignment1.errors.txt b/tests/baselines/reference/parserShorthandPropertyAssignment1.errors.txt new file mode 100644 index 00000000000..b877d853bdd --- /dev/null +++ b/tests/baselines/reference/parserShorthandPropertyAssignment1.errors.txt @@ -0,0 +1,12 @@ +tests/cases/conformance/parser/ecmascript6/ShorthandPropertyAssignment/parserShorthandPropertyAssignment1.ts(3,11): error TS1162: An object member cannot be declared optional. +tests/cases/conformance/parser/ecmascript6/ShorthandPropertyAssignment/parserShorthandPropertyAssignment1.ts(3,16): error TS1162: An object member cannot be declared optional. + + +==== tests/cases/conformance/parser/ecmascript6/ShorthandPropertyAssignment/parserShorthandPropertyAssignment1.ts (2 errors) ==== + function foo(obj: { name?: string; id: number }) { } + var name:any, id: any; + foo({ name?, id? }); + ~ +!!! error TS1162: An object member cannot be declared optional. + ~ +!!! error TS1162: An object member cannot be declared optional. \ No newline at end of file diff --git a/tests/baselines/reference/parserShorthandPropertyAssignment2.errors.txt b/tests/baselines/reference/parserShorthandPropertyAssignment2.errors.txt new file mode 100644 index 00000000000..d6841652600 --- /dev/null +++ b/tests/baselines/reference/parserShorthandPropertyAssignment2.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/parser/ecmascript6/ShorthandPropertyAssignment/parserShorthandPropertyAssignment2.ts(1,17): error TS1005: ':' expected. + + +==== tests/cases/conformance/parser/ecmascript6/ShorthandPropertyAssignment/parserShorthandPropertyAssignment2.ts (1 errors) ==== + var v = { class }; + ~ +!!! error TS1005: ':' expected. \ No newline at end of file diff --git a/tests/baselines/reference/parserShorthandPropertyAssignment3.errors.txt b/tests/baselines/reference/parserShorthandPropertyAssignment3.errors.txt new file mode 100644 index 00000000000..aa8fbfb2beb --- /dev/null +++ b/tests/baselines/reference/parserShorthandPropertyAssignment3.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/parser/ecmascript6/ShorthandPropertyAssignment/parserShorthandPropertyAssignment3.ts(1,14): error TS1005: ':' expected. + + +==== tests/cases/conformance/parser/ecmascript6/ShorthandPropertyAssignment/parserShorthandPropertyAssignment3.ts (1 errors) ==== + var v = { "" }; + ~ +!!! error TS1005: ':' expected. \ No newline at end of file diff --git a/tests/baselines/reference/parserShorthandPropertyAssignment4.errors.txt b/tests/baselines/reference/parserShorthandPropertyAssignment4.errors.txt new file mode 100644 index 00000000000..8cadf423e19 --- /dev/null +++ b/tests/baselines/reference/parserShorthandPropertyAssignment4.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/parser/ecmascript6/ShorthandPropertyAssignment/parserShorthandPropertyAssignment4.ts(1,13): error TS1005: ':' expected. + + +==== tests/cases/conformance/parser/ecmascript6/ShorthandPropertyAssignment/parserShorthandPropertyAssignment4.ts (1 errors) ==== + var v = { 0 }; + ~ +!!! error TS1005: ':' expected. \ No newline at end of file diff --git a/tests/baselines/reference/parserShorthandPropertyAssignment5.errors.txt b/tests/baselines/reference/parserShorthandPropertyAssignment5.errors.txt new file mode 100644 index 00000000000..714881727b8 --- /dev/null +++ b/tests/baselines/reference/parserShorthandPropertyAssignment5.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript6/ShorthandPropertyAssignment/parserShorthandPropertyAssignment5.ts(2,18): error TS1162: An object member cannot be declared optional. + + +==== tests/cases/conformance/parser/ecmascript6/ShorthandPropertyAssignment/parserShorthandPropertyAssignment5.ts (1 errors) ==== + var greet = "hello"; + var obj = { greet? }; + ~ +!!! error TS1162: An object member cannot be declared optional. \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/ShorthandPropertyAssignment/parserShorthandPropertyAssignment1.ts b/tests/cases/conformance/parser/ecmascript6/ShorthandPropertyAssignment/parserShorthandPropertyAssignment1.ts new file mode 100644 index 00000000000..9ef2f06cdfc --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/ShorthandPropertyAssignment/parserShorthandPropertyAssignment1.ts @@ -0,0 +1,3 @@ +function foo(obj: { name?: string; id: number }) { } +var name:any, id: any; +foo({ name?, id? }); \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/ShorthandPropertyAssignment/parserShorthandPropertyAssignment2.ts b/tests/cases/conformance/parser/ecmascript6/ShorthandPropertyAssignment/parserShorthandPropertyAssignment2.ts new file mode 100644 index 00000000000..ca28c05016b --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/ShorthandPropertyAssignment/parserShorthandPropertyAssignment2.ts @@ -0,0 +1 @@ +var v = { class }; \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/ShorthandPropertyAssignment/parserShorthandPropertyAssignment3.ts b/tests/cases/conformance/parser/ecmascript6/ShorthandPropertyAssignment/parserShorthandPropertyAssignment3.ts new file mode 100644 index 00000000000..de2a94b194e --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/ShorthandPropertyAssignment/parserShorthandPropertyAssignment3.ts @@ -0,0 +1 @@ +var v = { "" }; \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/ShorthandPropertyAssignment/parserShorthandPropertyAssignment4.ts b/tests/cases/conformance/parser/ecmascript6/ShorthandPropertyAssignment/parserShorthandPropertyAssignment4.ts new file mode 100644 index 00000000000..5479b23b32b --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/ShorthandPropertyAssignment/parserShorthandPropertyAssignment4.ts @@ -0,0 +1 @@ +var v = { 0 }; \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/ShorthandPropertyAssignment/parserShorthandPropertyAssignment5.ts b/tests/cases/conformance/parser/ecmascript6/ShorthandPropertyAssignment/parserShorthandPropertyAssignment5.ts new file mode 100644 index 00000000000..8f8e7902cd4 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/ShorthandPropertyAssignment/parserShorthandPropertyAssignment5.ts @@ -0,0 +1,2 @@ +var greet = "hello"; +var obj = { greet? }; \ No newline at end of file From a4f17b14176b472bdc50cd3c91fb6dc6b12c35f6 Mon Sep 17 00:00:00 2001 From: Yui T Date: Sun, 14 Dec 2014 19:57:12 -0800 Subject: [PATCH 45/78] Move grammar checking: switchStatement; there are still errors from incomplete grammar migration --- src/compiler/checker.ts | 18 ++++++++++++++++++ .../diagnosticInformationMap.generated.ts | 2 +- src/compiler/diagnosticMessages.json | 3 ++- src/compiler/parser.ts | 3 ++- 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 8fe31a0c5ce..737393486b2 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -8182,8 +8182,26 @@ module ts { } function checkSwitchStatement(node: SwitchStatement) { + // Grammar checking + var firstDefaultClause: CaseOrDefaultClause; + var hasDuplicateDefaultClause = false; + var expressionType = checkExpression(node.expression); forEach(node.clauses, clause => { + // Grammar check for duplicate default clauses, skip if we already report duplicate default clause + if (clause.kind === SyntaxKind.DefaultClause && !hasDuplicateDefaultClause) { + if (firstDefaultClause === undefined) { + firstDefaultClause = clause; + } + else { + var sourceFile = getSourceFileOfNode(node); + var start = skipTrivia(sourceFile.text, clause.pos); + var end = clause.statements.length > 0 ? clause.statements[0].pos : clause.end; + grammarErrorAtPos(sourceFile, start, end - start, Diagnostics.A_default_clause_cannot_appear_more_than_once_in_a_switch_statement); + hasDuplicateDefaultClause = true; + } + } + if (fullTypeCheck && clause.kind === SyntaxKind.CaseClause) { var caseClause = clause; // TypeScript 1.0 spec (April 2014):5.9 diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index c9bf3883200..1a25fdcffe9 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -76,7 +76,7 @@ module ts { Type_expected: { code: 1110, category: DiagnosticCategory.Error, key: "Type expected.", isEarly: true }, A_constructor_implementation_cannot_be_declared_in_an_ambient_context: { code: 1111, category: DiagnosticCategory.Error, key: "A constructor implementation cannot be declared in an ambient context.", isEarly: true }, A_class_member_cannot_be_declared_optional: { code: 1112, category: DiagnosticCategory.Error, key: "A class member cannot be declared optional.", isEarly: true }, - A_default_clause_cannot_appear_more_than_once_in_a_switch_statement: { code: 1113, category: DiagnosticCategory.Error, key: "A 'default' clause cannot appear more than once in a 'switch' statement." }, + A_default_clause_cannot_appear_more_than_once_in_a_switch_statement: { code: 1113, category: DiagnosticCategory.Error, key: "A 'default' clause cannot appear more than once in a 'switch' statement.", isEarly: true }, Duplicate_label_0: { code: 1114, category: DiagnosticCategory.Error, key: "Duplicate label '{0}'", isEarly: true }, A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement: { code: 1115, category: DiagnosticCategory.Error, key: "A 'continue' statement can only jump to a label of an enclosing iteration statement.", isEarly: true }, A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement: { code: 1116, category: DiagnosticCategory.Error, key: "A 'break' statement can only jump to a label of an enclosing statement.", isEarly: true }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 240661277ee..390e6e79dc7 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -347,7 +347,8 @@ }, "A 'default' clause cannot appear more than once in a 'switch' statement.": { "category": "Error", - "code": 1113 + "code": 1113, + "isEarly": true }, "Duplicate label '{0}'": { "category": "Error", diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index fa2df653765..d8f6cf636f3 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -4669,7 +4669,7 @@ module ts { case SyntaxKind.SetAccessor: return checkSetAccessor(node); case SyntaxKind.SourceFile: return checkSourceFile(node); //case SyntaxKind.ShorthandPropertyAssignment: return checkShorthandPropertyAssignment(node); - case SyntaxKind.SwitchStatement: return checkSwitchStatement(node); + //case SyntaxKind.SwitchStatement: return checkSwitchStatement(node); case SyntaxKind.TaggedTemplateExpression: return checkTaggedTemplateExpression(node); case SyntaxKind.ThrowStatement: return checkThrowStatement(node); case SyntaxKind.TypeReference: return checkTypeReference(node); @@ -5694,6 +5694,7 @@ module ts { var start = skipTrivia(file.text, clause.pos); var end = clause.statements.length > 0 ? clause.statements[0].pos : clause.end; return grammarErrorAtPos(start, end - start, Diagnostics.A_default_clause_cannot_appear_more_than_once_in_a_switch_statement); + } } } From b388eb3c2a1c5a7991cedfe8ee334883e2146c40 Mon Sep 17 00:00:00 2001 From: Yui T Date: Sun, 14 Dec 2014 21:12:14 -0800 Subject: [PATCH 46/78] Move grammar checking: taggedTemplateExpression --- src/compiler/checker.ts | 5 +++++ .../diagnosticInformationMap.generated.ts | 2 +- src/compiler/diagnosticMessages.json | 3 ++- src/compiler/parser.ts | 2 +- ...mplateStringsTypeArgumentInference.errors.txt | 16 ++++++++-------- ...lateStringsWithOverloadResolution1.errors.txt | 12 ++++++------ ...lateStringsWithOverloadResolution3.errors.txt | 16 ++++++++-------- ...teStringsArrayTypeDefinedInES5Mode.errors.txt | 2 +- ...eStringsArrayTypeNotDefinedES5Mode.errors.txt | 2 +- 9 files changed, 33 insertions(+), 27 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 737393486b2..edf1a01ad3b 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -6303,6 +6303,11 @@ module ts { } function checkTaggedTemplateExpression(node: TaggedTemplateExpression): Type { + // Grammar checking + if (compilerOptions.target < ScriptTarget.ES6) { + grammarErrorOnFirstToken(node.template, Diagnostics.Tagged_templates_are_only_available_when_targeting_ECMAScript_6_and_higher); + } + return getReturnTypeOfSignature(getResolvedSignature(node)); } diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index 1a25fdcffe9..b2209d41677 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -119,7 +119,7 @@ module ts { const_declarations_must_be_initialized: { code: 1155, category: DiagnosticCategory.Error, key: "'const' declarations must be initialized", isEarly: true }, const_declarations_can_only_be_declared_inside_a_block: { code: 1156, category: DiagnosticCategory.Error, key: "'const' declarations can only be declared inside a block.", isEarly: true }, let_declarations_can_only_be_declared_inside_a_block: { code: 1157, category: DiagnosticCategory.Error, key: "'let' declarations can only be declared inside a block.", isEarly: true }, - Tagged_templates_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1159, category: DiagnosticCategory.Error, key: "Tagged templates are only available when targeting ECMAScript 6 and higher." }, + Tagged_templates_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1159, category: DiagnosticCategory.Error, key: "Tagged templates are only available when targeting ECMAScript 6 and higher.", isEarly: true }, Unterminated_template_literal: { code: 1160, category: DiagnosticCategory.Error, key: "Unterminated template literal." }, Unterminated_regular_expression_literal: { code: 1161, category: DiagnosticCategory.Error, key: "Unterminated regular expression literal." }, An_object_member_cannot_be_declared_optional: { code: 1162, category: DiagnosticCategory.Error, key: "An object member cannot be declared optional.", isEarly: true }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 390e6e79dc7..9651742d437 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -540,7 +540,8 @@ }, "Tagged templates are only available when targeting ECMAScript 6 and higher.": { "category": "Error", - "code": 1159 + "code": 1159, + "isEarly": true }, "Unterminated template literal.": { "category": "Error", diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index d8f6cf636f3..162f895fe09 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -4670,7 +4670,7 @@ module ts { case SyntaxKind.SourceFile: return checkSourceFile(node); //case SyntaxKind.ShorthandPropertyAssignment: return checkShorthandPropertyAssignment(node); //case SyntaxKind.SwitchStatement: return checkSwitchStatement(node); - case SyntaxKind.TaggedTemplateExpression: return checkTaggedTemplateExpression(node); + //case SyntaxKind.TaggedTemplateExpression: return checkTaggedTemplateExpression(node); case SyntaxKind.ThrowStatement: return checkThrowStatement(node); case SyntaxKind.TypeReference: return checkTypeReference(node); case SyntaxKind.VariableDeclaration: return checkVariableDeclaration(node); diff --git a/tests/baselines/reference/taggedTemplateStringsTypeArgumentInference.errors.txt b/tests/baselines/reference/taggedTemplateStringsTypeArgumentInference.errors.txt index ac184e9489f..99e90d57148 100644 --- a/tests/baselines/reference/taggedTemplateStringsTypeArgumentInference.errors.txt +++ b/tests/baselines/reference/taggedTemplateStringsTypeArgumentInference.errors.txt @@ -21,15 +21,15 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(53,15): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(57,23): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(58,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(64,11): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. + Type argument candidate 'string' is not a valid type argument because it is not a supertype of candidate 'number'. tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(64,25): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(77,11): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. + Type argument candidate '{ x: number; z: Date; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; y: string; }'. tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(77,25): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(81,25): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(86,23): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(90,25): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(64,11): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. - Type argument candidate 'string' is not a valid type argument because it is not a supertype of candidate 'number'. -tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(77,11): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. - Type argument candidate '{ x: number; z: Date; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; y: string; }'. ==== tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts (30 errors) ==== @@ -143,11 +143,11 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference return null; } var a9a = someGenerics9 `${ '' }${ 0 }${ [] }`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. ~~~~~~~~~~~~~ !!! error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. !!! error TS2453: Type argument candidate 'string' is not a valid type argument because it is not a supertype of candidate 'number'. + ~~~ +!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. var a9a: {}; // Generic tag with multiple parameters of generic type passed arguments with multiple best common types @@ -161,11 +161,11 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference } var a9e = someGenerics9 `${ undefined }${ { x: 6, z: new Date() } }${ { x: 6, y: '' } }`; - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. ~~~~~~~~~~~~~ !!! error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. !!! error TS2453: Type argument candidate '{ x: number; z: Date; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; y: string; }'. + ~~~ +!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. var a9e: {}; // Generic tag with multiple parameters of generic type passed arguments with a single best common type diff --git a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution1.errors.txt b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution1.errors.txt index bb5b56578df..e4c79537ce2 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution1.errors.txt +++ b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution1.errors.txt @@ -1,13 +1,13 @@ +tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(12,20): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(14,9): error TS2346: Supplied parameters do not match any signature of call target. tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(16,13): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(17,13): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(18,13): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(19,13): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(20,13): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(21,13): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(12,20): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(14,9): error TS2346: Supplied parameters do not match any signature of call target. tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(19,20): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(20,13): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(21,9): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts(21,13): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. ==== tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution1.ts (10 errors) ==== @@ -48,8 +48,8 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolutio ~~~ !!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. var z = foo `${1}${2}${3}`; // any (with error) - ~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. ~~~~~~~~~~~~~~~~~~ !!! error TS2346: Supplied parameters do not match any signature of call target. + ~~~ +!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. \ No newline at end of file diff --git a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3.errors.txt b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3.errors.txt index 3ffe3d5820d..c1a6b228b01 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3.errors.txt +++ b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3.errors.txt @@ -1,7 +1,9 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(7,21): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(10,5): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(10,9): error TS2345: Argument of type '{}' is not assignable to parameter of type 'number'. tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(16,20): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(17,20): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(19,4): error TS2339: Property 'foo' does not exist on type 'Date'. tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(23,5): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(26,5): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(34,13): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. @@ -10,6 +12,7 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolutio tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(40,13): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(41,13): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(42,13): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(45,1): error TS2346: Supplied parameters do not match any signature of call target. tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(45,5): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(54,5): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(55,5): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. @@ -17,15 +20,12 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolutio tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(57,5): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(60,5): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(63,5): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(64,5): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(70,5): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(71,5): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(10,9): error TS2345: Argument of type '{}' is not assignable to parameter of type 'number'. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(19,4): error TS2339: Property 'foo' does not exist on type 'Date'. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(45,1): error TS2346: Supplied parameters do not match any signature of call target. tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(63,9): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'number'. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(64,5): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(64,18): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string'. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(70,5): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(70,18): error TS2339: Property 'toFixed' does not exist on type 'string'. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts(71,5): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. ==== tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3.ts (28 errors) ==== @@ -102,10 +102,10 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolutio // Generic overloads with differing arity tagging with argument count that doesn't match any overload fn3 ``; // Error - ~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. ~~~~~~ !!! error TS2346: Supplied parameters do not match any signature of call target. + ~~ +!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. // Generic overloads with constraints function fn4(strs: TemplateStringsArray, n: T, m: U); diff --git a/tests/baselines/reference/templateStringsArrayTypeDefinedInES5Mode.errors.txt b/tests/baselines/reference/templateStringsArrayTypeDefinedInES5Mode.errors.txt index dc494c7c3f4..61b82bcb459 100644 --- a/tests/baselines/reference/templateStringsArrayTypeDefinedInES5Mode.errors.txt +++ b/tests/baselines/reference/templateStringsArrayTypeDefinedInES5Mode.errors.txt @@ -1,8 +1,8 @@ -tests/cases/compiler/templateStringsArrayTypeDefinedInES5Mode.ts(10,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. lib.d.ts(515,11): error TS2300: Duplicate identifier 'TemplateStringsArray'. tests/cases/compiler/templateStringsArrayTypeDefinedInES5Mode.ts(2,7): error TS2300: Duplicate identifier 'TemplateStringsArray'. tests/cases/compiler/templateStringsArrayTypeDefinedInES5Mode.ts(8,3): error TS2345: Argument of type '{ [x: number]: undefined; }' is not assignable to parameter of type 'TemplateStringsArray'. Property 'raw' is missing in type '{ [x: number]: undefined; }'. +tests/cases/compiler/templateStringsArrayTypeDefinedInES5Mode.ts(10,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. ==== tests/cases/compiler/templateStringsArrayTypeDefinedInES5Mode.ts (3 errors) ==== diff --git a/tests/baselines/reference/templateStringsArrayTypeNotDefinedES5Mode.errors.txt b/tests/baselines/reference/templateStringsArrayTypeNotDefinedES5Mode.errors.txt index 56793bf95ad..b233ad963c7 100644 --- a/tests/baselines/reference/templateStringsArrayTypeNotDefinedES5Mode.errors.txt +++ b/tests/baselines/reference/templateStringsArrayTypeNotDefinedES5Mode.errors.txt @@ -1,6 +1,6 @@ -tests/cases/compiler/templateStringsArrayTypeNotDefinedES5Mode.ts(7,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. tests/cases/compiler/templateStringsArrayTypeNotDefinedES5Mode.ts(5,3): error TS2345: Argument of type '{ [x: number]: undefined; }' is not assignable to parameter of type 'TemplateStringsArray'. Property 'raw' is missing in type '{ [x: number]: undefined; }'. +tests/cases/compiler/templateStringsArrayTypeNotDefinedES5Mode.ts(7,3): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. ==== tests/cases/compiler/templateStringsArrayTypeNotDefinedES5Mode.ts (2 errors) ==== From 98cb805f138d829d82983903dd1874af2da3e7d1 Mon Sep 17 00:00:00 2001 From: Yui T Date: Sun, 14 Dec 2014 22:50:58 -0800 Subject: [PATCH 47/78] Move grammar check: throwStatement; there are still errors from incomplete grammar migration --- src/compiler/checker.ts | 13 +++++++++++++ src/compiler/diagnosticInformationMap.generated.ts | 2 +- src/compiler/diagnosticMessages.json | 3 ++- src/compiler/parser.ts | 2 +- 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index edf1a01ad3b..10abc5601af 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -8241,6 +8241,10 @@ module ts { } function checkThrowStatement(node: ThrowStatement) { + if (node.expression === undefined) { + grammarErrorAfterFirstToken(getSourceFileOfNode(node), node, Diagnostics.Line_break_not_permitted_here); + } + if (node.expression) { checkExpression(node.expression); } @@ -10353,6 +10357,15 @@ module ts { return grammarErrorOnNode(node, Diagnostics.Invalid_use_of_0_in_strict_mode, name); } + function grammarErrorAfterFirstToken(sourceFile: SourceFile, node: Node, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any): boolean { + if (!hasParseDiagnostics(sourceFile)) { + var scanner = createScanner(compilerOptions.target, /*skipTrivia*/ true, sourceFile.text); + scanToken(scanner, node.pos); + diagnostics.push(createFileDiagnostic(sourceFile, scanner.getTextPos(), 0, message, arg0, arg1, arg2)); + return true; + } + } + initializeTypeChecker(); return checker; diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index b2209d41677..2050bad5ca5 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -105,7 +105,7 @@ module ts { Type_parameter_declaration_expected: { code: 1139, category: DiagnosticCategory.Error, key: "Type parameter declaration expected." }, Type_argument_expected: { code: 1140, category: DiagnosticCategory.Error, key: "Type argument expected." }, String_literal_expected: { code: 1141, category: DiagnosticCategory.Error, key: "String literal expected.", isEarly: true }, - Line_break_not_permitted_here: { code: 1142, category: DiagnosticCategory.Error, key: "Line break not permitted here." }, + Line_break_not_permitted_here: { code: 1142, category: DiagnosticCategory.Error, key: "Line break not permitted here.", isEarly: true }, or_expected: { code: 1144, category: DiagnosticCategory.Error, key: "'{' or ';' expected." }, Modifiers_not_permitted_on_index_signature_members: { code: 1145, category: DiagnosticCategory.Error, key: "Modifiers not permitted on index signature members.", isEarly: true }, Declaration_expected: { code: 1146, category: DiagnosticCategory.Error, key: "Declaration expected." }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 9651742d437..2cef9250a8f 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -476,7 +476,8 @@ }, "Line break not permitted here.": { "category": "Error", - "code": 1142 + "code": 1142, + "isEarly": true }, "'{' or ';' expected.": { "category": "Error", diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 162f895fe09..41ccdfd3dc3 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -4671,7 +4671,7 @@ module ts { //case SyntaxKind.ShorthandPropertyAssignment: return checkShorthandPropertyAssignment(node); //case SyntaxKind.SwitchStatement: return checkSwitchStatement(node); //case SyntaxKind.TaggedTemplateExpression: return checkTaggedTemplateExpression(node); - case SyntaxKind.ThrowStatement: return checkThrowStatement(node); + //case SyntaxKind.ThrowStatement: return checkThrowStatement(node); case SyntaxKind.TypeReference: return checkTypeReference(node); case SyntaxKind.VariableDeclaration: return checkVariableDeclaration(node); case SyntaxKind.VariableStatement: return checkVariableStatement(node); From 5d91394713910e48e32932f9bbfe8489affbf329 Mon Sep 17 00:00:00 2001 From: Yui T Date: Mon, 15 Dec 2014 10:15:12 -0800 Subject: [PATCH 48/78] Movev grammar checking: typeReference; there are still errors from incomplet grammar migration --- src/compiler/checker.ts | 7 +++++-- src/compiler/parser.ts | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 10abc5601af..ae7fc25c7e4 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -7363,6 +7363,9 @@ module ts { } function checkTypeReference(node: TypeReferenceNode) { + // Grammar checking + checkGrammarTypeArguments(node, node.typeArguments); + var type = getTypeFromTypeReferenceNode(node); if (type !== unknownType && node.typeArguments) { // Do type argument local checks only if referenced type is successfully resolved @@ -10082,7 +10085,7 @@ module ts { checkGrammarModifiers(node) || checkGrammarIndexSignatureParameters(node) || checkGrammarForIndexSignatureModifier(node); } - function checkGrammarForAtLeastOneTypeArgument(node: CallExpression, typeArguments: NodeArray): boolean { + function checkGrammarForAtLeastOneTypeArgument(node: Node, typeArguments: NodeArray): boolean { if (typeArguments && typeArguments.length === 0) { var sourceFile = getSourceFileOfNode(node); var start = typeArguments.pos - "<".length; @@ -10091,7 +10094,7 @@ module ts { } } - function checkGrammarTypeArguments(node: CallExpression, typeArguments: NodeArray): boolean { + function checkGrammarTypeArguments(node: Node, typeArguments: NodeArray): boolean { return checkGrammarForDisallowedTrailingComma(typeArguments) || checkGrammarForAtLeastOneTypeArgument(node, typeArguments); } diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 41ccdfd3dc3..c1ec9a113a7 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -4672,7 +4672,7 @@ module ts { //case SyntaxKind.SwitchStatement: return checkSwitchStatement(node); //case SyntaxKind.TaggedTemplateExpression: return checkTaggedTemplateExpression(node); //case SyntaxKind.ThrowStatement: return checkThrowStatement(node); - case SyntaxKind.TypeReference: return checkTypeReference(node); + //case SyntaxKind.TypeReference: return checkTypeReference(node); case SyntaxKind.VariableDeclaration: return checkVariableDeclaration(node); case SyntaxKind.VariableStatement: return checkVariableStatement(node); case SyntaxKind.WithStatement: return checkWithStatement(node); From 896f172d72a594ed9e36fa62c4d7cf26ee890789 Mon Sep 17 00:00:00 2001 From: Yui T Date: Mon, 15 Dec 2014 10:15:46 -0800 Subject: [PATCH 49/78] Move grammar checking: wihtStatement; there are still errors from incomplete grammar migration --- src/compiler/checker.ts | 7 ++++++- src/compiler/parser.ts | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index ae7fc25c7e4..cc73dca16ed 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -8171,7 +8171,12 @@ module ts { } function checkWithStatement(node: WithStatement) { - // Grammar checking + // Grammar checking for withStatement + if (node.parserContextFlags & ParserContextFlags.StrictMode) { + grammarErrorOnFirstToken(node, Diagnostics.with_statements_are_not_allowed_in_strict_mode); + } + + // Grammar checking for invalid use of return statement if (node.statement.kind === SyntaxKind.ReturnStatement) { // Grammar check for invalid use of return statement grammarErrorOnFirstToken(node.statement, Diagnostics.A_return_statement_can_only_be_used_within_a_function_body); diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index c1ec9a113a7..29b91a434a7 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -4675,7 +4675,7 @@ module ts { //case SyntaxKind.TypeReference: return checkTypeReference(node); case SyntaxKind.VariableDeclaration: return checkVariableDeclaration(node); case SyntaxKind.VariableStatement: return checkVariableStatement(node); - case SyntaxKind.WithStatement: return checkWithStatement(node); + //case SyntaxKind.WithStatement: return checkWithStatement(node); case SyntaxKind.YieldExpression: return checkYieldExpression(node); } } From aa59b4d3f11d8911cfb22ef59ab2eced97c518e6 Mon Sep 17 00:00:00 2001 From: Yui T Date: Mon, 15 Dec 2014 10:47:42 -0800 Subject: [PATCH 50/78] Move grammar checking: yieldExpression; there are still error from incomplete grammar migration. --- src/compiler/checker.ts | 13 +++++++++++++ src/compiler/parser.ts | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index cc73dca16ed..6b662cf70f0 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -6936,6 +6936,16 @@ module ts { } } + function checkYieldExpression(node: YieldExpression): void { + // Grammar checking + if (!(node.parserContextFlags & ParserContextFlags.Yield)) { + grammarErrorOnFirstToken(node, Diagnostics.yield_expression_must_be_contained_within_a_generator_declaration); + } + else { + grammarErrorOnFirstToken(node, Diagnostics.yield_expressions_are_not_currently_supported); + } + } + function checkConditionalExpression(node: ConditionalExpression, contextualMapper?: TypeMapper): Type { checkExpression(node.condition); var type1 = checkExpression(node.whenTrue, contextualMapper); @@ -7103,6 +7113,9 @@ module ts { return checkConditionalExpression(node, contextualMapper); case SyntaxKind.OmittedExpression: return undefinedType; + case SyntaxKind.YieldExpression: + checkYieldExpression(node); + return unknownType; } return unknownType; } diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 29b91a434a7..2763340551a 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -4676,7 +4676,7 @@ module ts { case SyntaxKind.VariableDeclaration: return checkVariableDeclaration(node); case SyntaxKind.VariableStatement: return checkVariableStatement(node); //case SyntaxKind.WithStatement: return checkWithStatement(node); - case SyntaxKind.YieldExpression: return checkYieldExpression(node); + //case SyntaxKind.YieldExpression: return checkYieldExpression(node); } } From e49470bf86842af79c694b7d61a0849e8988b7db Mon Sep 17 00:00:00 2001 From: Yui T Date: Mon, 15 Dec 2014 14:16:11 -0800 Subject: [PATCH 51/78] Address code review --- src/compiler/checker.ts | 110 ++++++++++++++++------------------------ 1 file changed, 43 insertions(+), 67 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 6b662cf70f0..972290095ed 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -5374,9 +5374,6 @@ module ts { if (member.flags & SymbolFlags.Property || isObjectLiteralMethod(member.declarations[0])) { var memberDecl = member.declarations[0]; if (memberDecl.kind === SyntaxKind.PropertyAssignment) { - // Grammar checking - checkGrammarForInvalidQuestionMark(memberDecl,(memberDecl).questionToken, Diagnostics.An_object_member_cannot_be_declared_optional); - var type = checkExpression((memberDecl).initializer, contextualMapper); } else if (memberDecl.kind === SyntaxKind.MethodDeclaration) { @@ -6605,13 +6602,11 @@ module ts { function checkPrefixUnaryExpression(node: PrefixUnaryExpression): Type { // Grammar checking - if (node.parserContextFlags & ParserContextFlags.StrictMode) { - // The identifier eval or arguments may not appear as the LeftHandSideExpression of an - // Assignment operator(11.13) or of a PostfixExpression(11.3) or as the UnaryExpression - // operated upon by a Prefix Increment(11.4.4) or a Prefix Decrement(11.4.5) operator - if ((node.operator === SyntaxKind.PlusPlusToken || node.operator === SyntaxKind.MinusMinusToken) && isEvalOrArgumentsIdentifier(node.operand)) { - reportGrammarErrorOfInvalidUseInStrictMode(node.operand); - } + // The identifier eval or arguments may not appear as the LeftHandSideExpression of an + // Assignment operator(11.13) or of a PostfixExpression(11.3) or as the UnaryExpression + // operated upon by a Prefix Increment(11.4.4) or a Prefix Decrement(11.4.5) operator + if ((node.operator === SyntaxKind.PlusPlusToken || node.operator === SyntaxKind.MinusMinusToken)) { + checkGrammarEvalOrArgumentsInStrictMode(node, node.operand); } var operandType = checkExpression(node.operand); @@ -6641,9 +6636,7 @@ module ts { // The identifier eval or arguments may not appear as the LeftHandSideExpression of an // Assignment operator(11.13) or of a PostfixExpression(11.3) or as the UnaryExpression // operated upon by a Prefix Increment(11.4.4) or a Prefix Decrement(11.4.5) operator. - if (node.parserContextFlags & ParserContextFlags.StrictMode && isEvalOrArgumentsIdentifier(node.operand)) { - reportGrammarErrorOfInvalidUseInStrictMode(node.operand); - } + checkGrammarEvalOrArgumentsInStrictMode(node, node.operand); var operandType = checkExpression(node.operand); var ok = checkArithmeticOperandType(node.operand, operandType, Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); @@ -6772,14 +6765,10 @@ module ts { function checkBinaryExpression(node: BinaryExpression, contextualMapper?: TypeMapper) { // Grammar checking - if (node.parserContextFlags & ParserContextFlags.StrictMode) { - if (isLeftHandSideExpression(node.left) && isAssignmentOperator(node.operator)) { - if (isEvalOrArgumentsIdentifier(node.left)) { - // ECMA 262 (Annex C) The identifier eval or arguments may not appear as the LeftHandSideExpression of an - // Assignment operator(11.13) or of a PostfixExpression(11.3) - reportGrammarErrorOfInvalidUseInStrictMode(node.left); - } - } + if (isLeftHandSideExpression(node.left) && isAssignmentOperator(node.operator)) { + // ECMA 262 (Annex C) The identifier eval or arguments may not appear as the LeftHandSideExpression of an + // Assignment operator(11.13) or of a PostfixExpression(11.3) + checkGrammarEvalOrArgumentsInStrictMode(node, node.left); } var operator = node.operator; @@ -7143,8 +7132,8 @@ module ts { // or if its FunctionBody is strict code(11.1.5). // It is a SyntaxError if the identifier eval or arguments appears within a FormalParameterList of a // strict mode FunctionLikeDeclaration or FunctionExpression(13.1) - if (!checkGrammarModifiers(node) && (node.parserContextFlags & ParserContextFlags.StrictMode && isEvalOrArgumentsIdentifier(node.name))) { - reportGrammarErrorOfInvalidUseInStrictMode(node.name); + if (!checkGrammarModifiers(node)) { + checkGrammarEvalOrArgumentsInStrictMode(node, node.name); } checkVariableLikeDeclaration(node); @@ -8281,11 +8270,10 @@ module ts { var colonStart = skipTrivia(sourceFile.text, catchClause.name.end); grammarErrorAtPos(sourceFile, colonStart, ":".length, Diagnostics.Catch_clause_parameter_cannot_have_a_type_annotation); } - if (node.parserContextFlags & ParserContextFlags.StrictMode && isEvalOrArgumentsIdentifier(catchClause.name)) { - // It is a SyntaxError if a TryStatement with a Catch occurs within strict code and the Identifier of the - // Catch production is eval or arguments - reportGrammarErrorOfInvalidUseInStrictMode(catchClause.name); - } + // It is a SyntaxError if a TryStatement with a Catch occurs within strict code and the Identifier of the + // Catch production is eval or arguments + checkGrammarEvalOrArgumentsInStrictMode(node, catchClause.name); + checkBlock(catchClause.block); } if (node.finallyBlock) checkBlock(node.finallyBlock); @@ -10135,11 +10123,9 @@ module ts { } function checkGrammarBindingElement(node: BindingElement) { - if (node.parserContextFlags & ParserContextFlags.StrictMode && isEvalOrArgumentsIdentifier(node.name)) { - // It is a SyntaxError if a VariableDeclaration or VariableDeclarationNoIn occurs within strict code - // and its Identifier is eval or arguments - reportGrammarErrorOfInvalidUseInStrictMode(node.name); - } + // It is a SyntaxError if a VariableDeclaration or VariableDeclarationNoIn occurs within strict code + // and its Identifier is eval or arguments + checkGrammarEvalOrArgumentsInStrictMode(node, node.name); } function checkGrammarHeritageClause(node: HeritageClause): boolean { @@ -10147,8 +10133,8 @@ module ts { if (checkGrammarForDisallowedTrailingComma(types)) { return true; } - var listType = tokenToString(node.token); if (types && types.length === 0) { + var listType = tokenToString(node.token); var sourceFile = getSourceFileOfNode(node); return grammarErrorAtPos(sourceFile, types.pos, 0, Diagnostics._0_list_cannot_be_empty, listType) } @@ -10165,18 +10151,15 @@ module ts { if (heritageClause.token === SyntaxKind.ExtendsKeyword) { if (seenExtendsClause) { - grammarErrorOnFirstToken(heritageClause, Diagnostics.extends_clause_already_seen) - break; + return grammarErrorOnFirstToken(heritageClause, Diagnostics.extends_clause_already_seen) } if (seenImplementsClause) { - grammarErrorOnFirstToken(heritageClause, Diagnostics.extends_clause_must_precede_implements_clause); - break; + return grammarErrorOnFirstToken(heritageClause, Diagnostics.extends_clause_must_precede_implements_clause); } if (heritageClause.types.length > 1) { - grammarErrorOnFirstToken(heritageClause.types[1], Diagnostics.Classes_can_only_extend_a_single_class); - break; + return grammarErrorOnFirstToken(heritageClause.types[1], Diagnostics.Classes_can_only_extend_a_single_class); } seenExtendsClause = true; @@ -10184,8 +10167,7 @@ module ts { else { Debug.assert(heritageClause.token === SyntaxKind.ImplementsKeyword); if (seenImplementsClause) { - grammarErrorOnFirstToken(heritageClause, Diagnostics.implements_clause_already_seen); - break; + return grammarErrorOnFirstToken(heritageClause, Diagnostics.implements_clause_already_seen); } seenImplementsClause = true; @@ -10246,11 +10228,8 @@ module ts { } function checkGrammarFunctionName(name: Node) { - if (name && name.parserContextFlags & ParserContextFlags.StrictMode && isEvalOrArgumentsIdentifier(name)) { - // It is a SyntaxError to use within strict mode code the identifiers eval or arguments as the - // Identifier of a FunctionLikeDeclaration or FunctionExpression or as a formal parameter name(13.1) - return reportGrammarErrorOfInvalidUseInStrictMode(name); - } + // It is a SyntaxError if the identifier eval or arguments appears within a FormalParameterList of a strict mode FunctionDeclaration or FunctionExpression (13.1)) + return checkGrammarEvalOrArgumentsInStrictMode(name, name); } function checkGrammarForInvalidQuestionMark(node: Declaration, questionToken: Node, message: DiagnosticMessage): boolean { @@ -10268,9 +10247,13 @@ module ts { var inStrictMode = (node.parserContextFlags & ParserContextFlags.StrictMode) !== 0; for (var i = 0, n = node.properties.length; i < n; i++) { - var prop = node.properties[i]; + var prop = node.properties[i]; var name = prop.name; - if (prop.kind === SyntaxKind.OmittedExpression || name.kind === SyntaxKind.ComputedPropertyName) { + if (prop.kind === SyntaxKind.OmittedExpression) { + continue; + } + else if (name.kind === SyntaxKind.ComputedPropertyName) { + checkGrammarComputedPropertyName(name); continue; } @@ -10283,9 +10266,12 @@ module ts { // d.IsAccessorDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true // and either both previous and propId.descriptor have[[Get]] fields or both previous and propId.descriptor have[[Set]] fields var currentKind: number; - if (prop.kind === SyntaxKind.PropertyAssignment || - prop.kind === SyntaxKind.ShorthandPropertyAssignment || - prop.kind === SyntaxKind.MethodDeclaration) { + if (prop.kind === SyntaxKind.PropertyAssignment || prop.kind === SyntaxKind.ShorthandPropertyAssignment) { + // Grammar checking for computedPropertName and shorthandPropertyAssignment + checkGrammarForInvalidQuestionMark(prop,(prop).questionToken, Diagnostics.An_object_member_cannot_be_declared_optional); + currentKind = Property; + } + else if ( prop.kind === SyntaxKind.MethodDeclaration) { currentKind = Property; } else if (prop.kind === SyntaxKind.GetAccessor) { @@ -10321,16 +10307,6 @@ module ts { } } } - - // Grammar checking for computedPropertName and shorthandPropertyAssignment - forEach(node.properties, prop => { - if (prop.name.kind === SyntaxKind.ComputedPropertyName) { - checkGrammarComputedPropertyName(prop.name); - } - else if (prop.kind === SyntaxKind.ShorthandPropertyAssignment) { - checkGrammarForInvalidQuestionMark(prop, (prop).questionToken, Diagnostics.An_object_member_cannot_be_declared_optional); - } - }); } function hasParseDiagnostics(sourceFile: SourceFile): boolean { @@ -10371,11 +10347,11 @@ module ts { } } - function reportGrammarErrorOfInvalidUseInStrictMode(node: Identifier): boolean { - //var sourceText = getSourceFileOfNode(node).text; - //var name = sourceText.substring(skipTrivia(sourceText, node.pos), node.end); - var name = declarationNameToString(node); - return grammarErrorOnNode(node, Diagnostics.Invalid_use_of_0_in_strict_mode, name); + function checkGrammarEvalOrArgumentsInStrictMode(contextNode: Node, identifier: Identifier): boolean { + if (contextNode && (contextNode.parserContextFlags & ParserContextFlags.StrictMode) && isEvalOrArgumentsIdentifier(identifier)) { + var name = declarationNameToString(identifier); + return grammarErrorOnNode(identifier, Diagnostics.Invalid_use_of_0_in_strict_mode, name); + } } function grammarErrorAfterFirstToken(sourceFile: SourceFile, node: Node, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any): boolean { From d584737ea2afab9a42fc7ec44e4170e836e8e90b Mon Sep 17 00:00:00 2001 From: Yui T Date: Mon, 15 Dec 2014 14:47:09 -0800 Subject: [PATCH 52/78] Address code review --- src/compiler/checker.ts | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 972290095ed..d4376becd6a 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -8139,14 +8139,8 @@ module ts { // Grammar checking var parent = node.parent; var inFunctionBlock = false; - while (parent && parent.kind !== SyntaxKind.SourceFile) { - inFunctionBlock = isFunctionBlock(parent); - if (inFunctionBlock) { - break; - } - parent = parent.parent; - } - if (!inFunctionBlock) { + var functionBlock = getContainingFunction(node); + if (!functionBlock) { grammarErrorOnFirstToken(node, Diagnostics.A_return_statement_can_only_be_used_within_a_function_body); } @@ -8174,21 +8168,16 @@ module ts { function checkWithStatement(node: WithStatement) { // Grammar checking for withStatement + var hasStrictModeError = false; if (node.parserContextFlags & ParserContextFlags.StrictMode) { grammarErrorOnFirstToken(node, Diagnostics.with_statements_are_not_allowed_in_strict_mode); + hasStrictModeError = true; } // Grammar checking for invalid use of return statement - if (node.statement.kind === SyntaxKind.ReturnStatement) { - // Grammar check for invalid use of return statement - grammarErrorOnFirstToken(node.statement, Diagnostics.A_return_statement_can_only_be_used_within_a_function_body); - } - else if (node.statement.kind === SyntaxKind.Block) { - forEach((node.statement).statements, statement => { - if (statement.kind === SyntaxKind.ReturnStatement) { - // Grammar check for invalid use of return statement - grammarErrorOnFirstToken(node.statement, Diagnostics.A_return_statement_can_only_be_used_within_a_function_body); - } + if (!hasStrictModeError) { + forEachReturnStatement(node.statement, (returnStatement) => { + grammarErrorOnFirstToken(returnStatement, Diagnostics.A_return_statement_can_only_be_used_within_a_function_body); }); } From 60eb37df94b9e6cc2aa76910171e6c82dc67ecb0 Mon Sep 17 00:00:00 2001 From: Yui T Date: Mon, 15 Dec 2014 14:51:52 -0800 Subject: [PATCH 53/78] Move grammar checking: declare keyword in checkGrammarModifier; there are still erros from incomplete grammar migration --- src/compiler/checker.ts | 15 ++++++++++++++- .../diagnosticInformationMap.generated.ts | 2 +- src/compiler/diagnosticMessages.json | 3 ++- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index d4376becd6a..8983725d206 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -9947,7 +9947,20 @@ module ts { break; case SyntaxKind.DeclareKeyword: - // TODO (yuisu) : Revisit this once moving ambient Context into type checking + if (flags & NodeFlags.Ambient) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, "declare"); + } + else if (node.parent.kind === SyntaxKind.ClassDeclaration) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare"); + } + else if (node.kind === SyntaxKind.Parameter) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); + } + else if (isInAmbientContext(node.parent) && node.parent.kind === SyntaxKind.ModuleBlock) { + return grammarErrorOnNode(modifier, Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); + } + flags |= NodeFlags.Ambient; + lastDeclare = modifier break; } } diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index 2050bad5ca5..fa21ddd03d4 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -33,7 +33,7 @@ module ts { Only_ambient_modules_can_use_quoted_names: { code: 1035, category: DiagnosticCategory.Error, key: "Only ambient modules can use quoted names.", isEarly: true }, Statements_are_not_allowed_in_ambient_contexts: { code: 1036, category: DiagnosticCategory.Error, key: "Statements are not allowed in ambient contexts.", isEarly: true }, A_function_implementation_cannot_be_declared_in_an_ambient_context: { code: 1037, category: DiagnosticCategory.Error, key: "A function implementation cannot be declared in an ambient context.", isEarly: true }, - A_declare_modifier_cannot_be_used_in_an_already_ambient_context: { code: 1038, category: DiagnosticCategory.Error, key: "A 'declare' modifier cannot be used in an already ambient context." }, + A_declare_modifier_cannot_be_used_in_an_already_ambient_context: { code: 1038, category: DiagnosticCategory.Error, key: "A 'declare' modifier cannot be used in an already ambient context.", isEarly: true }, Initializers_are_not_allowed_in_ambient_contexts: { code: 1039, category: DiagnosticCategory.Error, key: "Initializers are not allowed in ambient contexts.", isEarly: true }, _0_modifier_cannot_appear_on_a_module_element: { code: 1044, category: DiagnosticCategory.Error, key: "'{0}' modifier cannot appear on a module element.", isEarly: true }, A_declare_modifier_cannot_be_used_with_an_interface_declaration: { code: 1045, category: DiagnosticCategory.Error, key: "A 'declare' modifier cannot be used with an interface declaration." }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 2cef9250a8f..3ddd6cf2a84 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -144,7 +144,8 @@ }, "A 'declare' modifier cannot be used in an already ambient context.": { "category": "Error", - "code": 1038 + "code": 1038, + "isEarly": true }, "Initializers are not allowed in ambient contexts.": { "category": "Error", From 28a115ef37931211bb27204d5833561ddc62e4a8 Mon Sep 17 00:00:00 2001 From: Yui T Date: Mon, 15 Dec 2014 15:05:31 -0800 Subject: [PATCH 54/78] Move grammar checking: breakStatement, continueStatement; there are still errors from incomplete grammar migration --- src/compiler/checker.ts | 71 +++++++++++++++++++ src/compiler/parser.ts | 6 +- .../invalidDoWhileBreakStatements.errors.txt | 4 +- ...nvalidDoWhileContinueStatements.errors.txt | 4 +- .../invalidForBreakStatements.errors.txt | 4 +- .../invalidForContinueStatements.errors.txt | 4 +- .../invalidForInBreakStatements.errors.txt | 4 +- .../invalidForInContinueStatements.errors.txt | 4 +- .../invalidWhileBreakStatements.errors.txt | 4 +- .../invalidWhileContinueStatements.errors.txt | 4 +- 10 files changed, 90 insertions(+), 19 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 8983725d206..a77da719e52 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -8128,6 +8128,9 @@ module ts { } function checkBreakOrContinueStatement(node: BreakOrContinueStatement) { + // Grammar checking + checkGrammarBreakOrContinueStatement(node); + // TODO: Check that target label is valid } @@ -10311,6 +10314,74 @@ module ts { } } + function isIterationStatement(node: Node, lookInLabeledStatements: boolean): boolean { + switch (node.kind) { + case SyntaxKind.ForStatement: + case SyntaxKind.ForInStatement: + case SyntaxKind.DoStatement: + case SyntaxKind.WhileStatement: + return true; + case SyntaxKind.LabeledStatement: + return lookInLabeledStatements && isIterationStatement((node).statement, lookInLabeledStatements); + } + + return false; + } + + function checkGrammarBreakOrContinueStatement(node: BreakOrContinueStatement): boolean { + var current: Node = node; + while (current) { + if (isAnyFunction(current)) { + return grammarErrorOnNode(node, Diagnostics.Jump_target_cannot_cross_function_boundary); + } + + switch (current.kind) { + case SyntaxKind.LabeledStatement: + if (node.label && (current).label.text === node.label.text) { + // found matching label - verify that label usage is correct + // continue can only target labels that are on iteration statements + var isMisplacedContinueLabel = node.kind === SyntaxKind.ContinueStatement + && !isIterationStatement((current).statement, /*lookInLabeledStatement*/ true); + + if (isMisplacedContinueLabel) { + return grammarErrorOnNode(node, Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement); + } + + return false; + } + break; + case SyntaxKind.SwitchStatement: + if (node.kind === SyntaxKind.BreakStatement && !node.label) { + // unlabeled break within switch statement - ok + return false; + } + break; + default: + if (isIterationStatement(current, /*lookInLabeledStatement*/ false) && !node.label) { + // unlabeled break or continue within iteration statement - ok + return false; + } + break; + } + + current = current.parent; + } + + if (node.label) { + var message = node.kind === SyntaxKind.BreakStatement + ? Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement + : Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement; + + return grammarErrorOnNode(node, message) + } + else { + var message = node.kind === SyntaxKind.BreakStatement + ? Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement + : Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; + return grammarErrorOnNode(node, message) + } + } + function hasParseDiagnostics(sourceFile: SourceFile): boolean { return sourceFile.parseDiagnostics.length > 0; } diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 2763340551a..b2fbe11fcb5 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -4626,9 +4626,9 @@ module ts { function checkNode(node: Node, nodeKind: SyntaxKind): boolean { // Now do node specific checks. switch (nodeKind) { - case SyntaxKind.BreakStatement: - case SyntaxKind.ContinueStatement: - return checkBreakOrContinueStatement(node); + //case SyntaxKind.BreakStatement: + //case SyntaxKind.ContinueStatement: + //return checkBreakOrContinueStatement(node); //case SyntaxKind.CallExpression: //case SyntaxKind.NewExpression: //return checkCallOrNewExpression(node); diff --git a/tests/baselines/reference/invalidDoWhileBreakStatements.errors.txt b/tests/baselines/reference/invalidDoWhileBreakStatements.errors.txt index 65fd55b763b..6113009e598 100644 --- a/tests/baselines/reference/invalidDoWhileBreakStatements.errors.txt +++ b/tests/baselines/reference/invalidDoWhileBreakStatements.errors.txt @@ -1,9 +1,9 @@ tests/cases/conformance/statements/breakStatements/invalidDoWhileBreakStatements.ts(4,1): error TS1105: A 'break' statement can only be used within an enclosing iteration or switch statement. tests/cases/conformance/statements/breakStatements/invalidDoWhileBreakStatements.ts(8,4): error TS1116: A 'break' statement can only jump to a label of an enclosing statement. -tests/cases/conformance/statements/breakStatements/invalidDoWhileBreakStatements.ts(14,9): error TS1107: Jump target cannot cross function boundary. -tests/cases/conformance/statements/breakStatements/invalidDoWhileBreakStatements.ts(21,9): error TS1107: Jump target cannot cross function boundary. tests/cases/conformance/statements/breakStatements/invalidDoWhileBreakStatements.ts(27,5): error TS1116: A 'break' statement can only jump to a label of an enclosing statement. tests/cases/conformance/statements/breakStatements/invalidDoWhileBreakStatements.ts(37,5): error TS1116: A 'break' statement can only jump to a label of an enclosing statement. +tests/cases/conformance/statements/breakStatements/invalidDoWhileBreakStatements.ts(14,9): error TS1107: Jump target cannot cross function boundary. +tests/cases/conformance/statements/breakStatements/invalidDoWhileBreakStatements.ts(21,9): error TS1107: Jump target cannot cross function boundary. ==== tests/cases/conformance/statements/breakStatements/invalidDoWhileBreakStatements.ts (6 errors) ==== diff --git a/tests/baselines/reference/invalidDoWhileContinueStatements.errors.txt b/tests/baselines/reference/invalidDoWhileContinueStatements.errors.txt index e9643394d12..c89f9c01055 100644 --- a/tests/baselines/reference/invalidDoWhileContinueStatements.errors.txt +++ b/tests/baselines/reference/invalidDoWhileContinueStatements.errors.txt @@ -1,9 +1,9 @@ tests/cases/conformance/statements/continueStatements/invalidDoWhileContinueStatements.ts(4,1): error TS1104: A 'continue' statement can only be used within an enclosing iteration statement. tests/cases/conformance/statements/continueStatements/invalidDoWhileContinueStatements.ts(8,4): error TS1115: A 'continue' statement can only jump to a label of an enclosing iteration statement. -tests/cases/conformance/statements/continueStatements/invalidDoWhileContinueStatements.ts(14,9): error TS1107: Jump target cannot cross function boundary. -tests/cases/conformance/statements/continueStatements/invalidDoWhileContinueStatements.ts(21,9): error TS1107: Jump target cannot cross function boundary. tests/cases/conformance/statements/continueStatements/invalidDoWhileContinueStatements.ts(27,5): error TS1115: A 'continue' statement can only jump to a label of an enclosing iteration statement. tests/cases/conformance/statements/continueStatements/invalidDoWhileContinueStatements.ts(37,5): error TS1115: A 'continue' statement can only jump to a label of an enclosing iteration statement. +tests/cases/conformance/statements/continueStatements/invalidDoWhileContinueStatements.ts(14,9): error TS1107: Jump target cannot cross function boundary. +tests/cases/conformance/statements/continueStatements/invalidDoWhileContinueStatements.ts(21,9): error TS1107: Jump target cannot cross function boundary. ==== tests/cases/conformance/statements/continueStatements/invalidDoWhileContinueStatements.ts (6 errors) ==== diff --git a/tests/baselines/reference/invalidForBreakStatements.errors.txt b/tests/baselines/reference/invalidForBreakStatements.errors.txt index 50e4013c0ea..c63c97dcf69 100644 --- a/tests/baselines/reference/invalidForBreakStatements.errors.txt +++ b/tests/baselines/reference/invalidForBreakStatements.errors.txt @@ -1,9 +1,9 @@ tests/cases/conformance/statements/breakStatements/invalidForBreakStatements.ts(4,1): error TS1105: A 'break' statement can only be used within an enclosing iteration or switch statement. tests/cases/conformance/statements/breakStatements/invalidForBreakStatements.ts(8,9): error TS1116: A 'break' statement can only jump to a label of an enclosing statement. -tests/cases/conformance/statements/breakStatements/invalidForBreakStatements.ts(14,9): error TS1107: Jump target cannot cross function boundary. -tests/cases/conformance/statements/breakStatements/invalidForBreakStatements.ts(21,9): error TS1107: Jump target cannot cross function boundary. tests/cases/conformance/statements/breakStatements/invalidForBreakStatements.ts(27,5): error TS1116: A 'break' statement can only jump to a label of an enclosing statement. tests/cases/conformance/statements/breakStatements/invalidForBreakStatements.ts(36,5): error TS1116: A 'break' statement can only jump to a label of an enclosing statement. +tests/cases/conformance/statements/breakStatements/invalidForBreakStatements.ts(14,9): error TS1107: Jump target cannot cross function boundary. +tests/cases/conformance/statements/breakStatements/invalidForBreakStatements.ts(21,9): error TS1107: Jump target cannot cross function boundary. ==== tests/cases/conformance/statements/breakStatements/invalidForBreakStatements.ts (6 errors) ==== diff --git a/tests/baselines/reference/invalidForContinueStatements.errors.txt b/tests/baselines/reference/invalidForContinueStatements.errors.txt index 3af47370df1..459c2c5efa7 100644 --- a/tests/baselines/reference/invalidForContinueStatements.errors.txt +++ b/tests/baselines/reference/invalidForContinueStatements.errors.txt @@ -1,9 +1,9 @@ tests/cases/conformance/statements/continueStatements/invalidForContinueStatements.ts(4,1): error TS1104: A 'continue' statement can only be used within an enclosing iteration statement. tests/cases/conformance/statements/continueStatements/invalidForContinueStatements.ts(8,9): error TS1115: A 'continue' statement can only jump to a label of an enclosing iteration statement. -tests/cases/conformance/statements/continueStatements/invalidForContinueStatements.ts(14,9): error TS1107: Jump target cannot cross function boundary. -tests/cases/conformance/statements/continueStatements/invalidForContinueStatements.ts(21,9): error TS1107: Jump target cannot cross function boundary. tests/cases/conformance/statements/continueStatements/invalidForContinueStatements.ts(27,5): error TS1115: A 'continue' statement can only jump to a label of an enclosing iteration statement. tests/cases/conformance/statements/continueStatements/invalidForContinueStatements.ts(36,5): error TS1115: A 'continue' statement can only jump to a label of an enclosing iteration statement. +tests/cases/conformance/statements/continueStatements/invalidForContinueStatements.ts(14,9): error TS1107: Jump target cannot cross function boundary. +tests/cases/conformance/statements/continueStatements/invalidForContinueStatements.ts(21,9): error TS1107: Jump target cannot cross function boundary. ==== tests/cases/conformance/statements/continueStatements/invalidForContinueStatements.ts (6 errors) ==== diff --git a/tests/baselines/reference/invalidForInBreakStatements.errors.txt b/tests/baselines/reference/invalidForInBreakStatements.errors.txt index d83304ab1c6..c12babd3a3a 100644 --- a/tests/baselines/reference/invalidForInBreakStatements.errors.txt +++ b/tests/baselines/reference/invalidForInBreakStatements.errors.txt @@ -1,9 +1,9 @@ tests/cases/conformance/statements/breakStatements/invalidForInBreakStatements.ts(4,1): error TS1105: A 'break' statement can only be used within an enclosing iteration or switch statement. tests/cases/conformance/statements/breakStatements/invalidForInBreakStatements.ts(8,19): error TS1116: A 'break' statement can only jump to a label of an enclosing statement. -tests/cases/conformance/statements/breakStatements/invalidForInBreakStatements.ts(14,9): error TS1107: Jump target cannot cross function boundary. -tests/cases/conformance/statements/breakStatements/invalidForInBreakStatements.ts(21,9): error TS1107: Jump target cannot cross function boundary. tests/cases/conformance/statements/breakStatements/invalidForInBreakStatements.ts(27,5): error TS1116: A 'break' statement can only jump to a label of an enclosing statement. tests/cases/conformance/statements/breakStatements/invalidForInBreakStatements.ts(37,5): error TS1116: A 'break' statement can only jump to a label of an enclosing statement. +tests/cases/conformance/statements/breakStatements/invalidForInBreakStatements.ts(14,9): error TS1107: Jump target cannot cross function boundary. +tests/cases/conformance/statements/breakStatements/invalidForInBreakStatements.ts(21,9): error TS1107: Jump target cannot cross function boundary. ==== tests/cases/conformance/statements/breakStatements/invalidForInBreakStatements.ts (6 errors) ==== diff --git a/tests/baselines/reference/invalidForInContinueStatements.errors.txt b/tests/baselines/reference/invalidForInContinueStatements.errors.txt index 7353a22d9cd..ebd96fd6e46 100644 --- a/tests/baselines/reference/invalidForInContinueStatements.errors.txt +++ b/tests/baselines/reference/invalidForInContinueStatements.errors.txt @@ -1,9 +1,9 @@ tests/cases/conformance/statements/continueStatements/invalidForInContinueStatements.ts(4,1): error TS1104: A 'continue' statement can only be used within an enclosing iteration statement. tests/cases/conformance/statements/continueStatements/invalidForInContinueStatements.ts(8,19): error TS1115: A 'continue' statement can only jump to a label of an enclosing iteration statement. -tests/cases/conformance/statements/continueStatements/invalidForInContinueStatements.ts(14,9): error TS1107: Jump target cannot cross function boundary. -tests/cases/conformance/statements/continueStatements/invalidForInContinueStatements.ts(21,9): error TS1107: Jump target cannot cross function boundary. tests/cases/conformance/statements/continueStatements/invalidForInContinueStatements.ts(27,5): error TS1115: A 'continue' statement can only jump to a label of an enclosing iteration statement. tests/cases/conformance/statements/continueStatements/invalidForInContinueStatements.ts(37,5): error TS1115: A 'continue' statement can only jump to a label of an enclosing iteration statement. +tests/cases/conformance/statements/continueStatements/invalidForInContinueStatements.ts(14,9): error TS1107: Jump target cannot cross function boundary. +tests/cases/conformance/statements/continueStatements/invalidForInContinueStatements.ts(21,9): error TS1107: Jump target cannot cross function boundary. ==== tests/cases/conformance/statements/continueStatements/invalidForInContinueStatements.ts (6 errors) ==== diff --git a/tests/baselines/reference/invalidWhileBreakStatements.errors.txt b/tests/baselines/reference/invalidWhileBreakStatements.errors.txt index 54adc2856d7..1ed29772d7b 100644 --- a/tests/baselines/reference/invalidWhileBreakStatements.errors.txt +++ b/tests/baselines/reference/invalidWhileBreakStatements.errors.txt @@ -1,9 +1,9 @@ tests/cases/conformance/statements/breakStatements/invalidWhileBreakStatements.ts(4,1): error TS1105: A 'break' statement can only be used within an enclosing iteration or switch statement. tests/cases/conformance/statements/breakStatements/invalidWhileBreakStatements.ts(8,14): error TS1116: A 'break' statement can only jump to a label of an enclosing statement. -tests/cases/conformance/statements/breakStatements/invalidWhileBreakStatements.ts(14,9): error TS1107: Jump target cannot cross function boundary. -tests/cases/conformance/statements/breakStatements/invalidWhileBreakStatements.ts(21,9): error TS1107: Jump target cannot cross function boundary. tests/cases/conformance/statements/breakStatements/invalidWhileBreakStatements.ts(27,5): error TS1116: A 'break' statement can only jump to a label of an enclosing statement. tests/cases/conformance/statements/breakStatements/invalidWhileBreakStatements.ts(37,5): error TS1116: A 'break' statement can only jump to a label of an enclosing statement. +tests/cases/conformance/statements/breakStatements/invalidWhileBreakStatements.ts(14,9): error TS1107: Jump target cannot cross function boundary. +tests/cases/conformance/statements/breakStatements/invalidWhileBreakStatements.ts(21,9): error TS1107: Jump target cannot cross function boundary. ==== tests/cases/conformance/statements/breakStatements/invalidWhileBreakStatements.ts (6 errors) ==== diff --git a/tests/baselines/reference/invalidWhileContinueStatements.errors.txt b/tests/baselines/reference/invalidWhileContinueStatements.errors.txt index 462b244efd4..ac658dbc944 100644 --- a/tests/baselines/reference/invalidWhileContinueStatements.errors.txt +++ b/tests/baselines/reference/invalidWhileContinueStatements.errors.txt @@ -1,9 +1,9 @@ tests/cases/conformance/statements/continueStatements/invalidWhileContinueStatements.ts(4,1): error TS1104: A 'continue' statement can only be used within an enclosing iteration statement. tests/cases/conformance/statements/continueStatements/invalidWhileContinueStatements.ts(8,14): error TS1115: A 'continue' statement can only jump to a label of an enclosing iteration statement. -tests/cases/conformance/statements/continueStatements/invalidWhileContinueStatements.ts(14,9): error TS1107: Jump target cannot cross function boundary. -tests/cases/conformance/statements/continueStatements/invalidWhileContinueStatements.ts(21,9): error TS1107: Jump target cannot cross function boundary. tests/cases/conformance/statements/continueStatements/invalidWhileContinueStatements.ts(27,5): error TS1115: A 'continue' statement can only jump to a label of an enclosing iteration statement. tests/cases/conformance/statements/continueStatements/invalidWhileContinueStatements.ts(37,5): error TS1115: A 'continue' statement can only jump to a label of an enclosing iteration statement. +tests/cases/conformance/statements/continueStatements/invalidWhileContinueStatements.ts(14,9): error TS1107: Jump target cannot cross function boundary. +tests/cases/conformance/statements/continueStatements/invalidWhileContinueStatements.ts(21,9): error TS1107: Jump target cannot cross function boundary. ==== tests/cases/conformance/statements/continueStatements/invalidWhileContinueStatements.ts (6 errors) ==== From bcf73a8207db16ae281cf87b1ec88b8b5a94d5dd Mon Sep 17 00:00:00 2001 From: Yui T Date: Mon, 15 Dec 2014 15:26:08 -0800 Subject: [PATCH 55/78] Move grammar checking: enumDeclaration; there are still erros from incomplete grammar migration --- src/compiler/checker.ts | 54 +++++++++++++++++++ src/compiler/parser.ts | 2 +- .../reference/ambientErrors.errors.txt | 4 +- 3 files changed, 57 insertions(+), 3 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index a77da719e52..a259e3a5aa4 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -8779,6 +8779,9 @@ module ts { } function checkEnumDeclaration(node: EnumDeclaration) { + // Grammar checking + checkGrammarModifiers(node) || checkGrammarEnumDeclaration(node); + if (!fullTypeCheck) { return; } @@ -10382,6 +10385,57 @@ module ts { } } + function isIntegerLiteral(expression: Expression): boolean { + if (expression.kind === SyntaxKind.PrefixUnaryExpression) { + var unaryExpression = expression; + if (unaryExpression.operator === SyntaxKind.PlusToken || unaryExpression.operator === SyntaxKind.MinusToken) { + expression = unaryExpression.operand; + } + } + if (expression.kind === SyntaxKind.NumericLiteral) { + // Allows for scientific notation since literalExpression.text was formed by + // coercing a number to a string. Sometimes this coercion can yield a string + // in scientific notation. + // We also don't need special logic for hex because a hex integer is converted + // to decimal when it is coerced. + return /^[0-9]+([eE]\+?[0-9]+)?$/.test((expression).text); + } + + return false; + } + + function checkGrammarEnumDeclaration(enumDecl: EnumDeclaration): boolean { + var enumIsConst = (enumDecl.flags & NodeFlags.Const) !== 0; + + var hasError = false; + + // skip checks below for const enums - they allow arbitrary initializers as long as they can be evaluated to constant expressions. + // since all values are known in compile time - it is not necessary to check that constant enum section precedes computed enum members. + if (!enumIsConst) { + var inConstantEnumMemberSection = true; + var inAmbientContext = isInAmbientContext(enumDecl); + for (var i = 0, n = enumDecl.members.length; i < n; i++) { + var node = enumDecl.members[i]; + if (node.name.kind === SyntaxKind.ComputedPropertyName) { + hasError = grammarErrorOnNode(node.name, Diagnostics.Computed_property_names_are_not_allowed_in_enums); + } + else if (inAmbientContext) { + if (node.initializer && !isIntegerLiteral(node.initializer)) { + hasError = grammarErrorOnNode(node.name, Diagnostics.Ambient_enum_elements_can_only_have_integer_literal_initializers) || hasError; + } + } + else if (node.initializer) { + inConstantEnumMemberSection = isIntegerLiteral(node.initializer); + } + else if (!inConstantEnumMemberSection) { + hasError = grammarErrorOnNode(node.name, Diagnostics.Enum_member_must_have_initializer) || hasError; + } + } + } + + return hasError; + } + function hasParseDiagnostics(sourceFile: SourceFile): boolean { return sourceFile.parseDiagnostics.length > 0; } diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index b2fbe11fcb5..c823469c7a0 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -4633,7 +4633,7 @@ module ts { //case SyntaxKind.NewExpression: //return checkCallOrNewExpression(node); - case SyntaxKind.EnumDeclaration: return checkEnumDeclaration(node); + //case SyntaxKind.EnumDeclaration: return checkEnumDeclaration(node); //case SyntaxKind.BinaryExpression: return checkBinaryExpression(node); //case SyntaxKind.BindingElement: return checkBindingElement(node); //case SyntaxKind.CatchClause: return checkCatchClause(node); diff --git a/tests/baselines/reference/ambientErrors.errors.txt b/tests/baselines/reference/ambientErrors.errors.txt index 6fe7a25dfe9..834c35e541c 100644 --- a/tests/baselines/reference/ambientErrors.errors.txt +++ b/tests/baselines/reference/ambientErrors.errors.txt @@ -1,7 +1,5 @@ tests/cases/conformance/ambient/ambientErrors.ts(2,15): error TS1039: Initializers are not allowed in ambient contexts. tests/cases/conformance/ambient/ambientErrors.ts(20,24): error TS1037: A function implementation cannot be declared in an ambient context. -tests/cases/conformance/ambient/ambientErrors.ts(24,5): error TS1066: Ambient enum elements can only have integer literal initializers. -tests/cases/conformance/ambient/ambientErrors.ts(29,5): error TS1066: Ambient enum elements can only have integer literal initializers. tests/cases/conformance/ambient/ambientErrors.ts(34,11): error TS1039: Initializers are not allowed in ambient contexts. tests/cases/conformance/ambient/ambientErrors.ts(35,19): error TS1037: A function implementation cannot be declared in an ambient context. tests/cases/conformance/ambient/ambientErrors.ts(37,20): error TS1039: Initializers are not allowed in ambient contexts. @@ -11,6 +9,8 @@ tests/cases/conformance/ambient/ambientErrors.ts(40,14): error TS1037: A functio tests/cases/conformance/ambient/ambientErrors.ts(41,22): error TS1037: A function implementation cannot be declared in an ambient context. tests/cases/conformance/ambient/ambientErrors.ts(6,1): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. tests/cases/conformance/ambient/ambientErrors.ts(17,22): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. +tests/cases/conformance/ambient/ambientErrors.ts(24,5): error TS1066: Ambient enum elements can only have integer literal initializers. +tests/cases/conformance/ambient/ambientErrors.ts(29,5): error TS1066: Ambient enum elements can only have integer literal initializers. tests/cases/conformance/ambient/ambientErrors.ts(47,20): error TS2435: Ambient external modules cannot be nested in other modules. tests/cases/conformance/ambient/ambientErrors.ts(51,16): error TS2436: Ambient external module declaration cannot specify relative module name. tests/cases/conformance/ambient/ambientErrors.ts(57,5): error TS2309: An export assignment cannot be used in a module with other exported elements. From f22adf678534cd2269255ddb1b85e3c9c9ed2b17 Mon Sep 17 00:00:00 2001 From: Yui T Date: Mon, 15 Dec 2014 16:42:31 -0800 Subject: [PATCH 56/78] Move grammar checking: constructorDeclaration; there are still errors from incomplete grammar migration --- src/compiler/checker.ts | 32 ++++++++++++-- src/compiler/parser.ts | 6 +-- .../emptyGenericParamList.errors.txt | 8 ++-- ...implicitAnyInAmbientDeclaration.errors.txt | 2 +- ...licitAnyInAmbientDeclaration2.d.errors.txt | 2 +- ...ModuleWithStatementsOfEveryKind.errors.txt | 6 +-- .../parserComputedPropertyName34.errors.txt | 2 +- .../parserConstructorDeclaration12.errors.txt | 42 +++++++++---------- .../reference/protectedMembers.errors.txt | 2 +- .../templateStringInTaggedTemplate.errors.txt | 8 ++-- .../typesWithPrivateConstructor.errors.txt | 2 +- 11 files changed, 68 insertions(+), 44 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index a259e3a5aa4..bc202d76371 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -7157,8 +7157,7 @@ module ts { checkGrammarIndexSignature(node); } // TODO (yuisu): Remove this check in else-if when SyntaxKind.Construct is moved and ambient context is handled - else if (node.kind === SyntaxKind.FunctionType || node.kind === SyntaxKind.ConstructorType || - node.kind === SyntaxKind.CallSignature || node.kind === SyntaxKind.ConstructSignature){ + else if (node.kind === SyntaxKind.FunctionType || node.kind === SyntaxKind.ConstructorType || node.kind === SyntaxKind.CallSignature){ checkGrammarFunctionLikeDeclaration(node); } @@ -7241,6 +7240,9 @@ module ts { } function checkConstructorDeclaration(node: ConstructorDeclaration) { + // Grammar check on signature of constructor is done in checkSignatureDeclaration function + checkGrammarModifiers(node) || checkGrammarFunctionLikeDeclaration(node) || checkGrammarConstructorTypeParameters(node) || checkGrammarConstructorTypeAnnotation(node) || checkGrammarForBodyInAmbientContext(node.body, /*isConstructor:*/ true); + checkSignatureDeclaration(node); checkSourceElement(node.body); @@ -8244,7 +8246,7 @@ module ts { function checkThrowStatement(node: ThrowStatement) { if (node.expression === undefined) { - grammarErrorAfterFirstToken(getSourceFileOfNode(node), node, Diagnostics.Line_break_not_permitted_here); + grammarErrorAfterFirstToken(node, Diagnostics.Line_break_not_permitted_here); } if (node.expression) { @@ -10481,7 +10483,29 @@ module ts { } } - function grammarErrorAfterFirstToken(sourceFile: SourceFile, node: Node, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any): boolean { + function checkGrammarConstructorTypeParameters(node: ConstructorDeclaration) { + if (node.typeParameters) { + return grammarErrorAtPos(getSourceFileOfNode(node), node.typeParameters.pos, node.typeParameters.end - node.typeParameters.pos, Diagnostics.Type_parameters_cannot_appear_on_a_constructor_declaration); + } + } + + function checkGrammarConstructorTypeAnnotation(node: ConstructorDeclaration) { + if (node.type) { + return grammarErrorOnNode(node.type, Diagnostics.Type_annotation_cannot_appear_on_a_constructor_declaration); + } + } + + function checkGrammarForBodyInAmbientContext(body: Block | Expression, isConstructor: boolean): boolean { + if (isInAmbientContext(body) && body && body.kind === SyntaxKind.Block) { + var diagnostic = isConstructor + ? Diagnostics.A_constructor_implementation_cannot_be_declared_in_an_ambient_context + : Diagnostics.A_function_implementation_cannot_be_declared_in_an_ambient_context; + return grammarErrorOnFirstToken(body, diagnostic); + } + } + + function grammarErrorAfterFirstToken(node: Node, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any): boolean { + var sourceFile = getSourceFileOfNode(node); if (!hasParseDiagnostics(sourceFile)) { var scanner = createScanner(compilerOptions.target, /*skipTrivia*/ true, sourceFile.text); scanToken(scanner, node.pos); diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index c823469c7a0..6feeedc159c 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -4639,7 +4639,7 @@ module ts { //case SyntaxKind.CatchClause: return checkCatchClause(node); //case SyntaxKind.ClassDeclaration: return checkClassDeclaration(node); //case SyntaxKind.ComputedPropertyName: return checkComputedPropertyName(node); - case SyntaxKind.Constructor: return checkConstructor(node); + //case SyntaxKind.Constructor: return checkConstructor(node); //case SyntaxKind.DeleteExpression: return checkDeleteExpression( node); //case SyntaxKind.ElementAccessExpression: return checkElementAccessExpression(node); //case SyntaxKind.ExportAssignment: return checkExportAssignment(node); @@ -5323,7 +5323,7 @@ module ts { switch (node.kind) { case SyntaxKind.GetAccessor: case SyntaxKind.SetAccessor: - case SyntaxKind.Constructor: + //case SyntaxKind.Constructor: case SyntaxKind.PropertyDeclaration: case SyntaxKind.PropertySignature: case SyntaxKind.MethodDeclaration: @@ -5331,7 +5331,7 @@ module ts { //case SyntaxKind.ClassDeclaration: case SyntaxKind.InterfaceDeclaration: case SyntaxKind.ModuleDeclaration: - case SyntaxKind.EnumDeclaration: + //case SyntaxKind.EnumDeclaration: case SyntaxKind.ExportAssignment: case SyntaxKind.VariableStatement: case SyntaxKind.FunctionDeclaration: diff --git a/tests/baselines/reference/emptyGenericParamList.errors.txt b/tests/baselines/reference/emptyGenericParamList.errors.txt index 361e5a2fc21..ed1046d0f49 100644 --- a/tests/baselines/reference/emptyGenericParamList.errors.txt +++ b/tests/baselines/reference/emptyGenericParamList.errors.txt @@ -1,11 +1,11 @@ -tests/cases/compiler/emptyGenericParamList.ts(2,9): error TS1099: Type argument list cannot be empty. tests/cases/compiler/emptyGenericParamList.ts(2,8): error TS2314: Generic type 'I' requires 1 type argument(s). +tests/cases/compiler/emptyGenericParamList.ts(2,9): error TS1099: Type argument list cannot be empty. ==== tests/cases/compiler/emptyGenericParamList.ts (2 errors) ==== class I {} var x: I<>; - ~~ -!!! error TS1099: Type argument list cannot be empty. ~~~ -!!! error TS2314: Generic type 'I' requires 1 type argument(s). \ No newline at end of file +!!! error TS2314: Generic type 'I' requires 1 type argument(s). + ~~ +!!! error TS1099: Type argument list cannot be empty. \ No newline at end of file diff --git a/tests/baselines/reference/implicitAnyInAmbientDeclaration.errors.txt b/tests/baselines/reference/implicitAnyInAmbientDeclaration.errors.txt index 6ec975e33ea..4775ec0511b 100644 --- a/tests/baselines/reference/implicitAnyInAmbientDeclaration.errors.txt +++ b/tests/baselines/reference/implicitAnyInAmbientDeclaration.errors.txt @@ -1,7 +1,7 @@ -tests/cases/compiler/implicitAnyInAmbientDeclaration.ts(8,9): error TS1089: 'private' modifier cannot appear on a constructor declaration. tests/cases/compiler/implicitAnyInAmbientDeclaration.ts(3,9): error TS7008: Member 'publicMember' implicitly has an 'any' type. tests/cases/compiler/implicitAnyInAmbientDeclaration.ts(6,9): error TS7010: 'publicFunction', which lacks return-type annotation, implicitly has an 'any' return type. tests/cases/compiler/implicitAnyInAmbientDeclaration.ts(6,31): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/implicitAnyInAmbientDeclaration.ts(8,9): error TS1089: 'private' modifier cannot appear on a constructor declaration. ==== tests/cases/compiler/implicitAnyInAmbientDeclaration.ts (4 errors) ==== diff --git a/tests/baselines/reference/implicitAnyInAmbientDeclaration2.d.errors.txt b/tests/baselines/reference/implicitAnyInAmbientDeclaration2.d.errors.txt index 726c408aced..260dc6c9899 100644 --- a/tests/baselines/reference/implicitAnyInAmbientDeclaration2.d.errors.txt +++ b/tests/baselines/reference/implicitAnyInAmbientDeclaration2.d.errors.txt @@ -1,10 +1,10 @@ -tests/cases/compiler/implicitAnyInAmbientDeclaration2.d.ts(9,5): error TS1089: 'private' modifier cannot appear on a constructor declaration. tests/cases/compiler/implicitAnyInAmbientDeclaration2.d.ts(1,1): error TS7010: 'foo', which lacks return-type annotation, implicitly has an 'any' return type. tests/cases/compiler/implicitAnyInAmbientDeclaration2.d.ts(1,22): error TS7006: Parameter 'x' implicitly has an 'any' type. tests/cases/compiler/implicitAnyInAmbientDeclaration2.d.ts(2,13): error TS7005: Variable 'bar' implicitly has an 'any' type. tests/cases/compiler/implicitAnyInAmbientDeclaration2.d.ts(4,5): error TS7008: Member 'publicMember' implicitly has an 'any' type. tests/cases/compiler/implicitAnyInAmbientDeclaration2.d.ts(7,5): error TS7010: 'publicFunction', which lacks return-type annotation, implicitly has an 'any' return type. tests/cases/compiler/implicitAnyInAmbientDeclaration2.d.ts(7,27): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/implicitAnyInAmbientDeclaration2.d.ts(9,5): error TS1089: 'private' modifier cannot appear on a constructor declaration. tests/cases/compiler/implicitAnyInAmbientDeclaration2.d.ts(13,24): error TS7006: Parameter 'publicConsParam' implicitly has an 'any' type. diff --git a/tests/baselines/reference/invalidModuleWithStatementsOfEveryKind.errors.txt b/tests/baselines/reference/invalidModuleWithStatementsOfEveryKind.errors.txt index 09647b56771..0d2ef3d6924 100644 --- a/tests/baselines/reference/invalidModuleWithStatementsOfEveryKind.errors.txt +++ b/tests/baselines/reference/invalidModuleWithStatementsOfEveryKind.errors.txt @@ -1,24 +1,24 @@ tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(13,5): error TS1044: 'public' modifier cannot appear on a module element. tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(19,5): error TS1044: 'public' modifier cannot appear on a module element. -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(25,5): error TS1044: 'public' modifier cannot appear on a module element. tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(38,5): error TS1044: 'private' modifier cannot appear on a module element. tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(44,5): error TS1044: 'private' modifier cannot appear on a module element. -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(50,5): error TS1044: 'private' modifier cannot appear on a module element. tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(64,5): error TS1044: 'static' modifier cannot appear on a module element. tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(70,5): error TS1044: 'static' modifier cannot appear on a module element. -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(76,5): error TS1044: 'static' modifier cannot appear on a module element. tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(4,5): error TS1044: 'public' modifier cannot appear on a module element. tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(6,5): error TS1044: 'public' modifier cannot appear on a module element. tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(12,5): error TS1044: 'public' modifier cannot appear on a module element. tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(15,5): error TS1044: 'public' modifier cannot appear on a module element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(25,5): error TS1044: 'public' modifier cannot appear on a module element. tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(29,5): error TS1044: 'private' modifier cannot appear on a module element. tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(31,5): error TS1044: 'private' modifier cannot appear on a module element. tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(37,5): error TS1044: 'private' modifier cannot appear on a module element. tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(40,5): error TS1044: 'private' modifier cannot appear on a module element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(50,5): error TS1044: 'private' modifier cannot appear on a module element. tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(55,5): error TS1044: 'static' modifier cannot appear on a module element. tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(57,5): error TS1044: 'static' modifier cannot appear on a module element. tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(63,5): error TS1044: 'static' modifier cannot appear on a module element. tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(66,5): error TS1044: 'static' modifier cannot appear on a module element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(76,5): error TS1044: 'static' modifier cannot appear on a module element. ==== tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts (21 errors) ==== diff --git a/tests/baselines/reference/parserComputedPropertyName34.errors.txt b/tests/baselines/reference/parserComputedPropertyName34.errors.txt index 05d7375f132..9b244a5a13a 100644 --- a/tests/baselines/reference/parserComputedPropertyName34.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName34.errors.txt @@ -1,6 +1,6 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName34.ts(3,5): error TS1164: Computed property names are not allowed in enums. -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName34.ts(4,5): error TS1164: Computed property names are not allowed in enums. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName34.ts(3,11): error TS2304: Cannot find name 'id'. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName34.ts(4,5): error TS1164: Computed property names are not allowed in enums. ==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName34.ts (3 errors) ==== diff --git a/tests/baselines/reference/parserConstructorDeclaration12.errors.txt b/tests/baselines/reference/parserConstructorDeclaration12.errors.txt index 949098e91da..181a3b2215f 100644 --- a/tests/baselines/reference/parserConstructorDeclaration12.errors.txt +++ b/tests/baselines/reference/parserConstructorDeclaration12.errors.txt @@ -1,61 +1,61 @@ -tests/cases/compiler/parserConstructorDeclaration12.ts(2,14): error TS1098: Type parameter list cannot be empty. -tests/cases/compiler/parserConstructorDeclaration12.ts(3,14): error TS1098: Type parameter list cannot be empty. -tests/cases/compiler/parserConstructorDeclaration12.ts(4,15): error TS1098: Type parameter list cannot be empty. -tests/cases/compiler/parserConstructorDeclaration12.ts(5,15): error TS1098: Type parameter list cannot be empty. -tests/cases/compiler/parserConstructorDeclaration12.ts(6,14): error TS1098: Type parameter list cannot be empty. -tests/cases/compiler/parserConstructorDeclaration12.ts(7,14): error TS1098: Type parameter list cannot be empty. -tests/cases/compiler/parserConstructorDeclaration12.ts(8,15): error TS1098: Type parameter list cannot be empty. -tests/cases/compiler/parserConstructorDeclaration12.ts(9,15): error TS1098: Type parameter list cannot be empty. tests/cases/compiler/parserConstructorDeclaration12.ts(2,3): error TS2392: Multiple constructor implementations are not allowed. +tests/cases/compiler/parserConstructorDeclaration12.ts(2,14): error TS1098: Type parameter list cannot be empty. tests/cases/compiler/parserConstructorDeclaration12.ts(3,3): error TS2392: Multiple constructor implementations are not allowed. +tests/cases/compiler/parserConstructorDeclaration12.ts(3,14): error TS1098: Type parameter list cannot be empty. tests/cases/compiler/parserConstructorDeclaration12.ts(4,3): error TS2392: Multiple constructor implementations are not allowed. +tests/cases/compiler/parserConstructorDeclaration12.ts(4,15): error TS1098: Type parameter list cannot be empty. tests/cases/compiler/parserConstructorDeclaration12.ts(5,3): error TS2392: Multiple constructor implementations are not allowed. +tests/cases/compiler/parserConstructorDeclaration12.ts(5,15): error TS1098: Type parameter list cannot be empty. tests/cases/compiler/parserConstructorDeclaration12.ts(6,3): error TS2392: Multiple constructor implementations are not allowed. +tests/cases/compiler/parserConstructorDeclaration12.ts(6,14): error TS1098: Type parameter list cannot be empty. tests/cases/compiler/parserConstructorDeclaration12.ts(7,3): error TS2392: Multiple constructor implementations are not allowed. +tests/cases/compiler/parserConstructorDeclaration12.ts(7,14): error TS1098: Type parameter list cannot be empty. tests/cases/compiler/parserConstructorDeclaration12.ts(8,3): error TS2392: Multiple constructor implementations are not allowed. +tests/cases/compiler/parserConstructorDeclaration12.ts(8,15): error TS1098: Type parameter list cannot be empty. tests/cases/compiler/parserConstructorDeclaration12.ts(9,3): error TS2392: Multiple constructor implementations are not allowed. +tests/cases/compiler/parserConstructorDeclaration12.ts(9,15): error TS1098: Type parameter list cannot be empty. ==== tests/cases/compiler/parserConstructorDeclaration12.ts (16 errors) ==== class C { constructor<>() { } - ~~ -!!! error TS1098: Type parameter list cannot be empty. ~~~~~~~~~~~~~~~~~~~ !!! error TS2392: Multiple constructor implementations are not allowed. - constructor<> () { } ~~ !!! error TS1098: Type parameter list cannot be empty. + constructor<> () { } ~~~~~~~~~~~~~~~~~~~~ !!! error TS2392: Multiple constructor implementations are not allowed. + ~~ +!!! error TS1098: Type parameter list cannot be empty. constructor <>() { } - ~~ -!!! error TS1098: Type parameter list cannot be empty. ~~~~~~~~~~~~~~~~~~~~ !!! error TS2392: Multiple constructor implementations are not allowed. + ~~ +!!! error TS1098: Type parameter list cannot be empty. constructor <> () { } + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2392: Multiple constructor implementations are not allowed. ~~ !!! error TS1098: Type parameter list cannot be empty. - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2392: Multiple constructor implementations are not allowed. constructor< >() { } - ~~~ -!!! error TS1098: Type parameter list cannot be empty. ~~~~~~~~~~~~~~~~~~~~ !!! error TS2392: Multiple constructor implementations are not allowed. - constructor< > () { } ~~~ !!! error TS1098: Type parameter list cannot be empty. + constructor< > () { } ~~~~~~~~~~~~~~~~~~~~~ !!! error TS2392: Multiple constructor implementations are not allowed. + ~~~ +!!! error TS1098: Type parameter list cannot be empty. constructor < >() { } - ~~~ -!!! error TS1098: Type parameter list cannot be empty. ~~~~~~~~~~~~~~~~~~~~~ !!! error TS2392: Multiple constructor implementations are not allowed. - constructor < > () { } ~~~ !!! error TS1098: Type parameter list cannot be empty. + constructor < > () { } ~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2392: Multiple constructor implementations are not allowed. + ~~~ +!!! error TS1098: Type parameter list cannot be empty. } \ No newline at end of file diff --git a/tests/baselines/reference/protectedMembers.errors.txt b/tests/baselines/reference/protectedMembers.errors.txt index 10ea00cf10f..c35bc25fe71 100644 --- a/tests/baselines/reference/protectedMembers.errors.txt +++ b/tests/baselines/reference/protectedMembers.errors.txt @@ -1,4 +1,3 @@ -tests/cases/compiler/protectedMembers.ts(86,5): error TS1089: 'protected' modifier cannot appear on a constructor declaration. tests/cases/compiler/protectedMembers.ts(40,1): error TS2445: Property 'x' is protected and only accessible within class 'C1' and its subclasses. tests/cases/compiler/protectedMembers.ts(41,1): error TS2445: Property 'f' is protected and only accessible within class 'C1' and its subclasses. tests/cases/compiler/protectedMembers.ts(42,1): error TS2445: Property 'sx' is protected and only accessible within class 'C1' and its subclasses. @@ -9,6 +8,7 @@ tests/cases/compiler/protectedMembers.ts(48,1): error TS2445: Property 'sx' is p tests/cases/compiler/protectedMembers.ts(49,1): error TS2445: Property 'sf' is protected and only accessible within class 'C2' and its subclasses. tests/cases/compiler/protectedMembers.ts(68,9): error TS2446: Property 'x' is protected and only accessible through an instance of class 'C'. tests/cases/compiler/protectedMembers.ts(69,9): error TS2446: Property 'x' is protected and only accessible through an instance of class 'C'. +tests/cases/compiler/protectedMembers.ts(86,5): error TS1089: 'protected' modifier cannot appear on a constructor declaration. tests/cases/compiler/protectedMembers.ts(98,1): error TS2322: Type 'B1' is not assignable to type 'A1'. Property 'x' is protected but type 'B1' is not a class derived from 'A1'. tests/cases/compiler/protectedMembers.ts(99,1): error TS2322: Type 'A1' is not assignable to type 'B1'. diff --git a/tests/baselines/reference/templateStringInTaggedTemplate.errors.txt b/tests/baselines/reference/templateStringInTaggedTemplate.errors.txt index 45f860bc9a3..9106cdb6151 100644 --- a/tests/baselines/reference/templateStringInTaggedTemplate.errors.txt +++ b/tests/baselines/reference/templateStringInTaggedTemplate.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/es6/templates/templateStringInTaggedTemplate.ts(1,42): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/templates/templateStringInTaggedTemplate.ts(1,1): error TS2349: Cannot invoke an expression whose type lacks a call signature. +tests/cases/conformance/es6/templates/templateStringInTaggedTemplate.ts(1,42): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. ==== tests/cases/conformance/es6/templates/templateStringInTaggedTemplate.ts (2 errors) ==== `I AM THE ${ `${ `TAG` } ` } PORTION` `I ${ "AM" } THE TEMPLATE PORTION` - ~~~~~ -!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. \ No newline at end of file +!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. + ~~~~~ +!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher. \ No newline at end of file diff --git a/tests/baselines/reference/typesWithPrivateConstructor.errors.txt b/tests/baselines/reference/typesWithPrivateConstructor.errors.txt index 010831effe8..2440e51cd39 100644 --- a/tests/baselines/reference/typesWithPrivateConstructor.errors.txt +++ b/tests/baselines/reference/typesWithPrivateConstructor.errors.txt @@ -1,7 +1,7 @@ tests/cases/conformance/types/members/typesWithPrivateConstructor.ts(4,5): error TS1089: 'private' modifier cannot appear on a constructor declaration. +tests/cases/conformance/types/members/typesWithPrivateConstructor.ts(8,5): error TS2322: Type 'Function' is not assignable to type '() => void'. tests/cases/conformance/types/members/typesWithPrivateConstructor.ts(11,5): error TS1089: 'private' modifier cannot appear on a constructor declaration. tests/cases/conformance/types/members/typesWithPrivateConstructor.ts(12,5): error TS1089: 'private' modifier cannot appear on a constructor declaration. -tests/cases/conformance/types/members/typesWithPrivateConstructor.ts(8,5): error TS2322: Type 'Function' is not assignable to type '() => void'. tests/cases/conformance/types/members/typesWithPrivateConstructor.ts(15,10): error TS2346: Supplied parameters do not match any signature of call target. From 90333fe49b389b085813fe79b320aa57f760adc8 Mon Sep 17 00:00:00 2001 From: Yui T Date: Mon, 15 Dec 2014 16:43:35 -0800 Subject: [PATCH 57/78] Address code review --- src/compiler/checker.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index bc202d76371..746061c008a 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -8173,14 +8173,11 @@ module ts { function checkWithStatement(node: WithStatement) { // Grammar checking for withStatement - var hasStrictModeError = false; if (node.parserContextFlags & ParserContextFlags.StrictMode) { grammarErrorOnFirstToken(node, Diagnostics.with_statements_are_not_allowed_in_strict_mode); - hasStrictModeError = true; } - - // Grammar checking for invalid use of return statement - if (!hasStrictModeError) { + else { + // Grammar checking for invalid use of return statement forEachReturnStatement(node.statement, (returnStatement) => { grammarErrorOnFirstToken(returnStatement, Diagnostics.A_return_statement_can_only_be_used_within_a_function_body); }); From 5cb958ef43c4b3c1a8d2d474b8fa858b5111610b Mon Sep 17 00:00:00 2001 From: Yui T Date: Mon, 15 Dec 2014 17:16:22 -0800 Subject: [PATCH 58/78] Address code review --- src/compiler/checker.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 746061c008a..349f3766be6 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -7157,7 +7157,8 @@ module ts { checkGrammarIndexSignature(node); } // TODO (yuisu): Remove this check in else-if when SyntaxKind.Construct is moved and ambient context is handled - else if (node.kind === SyntaxKind.FunctionType || node.kind === SyntaxKind.ConstructorType || node.kind === SyntaxKind.CallSignature){ + else if (node.kind === SyntaxKind.FunctionType || node.kind === SyntaxKind.ConstructorType || + node.kind === SyntaxKind.CallSignature || node.kind === SyntaxKind.Constructor){ checkGrammarFunctionLikeDeclaration(node); } @@ -7240,10 +7241,11 @@ module ts { } function checkConstructorDeclaration(node: ConstructorDeclaration) { - // Grammar check on signature of constructor is done in checkSignatureDeclaration function - checkGrammarModifiers(node) || checkGrammarFunctionLikeDeclaration(node) || checkGrammarConstructorTypeParameters(node) || checkGrammarConstructorTypeAnnotation(node) || checkGrammarForBodyInAmbientContext(node.body, /*isConstructor:*/ true); - + // Grammar check on signature of constructor and modifier of the constructor is done in checkSignatureDeclaration function. checkSignatureDeclaration(node); + // Grammar check for checking only related to constructoDeclaration + checkGrammarConstructorTypeParameters(node) || checkGrammarConstructorTypeAnnotation(node) || checkGrammarForBodyInAmbientContext(node.body, /*isConstructor:*/ true); + checkSourceElement(node.body); var symbol = getSymbolOfNode(node); @@ -8178,7 +8180,7 @@ module ts { } else { // Grammar checking for invalid use of return statement - forEachReturnStatement(node.statement, (returnStatement) => { + forEachReturnStatement(node.statement, returnStatement => { grammarErrorOnFirstToken(returnStatement, Diagnostics.A_return_statement_can_only_be_used_within_a_function_body); }); } From 20b7bb249ef366bc9d759883432e8c89739e3d05 Mon Sep 17 00:00:00 2001 From: Yui T Date: Mon, 15 Dec 2014 17:23:33 -0800 Subject: [PATCH 59/78] Address code review --- src/compiler/checker.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 746061c008a..154908778a9 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -7157,7 +7157,9 @@ module ts { checkGrammarIndexSignature(node); } // TODO (yuisu): Remove this check in else-if when SyntaxKind.Construct is moved and ambient context is handled - else if (node.kind === SyntaxKind.FunctionType || node.kind === SyntaxKind.ConstructorType || node.kind === SyntaxKind.CallSignature){ + else if (node.kind === SyntaxKind.FunctionType || node.kind === SyntaxKind.ConstructorType || + node.kind === SyntaxKind.CallSignature || node.kind === SyntaxKind.Constructor || + node.kind === SyntaxKind.ConstructSignature){ checkGrammarFunctionLikeDeclaration(node); } @@ -7240,10 +7242,11 @@ module ts { } function checkConstructorDeclaration(node: ConstructorDeclaration) { - // Grammar check on signature of constructor is done in checkSignatureDeclaration function - checkGrammarModifiers(node) || checkGrammarFunctionLikeDeclaration(node) || checkGrammarConstructorTypeParameters(node) || checkGrammarConstructorTypeAnnotation(node) || checkGrammarForBodyInAmbientContext(node.body, /*isConstructor:*/ true); - + // Grammar check on signature of constructor and modifier of the constructor is done in checkSignatureDeclaration function. checkSignatureDeclaration(node); + // Grammar check for checking only related to constructoDeclaration + checkGrammarConstructorTypeParameters(node) || checkGrammarConstructorTypeAnnotation(node) || checkGrammarForBodyInAmbientContext(node.body, /*isConstructor:*/ true); + checkSourceElement(node.body); var symbol = getSymbolOfNode(node); @@ -8178,7 +8181,7 @@ module ts { } else { // Grammar checking for invalid use of return statement - forEachReturnStatement(node.statement, (returnStatement) => { + forEachReturnStatement(node.statement, returnStatement => { grammarErrorOnFirstToken(returnStatement, Diagnostics.A_return_statement_can_only_be_used_within_a_function_body); }); } From 8a87d519565544b7082510af7547b84919d1b88b Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Mon, 15 Dec 2014 17:32:11 -0800 Subject: [PATCH 60/78] Do not use the file name in errors unless it exists --- src/compiler/parser.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index ea5b35cbce1..e145a4ec447 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -5362,8 +5362,13 @@ module ts { // We haven't looked for this file, do so now and cache result var file = filesByName[canonicalName] = host.getSourceFile(filename, options.target, hostErrorMessage => { - errors.push(createFileDiagnostic(refFile, refStart, refLength, - Diagnostics.Cannot_read_file_0_Colon_1, filename, hostErrorMessage)); + if (refFile) { + errors.push(createFileDiagnostic(refFile, refStart, refLength, + Diagnostics.Cannot_read_file_0_Colon_1, filename, hostErrorMessage)); + } + else { + errors.push(createCompilerDiagnostic(Diagnostics.Cannot_read_file_0_Colon_1, filename, hostErrorMessage)); + } }); if (file) { seenNoDefaultLib = seenNoDefaultLib || file.hasNoDefaultLib; From e0e88adfc51d8b5ddad783adcdeabd8e4b642b51 Mon Sep 17 00:00:00 2001 From: Yui T Date: Mon, 15 Dec 2014 18:10:35 -0800 Subject: [PATCH 61/78] Move grammar checking: variableDeclaration, variableStatements; there are still erros from incomplete grammar migration --- src/compiler/checker.ts | 89 +++++++++++++++++-- src/compiler/parser.ts | 6 +- .../initializersInDeclarations.errors.txt | 2 +- .../invalidModuleWithVarStatements.errors.txt | 6 +- .../reference/letDeclarations-es5.errors.txt | 4 +- tests/baselines/reference/varBlock.errors.txt | 12 +-- ...ariableDeclarationInStrictMode1.errors.txt | 2 +- 7 files changed, 97 insertions(+), 24 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 154908778a9..a58b8f052aa 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -8000,7 +8000,10 @@ module ts { // Grammar checking // TODO (yuisu) : Revisit this check once move all grammar checking if (node.kind === SyntaxKind.BindingElement) { - checkGrammarBindingElement(node); + checkGrammarEvalOrArgumentsInStrictMode(node, node.name); + } + else if (node.kind === SyntaxKind.VariableDeclaration) { + checkGrammarVariableDeclaration(node); } checkSourceElement(node.type); @@ -8059,6 +8062,9 @@ module ts { } function checkVariableStatement(node: VariableStatement) { + // Grammar checking + checkGrammarModifiers(node) || checkGrammarVariableDeclarations(node, node.declarations) || checkGrammarForDisallowedLetOrConstStatement(node); + forEach(node.declarations, checkSourceElement); } @@ -8091,7 +8097,6 @@ module ts { } function checkForInStatement(node: ForInStatement) { - // TypeScript 1.0 spec (April 2014): 5.4 // In a 'for-in' statement of the form // for (var VarDecl in Expr) Statement @@ -10132,12 +10137,6 @@ module ts { checkGrammarForOmittedArgument(node, arguments); } - function checkGrammarBindingElement(node: BindingElement) { - // It is a SyntaxError if a VariableDeclaration or VariableDeclarationNoIn occurs within strict code - // and its Identifier is eval or arguments - checkGrammarEvalOrArgumentsInStrictMode(node, node.name); - } - function checkGrammarHeritageClause(node: HeritageClause): boolean { var types = node.types; if (checkGrammarForDisallowedTrailingComma(types)) { @@ -10387,6 +10386,80 @@ module ts { } } + function checkGrammarVariableDeclaration(node: VariableDeclaration) { + if (isInAmbientContext(node)) { + if (isBindingPattern(node.name)) { + return grammarErrorOnNode(node, Diagnostics.Destructuring_declarations_are_not_allowed_in_ambient_contexts); + } + if (node.initializer) { + // Error on equals token which immediate precedes the initializer + return grammarErrorAtPos(getSourceFileOfNode(node), node.initializer.pos - 1, 1, Diagnostics.Initializers_are_not_allowed_in_ambient_contexts); + } + } + else { + if (!node.initializer) { + if (isBindingPattern(node.name) && !isBindingPattern(node.parent)) { + return grammarErrorOnNode(node, Diagnostics.A_destructuring_declaration_must_have_an_initializer); + } + if (isConst(node)) { + return grammarErrorOnNode(node, Diagnostics.const_declarations_must_be_initialized); + } + } + } + // It is a SyntaxError if a VariableDeclaration or VariableDeclarationNoIn occurs within strict code + // and its Identifier is eval or arguments + return checkGrammarEvalOrArgumentsInStrictMode(node, node.name); + } + + function checkGrammarVariableDeclarations(variableStatement: VariableStatement, declarations: NodeArray): boolean { + if (declarations) { + if (checkGrammarForDisallowedTrailingComma(declarations)) { + return true; + } + + if (!declarations.length) { + return grammarErrorAtPos(getSourceFileOfNode(variableStatement), declarations.pos, declarations.end - declarations.pos, Diagnostics.Variable_declaration_list_cannot_be_empty); + } + + var decl = declarations[0]; + if (compilerOptions.target < ScriptTarget.ES6) { + if (isLet(decl)) { + return grammarErrorOnFirstToken(decl, Diagnostics.let_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher); + } + else if (isConst(decl)) { + return grammarErrorOnFirstToken(decl, Diagnostics.const_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher); + } + } + } + } + + function allowLetAndConstDeclarations(parent: Node): boolean { + switch (parent.kind) { + case SyntaxKind.IfStatement: + case SyntaxKind.DoStatement: + case SyntaxKind.WhileStatement: + case SyntaxKind.WithStatement: + case SyntaxKind.ForStatement: + case SyntaxKind.ForInStatement: + return false; + case SyntaxKind.LabeledStatement: + return allowLetAndConstDeclarations(parent.parent); + } + + return true; + } + + function checkGrammarForDisallowedLetOrConstStatement(node: VariableStatement) { + if (!allowLetAndConstDeclarations(node.parent)) { + if (isLet(node)) { + return grammarErrorOnNode(node, Diagnostics.let_declarations_can_only_be_declared_inside_a_block); + } + else if (isConst(node)) { + return grammarErrorOnNode(node, Diagnostics.const_declarations_can_only_be_declared_inside_a_block); + } + } + } + function isIntegerLiteral(expression: Expression): boolean { if (expression.kind === SyntaxKind.PrefixUnaryExpression) { var unaryExpression = expression; diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 6feeedc159c..7f73c275327 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -4673,8 +4673,8 @@ module ts { //case SyntaxKind.TaggedTemplateExpression: return checkTaggedTemplateExpression(node); //case SyntaxKind.ThrowStatement: return checkThrowStatement(node); //case SyntaxKind.TypeReference: return checkTypeReference(node); - case SyntaxKind.VariableDeclaration: return checkVariableDeclaration(node); - case SyntaxKind.VariableStatement: return checkVariableStatement(node); + //case SyntaxKind.VariableDeclaration: return checkVariableDeclaration(node); + //case SyntaxKind.VariableStatement: return checkVariableStatement(node); //case SyntaxKind.WithStatement: return checkWithStatement(node); //case SyntaxKind.YieldExpression: return checkYieldExpression(node); } @@ -5333,7 +5333,7 @@ module ts { case SyntaxKind.ModuleDeclaration: //case SyntaxKind.EnumDeclaration: case SyntaxKind.ExportAssignment: - case SyntaxKind.VariableStatement: + //case SyntaxKind.VariableStatement: case SyntaxKind.FunctionDeclaration: case SyntaxKind.TypeAliasDeclaration: case SyntaxKind.ImportDeclaration: diff --git a/tests/baselines/reference/initializersInDeclarations.errors.txt b/tests/baselines/reference/initializersInDeclarations.errors.txt index 5ab9ae5d2bc..ad92cc79281 100644 --- a/tests/baselines/reference/initializersInDeclarations.errors.txt +++ b/tests/baselines/reference/initializersInDeclarations.errors.txt @@ -1,9 +1,9 @@ tests/cases/conformance/externalModules/initializersInDeclarations.ts(5,9): error TS1039: Initializers are not allowed in ambient contexts. tests/cases/conformance/externalModules/initializersInDeclarations.ts(6,16): error TS1039: Initializers are not allowed in ambient contexts. tests/cases/conformance/externalModules/initializersInDeclarations.ts(7,16): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/conformance/externalModules/initializersInDeclarations.ts(16,2): error TS1036: Statements are not allowed in ambient contexts. tests/cases/conformance/externalModules/initializersInDeclarations.ts(12,15): error TS1039: Initializers are not allowed in ambient contexts. tests/cases/conformance/externalModules/initializersInDeclarations.ts(13,15): error TS1039: Initializers are not allowed in ambient contexts. -tests/cases/conformance/externalModules/initializersInDeclarations.ts(16,2): error TS1036: Statements are not allowed in ambient contexts. tests/cases/conformance/externalModules/initializersInDeclarations.ts(18,16): error TS1039: Initializers are not allowed in ambient contexts. diff --git a/tests/baselines/reference/invalidModuleWithVarStatements.errors.txt b/tests/baselines/reference/invalidModuleWithVarStatements.errors.txt index ad8d457670a..e0ba35c3385 100644 --- a/tests/baselines/reference/invalidModuleWithVarStatements.errors.txt +++ b/tests/baselines/reference/invalidModuleWithVarStatements.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithVarStatements.ts(4,5): error TS1044: 'public' modifier cannot appear on a module element. tests/cases/conformance/internalModules/moduleBody/invalidModuleWithVarStatements.ts(8,5): error TS1044: 'public' modifier cannot appear on a module element. -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithVarStatements.ts(12,5): error TS1044: 'static' modifier cannot appear on a module element. tests/cases/conformance/internalModules/moduleBody/invalidModuleWithVarStatements.ts(16,5): error TS1044: 'static' modifier cannot appear on a module element. -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithVarStatements.ts(20,5): error TS1044: 'private' modifier cannot appear on a module element. tests/cases/conformance/internalModules/moduleBody/invalidModuleWithVarStatements.ts(25,5): error TS1044: 'private' modifier cannot appear on a module element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithVarStatements.ts(4,5): error TS1044: 'public' modifier cannot appear on a module element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithVarStatements.ts(12,5): error TS1044: 'static' modifier cannot appear on a module element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithVarStatements.ts(20,5): error TS1044: 'private' modifier cannot appear on a module element. ==== tests/cases/conformance/internalModules/moduleBody/invalidModuleWithVarStatements.ts (6 errors) ==== diff --git a/tests/baselines/reference/letDeclarations-es5.errors.txt b/tests/baselines/reference/letDeclarations-es5.errors.txt index 34bd93dba3c..19551e9fad5 100644 --- a/tests/baselines/reference/letDeclarations-es5.errors.txt +++ b/tests/baselines/reference/letDeclarations-es5.errors.txt @@ -1,11 +1,11 @@ +tests/cases/compiler/letDeclarations-es5.ts(10,9): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. +tests/cases/compiler/letDeclarations-es5.ts(12,9): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. tests/cases/compiler/letDeclarations-es5.ts(2,5): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. tests/cases/compiler/letDeclarations-es5.ts(3,5): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. tests/cases/compiler/letDeclarations-es5.ts(4,5): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. tests/cases/compiler/letDeclarations-es5.ts(6,5): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. tests/cases/compiler/letDeclarations-es5.ts(7,5): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. tests/cases/compiler/letDeclarations-es5.ts(8,5): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. -tests/cases/compiler/letDeclarations-es5.ts(10,9): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. -tests/cases/compiler/letDeclarations-es5.ts(12,9): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. ==== tests/cases/compiler/letDeclarations-es5.ts (8 errors) ==== diff --git a/tests/baselines/reference/varBlock.errors.txt b/tests/baselines/reference/varBlock.errors.txt index 0d9b5f6b1b4..6746a760a44 100644 --- a/tests/baselines/reference/varBlock.errors.txt +++ b/tests/baselines/reference/varBlock.errors.txt @@ -1,4 +1,6 @@ tests/cases/compiler/varBlock.ts(8,16): error TS1039: Initializers are not allowed in ambient contexts. +tests/cases/compiler/varBlock.ts(11,22): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/compiler/varBlock.ts(11,22): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. tests/cases/compiler/varBlock.ts(15,15): error TS1039: Initializers are not allowed in ambient contexts. tests/cases/compiler/varBlock.ts(21,16): error TS1039: Initializers are not allowed in ambient contexts. tests/cases/compiler/varBlock.ts(22,20): error TS1039: Initializers are not allowed in ambient contexts. @@ -14,10 +16,8 @@ tests/cases/compiler/varBlock.ts(33,25): error TS1039: Initializers are not allo tests/cases/compiler/varBlock.ts(34,19): error TS1039: Initializers are not allowed in ambient contexts. tests/cases/compiler/varBlock.ts(35,25): error TS1039: Initializers are not allowed in ambient contexts. tests/cases/compiler/varBlock.ts(35,35): error TS1039: Initializers are not allowed in ambient contexts. -tests/cases/compiler/varBlock.ts(39,15): error TS1039: Initializers are not allowed in ambient contexts. -tests/cases/compiler/varBlock.ts(11,22): error TS2369: A parameter property is only allowed in a constructor implementation. -tests/cases/compiler/varBlock.ts(11,22): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. tests/cases/compiler/varBlock.ts(39,13): error TS2403: Subsequent variable declarations must have the same type. Variable 'c' must be of type 'any', but here has type 'number'. +tests/cases/compiler/varBlock.ts(39,15): error TS1039: Initializers are not allowed in ambient contexts. ==== tests/cases/compiler/varBlock.ts (20 errors) ==== @@ -96,7 +96,7 @@ tests/cases/compiler/varBlock.ts(39,13): error TS2403: Subsequent variable decla declare var c; declare var c = 10; - ~ -!!! error TS1039: Initializers are not allowed in ambient contexts. ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'c' must be of type 'any', but here has type 'number'. \ No newline at end of file +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'c' must be of type 'any', but here has type 'number'. + ~ +!!! error TS1039: Initializers are not allowed in ambient contexts. \ No newline at end of file diff --git a/tests/baselines/reference/variableDeclarationInStrictMode1.errors.txt b/tests/baselines/reference/variableDeclarationInStrictMode1.errors.txt index aa2ccdbed9f..328e080fbaa 100644 --- a/tests/baselines/reference/variableDeclarationInStrictMode1.errors.txt +++ b/tests/baselines/reference/variableDeclarationInStrictMode1.errors.txt @@ -1,5 +1,5 @@ -tests/cases/compiler/variableDeclarationInStrictMode1.ts(2,5): error TS1100: Invalid use of 'eval' in strict mode. lib.d.ts(29,18): error TS2300: Duplicate identifier 'eval'. +tests/cases/compiler/variableDeclarationInStrictMode1.ts(2,5): error TS1100: Invalid use of 'eval' in strict mode. tests/cases/compiler/variableDeclarationInStrictMode1.ts(2,5): error TS2300: Duplicate identifier 'eval'. From 010745c3713b37c5f53d7740390fdc408785a676 Mon Sep 17 00:00:00 2001 From: Yui T Date: Mon, 15 Dec 2014 18:28:24 -0800 Subject: [PATCH 62/78] Move grammar checking: forInStatement; there are still errors from incomplete migration --- src/compiler/checker.ts | 12 ++++++++++-- src/compiler/parser.ts | 2 +- .../reference/constDeclarations-errors.errors.txt | 2 +- .../reference/declareAlreadySeen.errors.txt | 2 +- .../reference/letDeclarations-es5.errors.txt | 2 +- .../reference/parserForInStatement7.errors.txt | 6 +++--- 6 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index a58b8f052aa..527e1bdb1a7 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -8097,6 +8097,14 @@ module ts { } function checkForInStatement(node: ForInStatement) { + // Grammar checking + var declarations = node.declarations; + if (!checkGrammarVariableDeclarations(node, declarations)) { + if (declarations && declarations.length > 1) { + grammarErrorOnFirstToken(declarations[1], Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement); + } + } + // TypeScript 1.0 spec (April 2014): 5.4 // In a 'for-in' statement of the form // for (var VarDecl in Expr) Statement @@ -10411,14 +10419,14 @@ module ts { return checkGrammarEvalOrArgumentsInStrictMode(node, node.name); } - function checkGrammarVariableDeclarations(variableStatement: VariableStatement, declarations: NodeArray): boolean { + function checkGrammarVariableDeclarations(container: Node, declarations: NodeArray): boolean { if (declarations) { if (checkGrammarForDisallowedTrailingComma(declarations)) { return true; } if (!declarations.length) { - return grammarErrorAtPos(getSourceFileOfNode(variableStatement), declarations.pos, declarations.end - declarations.pos, Diagnostics.Variable_declaration_list_cannot_be_empty); + return grammarErrorAtPos(getSourceFileOfNode(container), declarations.pos, declarations.end - declarations.pos, Diagnostics.Variable_declaration_list_cannot_be_empty); } var decl = declarations[0]; diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 7f73c275327..7e3aff21915 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -4644,7 +4644,7 @@ module ts { //case SyntaxKind.ElementAccessExpression: return checkElementAccessExpression(node); //case SyntaxKind.ExportAssignment: return checkExportAssignment(node); //case SyntaxKind.ExternalModuleReference: return checkExternalModuleReference(node); - case SyntaxKind.ForInStatement: return checkForInStatement(node); + //case SyntaxKind.ForInStatement: return checkForInStatement(node); case SyntaxKind.ForStatement: return checkForStatement(node); case SyntaxKind.FunctionDeclaration: return checkFunctionDeclaration(node); //case SyntaxKind.FunctionExpression: return checkFunctionExpression(node); diff --git a/tests/baselines/reference/constDeclarations-errors.errors.txt b/tests/baselines/reference/constDeclarations-errors.errors.txt index d87007474a1..c0ae6635c5e 100644 --- a/tests/baselines/reference/constDeclarations-errors.errors.txt +++ b/tests/baselines/reference/constDeclarations-errors.errors.txt @@ -5,9 +5,9 @@ tests/cases/compiler/constDeclarations-errors.ts(5,11): error TS1155: 'const' de tests/cases/compiler/constDeclarations-errors.ts(5,15): error TS1155: 'const' declarations must be initialized tests/cases/compiler/constDeclarations-errors.ts(5,27): error TS1155: 'const' declarations must be initialized tests/cases/compiler/constDeclarations-errors.ts(8,11): error TS1155: 'const' declarations must be initialized +tests/cases/compiler/constDeclarations-errors.ts(11,27): error TS2449: The operand of an increment or decrement operator cannot be a constant. tests/cases/compiler/constDeclarations-errors.ts(14,11): error TS1155: 'const' declarations must be initialized tests/cases/compiler/constDeclarations-errors.ts(17,20): error TS1155: 'const' declarations must be initialized -tests/cases/compiler/constDeclarations-errors.ts(11,27): error TS2449: The operand of an increment or decrement operator cannot be a constant. ==== tests/cases/compiler/constDeclarations-errors.ts (10 errors) ==== diff --git a/tests/baselines/reference/declareAlreadySeen.errors.txt b/tests/baselines/reference/declareAlreadySeen.errors.txt index d606b571478..60cd204c40c 100644 --- a/tests/baselines/reference/declareAlreadySeen.errors.txt +++ b/tests/baselines/reference/declareAlreadySeen.errors.txt @@ -1,6 +1,6 @@ -tests/cases/compiler/declareAlreadySeen.ts(2,13): error TS1030: 'declare' modifier already seen. tests/cases/compiler/declareAlreadySeen.ts(3,13): error TS1030: 'declare' modifier already seen. tests/cases/compiler/declareAlreadySeen.ts(5,13): error TS1030: 'declare' modifier already seen. +tests/cases/compiler/declareAlreadySeen.ts(2,13): error TS1030: 'declare' modifier already seen. tests/cases/compiler/declareAlreadySeen.ts(7,13): error TS1030: 'declare' modifier already seen. diff --git a/tests/baselines/reference/letDeclarations-es5.errors.txt b/tests/baselines/reference/letDeclarations-es5.errors.txt index 19551e9fad5..824e36e2791 100644 --- a/tests/baselines/reference/letDeclarations-es5.errors.txt +++ b/tests/baselines/reference/letDeclarations-es5.errors.txt @@ -1,4 +1,3 @@ -tests/cases/compiler/letDeclarations-es5.ts(10,9): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. tests/cases/compiler/letDeclarations-es5.ts(12,9): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. tests/cases/compiler/letDeclarations-es5.ts(2,5): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. tests/cases/compiler/letDeclarations-es5.ts(3,5): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. @@ -6,6 +5,7 @@ tests/cases/compiler/letDeclarations-es5.ts(4,5): error TS1153: 'let' declaratio tests/cases/compiler/letDeclarations-es5.ts(6,5): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. tests/cases/compiler/letDeclarations-es5.ts(7,5): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. tests/cases/compiler/letDeclarations-es5.ts(8,5): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. +tests/cases/compiler/letDeclarations-es5.ts(10,9): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. ==== tests/cases/compiler/letDeclarations-es5.ts (8 errors) ==== diff --git a/tests/baselines/reference/parserForInStatement7.errors.txt b/tests/baselines/reference/parserForInStatement7.errors.txt index 2371b3453c3..397401003db 100644 --- a/tests/baselines/reference/parserForInStatement7.errors.txt +++ b/tests/baselines/reference/parserForInStatement7.errors.txt @@ -1,14 +1,14 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserForInStatement7.ts(1,25): error TS1091: Only a single variable declaration is allowed in a 'for...in' statement. tests/cases/conformance/parser/ecmascript5/Statements/parserForInStatement7.ts(1,10): error TS2404: The left-hand side of a 'for...in' statement cannot use a type annotation. +tests/cases/conformance/parser/ecmascript5/Statements/parserForInStatement7.ts(1,25): error TS1091: Only a single variable declaration is allowed in a 'for...in' statement. tests/cases/conformance/parser/ecmascript5/Statements/parserForInStatement7.ts(1,43): error TS2304: Cannot find name 'X'. ==== tests/cases/conformance/parser/ecmascript5/Statements/parserForInStatement7.ts (3 errors) ==== for (var a: number = 1, b: string = "" in X) { - ~ -!!! error TS1091: Only a single variable declaration is allowed in a 'for...in' statement. ~ !!! error TS2404: The left-hand side of a 'for...in' statement cannot use a type annotation. + ~ +!!! error TS1091: Only a single variable declaration is allowed in a 'for...in' statement. ~ !!! error TS2304: Cannot find name 'X'. } \ No newline at end of file From 25a6302b48a9b12e2f48555e71ba4c10623d7524 Mon Sep 17 00:00:00 2001 From: Yui T Date: Mon, 15 Dec 2014 18:39:44 -0800 Subject: [PATCH 63/78] Move grammar checking: forStatement --- src/compiler/checker.ts | 3 +++ src/compiler/parser.ts | 2 +- tests/baselines/reference/letDeclarations-es5.errors.txt | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 527e1bdb1a7..a7805255a96 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -8089,6 +8089,9 @@ module ts { } function checkForStatement(node: ForStatement) { + // Grammar checking + checkGrammarVariableDeclarations(node, node.declarations); + if (node.declarations) forEach(node.declarations, checkVariableLikeDeclaration); if (node.initializer) checkExpression(node.initializer); if (node.condition) checkExpression(node.condition); diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 7e3aff21915..6b8df5cdad5 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -4645,7 +4645,7 @@ module ts { //case SyntaxKind.ExportAssignment: return checkExportAssignment(node); //case SyntaxKind.ExternalModuleReference: return checkExternalModuleReference(node); //case SyntaxKind.ForInStatement: return checkForInStatement(node); - case SyntaxKind.ForStatement: return checkForStatement(node); + //case SyntaxKind.ForStatement: return checkForStatement(node); case SyntaxKind.FunctionDeclaration: return checkFunctionDeclaration(node); //case SyntaxKind.FunctionExpression: return checkFunctionExpression(node); case SyntaxKind.GetAccessor: return checkGetAccessor(node); diff --git a/tests/baselines/reference/letDeclarations-es5.errors.txt b/tests/baselines/reference/letDeclarations-es5.errors.txt index 824e36e2791..34bd93dba3c 100644 --- a/tests/baselines/reference/letDeclarations-es5.errors.txt +++ b/tests/baselines/reference/letDeclarations-es5.errors.txt @@ -1,4 +1,3 @@ -tests/cases/compiler/letDeclarations-es5.ts(12,9): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. tests/cases/compiler/letDeclarations-es5.ts(2,5): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. tests/cases/compiler/letDeclarations-es5.ts(3,5): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. tests/cases/compiler/letDeclarations-es5.ts(4,5): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. @@ -6,6 +5,7 @@ tests/cases/compiler/letDeclarations-es5.ts(6,5): error TS1153: 'let' declaratio tests/cases/compiler/letDeclarations-es5.ts(7,5): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. tests/cases/compiler/letDeclarations-es5.ts(8,5): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. tests/cases/compiler/letDeclarations-es5.ts(10,9): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. +tests/cases/compiler/letDeclarations-es5.ts(12,9): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. ==== tests/cases/compiler/letDeclarations-es5.ts (8 errors) ==== From 694771b2d791868b7735225fc7565ada1e115b23 Mon Sep 17 00:00:00 2001 From: Yui T Date: Mon, 15 Dec 2014 23:05:29 -0800 Subject: [PATCH 64/78] Move grammar checking: functionDeclaration; there are still errors from incomplet grammar migration --- src/compiler/checker.ts | 6 +++++- src/compiler/parser.ts | 4 ++-- tests/baselines/reference/declareAlreadySeen.errors.txt | 2 +- .../reference/invalidModuleWithVarStatements.errors.txt | 6 +++--- .../reference/optionalArgsWithDefaultValues.errors.txt | 2 +- 5 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index a7805255a96..fa7b6f571ef 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -7157,7 +7157,7 @@ module ts { checkGrammarIndexSignature(node); } // TODO (yuisu): Remove this check in else-if when SyntaxKind.Construct is moved and ambient context is handled - else if (node.kind === SyntaxKind.FunctionType || node.kind === SyntaxKind.ConstructorType || + else if (node.kind === SyntaxKind.FunctionType || node.kind === SyntaxKind.FunctionDeclaration || node.kind === SyntaxKind.ConstructorType || node.kind === SyntaxKind.CallSignature || node.kind === SyntaxKind.Constructor || node.kind === SyntaxKind.ConstructSignature){ checkGrammarFunctionLikeDeclaration(node); @@ -7764,7 +7764,11 @@ module ts { } function checkFunctionDeclaration(node: FunctionDeclaration): void { + // Grammar Checking, check signature of function declaration as checkFunctionLikeDeclaration call checkGarmmarFunctionLikeDeclaration checkFunctionLikeDeclaration(node); + //Grammar check other component of the functionDeclaration + checkGrammarFunctionName(node.name) || checkGrammarForBodyInAmbientContext(node.body, /*isConstructor*/ false) || checkGrammarForGenerator(node); + if (fullTypeCheck) { checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 6b8df5cdad5..99d1cb69f10 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -4646,7 +4646,7 @@ module ts { //case SyntaxKind.ExternalModuleReference: return checkExternalModuleReference(node); //case SyntaxKind.ForInStatement: return checkForInStatement(node); //case SyntaxKind.ForStatement: return checkForStatement(node); - case SyntaxKind.FunctionDeclaration: return checkFunctionDeclaration(node); + //case SyntaxKind.FunctionDeclaration: return checkFunctionDeclaration(node); //case SyntaxKind.FunctionExpression: return checkFunctionExpression(node); case SyntaxKind.GetAccessor: return checkGetAccessor(node); //case SyntaxKind.HeritageClause: return checkHeritageClause(node); @@ -5334,7 +5334,7 @@ module ts { //case SyntaxKind.EnumDeclaration: case SyntaxKind.ExportAssignment: //case SyntaxKind.VariableStatement: - case SyntaxKind.FunctionDeclaration: + //case SyntaxKind.FunctionDeclaration: case SyntaxKind.TypeAliasDeclaration: case SyntaxKind.ImportDeclaration: //case SyntaxKind.Parameter: diff --git a/tests/baselines/reference/declareAlreadySeen.errors.txt b/tests/baselines/reference/declareAlreadySeen.errors.txt index 60cd204c40c..da671ad313a 100644 --- a/tests/baselines/reference/declareAlreadySeen.errors.txt +++ b/tests/baselines/reference/declareAlreadySeen.errors.txt @@ -1,6 +1,6 @@ -tests/cases/compiler/declareAlreadySeen.ts(3,13): error TS1030: 'declare' modifier already seen. tests/cases/compiler/declareAlreadySeen.ts(5,13): error TS1030: 'declare' modifier already seen. tests/cases/compiler/declareAlreadySeen.ts(2,13): error TS1030: 'declare' modifier already seen. +tests/cases/compiler/declareAlreadySeen.ts(3,13): error TS1030: 'declare' modifier already seen. tests/cases/compiler/declareAlreadySeen.ts(7,13): error TS1030: 'declare' modifier already seen. diff --git a/tests/baselines/reference/invalidModuleWithVarStatements.errors.txt b/tests/baselines/reference/invalidModuleWithVarStatements.errors.txt index e0ba35c3385..ad8d457670a 100644 --- a/tests/baselines/reference/invalidModuleWithVarStatements.errors.txt +++ b/tests/baselines/reference/invalidModuleWithVarStatements.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithVarStatements.ts(8,5): error TS1044: 'public' modifier cannot appear on a module element. -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithVarStatements.ts(16,5): error TS1044: 'static' modifier cannot appear on a module element. -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithVarStatements.ts(25,5): error TS1044: 'private' modifier cannot appear on a module element. tests/cases/conformance/internalModules/moduleBody/invalidModuleWithVarStatements.ts(4,5): error TS1044: 'public' modifier cannot appear on a module element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithVarStatements.ts(8,5): error TS1044: 'public' modifier cannot appear on a module element. tests/cases/conformance/internalModules/moduleBody/invalidModuleWithVarStatements.ts(12,5): error TS1044: 'static' modifier cannot appear on a module element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithVarStatements.ts(16,5): error TS1044: 'static' modifier cannot appear on a module element. tests/cases/conformance/internalModules/moduleBody/invalidModuleWithVarStatements.ts(20,5): error TS1044: 'private' modifier cannot appear on a module element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithVarStatements.ts(25,5): error TS1044: 'private' modifier cannot appear on a module element. ==== tests/cases/conformance/internalModules/moduleBody/invalidModuleWithVarStatements.ts (6 errors) ==== diff --git a/tests/baselines/reference/optionalArgsWithDefaultValues.errors.txt b/tests/baselines/reference/optionalArgsWithDefaultValues.errors.txt index 414e718ac71..784f8b64e2a 100644 --- a/tests/baselines/reference/optionalArgsWithDefaultValues.errors.txt +++ b/tests/baselines/reference/optionalArgsWithDefaultValues.errors.txt @@ -1,6 +1,6 @@ -tests/cases/compiler/optionalArgsWithDefaultValues.ts(1,25): error TS1015: Parameter cannot have question mark and initializer. tests/cases/compiler/optionalArgsWithDefaultValues.ts(4,27): error TS1015: Parameter cannot have question mark and initializer. tests/cases/compiler/optionalArgsWithDefaultValues.ts(5,28): error TS1015: Parameter cannot have question mark and initializer. +tests/cases/compiler/optionalArgsWithDefaultValues.ts(1,25): error TS1015: Parameter cannot have question mark and initializer. tests/cases/compiler/optionalArgsWithDefaultValues.ts(8,10): error TS1015: Parameter cannot have question mark and initializer. tests/cases/compiler/optionalArgsWithDefaultValues.ts(9,13): error TS1015: Parameter cannot have question mark and initializer. From 7a4d8cd8ee711fc47d81c9c4fc45a50544535431 Mon Sep 17 00:00:00 2001 From: Yui T Date: Tue, 16 Dec 2014 12:25:05 -0800 Subject: [PATCH 65/78] Move grammar checking: setAccessor, getAccessor; there are still erros from incomplete grammar migration --- src/compiler/checker.ts | 47 ++++++++++++++++++- .../diagnosticInformationMap.generated.ts | 12 ++--- src/compiler/diagnosticMessages.json | 18 ++++--- src/compiler/parser.ts | 8 ++-- .../accessibilityModifiers.errors.txt | 12 ++--- ...rParameterAccessibilityModifier.errors.txt | 2 +- .../accessorParameterAccessibilityModifier.js | 25 ++++++++++ ...rs_spec_section-4.5_error-cases.errors.txt | 8 ++-- .../reference/anyIdenticalToItself.errors.txt | 2 +- ...uperAndLocalFunctionInAccessors.errors.txt | 6 +-- ...sionSuperAndLocalVarInAccessors.errors.txt | 6 +-- .../collisionSuperAndParameter.errors.txt | 2 +- ...xpressionAndLocalVarInAccessors.errors.txt | 6 +-- ...InstanceShadowingPublicInstance.errors.txt | 4 +- ...vateStaticShadowingPublicStatic.errors.txt | 4 +- .../duplicateClassElements.errors.txt | 20 ++++---- .../errorSuperPropertyAccess.errors.txt | 16 +++---- .../errorsInGenericTypeReference.errors.txt | 2 +- .../reference/es6ClassTest2.errors.txt | 2 +- .../fieldAndGetterWithSameName.errors.txt | 2 +- ...functionAndPropertyNameConflict.errors.txt | 2 +- .../genericReturnTypeFromGetter1.errors.txt | 2 +- ...ReturnTypeAndFunctionClassMerge.errors.txt | 2 +- .../getAndSetNotIdenticalType.errors.txt | 10 ++-- .../getAndSetNotIdenticalType2.errors.txt | 8 ++-- .../getAndSetNotIdenticalType3.errors.txt | 8 ++-- .../reference/gettersAndSetters.errors.txt | 4 +- .../gettersAndSettersAccessibility.errors.txt | 2 +- .../gettersAndSettersErrors.errors.txt | 8 ++-- .../illegalSuperCallsInConstructor.errors.txt | 8 ++-- .../implicitAnyCastedValue.errors.txt | 6 +-- ...AndSetAccessorWithAnyReturnType.errors.txt | 10 ++-- .../reference/inferSetterParamType.errors.txt | 2 +- ...eMemberAccessorOverridingMethod.errors.txt | 4 +- ...eStaticAccessorOverridingMethod.errors.txt | 4 +- ...ropertiesInheritedIntoClassType.errors.txt | 2 +- .../instancePropertyInClassType.errors.txt | 2 +- ...rConstrainsPropertyDeclarations.errors.txt | 8 ++-- .../objectLiteralGettersAndSetters.errors.txt | 4 +- .../reference/parserAstSpans1.errors.txt | 2 +- .../parserMemberAccessorDeclaration15.js | 17 +++++++ ...propertyAndAccessorWithSameName.errors.txt | 8 ++-- .../staticPropertyNotInClassType.errors.txt | 4 +- .../reference/staticVisibility.errors.txt | 4 +- ...rConstrainsPropertyDeclarations.errors.txt | 10 ++-- .../reference/superPropertyAccess1.errors.txt | 2 +- .../reference/superPropertyAccess2.errors.txt | 2 +- ...ect-literal-getters-and-setters.errors.txt | 4 +- .../twoAccessorsWithSameName2.errors.txt | 8 ++-- .../typeOfThisInInstanceMember.errors.txt | 2 +- ...typeParametersInStaticAccessors.errors.txt | 2 +- 51 files changed, 229 insertions(+), 136 deletions(-) create mode 100644 tests/baselines/reference/accessorParameterAccessibilityModifier.js create mode 100644 tests/baselines/reference/parserMemberAccessorDeclaration15.js diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index fa7b6f571ef..6cb38e98eaa 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -7329,7 +7329,10 @@ module ts { } function checkAccessorDeclaration(node: AccessorDeclaration) { - // Grammar checking + // Grammar checking accessors + checkGrammarFunctionLikeDeclaration(node) || checkGrammarAccessor(node); + + // Grammar checking if name is a computed-property if (node.name.kind === SyntaxKind.ComputedPropertyName) { checkGrammarComputedPropertyName(node.name); } @@ -10333,6 +10336,48 @@ module ts { } } + function checkGrammarAccessor(accessor: MethodDeclaration): boolean { + var kind = accessor.kind; + if (compilerOptions.target < ScriptTarget.ES5) { + return grammarErrorOnNode(accessor.name, Diagnostics.Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher); + } + else if (isInAmbientContext(accessor)) { + return grammarErrorOnNode(accessor.name, Diagnostics.An_accessor_cannot_be_declared_in_an_ambient_context); + } + else if (accessor.body === undefined) { + return grammarErrorAtPos(getSourceFileOfNode(accessor), accessor.end - 1, ";".length, Diagnostics._0_expected, "{"); + } + else if (accessor.typeParameters) { + return grammarErrorOnNode(accessor.name, Diagnostics.An_accessor_cannot_have_type_parameters); + } + else if (kind === SyntaxKind.GetAccessor && accessor.parameters.length) { + return grammarErrorOnNode(accessor.name, Diagnostics.A_get_accessor_cannot_have_parameters); + } + else if (kind === SyntaxKind.SetAccessor) { + if (accessor.type) { + return grammarErrorOnNode(accessor.name, Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation); + } + else if (accessor.parameters.length !== 1) { + return grammarErrorOnNode(accessor.name, Diagnostics.A_set_accessor_must_have_exactly_one_parameter); + } + else { + var parameter = accessor.parameters[0]; + if (parameter.dotDotDotToken) { + return grammarErrorOnNode(parameter.dotDotDotToken, Diagnostics.A_set_accessor_cannot_have_rest_parameter); + } + else if (parameter.flags & NodeFlags.Modifier) { + return grammarErrorOnNode(accessor.name, Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); + } + else if (parameter.questionToken) { + return grammarErrorOnNode(parameter.questionToken, Diagnostics.A_set_accessor_cannot_have_an_optional_parameter); + } + else if (parameter.initializer) { + return grammarErrorOnNode(accessor.name, Diagnostics.A_set_accessor_parameter_cannot_have_an_initializer); + } + } + } + } + function isIterationStatement(node: Node, lookInLabeledStatements: boolean): boolean { switch (node.kind) { case SyntaxKind.ForStatement: diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index fa21ddd03d4..085fb5c9654 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -4,7 +4,7 @@ module ts { export var Diagnostics = { Unterminated_string_literal: { code: 1002, category: DiagnosticCategory.Error, key: "Unterminated string literal." }, Identifier_expected: { code: 1003, category: DiagnosticCategory.Error, key: "Identifier expected." }, - _0_expected: { code: 1005, category: DiagnosticCategory.Error, key: "'{0}' expected." }, + _0_expected: { code: 1005, category: DiagnosticCategory.Error, key: "'{0}' expected.", isEarly: true }, A_file_cannot_have_a_reference_to_itself: { code: 1006, category: DiagnosticCategory.Error, key: "A file cannot have a reference to itself." }, Trailing_comma_not_allowed: { code: 1009, category: DiagnosticCategory.Error, key: "Trailing comma not allowed.", isEarly: true }, Asterisk_Slash_expected: { code: 1010, category: DiagnosticCategory.Error, key: "'*/' expected." }, @@ -40,9 +40,9 @@ module ts { A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file: { code: 1046, category: DiagnosticCategory.Error, key: "A 'declare' modifier is required for a top level declaration in a .d.ts file." }, A_rest_parameter_cannot_be_optional: { code: 1047, category: DiagnosticCategory.Error, key: "A rest parameter cannot be optional.", isEarly: true }, A_rest_parameter_cannot_have_an_initializer: { code: 1048, category: DiagnosticCategory.Error, key: "A rest parameter cannot have an initializer." }, - A_set_accessor_must_have_exactly_one_parameter: { code: 1049, category: DiagnosticCategory.Error, key: "A 'set' accessor must have exactly one parameter." }, - A_set_accessor_cannot_have_an_optional_parameter: { code: 1051, category: DiagnosticCategory.Error, key: "A 'set' accessor cannot have an optional parameter." }, - A_set_accessor_parameter_cannot_have_an_initializer: { code: 1052, category: DiagnosticCategory.Error, key: "A 'set' accessor parameter cannot have an initializer." }, + A_set_accessor_must_have_exactly_one_parameter: { code: 1049, category: DiagnosticCategory.Error, key: "A 'set' accessor must have exactly one parameter.", isEarly: true }, + A_set_accessor_cannot_have_an_optional_parameter: { code: 1051, category: DiagnosticCategory.Error, key: "A 'set' accessor cannot have an optional parameter.", isEarly: true }, + A_set_accessor_parameter_cannot_have_an_initializer: { code: 1052, category: DiagnosticCategory.Error, key: "A 'set' accessor parameter cannot have an initializer.", isEarly: true }, A_set_accessor_cannot_have_rest_parameter: { code: 1053, category: DiagnosticCategory.Error, key: "A 'set' accessor cannot have rest parameter.", isEarly: true }, A_get_accessor_cannot_have_parameters: { code: 1054, category: DiagnosticCategory.Error, key: "A 'get' accessor cannot have parameters.", isEarly: true }, Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1056, category: DiagnosticCategory.Error, key: "Accessors are only available when targeting ECMAScript 5 and higher.", isEarly: true }, @@ -59,8 +59,8 @@ module ts { Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement: { code: 1091, category: DiagnosticCategory.Error, key: "Only a single variable declaration is allowed in a 'for...in' statement.", isEarly: true }, Type_parameters_cannot_appear_on_a_constructor_declaration: { code: 1092, category: DiagnosticCategory.Error, key: "Type parameters cannot appear on a constructor declaration.", isEarly: true }, Type_annotation_cannot_appear_on_a_constructor_declaration: { code: 1093, category: DiagnosticCategory.Error, key: "Type annotation cannot appear on a constructor declaration.", isEarly: true }, - An_accessor_cannot_have_type_parameters: { code: 1094, category: DiagnosticCategory.Error, key: "An accessor cannot have type parameters." }, - A_set_accessor_cannot_have_a_return_type_annotation: { code: 1095, category: DiagnosticCategory.Error, key: "A 'set' accessor cannot have a return type annotation." }, + An_accessor_cannot_have_type_parameters: { code: 1094, category: DiagnosticCategory.Error, key: "An accessor cannot have type parameters.", isEarly: true }, + A_set_accessor_cannot_have_a_return_type_annotation: { code: 1095, category: DiagnosticCategory.Error, key: "A 'set' accessor cannot have a return type annotation.", isEarly: true }, An_index_signature_must_have_exactly_one_parameter: { code: 1096, category: DiagnosticCategory.Error, key: "An index signature must have exactly one parameter.", isEarly: true }, _0_list_cannot_be_empty: { code: 1097, category: DiagnosticCategory.Error, key: "'{0}' list cannot be empty.", isEarly: true }, Type_parameter_list_cannot_be_empty: { code: 1098, category: DiagnosticCategory.Error, key: "Type parameter list cannot be empty.", isEarly: true }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 3ddd6cf2a84..5d8f79eac42 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -9,7 +9,8 @@ }, "'{0}' expected.": { "category": "Error", - "code": 1005 + "code": 1005, + "isEarly": true }, "A file cannot have a reference to itself.": { "category": "Error", @@ -176,15 +177,18 @@ }, "A 'set' accessor must have exactly one parameter.": { "category": "Error", - "code": 1049 + "code": 1049, + "isEarly": true }, "A 'set' accessor cannot have an optional parameter.": { "category": "Error", - "code": 1051 + "code": 1051, + "isEarly": true }, "A 'set' accessor parameter cannot have an initializer.": { "category": "Error", - "code": 1052 + "code": 1052, + "isEarly": true }, "A 'set' accessor cannot have rest parameter.": { "category": "Error", @@ -265,11 +269,13 @@ }, "An accessor cannot have type parameters.": { "category": "Error", - "code": 1094 + "code": 1094, + "isEarly": true }, "A 'set' accessor cannot have a return type annotation.": { "category": "Error", - "code": 1095 + "code": 1095, + "isEarly": true }, "An index signature must have exactly one parameter.": { "category": "Error", diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 99d1cb69f10..24f0dafaa27 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -4648,7 +4648,7 @@ module ts { //case SyntaxKind.ForStatement: return checkForStatement(node); //case SyntaxKind.FunctionDeclaration: return checkFunctionDeclaration(node); //case SyntaxKind.FunctionExpression: return checkFunctionExpression(node); - case SyntaxKind.GetAccessor: return checkGetAccessor(node); + //case SyntaxKind.GetAccessor: return checkGetAccessor(node); //case SyntaxKind.HeritageClause: return checkHeritageClause(node); //case SyntaxKind.InterfaceDeclaration: return checkInterfaceDeclaration(node); //case SyntaxKind.LabeledStatement: return checkLabeledStatement(node); @@ -4666,7 +4666,7 @@ module ts { case SyntaxKind.PropertySignature: return checkProperty(node); //case SyntaxKind.ReturnStatement: return checkReturnStatement(node); - case SyntaxKind.SetAccessor: return checkSetAccessor(node); + //case SyntaxKind.SetAccessor: return checkSetAccessor(node); case SyntaxKind.SourceFile: return checkSourceFile(node); //case SyntaxKind.ShorthandPropertyAssignment: return checkShorthandPropertyAssignment(node); //case SyntaxKind.SwitchStatement: return checkSwitchStatement(node); @@ -5321,8 +5321,8 @@ module ts { function checkModifiers(node: Node): boolean { switch (node.kind) { - case SyntaxKind.GetAccessor: - case SyntaxKind.SetAccessor: + //case SyntaxKind.GetAccessor: + //case SyntaxKind.SetAccessor: //case SyntaxKind.Constructor: case SyntaxKind.PropertyDeclaration: case SyntaxKind.PropertySignature: diff --git a/tests/baselines/reference/accessibilityModifiers.errors.txt b/tests/baselines/reference/accessibilityModifiers.errors.txt index 1bf92139761..f571c8e3ee0 100644 --- a/tests/baselines/reference/accessibilityModifiers.errors.txt +++ b/tests/baselines/reference/accessibilityModifiers.errors.txt @@ -1,17 +1,17 @@ tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(22,12): error TS1029: 'private' modifier must precede 'static' modifier. tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(23,12): error TS1029: 'private' modifier must precede 'static' modifier. -tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(24,12): error TS1029: 'private' modifier must precede 'static' modifier. -tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(25,12): error TS1029: 'private' modifier must precede 'static' modifier. tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(27,12): error TS1029: 'protected' modifier must precede 'static' modifier. tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(28,12): error TS1029: 'protected' modifier must precede 'static' modifier. -tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(29,12): error TS1029: 'protected' modifier must precede 'static' modifier. -tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(30,12): error TS1029: 'protected' modifier must precede 'static' modifier. tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(32,12): error TS1029: 'public' modifier must precede 'static' modifier. tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(33,12): error TS1029: 'public' modifier must precede 'static' modifier. -tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(34,12): error TS1029: 'public' modifier must precede 'static' modifier. -tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(35,12): error TS1029: 'public' modifier must precede 'static' modifier. tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(40,13): error TS1028: Accessibility modifier already seen. tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(41,12): error TS1028: Accessibility modifier already seen. +tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(24,12): error TS1029: 'private' modifier must precede 'static' modifier. +tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(25,12): error TS1029: 'private' modifier must precede 'static' modifier. +tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(29,12): error TS1029: 'protected' modifier must precede 'static' modifier. +tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(30,12): error TS1029: 'protected' modifier must precede 'static' modifier. +tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(34,12): error TS1029: 'public' modifier must precede 'static' modifier. +tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(35,12): error TS1029: 'public' modifier must precede 'static' modifier. tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(42,13): error TS1028: Accessibility modifier already seen. tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(43,12): error TS1028: Accessibility modifier already seen. diff --git a/tests/baselines/reference/accessorParameterAccessibilityModifier.errors.txt b/tests/baselines/reference/accessorParameterAccessibilityModifier.errors.txt index 401a0107d89..fad1d8ff10a 100644 --- a/tests/baselines/reference/accessorParameterAccessibilityModifier.errors.txt +++ b/tests/baselines/reference/accessorParameterAccessibilityModifier.errors.txt @@ -1,6 +1,6 @@ tests/cases/compiler/accessorParameterAccessibilityModifier.ts(3,9): error TS2369: A parameter property is only allowed in a constructor implementation. -tests/cases/compiler/accessorParameterAccessibilityModifier.ts(4,16): error TS2369: A parameter property is only allowed in a constructor implementation. tests/cases/compiler/accessorParameterAccessibilityModifier.ts(3,11): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/compiler/accessorParameterAccessibilityModifier.ts(4,16): error TS2369: A parameter property is only allowed in a constructor implementation. tests/cases/compiler/accessorParameterAccessibilityModifier.ts(4,18): error TS2369: A parameter property is only allowed in a constructor implementation. diff --git a/tests/baselines/reference/accessorParameterAccessibilityModifier.js b/tests/baselines/reference/accessorParameterAccessibilityModifier.js new file mode 100644 index 00000000000..89a511e6c5c --- /dev/null +++ b/tests/baselines/reference/accessorParameterAccessibilityModifier.js @@ -0,0 +1,25 @@ +//// [accessorParameterAccessibilityModifier.ts] + +class C { + set X(public v) { } + static set X(public v2) { } +} + +//// [accessorParameterAccessibilityModifier.js] +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, "X", { + set: function (v) { + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C, "X", { + set: function (v2) { + }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/accessors_spec_section-4.5_error-cases.errors.txt b/tests/baselines/reference/accessors_spec_section-4.5_error-cases.errors.txt index 22fdeb099bc..981cb525625 100644 --- a/tests/baselines/reference/accessors_spec_section-4.5_error-cases.errors.txt +++ b/tests/baselines/reference/accessors_spec_section-4.5_error-cases.errors.txt @@ -1,15 +1,15 @@ tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(2,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(3,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(3,55): error TS2322: Type 'string' is not assignable to type 'number'. tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(5,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(5,54): error TS2322: Type 'string' is not assignable to type 'number'. tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(6,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(8,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(9,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(11,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(12,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(3,55): error TS2322: Type 'string' is not assignable to type 'number'. -tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(5,54): error TS2322: Type 'string' is not assignable to type 'number'. tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(9,52): error TS2322: Type 'number' is not assignable to type 'string'. +tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(11,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(11,51): error TS2322: Type 'number' is not assignable to type 'string'. +tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(12,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ==== tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts (12 errors) ==== diff --git a/tests/baselines/reference/anyIdenticalToItself.errors.txt b/tests/baselines/reference/anyIdenticalToItself.errors.txt index ea8583a6a75..6b82f3af73c 100644 --- a/tests/baselines/reference/anyIdenticalToItself.errors.txt +++ b/tests/baselines/reference/anyIdenticalToItself.errors.txt @@ -1,6 +1,6 @@ +tests/cases/compiler/anyIdenticalToItself.ts(1,1): error TS2394: Overload signature is not compatible with function implementation. tests/cases/compiler/anyIdenticalToItself.ts(6,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/anyIdenticalToItself.ts(10,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/anyIdenticalToItself.ts(1,1): error TS2394: Overload signature is not compatible with function implementation. ==== tests/cases/compiler/anyIdenticalToItself.ts (3 errors) ==== diff --git a/tests/baselines/reference/collisionSuperAndLocalFunctionInAccessors.errors.txt b/tests/baselines/reference/collisionSuperAndLocalFunctionInAccessors.errors.txt index 15ad1e0e8e7..6a459b222c7 100644 --- a/tests/baselines/reference/collisionSuperAndLocalFunctionInAccessors.errors.txt +++ b/tests/baselines/reference/collisionSuperAndLocalFunctionInAccessors.errors.txt @@ -1,12 +1,12 @@ tests/cases/compiler/collisionSuperAndLocalFunctionInAccessors.ts(4,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/collisionSuperAndLocalFunctionInAccessors.ts(9,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/collisionSuperAndLocalFunctionInAccessors.ts(15,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/collisionSuperAndLocalFunctionInAccessors.ts(20,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/collisionSuperAndLocalFunctionInAccessors.ts(26,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/collisionSuperAndLocalFunctionInAccessors.ts(33,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/collisionSuperAndLocalFunctionInAccessors.ts(16,9): error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. +tests/cases/compiler/collisionSuperAndLocalFunctionInAccessors.ts(20,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/collisionSuperAndLocalFunctionInAccessors.ts(21,9): error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. +tests/cases/compiler/collisionSuperAndLocalFunctionInAccessors.ts(26,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/collisionSuperAndLocalFunctionInAccessors.ts(28,13): error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. +tests/cases/compiler/collisionSuperAndLocalFunctionInAccessors.ts(33,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/collisionSuperAndLocalFunctionInAccessors.ts(35,13): error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. diff --git a/tests/baselines/reference/collisionSuperAndLocalVarInAccessors.errors.txt b/tests/baselines/reference/collisionSuperAndLocalVarInAccessors.errors.txt index 47c52c2582e..7e0f80f0658 100644 --- a/tests/baselines/reference/collisionSuperAndLocalVarInAccessors.errors.txt +++ b/tests/baselines/reference/collisionSuperAndLocalVarInAccessors.errors.txt @@ -1,12 +1,12 @@ tests/cases/compiler/collisionSuperAndLocalVarInAccessors.ts(3,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/collisionSuperAndLocalVarInAccessors.ts(7,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/collisionSuperAndLocalVarInAccessors.ts(12,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/collisionSuperAndLocalVarInAccessors.ts(16,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/collisionSuperAndLocalVarInAccessors.ts(21,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/collisionSuperAndLocalVarInAccessors.ts(27,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/collisionSuperAndLocalVarInAccessors.ts(13,13): error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. +tests/cases/compiler/collisionSuperAndLocalVarInAccessors.ts(16,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/collisionSuperAndLocalVarInAccessors.ts(17,13): error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. +tests/cases/compiler/collisionSuperAndLocalVarInAccessors.ts(21,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/collisionSuperAndLocalVarInAccessors.ts(23,17): error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. +tests/cases/compiler/collisionSuperAndLocalVarInAccessors.ts(27,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/collisionSuperAndLocalVarInAccessors.ts(29,17): error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. diff --git a/tests/baselines/reference/collisionSuperAndParameter.errors.txt b/tests/baselines/reference/collisionSuperAndParameter.errors.txt index b3dcdbf1be8..65dddd95d48 100644 --- a/tests/baselines/reference/collisionSuperAndParameter.errors.txt +++ b/tests/baselines/reference/collisionSuperAndParameter.errors.txt @@ -1,7 +1,7 @@ tests/cases/compiler/collisionSuperAndParameter.ts(12,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/collisionSuperAndParameter.ts(26,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/collisionSuperAndParameter.ts(17,22): error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. tests/cases/compiler/collisionSuperAndParameter.ts(21,7): error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. +tests/cases/compiler/collisionSuperAndParameter.ts(26,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/collisionSuperAndParameter.ts(26,11): error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. tests/cases/compiler/collisionSuperAndParameter.ts(32,19): error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. tests/cases/compiler/collisionSuperAndParameter.ts(35,17): error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. diff --git a/tests/baselines/reference/collisionThisExpressionAndLocalVarInAccessors.errors.txt b/tests/baselines/reference/collisionThisExpressionAndLocalVarInAccessors.errors.txt index 951a349be2b..cbe371c5934 100644 --- a/tests/baselines/reference/collisionThisExpressionAndLocalVarInAccessors.errors.txt +++ b/tests/baselines/reference/collisionThisExpressionAndLocalVarInAccessors.errors.txt @@ -1,10 +1,10 @@ tests/cases/compiler/collisionThisExpressionAndLocalVarInAccessors.ts(2,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/collisionThisExpressionAndLocalVarInAccessors.ts(12,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/collisionThisExpressionAndLocalVarInAccessors.ts(24,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/collisionThisExpressionAndLocalVarInAccessors.ts(34,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/collisionThisExpressionAndLocalVarInAccessors.ts(5,21): error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. +tests/cases/compiler/collisionThisExpressionAndLocalVarInAccessors.ts(12,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/collisionThisExpressionAndLocalVarInAccessors.ts(15,21): error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. +tests/cases/compiler/collisionThisExpressionAndLocalVarInAccessors.ts(24,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/collisionThisExpressionAndLocalVarInAccessors.ts(25,13): error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. +tests/cases/compiler/collisionThisExpressionAndLocalVarInAccessors.ts(34,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/collisionThisExpressionAndLocalVarInAccessors.ts(35,13): error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. diff --git a/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingPublicInstance.errors.txt b/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingPublicInstance.errors.txt index bbe47bb9544..6aeb5a7ec23 100644 --- a/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingPublicInstance.errors.txt +++ b/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingPublicInstance.errors.txt @@ -1,9 +1,9 @@ tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateInstanceShadowingPublicInstance.ts(7,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateInstanceShadowingPublicInstance.ts(8,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateInstanceShadowingPublicInstance.ts(18,17): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateInstanceShadowingPublicInstance.ts(19,17): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateInstanceShadowingPublicInstance.ts(12,7): error TS2415: Class 'Derived' incorrectly extends base class 'Base'. Property 'x' is private in type 'Derived' but not in type 'Base'. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateInstanceShadowingPublicInstance.ts(18,17): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateInstanceShadowingPublicInstance.ts(19,17): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateInstanceShadowingPublicInstance.ts(22,14): error TS2339: Property 'x' does not exist on type 'typeof Base'. tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateInstanceShadowingPublicInstance.ts(23,18): error TS2339: Property 'x' does not exist on type 'typeof Derived'. tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateInstanceShadowingPublicInstance.ts(25,15): error TS2339: Property 'fn' does not exist on type 'typeof Base'. diff --git a/tests/baselines/reference/derivedClassWithPrivateStaticShadowingPublicStatic.errors.txt b/tests/baselines/reference/derivedClassWithPrivateStaticShadowingPublicStatic.errors.txt index cfdf1381282..2e5d6f57c86 100644 --- a/tests/baselines/reference/derivedClassWithPrivateStaticShadowingPublicStatic.errors.txt +++ b/tests/baselines/reference/derivedClassWithPrivateStaticShadowingPublicStatic.errors.txt @@ -1,9 +1,9 @@ tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateStaticShadowingPublicStatic.ts(7,23): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateStaticShadowingPublicStatic.ts(8,23): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateStaticShadowingPublicStatic.ts(19,24): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateStaticShadowingPublicStatic.ts(20,24): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateStaticShadowingPublicStatic.ts(13,7): error TS2417: Class static side 'typeof Derived' incorrectly extends base class static side 'typeof Base'. Property 'x' is private in type 'typeof Derived' but not in type 'typeof Base'. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateStaticShadowingPublicStatic.ts(19,24): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateStaticShadowingPublicStatic.ts(20,24): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateStaticShadowingPublicStatic.ts(24,10): error TS2341: Property 'x' is private and only accessible within class 'Derived'. tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateStaticShadowingPublicStatic.ts(27,10): error TS2341: Property 'fn' is private and only accessible within class 'Derived'. tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateStaticShadowingPublicStatic.ts(32,10): error TS2341: Property 'a' is private and only accessible within class 'Derived'. diff --git a/tests/baselines/reference/duplicateClassElements.errors.txt b/tests/baselines/reference/duplicateClassElements.errors.txt index 004e68314fd..9dfec7a2908 100644 --- a/tests/baselines/reference/duplicateClassElements.errors.txt +++ b/tests/baselines/reference/duplicateClassElements.errors.txt @@ -1,27 +1,27 @@ -tests/cases/compiler/duplicateClassElements.ts(9,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/duplicateClassElements.ts(12,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/duplicateClassElements.ts(15,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/duplicateClassElements.ts(18,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/duplicateClassElements.ts(23,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/duplicateClassElements.ts(26,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/duplicateClassElements.ts(29,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/duplicateClassElements.ts(32,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/duplicateClassElements.ts(36,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/duplicateClassElements.ts(39,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/duplicateClassElements.ts(2,12): error TS2300: Duplicate identifier 'a'. tests/cases/compiler/duplicateClassElements.ts(3,12): error TS2300: Duplicate identifier 'a'. tests/cases/compiler/duplicateClassElements.ts(4,12): error TS2393: Duplicate function implementation. tests/cases/compiler/duplicateClassElements.ts(6,12): error TS2393: Duplicate function implementation. tests/cases/compiler/duplicateClassElements.ts(8,12): error TS2300: Duplicate identifier 'x'. +tests/cases/compiler/duplicateClassElements.ts(9,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/duplicateClassElements.ts(9,9): error TS2300: Duplicate identifier 'x'. +tests/cases/compiler/duplicateClassElements.ts(12,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/duplicateClassElements.ts(12,9): error TS2300: Duplicate identifier 'x'. +tests/cases/compiler/duplicateClassElements.ts(15,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/duplicateClassElements.ts(18,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/duplicateClassElements.ts(21,12): error TS2300: Duplicate identifier 'z'. +tests/cases/compiler/duplicateClassElements.ts(23,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/duplicateClassElements.ts(23,9): error TS2300: Duplicate identifier 'z'. +tests/cases/compiler/duplicateClassElements.ts(26,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/duplicateClassElements.ts(26,9): error TS2300: Duplicate identifier 'z'. +tests/cases/compiler/duplicateClassElements.ts(29,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/duplicateClassElements.ts(29,9): error TS2300: Duplicate identifier 'x2'. +tests/cases/compiler/duplicateClassElements.ts(32,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/duplicateClassElements.ts(32,9): error TS2300: Duplicate identifier 'x2'. tests/cases/compiler/duplicateClassElements.ts(34,12): error TS2300: Duplicate identifier 'x2'. +tests/cases/compiler/duplicateClassElements.ts(36,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/duplicateClassElements.ts(36,9): error TS2300: Duplicate identifier 'z2'. +tests/cases/compiler/duplicateClassElements.ts(39,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/duplicateClassElements.ts(39,9): error TS2300: Duplicate identifier 'z2'. tests/cases/compiler/duplicateClassElements.ts(41,12): error TS2300: Duplicate identifier 'z2'. diff --git a/tests/baselines/reference/errorSuperPropertyAccess.errors.txt b/tests/baselines/reference/errorSuperPropertyAccess.errors.txt index e192e99b87f..b273b1b6f45 100644 --- a/tests/baselines/reference/errorSuperPropertyAccess.errors.txt +++ b/tests/baselines/reference/errorSuperPropertyAccess.errors.txt @@ -1,11 +1,3 @@ -tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(24,23): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(29,23): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(64,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(68,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(94,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(98,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(113,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(119,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(6,17): error TS2335: 'super' can only be referenced in a derived class. tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(7,17): error TS2335: 'super' can only be referenced in a derived class. tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(11,17): error TS2335: 'super' can only be referenced in a derived class. @@ -13,24 +5,32 @@ tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(15,9): error TS2335: 'super' can only be referenced in a derived class. tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(16,9): error TS2335: 'super' can only be referenced in a derived class. tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(21,9): error TS2335: 'super' can only be referenced in a derived class. +tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(24,23): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(25,9): error TS2335: 'super' can only be referenced in a derived class. +tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(29,23): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(30,9): error TS2335: 'super' can only be referenced in a derived class. tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(57,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(61,23): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword +tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(64,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(65,23): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword +tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(68,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(69,19): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(73,13): error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(76,40): error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(87,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(91,23): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword +tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(94,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(95,23): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword +tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(98,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(99,19): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(109,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(110,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(111,9): error TS2341: Property 'privateStaticFunc' is private and only accessible within class 'SomeBase'. +tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(113,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(114,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(115,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(116,9): error TS2341: Property 'privateStaticFunc' is private and only accessible within class 'SomeBase'. +tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(119,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(120,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(121,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(122,9): error TS2341: Property 'privateStaticFunc' is private and only accessible within class 'SomeBase'. diff --git a/tests/baselines/reference/errorsInGenericTypeReference.errors.txt b/tests/baselines/reference/errorsInGenericTypeReference.errors.txt index dcb5018f035..729b4db5440 100644 --- a/tests/baselines/reference/errorsInGenericTypeReference.errors.txt +++ b/tests/baselines/reference/errorsInGenericTypeReference.errors.txt @@ -1,8 +1,8 @@ -tests/cases/compiler/errorsInGenericTypeReference.ts(25,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/errorsInGenericTypeReference.ts(12,17): error TS2304: Cannot find name 'V'. tests/cases/compiler/errorsInGenericTypeReference.ts(18,31): error TS2304: Cannot find name 'V'. tests/cases/compiler/errorsInGenericTypeReference.ts(23,29): error TS2304: Cannot find name 'V'. tests/cases/compiler/errorsInGenericTypeReference.ts(24,36): error TS2304: Cannot find name 'V'. +tests/cases/compiler/errorsInGenericTypeReference.ts(25,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/errorsInGenericTypeReference.ts(25,27): error TS2304: Cannot find name 'V'. tests/cases/compiler/errorsInGenericTypeReference.ts(26,24): error TS2304: Cannot find name 'V'. tests/cases/compiler/errorsInGenericTypeReference.ts(31,36): error TS2304: Cannot find name 'V'. diff --git a/tests/baselines/reference/es6ClassTest2.errors.txt b/tests/baselines/reference/es6ClassTest2.errors.txt index bf87a809b77..0b68e1cd784 100644 --- a/tests/baselines/reference/es6ClassTest2.errors.txt +++ b/tests/baselines/reference/es6ClassTest2.errors.txt @@ -1,6 +1,6 @@ +tests/cases/compiler/es6ClassTest2.ts(17,1): error TS2304: Cannot find name 'console'. tests/cases/compiler/es6ClassTest2.ts(30,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/es6ClassTest2.ts(35,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/es6ClassTest2.ts(17,1): error TS2304: Cannot find name 'console'. ==== tests/cases/compiler/es6ClassTest2.ts (3 errors) ==== diff --git a/tests/baselines/reference/fieldAndGetterWithSameName.errors.txt b/tests/baselines/reference/fieldAndGetterWithSameName.errors.txt index dd2374f2447..e78ccce2b83 100644 --- a/tests/baselines/reference/fieldAndGetterWithSameName.errors.txt +++ b/tests/baselines/reference/fieldAndGetterWithSameName.errors.txt @@ -1,5 +1,5 @@ -tests/cases/compiler/fieldAndGetterWithSameName.ts(3,7): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/fieldAndGetterWithSameName.ts(2,5): error TS2300: Duplicate identifier 'x'. +tests/cases/compiler/fieldAndGetterWithSameName.ts(3,7): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/fieldAndGetterWithSameName.ts(3,7): error TS2300: Duplicate identifier 'x'. diff --git a/tests/baselines/reference/functionAndPropertyNameConflict.errors.txt b/tests/baselines/reference/functionAndPropertyNameConflict.errors.txt index 640844064c4..a976048d0e3 100644 --- a/tests/baselines/reference/functionAndPropertyNameConflict.errors.txt +++ b/tests/baselines/reference/functionAndPropertyNameConflict.errors.txt @@ -1,5 +1,5 @@ -tests/cases/compiler/functionAndPropertyNameConflict.ts(3,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/functionAndPropertyNameConflict.ts(2,12): error TS2300: Duplicate identifier 'aaaaa'. +tests/cases/compiler/functionAndPropertyNameConflict.ts(3,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/functionAndPropertyNameConflict.ts(3,16): error TS2300: Duplicate identifier 'aaaaa'. diff --git a/tests/baselines/reference/genericReturnTypeFromGetter1.errors.txt b/tests/baselines/reference/genericReturnTypeFromGetter1.errors.txt index 8215d687443..6f5f68064a6 100644 --- a/tests/baselines/reference/genericReturnTypeFromGetter1.errors.txt +++ b/tests/baselines/reference/genericReturnTypeFromGetter1.errors.txt @@ -1,5 +1,5 @@ -tests/cases/compiler/genericReturnTypeFromGetter1.ts(6,7): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/genericReturnTypeFromGetter1.ts(5,18): error TS2314: Generic type 'A' requires 1 type argument(s). +tests/cases/compiler/genericReturnTypeFromGetter1.ts(6,7): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ==== tests/cases/compiler/genericReturnTypeFromGetter1.ts (2 errors) ==== diff --git a/tests/baselines/reference/getAccessorWithImpliedReturnTypeAndFunctionClassMerge.errors.txt b/tests/baselines/reference/getAccessorWithImpliedReturnTypeAndFunctionClassMerge.errors.txt index a7e8155c220..a11b0f0ad9e 100644 --- a/tests/baselines/reference/getAccessorWithImpliedReturnTypeAndFunctionClassMerge.errors.txt +++ b/tests/baselines/reference/getAccessorWithImpliedReturnTypeAndFunctionClassMerge.errors.txt @@ -1,10 +1,10 @@ -tests/cases/compiler/getAccessorWithImpliedReturnTypeAndFunctionClassMerge.ts(21,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/getAccessorWithImpliedReturnTypeAndFunctionClassMerge.ts(1,18): error TS2300: Duplicate identifier '_'. tests/cases/compiler/getAccessorWithImpliedReturnTypeAndFunctionClassMerge.ts(1,41): error TS2304: Cannot find name '_'. tests/cases/compiler/getAccessorWithImpliedReturnTypeAndFunctionClassMerge.ts(2,18): error TS2300: Duplicate identifier '_'. tests/cases/compiler/getAccessorWithImpliedReturnTypeAndFunctionClassMerge.ts(2,34): error TS2304: Cannot find name '_'. tests/cases/compiler/getAccessorWithImpliedReturnTypeAndFunctionClassMerge.ts(4,16): error TS2300: Duplicate identifier '_'. tests/cases/compiler/getAccessorWithImpliedReturnTypeAndFunctionClassMerge.ts(15,15): error TS2300: Duplicate identifier '_'. +tests/cases/compiler/getAccessorWithImpliedReturnTypeAndFunctionClassMerge.ts(21,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ==== tests/cases/compiler/getAccessorWithImpliedReturnTypeAndFunctionClassMerge.ts (7 errors) ==== diff --git a/tests/baselines/reference/getAndSetNotIdenticalType.errors.txt b/tests/baselines/reference/getAndSetNotIdenticalType.errors.txt index 5fe2e7ae321..6c55f966eee 100644 --- a/tests/baselines/reference/getAndSetNotIdenticalType.errors.txt +++ b/tests/baselines/reference/getAndSetNotIdenticalType.errors.txt @@ -1,23 +1,23 @@ -tests/cases/compiler/getAndSetNotIdenticalType.ts(2,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/getAndSetNotIdenticalType.ts(5,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/getAndSetNotIdenticalType.ts(2,5): error TS2380: 'get' and 'set' accessor must have the same type. +tests/cases/compiler/getAndSetNotIdenticalType.ts(2,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/getAndSetNotIdenticalType.ts(5,5): error TS2380: 'get' and 'set' accessor must have the same type. +tests/cases/compiler/getAndSetNotIdenticalType.ts(5,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ==== tests/cases/compiler/getAndSetNotIdenticalType.ts (4 errors) ==== class C { get x(): number { + ~~~~~~~~~~~~~~~~~ ~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. - ~~~~~~~~~~~~~~~~~ return 1; ~~~~~~~~~~~~~~~~~ } ~~~~~ !!! error TS2380: 'get' and 'set' accessor must have the same type. set x(v: string) { } - ~ -!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~~~~~~~~~~~~~~~~~~~ !!! error TS2380: 'get' and 'set' accessor must have the same type. + ~ +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. } \ No newline at end of file diff --git a/tests/baselines/reference/getAndSetNotIdenticalType2.errors.txt b/tests/baselines/reference/getAndSetNotIdenticalType2.errors.txt index 69d367bb21c..5cdb9b3a36f 100644 --- a/tests/baselines/reference/getAndSetNotIdenticalType2.errors.txt +++ b/tests/baselines/reference/getAndSetNotIdenticalType2.errors.txt @@ -1,7 +1,7 @@ -tests/cases/compiler/getAndSetNotIdenticalType2.ts(5,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/getAndSetNotIdenticalType2.ts(8,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/getAndSetNotIdenticalType2.ts(5,5): error TS2380: 'get' and 'set' accessor must have the same type. +tests/cases/compiler/getAndSetNotIdenticalType2.ts(5,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/getAndSetNotIdenticalType2.ts(8,5): error TS2380: 'get' and 'set' accessor must have the same type. +tests/cases/compiler/getAndSetNotIdenticalType2.ts(8,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/getAndSetNotIdenticalType2.ts(9,9): error TS2322: Type 'A' is not assignable to type 'A'. Type 'string' is not assignable to type 'T'. @@ -12,18 +12,18 @@ tests/cases/compiler/getAndSetNotIdenticalType2.ts(9,9): error TS2322: Type 'A { data: A; get x(): A { + ~~~~~~~~~~~~~~~ ~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. - ~~~~~~~~~~~~~~~ return this.data; ~~~~~~~~~~~~~~~~~~~~~~~~~ } ~~~~~ !!! error TS2380: 'get' and 'set' accessor must have the same type. set x(v: A) { + ~~~~~~~~~~~~~~~~~~~~~ ~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. - ~~~~~~~~~~~~~~~~~~~~~ this.data = v; ~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~ diff --git a/tests/baselines/reference/getAndSetNotIdenticalType3.errors.txt b/tests/baselines/reference/getAndSetNotIdenticalType3.errors.txt index bca86419f62..0aac384f7c3 100644 --- a/tests/baselines/reference/getAndSetNotIdenticalType3.errors.txt +++ b/tests/baselines/reference/getAndSetNotIdenticalType3.errors.txt @@ -1,7 +1,7 @@ -tests/cases/compiler/getAndSetNotIdenticalType3.ts(5,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/getAndSetNotIdenticalType3.ts(8,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/getAndSetNotIdenticalType3.ts(5,5): error TS2380: 'get' and 'set' accessor must have the same type. +tests/cases/compiler/getAndSetNotIdenticalType3.ts(5,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/getAndSetNotIdenticalType3.ts(8,5): error TS2380: 'get' and 'set' accessor must have the same type. +tests/cases/compiler/getAndSetNotIdenticalType3.ts(8,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/getAndSetNotIdenticalType3.ts(9,9): error TS2322: Type 'A' is not assignable to type 'A'. Type 'string' is not assignable to type 'number'. @@ -12,18 +12,18 @@ tests/cases/compiler/getAndSetNotIdenticalType3.ts(9,9): error TS2322: Type 'A { data: A; get x(): A { + ~~~~~~~~~~~~~~~~~~~~ ~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. - ~~~~~~~~~~~~~~~~~~~~ return this.data; ~~~~~~~~~~~~~~~~~~~~~~~~~ } ~~~~~ !!! error TS2380: 'get' and 'set' accessor must have the same type. set x(v: A) { + ~~~~~~~~~~~~~~~~~~~~~ ~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. - ~~~~~~~~~~~~~~~~~~~~~ this.data = v; ~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~ diff --git a/tests/baselines/reference/gettersAndSetters.errors.txt b/tests/baselines/reference/gettersAndSetters.errors.txt index 2c287f30497..a4cc4b585e2 100644 --- a/tests/baselines/reference/gettersAndSetters.errors.txt +++ b/tests/baselines/reference/gettersAndSetters.errors.txt @@ -2,10 +2,10 @@ tests/cases/compiler/gettersAndSetters.ts(7,16): error TS1056: Accessors are onl tests/cases/compiler/gettersAndSetters.ts(8,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/gettersAndSetters.ts(10,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/gettersAndSetters.ts(11,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/gettersAndSetters.ts(29,30): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/gettersAndSetters.ts(29,53): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/gettersAndSetters.ts(25,13): error TS2339: Property 'Baz' does not exist on type 'C'. tests/cases/compiler/gettersAndSetters.ts(26,3): error TS2339: Property 'Baz' does not exist on type 'C'. +tests/cases/compiler/gettersAndSetters.ts(29,30): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/gettersAndSetters.ts(29,53): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ==== tests/cases/compiler/gettersAndSetters.ts (8 errors) ==== diff --git a/tests/baselines/reference/gettersAndSettersAccessibility.errors.txt b/tests/baselines/reference/gettersAndSettersAccessibility.errors.txt index ddb8e95e5eb..faccaab8fdf 100644 --- a/tests/baselines/reference/gettersAndSettersAccessibility.errors.txt +++ b/tests/baselines/reference/gettersAndSettersAccessibility.errors.txt @@ -1,6 +1,6 @@ tests/cases/compiler/gettersAndSettersAccessibility.ts(2,14): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/gettersAndSettersAccessibility.ts(3,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/gettersAndSettersAccessibility.ts(2,14): error TS2379: Getter and setter accessors do not agree in visibility. +tests/cases/compiler/gettersAndSettersAccessibility.ts(3,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/gettersAndSettersAccessibility.ts(3,13): error TS2379: Getter and setter accessors do not agree in visibility. diff --git a/tests/baselines/reference/gettersAndSettersErrors.errors.txt b/tests/baselines/reference/gettersAndSettersErrors.errors.txt index 95fb571d9b8..db2d4c5bc87 100644 --- a/tests/baselines/reference/gettersAndSettersErrors.errors.txt +++ b/tests/baselines/reference/gettersAndSettersErrors.errors.txt @@ -1,13 +1,13 @@ tests/cases/compiler/gettersAndSettersErrors.ts(2,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/gettersAndSettersErrors.ts(2,16): error TS2300: Duplicate identifier 'Foo'. tests/cases/compiler/gettersAndSettersErrors.ts(3,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/gettersAndSettersErrors.ts(3,16): error TS2300: Duplicate identifier 'Foo'. +tests/cases/compiler/gettersAndSettersErrors.ts(5,12): error TS2300: Duplicate identifier 'Foo'. tests/cases/compiler/gettersAndSettersErrors.ts(6,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/gettersAndSettersErrors.ts(7,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/gettersAndSettersErrors.ts(11,17): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/gettersAndSettersErrors.ts(12,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/gettersAndSettersErrors.ts(2,16): error TS2300: Duplicate identifier 'Foo'. -tests/cases/compiler/gettersAndSettersErrors.ts(3,16): error TS2300: Duplicate identifier 'Foo'. -tests/cases/compiler/gettersAndSettersErrors.ts(5,12): error TS2300: Duplicate identifier 'Foo'. tests/cases/compiler/gettersAndSettersErrors.ts(11,17): error TS2379: Getter and setter accessors do not agree in visibility. +tests/cases/compiler/gettersAndSettersErrors.ts(12,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/gettersAndSettersErrors.ts(12,16): error TS2379: Getter and setter accessors do not agree in visibility. diff --git a/tests/baselines/reference/illegalSuperCallsInConstructor.errors.txt b/tests/baselines/reference/illegalSuperCallsInConstructor.errors.txt index 6b86209b5b1..a07fbea75d8 100644 --- a/tests/baselines/reference/illegalSuperCallsInConstructor.errors.txt +++ b/tests/baselines/reference/illegalSuperCallsInConstructor.errors.txt @@ -1,10 +1,10 @@ -tests/cases/compiler/illegalSuperCallsInConstructor.ts(11,17): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/illegalSuperCallsInConstructor.ts(15,17): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/illegalSuperCallsInConstructor.ts(6,5): error TS2377: Constructors for derived classes must contain a 'super' call. tests/cases/compiler/illegalSuperCallsInConstructor.ts(7,24): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors tests/cases/compiler/illegalSuperCallsInConstructor.ts(8,26): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors tests/cases/compiler/illegalSuperCallsInConstructor.ts(9,32): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors +tests/cases/compiler/illegalSuperCallsInConstructor.ts(11,17): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/illegalSuperCallsInConstructor.ts(12,17): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors +tests/cases/compiler/illegalSuperCallsInConstructor.ts(15,17): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/illegalSuperCallsInConstructor.ts(16,17): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors @@ -31,9 +31,9 @@ tests/cases/compiler/illegalSuperCallsInConstructor.ts(16,17): error TS2337: Sup var r5 = { ~~~~~~~~~~~~~~~~~~ get foo() { + ~~~~~~~~~~~~~~~~~~~~~~~ ~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. - ~~~~~~~~~~~~~~~~~~~~~~~ super(); ~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~ @@ -43,9 +43,9 @@ tests/cases/compiler/illegalSuperCallsInConstructor.ts(16,17): error TS2337: Sup }, ~~~~~~~~~~~~~~ set foo(v: number) { + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ super(); ~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~ diff --git a/tests/baselines/reference/implicitAnyCastedValue.errors.txt b/tests/baselines/reference/implicitAnyCastedValue.errors.txt index 4b88cb0a8b4..613aa4820d2 100644 --- a/tests/baselines/reference/implicitAnyCastedValue.errors.txt +++ b/tests/baselines/reference/implicitAnyCastedValue.errors.txt @@ -1,9 +1,9 @@ -tests/cases/compiler/implicitAnyCastedValue.ts(12,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/implicitAnyCastedValue.ts(28,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/implicitAnyCastedValue.ts(32,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/implicitAnyCastedValue.ts(10,5): error TS7008: Member 'bar' implicitly has an 'any' type. tests/cases/compiler/implicitAnyCastedValue.ts(11,5): error TS7008: Member 'foo' implicitly has an 'any' type. +tests/cases/compiler/implicitAnyCastedValue.ts(12,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/implicitAnyCastedValue.ts(26,5): error TS7008: Member 'getValue' implicitly has an 'any' type. +tests/cases/compiler/implicitAnyCastedValue.ts(28,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/implicitAnyCastedValue.ts(32,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/implicitAnyCastedValue.ts(41,1): error TS7010: 'notCastedNull', which lacks return-type annotation, implicitly has an 'any' return type. tests/cases/compiler/implicitAnyCastedValue.ts(53,24): error TS7006: Parameter 'x' implicitly has an 'any' type. tests/cases/compiler/implicitAnyCastedValue.ts(62,24): error TS7006: Parameter 'x' implicitly has an 'any' type. diff --git a/tests/baselines/reference/implicitAnyGetAndSetAccessorWithAnyReturnType.errors.txt b/tests/baselines/reference/implicitAnyGetAndSetAccessorWithAnyReturnType.errors.txt index 9f2dc9ce949..4d9008cd56a 100644 --- a/tests/baselines/reference/implicitAnyGetAndSetAccessorWithAnyReturnType.errors.txt +++ b/tests/baselines/reference/implicitAnyGetAndSetAccessorWithAnyReturnType.errors.txt @@ -1,11 +1,11 @@ +tests/cases/compiler/implicitAnyGetAndSetAccessorWithAnyReturnType.ts(3,5): error TS7008: Member 'getAndSet' implicitly has an 'any' type. tests/cases/compiler/implicitAnyGetAndSetAccessorWithAnyReturnType.ts(4,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/implicitAnyGetAndSetAccessorWithAnyReturnType.ts(9,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/implicitAnyGetAndSetAccessorWithAnyReturnType.ts(15,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/implicitAnyGetAndSetAccessorWithAnyReturnType.ts(20,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/implicitAnyGetAndSetAccessorWithAnyReturnType.ts(3,5): error TS7008: Member 'getAndSet' implicitly has an 'any' type. tests/cases/compiler/implicitAnyGetAndSetAccessorWithAnyReturnType.ts(15,5): error TS7016: Property 'haveOnlySet' implicitly has type 'any', because its 'set' accessor lacks a type annotation. +tests/cases/compiler/implicitAnyGetAndSetAccessorWithAnyReturnType.ts(15,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/implicitAnyGetAndSetAccessorWithAnyReturnType.ts(15,28): error TS7006: Parameter 'newXValue' implicitly has an 'any' type. tests/cases/compiler/implicitAnyGetAndSetAccessorWithAnyReturnType.ts(20,5): error TS7010: 'haveOnlyGet', which lacks return-type annotation, implicitly has an 'any' return type. +tests/cases/compiler/implicitAnyGetAndSetAccessorWithAnyReturnType.ts(20,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ==== tests/cases/compiler/implicitAnyGetAndSetAccessorWithAnyReturnType.ts (8 errors) ==== @@ -30,9 +30,9 @@ tests/cases/compiler/implicitAnyGetAndSetAccessorWithAnyReturnType.ts(20,5): err class SetterOnly { public set haveOnlySet(newXValue) { // error at "haveOnlySet, newXValue" + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~ !!! error TS7006: Parameter 'newXValue' implicitly has an 'any' type. } @@ -42,9 +42,9 @@ tests/cases/compiler/implicitAnyGetAndSetAccessorWithAnyReturnType.ts(20,5): err class GetterOnly { public get haveOnlyGet() { // error at "haveOnlyGet" + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ return null; ~~~~~~~~~~~~~~~~~~~~ } diff --git a/tests/baselines/reference/inferSetterParamType.errors.txt b/tests/baselines/reference/inferSetterParamType.errors.txt index c9232d3fac7..2ae2a16f9d2 100644 --- a/tests/baselines/reference/inferSetterParamType.errors.txt +++ b/tests/baselines/reference/inferSetterParamType.errors.txt @@ -1,8 +1,8 @@ tests/cases/compiler/inferSetterParamType.ts(3,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/inferSetterParamType.ts(6,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/inferSetterParamType.ts(12,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/inferSetterParamType.ts(15,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/inferSetterParamType.ts(13,16): error TS2322: Type 'number' is not assignable to type 'string'. +tests/cases/compiler/inferSetterParamType.ts(15,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ==== tests/cases/compiler/inferSetterParamType.ts (5 errors) ==== diff --git a/tests/baselines/reference/inheritanceMemberAccessorOverridingMethod.errors.txt b/tests/baselines/reference/inheritanceMemberAccessorOverridingMethod.errors.txt index 54f5fcc2a34..6fde83e08b0 100644 --- a/tests/baselines/reference/inheritanceMemberAccessorOverridingMethod.errors.txt +++ b/tests/baselines/reference/inheritanceMemberAccessorOverridingMethod.errors.txt @@ -1,9 +1,9 @@ -tests/cases/compiler/inheritanceMemberAccessorOverridingMethod.ts(8,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/inheritanceMemberAccessorOverridingMethod.ts(11,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/inheritanceMemberAccessorOverridingMethod.ts(7,7): error TS2415: Class 'b' incorrectly extends base class 'a'. Types of property 'x' are incompatible. Type 'string' is not assignable to type '() => string'. +tests/cases/compiler/inheritanceMemberAccessorOverridingMethod.ts(8,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/inheritanceMemberAccessorOverridingMethod.ts(8,9): error TS2423: Class 'a' defines instance member function 'x', but extended class 'b' defines it as instance member accessor. +tests/cases/compiler/inheritanceMemberAccessorOverridingMethod.ts(11,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ==== tests/cases/compiler/inheritanceMemberAccessorOverridingMethod.ts (4 errors) ==== diff --git a/tests/baselines/reference/inheritanceStaticAccessorOverridingMethod.errors.txt b/tests/baselines/reference/inheritanceStaticAccessorOverridingMethod.errors.txt index 026c2b51ac9..38b1ed61fac 100644 --- a/tests/baselines/reference/inheritanceStaticAccessorOverridingMethod.errors.txt +++ b/tests/baselines/reference/inheritanceStaticAccessorOverridingMethod.errors.txt @@ -1,8 +1,8 @@ -tests/cases/compiler/inheritanceStaticAccessorOverridingMethod.ts(8,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/inheritanceStaticAccessorOverridingMethod.ts(11,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/inheritanceStaticAccessorOverridingMethod.ts(7,7): error TS2417: Class static side 'typeof b' incorrectly extends base class static side 'typeof a'. Types of property 'x' are incompatible. Type 'string' is not assignable to type '() => string'. +tests/cases/compiler/inheritanceStaticAccessorOverridingMethod.ts(8,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/inheritanceStaticAccessorOverridingMethod.ts(11,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ==== tests/cases/compiler/inheritanceStaticAccessorOverridingMethod.ts (3 errors) ==== diff --git a/tests/baselines/reference/instancePropertiesInheritedIntoClassType.errors.txt b/tests/baselines/reference/instancePropertiesInheritedIntoClassType.errors.txt index fbd64e5018e..340b5081866 100644 --- a/tests/baselines/reference/instancePropertiesInheritedIntoClassType.errors.txt +++ b/tests/baselines/reference/instancePropertiesInheritedIntoClassType.errors.txt @@ -1,8 +1,8 @@ tests/cases/conformance/classes/members/classTypes/instancePropertiesInheritedIntoClassType.ts(4,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/classes/members/classTypes/instancePropertiesInheritedIntoClassType.ts(7,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/classes/members/classTypes/instancePropertiesInheritedIntoClassType.ts(19,14): error TS2349: Cannot invoke an expression whose type lacks a call signature. tests/cases/conformance/classes/members/classTypes/instancePropertiesInheritedIntoClassType.ts(26,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/classes/members/classTypes/instancePropertiesInheritedIntoClassType.ts(29,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/classes/members/classTypes/instancePropertiesInheritedIntoClassType.ts(19,14): error TS2349: Cannot invoke an expression whose type lacks a call signature. tests/cases/conformance/classes/members/classTypes/instancePropertiesInheritedIntoClassType.ts(41,14): error TS2349: Cannot invoke an expression whose type lacks a call signature. diff --git a/tests/baselines/reference/instancePropertyInClassType.errors.txt b/tests/baselines/reference/instancePropertyInClassType.errors.txt index 9a7dce0f0cd..d14607d81bc 100644 --- a/tests/baselines/reference/instancePropertyInClassType.errors.txt +++ b/tests/baselines/reference/instancePropertyInClassType.errors.txt @@ -1,8 +1,8 @@ tests/cases/conformance/classes/members/classTypes/instancePropertyInClassType.ts(4,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/classes/members/classTypes/instancePropertyInClassType.ts(7,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/classes/members/classTypes/instancePropertyInClassType.ts(17,14): error TS2349: Cannot invoke an expression whose type lacks a call signature. tests/cases/conformance/classes/members/classTypes/instancePropertyInClassType.ts(24,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/classes/members/classTypes/instancePropertyInClassType.ts(27,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/classes/members/classTypes/instancePropertyInClassType.ts(17,14): error TS2349: Cannot invoke an expression whose type lacks a call signature. tests/cases/conformance/classes/members/classTypes/instancePropertyInClassType.ts(37,14): error TS2349: Cannot invoke an expression whose type lacks a call signature. diff --git a/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations.errors.txt b/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations.errors.txt index bd9a0bcbc93..35673eb3072 100644 --- a/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations.errors.txt +++ b/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations.errors.txt @@ -1,10 +1,8 @@ +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(18,5): error TS2412: Property '2.0' of type 'number' is not assignable to numeric index type 'string'. +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(21,5): error TS2412: Property '3.0' of type 'MyNumber' is not assignable to numeric index type 'string'. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(23,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(26,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(36,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(90,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(93,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(18,5): error TS2412: Property '2.0' of type 'number' is not assignable to numeric index type 'string'. -tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(21,5): error TS2412: Property '3.0' of type 'MyNumber' is not assignable to numeric index type 'string'. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(50,5): error TS2412: Property '2.0' of type 'number' is not assignable to numeric index type 'string'. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(68,5): error TS2412: Property '2.0' of type 'number' is not assignable to numeric index type 'string'. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(78,5): error TS2322: Type '{ [x: number]: string | number; 1.0: string; 2.0: number; a: string; b: number; c: () => void; "d": string; "e": number; "3.0": string; "4.0": number; f: any; X: string; foo(): string; }' is not assignable to type '{ [x: number]: string; }'. @@ -12,6 +10,8 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerCo Type 'string | number' is not assignable to type 'string'. Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(88,9): error TS2304: Cannot find name 'Myn'. +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(90,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(93,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ==== tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts (11 errors) ==== diff --git a/tests/baselines/reference/objectLiteralGettersAndSetters.errors.txt b/tests/baselines/reference/objectLiteralGettersAndSetters.errors.txt index 4e04b856d8c..abc93a9cacc 100644 --- a/tests/baselines/reference/objectLiteralGettersAndSetters.errors.txt +++ b/tests/baselines/reference/objectLiteralGettersAndSetters.errors.txt @@ -22,12 +22,12 @@ tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetter tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(37,59): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(38,23): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(38,60): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(42,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(43,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(42,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(50,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(55,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(60,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(64,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(60,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(67,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(68,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/expressions/objectLiterals/objectLiteralGettersAndSetters.ts(76,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. diff --git a/tests/baselines/reference/parserAstSpans1.errors.txt b/tests/baselines/reference/parserAstSpans1.errors.txt index e4360dafa53..9697dcbc128 100644 --- a/tests/baselines/reference/parserAstSpans1.errors.txt +++ b/tests/baselines/reference/parserAstSpans1.errors.txt @@ -2,9 +2,9 @@ tests/cases/conformance/parser/ecmascript5/parserAstSpans1.ts(79,16): error TS10 tests/cases/conformance/parser/ecmascript5/parserAstSpans1.ts(85,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/parser/ecmascript5/parserAstSpans1.ts(94,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/parser/ecmascript5/parserAstSpans1.ts(100,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/parser/ecmascript5/parserAstSpans1.ts(111,25): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword tests/cases/conformance/parser/ecmascript5/parserAstSpans1.ts(119,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/parser/ecmascript5/parserAstSpans1.ts(125,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/parser/ecmascript5/parserAstSpans1.ts(111,25): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword tests/cases/conformance/parser/ecmascript5/parserAstSpans1.ts(217,24): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword diff --git a/tests/baselines/reference/parserMemberAccessorDeclaration15.js b/tests/baselines/reference/parserMemberAccessorDeclaration15.js new file mode 100644 index 00000000000..59ff360d432 --- /dev/null +++ b/tests/baselines/reference/parserMemberAccessorDeclaration15.js @@ -0,0 +1,17 @@ +//// [parserMemberAccessorDeclaration15.ts] +class C { + set Foo(public a: number) { } +} + +//// [parserMemberAccessorDeclaration15.js] +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, "Foo", { + set: function (a) { + }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/propertyAndAccessorWithSameName.errors.txt b/tests/baselines/reference/propertyAndAccessorWithSameName.errors.txt index 9ef943cc07a..620f4dc5940 100644 --- a/tests/baselines/reference/propertyAndAccessorWithSameName.errors.txt +++ b/tests/baselines/reference/propertyAndAccessorWithSameName.errors.txt @@ -1,13 +1,13 @@ -tests/cases/conformance/classes/propertyMemberDeclarations/propertyAndAccessorWithSameName.ts(3,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/classes/propertyMemberDeclarations/propertyAndAccessorWithSameName.ts(10,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/classes/propertyMemberDeclarations/propertyAndAccessorWithSameName.ts(15,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/classes/propertyMemberDeclarations/propertyAndAccessorWithSameName.ts(18,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/classes/propertyMemberDeclarations/propertyAndAccessorWithSameName.ts(2,5): error TS2300: Duplicate identifier 'x'. +tests/cases/conformance/classes/propertyMemberDeclarations/propertyAndAccessorWithSameName.ts(3,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/classes/propertyMemberDeclarations/propertyAndAccessorWithSameName.ts(3,9): error TS2300: Duplicate identifier 'x'. tests/cases/conformance/classes/propertyMemberDeclarations/propertyAndAccessorWithSameName.ts(9,5): error TS2300: Duplicate identifier 'x'. +tests/cases/conformance/classes/propertyMemberDeclarations/propertyAndAccessorWithSameName.ts(10,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/classes/propertyMemberDeclarations/propertyAndAccessorWithSameName.ts(10,9): error TS2300: Duplicate identifier 'x'. tests/cases/conformance/classes/propertyMemberDeclarations/propertyAndAccessorWithSameName.ts(14,13): error TS2300: Duplicate identifier 'x'. +tests/cases/conformance/classes/propertyMemberDeclarations/propertyAndAccessorWithSameName.ts(15,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/classes/propertyMemberDeclarations/propertyAndAccessorWithSameName.ts(15,9): error TS2300: Duplicate identifier 'x'. +tests/cases/conformance/classes/propertyMemberDeclarations/propertyAndAccessorWithSameName.ts(18,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/classes/propertyMemberDeclarations/propertyAndAccessorWithSameName.ts(18,9): error TS2300: Duplicate identifier 'x'. diff --git a/tests/baselines/reference/staticPropertyNotInClassType.errors.txt b/tests/baselines/reference/staticPropertyNotInClassType.errors.txt index fb2a76f8d3c..62f04b5c5fb 100644 --- a/tests/baselines/reference/staticPropertyNotInClassType.errors.txt +++ b/tests/baselines/reference/staticPropertyNotInClassType.errors.txt @@ -1,10 +1,10 @@ tests/cases/conformance/classes/members/classTypes/staticPropertyNotInClassType.ts(4,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/classes/members/classTypes/staticPropertyNotInClassType.ts(5,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/classes/members/classTypes/staticPropertyNotInClassType.ts(24,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/classes/members/classTypes/staticPropertyNotInClassType.ts(25,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/classes/members/classTypes/staticPropertyNotInClassType.ts(16,16): error TS2339: Property 'foo' does not exist on type 'C'. tests/cases/conformance/classes/members/classTypes/staticPropertyNotInClassType.ts(17,16): error TS2339: Property 'bar' does not exist on type 'C'. tests/cases/conformance/classes/members/classTypes/staticPropertyNotInClassType.ts(18,16): error TS2339: Property 'x' does not exist on type 'C'. +tests/cases/conformance/classes/members/classTypes/staticPropertyNotInClassType.ts(24,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/classes/members/classTypes/staticPropertyNotInClassType.ts(25,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/classes/members/classTypes/staticPropertyNotInClassType.ts(27,21): error TS2302: Static members cannot reference class type parameters. tests/cases/conformance/classes/members/classTypes/staticPropertyNotInClassType.ts(36,16): error TS2339: Property 'foo' does not exist on type 'C'. tests/cases/conformance/classes/members/classTypes/staticPropertyNotInClassType.ts(37,16): error TS2339: Property 'bar' does not exist on type 'C'. diff --git a/tests/baselines/reference/staticVisibility.errors.txt b/tests/baselines/reference/staticVisibility.errors.txt index 5d212f4fb9e..dccad4a2e2b 100644 --- a/tests/baselines/reference/staticVisibility.errors.txt +++ b/tests/baselines/reference/staticVisibility.errors.txt @@ -1,9 +1,9 @@ -tests/cases/compiler/staticVisibility.ts(31,12): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/staticVisibility.ts(33,12): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/staticVisibility.ts(10,9): error TS2304: Cannot find name 's'. tests/cases/compiler/staticVisibility.ts(13,9): error TS2304: Cannot find name 'b'. tests/cases/compiler/staticVisibility.ts(18,9): error TS2304: Cannot find name 'v'. tests/cases/compiler/staticVisibility.ts(19,14): error TS2339: Property 'p' does not exist on type 'typeof C1'. +tests/cases/compiler/staticVisibility.ts(31,12): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/staticVisibility.ts(33,12): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/staticVisibility.ts(33,29): error TS2304: Cannot find name 'barback'. diff --git a/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations.errors.txt b/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations.errors.txt index bdb122f6108..e3dfd6133c9 100644 --- a/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations.errors.txt +++ b/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations.errors.txt @@ -1,15 +1,13 @@ -tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(23,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(26,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(36,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(90,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(93,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(13,5): error TS2411: Property 'b' of type 'number' is not assignable to string index type 'string'. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(14,5): error TS2411: Property 'c' of type '() => {}' is not assignable to string index type 'string'. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(16,5): error TS2411: Property '"e"' of type 'number' is not assignable to string index type 'string'. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(18,5): error TS2411: Property '2.0' of type 'number' is not assignable to string index type 'string'. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(20,5): error TS2411: Property '"4.0"' of type 'number' is not assignable to string index type 'string'. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(21,5): error TS2411: Property 'f' of type 'MyString' is not assignable to string index type 'string'. +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(23,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(26,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(28,5): error TS2411: Property 'foo' of type '() => string' is not assignable to string index type 'string'. +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(36,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(45,5): error TS2411: Property 'b' of type 'number' is not assignable to string index type 'string'. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(46,5): error TS2411: Property 'c' of type '() => {}' is not assignable to string index type 'string'. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(48,5): error TS2411: Property '"e"' of type 'number' is not assignable to string index type 'string'. @@ -28,6 +26,8 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerCon Index signatures are incompatible. Type 'string | number | MyString | (() => void)' is not assignable to type 'string'. Type 'number' is not assignable to type 'string'. +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(90,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(93,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ==== tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts (27 errors) ==== diff --git a/tests/baselines/reference/superPropertyAccess1.errors.txt b/tests/baselines/reference/superPropertyAccess1.errors.txt index f5b565cae6e..b256860ec72 100644 --- a/tests/baselines/reference/superPropertyAccess1.errors.txt +++ b/tests/baselines/reference/superPropertyAccess1.errors.txt @@ -1,7 +1,7 @@ tests/cases/compiler/superPropertyAccess1.ts(3,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/superPropertyAccess1.ts(22,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/superPropertyAccess1.ts(13,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword tests/cases/compiler/superPropertyAccess1.ts(19,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword +tests/cases/compiler/superPropertyAccess1.ts(22,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/superPropertyAccess1.ts(24,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword diff --git a/tests/baselines/reference/superPropertyAccess2.errors.txt b/tests/baselines/reference/superPropertyAccess2.errors.txt index df9a5ee666b..475705f1506 100644 --- a/tests/baselines/reference/superPropertyAccess2.errors.txt +++ b/tests/baselines/reference/superPropertyAccess2.errors.txt @@ -1,8 +1,8 @@ tests/cases/compiler/superPropertyAccess2.ts(3,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/superPropertyAccess2.ts(22,23): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/superPropertyAccess2.ts(13,15): error TS2339: Property 'x' does not exist on type 'typeof C'. tests/cases/compiler/superPropertyAccess2.ts(18,15): error TS2339: Property 'bar' does not exist on type 'C'. tests/cases/compiler/superPropertyAccess2.ts(19,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword +tests/cases/compiler/superPropertyAccess2.ts(22,23): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/superPropertyAccess2.ts(24,15): error TS2339: Property 'x' does not exist on type 'typeof C'. diff --git a/tests/baselines/reference/super_inside-object-literal-getters-and-setters.errors.txt b/tests/baselines/reference/super_inside-object-literal-getters-and-setters.errors.txt index 9ec5b13ac65..44332e6e567 100644 --- a/tests/baselines/reference/super_inside-object-literal-getters-and-setters.errors.txt +++ b/tests/baselines/reference/super_inside-object-literal-getters-and-setters.errors.txt @@ -1,9 +1,9 @@ tests/cases/compiler/super_inside-object-literal-getters-and-setters.ts(4,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/super_inside-object-literal-getters-and-setters.ts(7,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/super_inside-object-literal-getters-and-setters.ts(20,17): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/super_inside-object-literal-getters-and-setters.ts(5,20): error TS2335: 'super' can only be referenced in a derived class. +tests/cases/compiler/super_inside-object-literal-getters-and-setters.ts(7,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/super_inside-object-literal-getters-and-setters.ts(8,13): error TS2335: 'super' can only be referenced in a derived class. tests/cases/compiler/super_inside-object-literal-getters-and-setters.ts(11,20): error TS2335: 'super' can only be referenced in a derived class. +tests/cases/compiler/super_inside-object-literal-getters-and-setters.ts(20,17): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/super_inside-object-literal-getters-and-setters.ts(21,24): error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class diff --git a/tests/baselines/reference/twoAccessorsWithSameName2.errors.txt b/tests/baselines/reference/twoAccessorsWithSameName2.errors.txt index 836a06a8192..59c15d73d5e 100644 --- a/tests/baselines/reference/twoAccessorsWithSameName2.errors.txt +++ b/tests/baselines/reference/twoAccessorsWithSameName2.errors.txt @@ -1,13 +1,13 @@ tests/cases/conformance/classes/propertyMemberDeclarations/twoAccessorsWithSameName2.ts(2,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/classes/propertyMemberDeclarations/twoAccessorsWithSameName2.ts(2,16): error TS2300: Duplicate identifier 'x'. tests/cases/conformance/classes/propertyMemberDeclarations/twoAccessorsWithSameName2.ts(3,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/classes/propertyMemberDeclarations/twoAccessorsWithSameName2.ts(3,16): error TS2300: Duplicate identifier 'x'. tests/cases/conformance/classes/propertyMemberDeclarations/twoAccessorsWithSameName2.ts(7,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/classes/propertyMemberDeclarations/twoAccessorsWithSameName2.ts(7,16): error TS2300: Duplicate identifier 'x'. tests/cases/conformance/classes/propertyMemberDeclarations/twoAccessorsWithSameName2.ts(8,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/classes/propertyMemberDeclarations/twoAccessorsWithSameName2.ts(8,16): error TS2300: Duplicate identifier 'x'. tests/cases/conformance/classes/propertyMemberDeclarations/twoAccessorsWithSameName2.ts(12,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/classes/propertyMemberDeclarations/twoAccessorsWithSameName2.ts(15,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/classes/propertyMemberDeclarations/twoAccessorsWithSameName2.ts(2,16): error TS2300: Duplicate identifier 'x'. -tests/cases/conformance/classes/propertyMemberDeclarations/twoAccessorsWithSameName2.ts(3,16): error TS2300: Duplicate identifier 'x'. -tests/cases/conformance/classes/propertyMemberDeclarations/twoAccessorsWithSameName2.ts(7,16): error TS2300: Duplicate identifier 'x'. -tests/cases/conformance/classes/propertyMemberDeclarations/twoAccessorsWithSameName2.ts(8,16): error TS2300: Duplicate identifier 'x'. ==== tests/cases/conformance/classes/propertyMemberDeclarations/twoAccessorsWithSameName2.ts (10 errors) ==== diff --git a/tests/baselines/reference/typeOfThisInInstanceMember.errors.txt b/tests/baselines/reference/typeOfThisInInstanceMember.errors.txt index bcfbaaad253..2685d2b34b8 100644 --- a/tests/baselines/reference/typeOfThisInInstanceMember.errors.txt +++ b/tests/baselines/reference/typeOfThisInInstanceMember.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/classes/members/instanceAndStaticMembers/typeOfThisInInstanceMember.ts(14,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/classes/members/instanceAndStaticMembers/typeOfThisInInstanceMember.ts(10,11): error TS2339: Property 'z' does not exist on type 'C'. +tests/cases/conformance/classes/members/instanceAndStaticMembers/typeOfThisInInstanceMember.ts(14,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ==== tests/cases/conformance/classes/members/instanceAndStaticMembers/typeOfThisInInstanceMember.ts (2 errors) ==== diff --git a/tests/baselines/reference/typeParametersInStaticAccessors.errors.txt b/tests/baselines/reference/typeParametersInStaticAccessors.errors.txt index b11542b0af2..644cd703cdf 100644 --- a/tests/baselines/reference/typeParametersInStaticAccessors.errors.txt +++ b/tests/baselines/reference/typeParametersInStaticAccessors.errors.txt @@ -1,6 +1,6 @@ tests/cases/compiler/typeParametersInStaticAccessors.ts(2,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/typeParametersInStaticAccessors.ts(3,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/typeParametersInStaticAccessors.ts(2,29): error TS2302: Static members cannot reference class type parameters. +tests/cases/compiler/typeParametersInStaticAccessors.ts(3,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/typeParametersInStaticAccessors.ts(3,28): error TS2302: Static members cannot reference class type parameters. From adb03934588624c844be32c0e5cac856fab29d6d Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Mon, 15 Dec 2014 21:09:57 -0800 Subject: [PATCH 66/78] Add internal definitions to a diffrent .d.ts files --- Jakefile | 38 ++++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/Jakefile b/Jakefile index 0425b0a0bf9..af0ddd0fed2 100644 --- a/Jakefile +++ b/Jakefile @@ -95,6 +95,13 @@ var definitionsRoots = [ "services/services.d.ts", ]; +var internalDefinitionsRoots = [ + "compiler/core.d.ts", + "compiler/sys.d.ts", + "compiler/utilities.d.ts", + "services/utilities.d.ts", +]; + var harnessSources = [ "harness.ts", "sourceMapRecorder.ts", @@ -315,6 +322,8 @@ compileFile(servicesFile, servicesSources,[builtLocalDirectory, copyright].conca var nodeDefinitionsFile = path.join(builtLocalDirectory, "typescript.d.ts"); var standaloneDefinitionsFile = path.join(builtLocalDirectory, "typescriptServices.d.ts"); +var internalNodeDefinitionsFile = path.join(builtLocalDirectory, "typescript_internal.d.ts"); +var internalStandaloneDefinitionsFile = path.join(builtLocalDirectory, "typescriptServices_internal.d.ts"); var tempDirPath = path.join(builtLocalDirectory, "temptempdir"); compileFile(nodeDefinitionsFile, servicesSources,[builtLocalDirectory, copyright].concat(servicesSources), /*prefixes*/ undefined, @@ -325,16 +334,25 @@ compileFile(nodeDefinitionsFile, servicesSources,[builtLocalDirectory, copyright /*keepComments*/ true, /*noResolve*/ true, /*callback*/ function () { - concatenateFiles(standaloneDefinitionsFile, definitionsRoots.map(function (f) { - return path.join(tempDirPath, f); - })); - prependFile(copyright, standaloneDefinitionsFile); + function makeDefinitionFiles(definitionsRoots, standaloneDefinitionsFile, nodeDefinitionsFile) { + // Create the standalone definition file + concatenateFiles(standaloneDefinitionsFile, definitionsRoots.map(function (f) { + return path.join(tempDirPath, f); + })); + prependFile(copyright, standaloneDefinitionsFile); - // Create the node definition file by replacing 'ts' module with '"typescript"' as a module. - jake.cpR(standaloneDefinitionsFile, nodeDefinitionsFile, {silent: true}); - var definitionFileContents = fs.readFileSync(nodeDefinitionsFile).toString(); - definitionFileContents = definitionFileContents.replace(/declare module ts/g, 'declare module "typescript"'); - fs.writeFileSync(nodeDefinitionsFile, definitionFileContents); + // Create the node definition file by replacing 'ts' module with '"typescript"' as a module. + jake.cpR(standaloneDefinitionsFile, nodeDefinitionsFile, {silent: true}); + var definitionFileContents = fs.readFileSync(nodeDefinitionsFile).toString(); + definitionFileContents = definitionFileContents.replace(/declare module ts/g, 'declare module "typescript"'); + fs.writeFileSync(nodeDefinitionsFile, definitionFileContents); + } + + // Create the public definition files + makeDefinitionFiles(definitionsRoots, standaloneDefinitionsFile, nodeDefinitionsFile); + + // Create the internal definition files + makeDefinitionFiles(internalDefinitionsRoots, internalStandaloneDefinitionsFile, internalNodeDefinitionsFile); // Delete the temp dir jake.rmRf(tempDirPath, {silent: true}); @@ -393,7 +411,7 @@ task("generate-spec", [specMd]) // Makes a new LKG. This target does not build anything, but errors if not all the outputs are present in the built/local directory desc("Makes a new LKG out of the built js files"); task("LKG", ["clean", "release", "local"].concat(libraryTargets), function() { - var expectedFiles = [tscFile, servicesFile, nodeDefinitionsFile, standaloneDefinitionsFile].concat(libraryTargets); + var expectedFiles = [tscFile, servicesFile, nodeDefinitionsFile, standaloneDefinitionsFile, internalNodeDefinitionsFile, internalStandaloneDefinitionsFile].concat(libraryTargets); var missingFiles = expectedFiles.filter(function (f) { return !fs.existsSync(f); }); From 003515655e4bb5d9b558b05c05616a2694604925 Mon Sep 17 00:00:00 2001 From: Yui T Date: Tue, 16 Dec 2014 12:51:42 -0800 Subject: [PATCH 67/78] Move grammar checking: methodDeclaration; there are still erros from incomplete grammar migration --- src/compiler/checker.ts | 43 +++++++++++++++++++ .../diagnosticInformationMap.generated.ts | 2 +- src/compiler/diagnosticMessages.json | 3 +- src/compiler/parser.ts | 10 ++--- .../accessibilityModifiers.errors.txt | 8 ++-- ...OptionalParameterAndInitializer.errors.txt | 10 ++--- .../classWithOptionalParameter.errors.txt | 2 +- .../optionalArgsWithDefaultValues.errors.txt | 2 +- .../optionalParamArgsTest.errors.txt | 6 +-- .../parserParameterList10.errors.txt | 6 +-- .../reference/parserRealSource11.errors.txt | 2 +- ...eterWithoutAnnotationIsAnyArray.errors.txt | 2 +- .../restParametersOfNonArrayTypes.errors.txt | 2 +- .../restParametersOfNonArrayTypes2.errors.txt | 4 +- ...ametersWithArrayTypeAnnotations.errors.txt | 4 +- 15 files changed, 75 insertions(+), 31 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 6cb38e98eaa..f2874ae5085 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -6972,6 +6972,9 @@ module ts { } function checkObjectLiteralMethod(node: MethodDeclaration, contextualMapper?: TypeMapper): Type { + // Grammar checking + checkGrammarMethod(node); + var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); return instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, contextualMapper); } @@ -7234,6 +7237,9 @@ module ts { function checkMethodDeclaration(node: MethodDeclaration) { // Grammar checking + // Grammar checking for modifiers is done inside the function checkGrammarFunctionLikeDeclaration + checkGrammarMethod(node); + if (node.name.kind === SyntaxKind.ComputedPropertyName) { checkGrammarComputedPropertyName(node.name); } @@ -10378,6 +10384,43 @@ module ts { } } + function checkGrammarForDisallowedComputedProperty(node: DeclarationName, message: DiagnosticMessage) { + if (node.kind === SyntaxKind.ComputedPropertyName) { + return grammarErrorOnNode(node, message); + } + } + + function checkGrammarMethod(node: MethodDeclaration) { + if (checkGrammarFunctionLikeDeclaration(node) || + checkGrammarForBodyInAmbientContext(node.body, /*isConstructor:*/ false) || + checkGrammarForGenerator(node)) { + return true; + } + + if (node.parent.kind === SyntaxKind.ClassDeclaration) { + if (checkGrammarForInvalidQuestionMark(node, node.questionToken, Diagnostics.A_class_member_cannot_be_declared_optional)) { + return true; + } + // Technically, computed properties in ambient contexts is disallowed + // for property declarations and accessors too, not just methods. + // However, property declarations disallow computed names in general, + // and accessors are not allowed in ambient contexts in general, + // so this error only really matters for methods. + if (isInAmbientContext(node)) { + return checkGrammarForDisallowedComputedProperty(node.name, Diagnostics.Computed_property_names_are_not_allowed_in_an_ambient_context); + } + else if (!node.body) { + return checkGrammarForDisallowedComputedProperty(node.name, Diagnostics.Computed_property_names_are_not_allowed_in_method_overloads); + } + } + else if (node.parent.kind === SyntaxKind.InterfaceDeclaration) { + return checkGrammarForDisallowedComputedProperty(node.name, Diagnostics.Computed_property_names_are_not_allowed_in_interfaces); + } + else if (node.parent.kind === SyntaxKind.TypeLiteral) { + return checkGrammarForDisallowedComputedProperty(node.name, Diagnostics.Computed_property_names_are_not_allowed_in_type_literals); + } + } + function isIterationStatement(node: Node, lookInLabeledStatements: boolean): boolean { switch (node.kind) { case SyntaxKind.ForStatement: diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index 085fb5c9654..2cc658621fb 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -39,7 +39,7 @@ module ts { A_declare_modifier_cannot_be_used_with_an_interface_declaration: { code: 1045, category: DiagnosticCategory.Error, key: "A 'declare' modifier cannot be used with an interface declaration." }, A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file: { code: 1046, category: DiagnosticCategory.Error, key: "A 'declare' modifier is required for a top level declaration in a .d.ts file." }, A_rest_parameter_cannot_be_optional: { code: 1047, category: DiagnosticCategory.Error, key: "A rest parameter cannot be optional.", isEarly: true }, - A_rest_parameter_cannot_have_an_initializer: { code: 1048, category: DiagnosticCategory.Error, key: "A rest parameter cannot have an initializer." }, + A_rest_parameter_cannot_have_an_initializer: { code: 1048, category: DiagnosticCategory.Error, key: "A rest parameter cannot have an initializer.", isEarly: true }, A_set_accessor_must_have_exactly_one_parameter: { code: 1049, category: DiagnosticCategory.Error, key: "A 'set' accessor must have exactly one parameter.", isEarly: true }, A_set_accessor_cannot_have_an_optional_parameter: { code: 1051, category: DiagnosticCategory.Error, key: "A 'set' accessor cannot have an optional parameter.", isEarly: true }, A_set_accessor_parameter_cannot_have_an_initializer: { code: 1052, category: DiagnosticCategory.Error, key: "A 'set' accessor parameter cannot have an initializer.", isEarly: true }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 5d8f79eac42..9bcd486513b 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -173,7 +173,8 @@ }, "A rest parameter cannot have an initializer.": { "category": "Error", - "code": 1048 + "code": 1048, + "isEarly": true }, "A 'set' accessor must have exactly one parameter.": { "category": "Error", diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 24f0dafaa27..f0c6fcc0e2a 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -4653,9 +4653,9 @@ module ts { //case SyntaxKind.InterfaceDeclaration: return checkInterfaceDeclaration(node); //case SyntaxKind.LabeledStatement: return checkLabeledStatement(node); //case SyntaxKind.PropertyAssignment: return checkPropertyAssignment(node); - case SyntaxKind.MethodDeclaration: - case SyntaxKind.MethodSignature: - return checkMethod(node); + //case SyntaxKind.MethodDeclaration: + //case SyntaxKind.MethodSignature: + //return checkMethod(node); case SyntaxKind.ModuleDeclaration: return checkModuleDeclaration(node); //case SyntaxKind.ObjectLiteralExpression: return checkObjectLiteralExpression(node); //case SyntaxKind.NumericLiteral: return checkNumericLiteral(node); @@ -5326,8 +5326,8 @@ module ts { //case SyntaxKind.Constructor: case SyntaxKind.PropertyDeclaration: case SyntaxKind.PropertySignature: - case SyntaxKind.MethodDeclaration: - case SyntaxKind.MethodSignature: + //case SyntaxKind.MethodDeclaration: + //case SyntaxKind.MethodSignature: //case SyntaxKind.ClassDeclaration: case SyntaxKind.InterfaceDeclaration: case SyntaxKind.ModuleDeclaration: diff --git a/tests/baselines/reference/accessibilityModifiers.errors.txt b/tests/baselines/reference/accessibilityModifiers.errors.txt index f571c8e3ee0..5650fca5931 100644 --- a/tests/baselines/reference/accessibilityModifiers.errors.txt +++ b/tests/baselines/reference/accessibilityModifiers.errors.txt @@ -1,17 +1,17 @@ tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(22,12): error TS1029: 'private' modifier must precede 'static' modifier. -tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(23,12): error TS1029: 'private' modifier must precede 'static' modifier. tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(27,12): error TS1029: 'protected' modifier must precede 'static' modifier. -tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(28,12): error TS1029: 'protected' modifier must precede 'static' modifier. tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(32,12): error TS1029: 'public' modifier must precede 'static' modifier. -tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(33,12): error TS1029: 'public' modifier must precede 'static' modifier. tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(40,13): error TS1028: Accessibility modifier already seen. -tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(41,12): error TS1028: Accessibility modifier already seen. +tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(23,12): error TS1029: 'private' modifier must precede 'static' modifier. tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(24,12): error TS1029: 'private' modifier must precede 'static' modifier. tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(25,12): error TS1029: 'private' modifier must precede 'static' modifier. +tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(28,12): error TS1029: 'protected' modifier must precede 'static' modifier. tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(29,12): error TS1029: 'protected' modifier must precede 'static' modifier. tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(30,12): error TS1029: 'protected' modifier must precede 'static' modifier. +tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(33,12): error TS1029: 'public' modifier must precede 'static' modifier. tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(34,12): error TS1029: 'public' modifier must precede 'static' modifier. tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(35,12): error TS1029: 'public' modifier must precede 'static' modifier. +tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(41,12): error TS1028: Accessibility modifier already seen. tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(42,13): error TS1028: Accessibility modifier already seen. tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(43,12): error TS1028: Accessibility modifier already seen. diff --git a/tests/baselines/reference/callSignatureWithOptionalParameterAndInitializer.errors.txt b/tests/baselines/reference/callSignatureWithOptionalParameterAndInitializer.errors.txt index eec5ea18afc..63a63309c31 100644 --- a/tests/baselines/reference/callSignatureWithOptionalParameterAndInitializer.errors.txt +++ b/tests/baselines/reference/callSignatureWithOptionalParameterAndInitializer.errors.txt @@ -1,17 +1,17 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(3,14): error TS1015: Parameter cannot have question mark and initializer. tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(4,22): error TS1015: Parameter cannot have question mark and initializer. -tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(15,9): error TS1015: Parameter cannot have question mark and initializer. -tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(24,20): error TS1015: Parameter cannot have question mark and initializer. -tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(35,9): error TS1015: Parameter cannot have question mark and initializer. -tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(44,9): error TS1015: Parameter cannot have question mark and initializer. -tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(45,32): error TS1015: Parameter cannot have question mark and initializer. tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(5,22): error TS1015: Parameter cannot have question mark and initializer. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(15,9): error TS1015: Parameter cannot have question mark and initializer. tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(23,6): error TS1015: Parameter cannot have question mark and initializer. tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(23,6): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(24,20): error TS1015: Parameter cannot have question mark and initializer. tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(24,20): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(34,6): error TS1015: Parameter cannot have question mark and initializer. tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(34,6): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(35,9): error TS1015: Parameter cannot have question mark and initializer. tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(35,9): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(44,9): error TS1015: Parameter cannot have question mark and initializer. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(45,32): error TS1015: Parameter cannot have question mark and initializer. tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(45,32): error TS2322: Type 'string' is not assignable to type 'number'. tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(46,9): error TS1015: Parameter cannot have question mark and initializer. diff --git a/tests/baselines/reference/classWithOptionalParameter.errors.txt b/tests/baselines/reference/classWithOptionalParameter.errors.txt index 6e512c2a02e..3d1ba523d14 100644 --- a/tests/baselines/reference/classWithOptionalParameter.errors.txt +++ b/tests/baselines/reference/classWithOptionalParameter.errors.txt @@ -1,6 +1,6 @@ tests/cases/conformance/types/namedTypes/classWithOptionalParameter.ts(4,6): error TS1112: A class member cannot be declared optional. -tests/cases/conformance/types/namedTypes/classWithOptionalParameter.ts(5,6): error TS1112: A class member cannot be declared optional. tests/cases/conformance/types/namedTypes/classWithOptionalParameter.ts(9,6): error TS1112: A class member cannot be declared optional. +tests/cases/conformance/types/namedTypes/classWithOptionalParameter.ts(5,6): error TS1112: A class member cannot be declared optional. tests/cases/conformance/types/namedTypes/classWithOptionalParameter.ts(10,6): error TS1112: A class member cannot be declared optional. diff --git a/tests/baselines/reference/optionalArgsWithDefaultValues.errors.txt b/tests/baselines/reference/optionalArgsWithDefaultValues.errors.txt index 784f8b64e2a..414e718ac71 100644 --- a/tests/baselines/reference/optionalArgsWithDefaultValues.errors.txt +++ b/tests/baselines/reference/optionalArgsWithDefaultValues.errors.txt @@ -1,6 +1,6 @@ +tests/cases/compiler/optionalArgsWithDefaultValues.ts(1,25): error TS1015: Parameter cannot have question mark and initializer. tests/cases/compiler/optionalArgsWithDefaultValues.ts(4,27): error TS1015: Parameter cannot have question mark and initializer. tests/cases/compiler/optionalArgsWithDefaultValues.ts(5,28): error TS1015: Parameter cannot have question mark and initializer. -tests/cases/compiler/optionalArgsWithDefaultValues.ts(1,25): error TS1015: Parameter cannot have question mark and initializer. tests/cases/compiler/optionalArgsWithDefaultValues.ts(8,10): error TS1015: Parameter cannot have question mark and initializer. tests/cases/compiler/optionalArgsWithDefaultValues.ts(9,13): error TS1015: Parameter cannot have question mark and initializer. diff --git a/tests/baselines/reference/optionalParamArgsTest.errors.txt b/tests/baselines/reference/optionalParamArgsTest.errors.txt index a8ce88e494e..3c4d2e37be9 100644 --- a/tests/baselines/reference/optionalParamArgsTest.errors.txt +++ b/tests/baselines/reference/optionalParamArgsTest.errors.txt @@ -1,6 +1,6 @@ -tests/cases/compiler/optionalParamArgsTest.ts(35,47): error TS1016: A required parameter cannot follow an optional parameter. tests/cases/compiler/optionalParamArgsTest.ts(31,12): error TS2393: Duplicate function implementation. tests/cases/compiler/optionalParamArgsTest.ts(35,12): error TS2393: Duplicate function implementation. +tests/cases/compiler/optionalParamArgsTest.ts(35,47): error TS1016: A required parameter cannot follow an optional parameter. tests/cases/compiler/optionalParamArgsTest.ts(99,1): error TS2346: Supplied parameters do not match any signature of call target. tests/cases/compiler/optionalParamArgsTest.ts(100,1): error TS2346: Supplied parameters do not match any signature of call target. tests/cases/compiler/optionalParamArgsTest.ts(101,1): error TS2346: Supplied parameters do not match any signature of call target. @@ -61,10 +61,10 @@ tests/cases/compiler/optionalParamArgsTest.ts(118,1): error TS2346: Supplied par // Negative test // "Optional parameters may only be followed by other optional parameters" public C1M5(C1M5A1:number,C1M5A2:number=0,C1M5A3:number) { return C1M5A1 + C1M5A2; } - ~~~~~~ -!!! error TS1016: A required parameter cannot follow an optional parameter. ~~~~ !!! error TS2393: Duplicate function implementation. + ~~~~~~ +!!! error TS1016: A required parameter cannot follow an optional parameter. } class C2 extends C1 { diff --git a/tests/baselines/reference/parserParameterList10.errors.txt b/tests/baselines/reference/parserParameterList10.errors.txt index 5239280d589..2737dc5efed 100644 --- a/tests/baselines/reference/parserParameterList10.errors.txt +++ b/tests/baselines/reference/parserParameterList10.errors.txt @@ -1,12 +1,12 @@ -tests/cases/conformance/parser/ecmascript5/ParameterLists/parserParameterList10.ts(2,11): error TS1048: A rest parameter cannot have an initializer. tests/cases/conformance/parser/ecmascript5/ParameterLists/parserParameterList10.ts(2,8): error TS2370: A rest parameter must be of an array type. +tests/cases/conformance/parser/ecmascript5/ParameterLists/parserParameterList10.ts(2,11): error TS1048: A rest parameter cannot have an initializer. ==== tests/cases/conformance/parser/ecmascript5/ParameterLists/parserParameterList10.ts (2 errors) ==== class C { foo(...bar = 0) { } - ~~~ -!!! error TS1048: A rest parameter cannot have an initializer. ~~~~~~~~~~ !!! error TS2370: A rest parameter must be of an array type. + ~~~ +!!! error TS1048: A rest parameter cannot have an initializer. } \ No newline at end of file diff --git a/tests/baselines/reference/parserRealSource11.errors.txt b/tests/baselines/reference/parserRealSource11.errors.txt index dc314c8d3e2..bf5432062b0 100644 --- a/tests/baselines/reference/parserRealSource11.errors.txt +++ b/tests/baselines/reference/parserRealSource11.errors.txt @@ -1,5 +1,4 @@ tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(4,1): error TS6053: File 'tests/cases/conformance/parser/ecmascript5/typescript.ts' not found. -tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(867,29): error TS1015: Parameter cannot have question mark and initializer. tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(13,22): error TS2304: Cannot find name 'Type'. tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(14,24): error TS2304: Cannot find name 'ASTFlags'. tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(17,38): error TS2304: Cannot find name 'CompilerDiagnostics'. @@ -215,6 +214,7 @@ tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(838,24): error tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(841,61): error TS2304: Cannot find name 'TypeSymbol'. tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(850,52): error TS2304: Cannot find name 'TokenID'. tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(863,36): error TS2304: Cannot find name 'TypeFlow'. +tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(867,29): error TS1015: Parameter cannot have question mark and initializer. tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(868,38): error TS2304: Cannot find name 'NodeType'. tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(877,40): error TS2304: Cannot find name 'NodeType'. tests/cases/conformance/parser/ecmascript5/parserRealSource11.ts(891,27): error TS2304: Cannot find name 'VarFlags'. diff --git a/tests/baselines/reference/restParameterWithoutAnnotationIsAnyArray.errors.txt b/tests/baselines/reference/restParameterWithoutAnnotationIsAnyArray.errors.txt index 72614738ed9..0177f1e9a1c 100644 --- a/tests/baselines/reference/restParameterWithoutAnnotationIsAnyArray.errors.txt +++ b/tests/baselines/reference/restParameterWithoutAnnotationIsAnyArray.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParameterWithoutAnnotationIsAnyArray.ts(13,9): error TS1014: A rest parameter must be last in a parameter list. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParameterWithoutAnnotationIsAnyArray.ts(5,11): error TS1014: A rest parameter must be last in a parameter list. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParameterWithoutAnnotationIsAnyArray.ts(13,9): error TS1014: A rest parameter must be last in a parameter list. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParameterWithoutAnnotationIsAnyArray.ts(23,21): error TS1014: A rest parameter must be last in a parameter list. diff --git a/tests/baselines/reference/restParametersOfNonArrayTypes.errors.txt b/tests/baselines/reference/restParametersOfNonArrayTypes.errors.txt index 6c3c8f5fe19..d2afe977fd0 100644 --- a/tests/baselines/reference/restParametersOfNonArrayTypes.errors.txt +++ b/tests/baselines/reference/restParametersOfNonArrayTypes.errors.txt @@ -1,4 +1,3 @@ -tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes.ts(13,9): error TS1014: A rest parameter must be last in a parameter list. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes.ts(3,14): error TS2370: A rest parameter must be of an array type. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes.ts(4,22): error TS2370: A rest parameter must be of an array type. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes.ts(5,11): error TS1014: A rest parameter must be last in a parameter list. @@ -6,6 +5,7 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfN tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes.ts(5,23): error TS2370: A rest parameter must be of an array type. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes.ts(8,9): error TS2370: A rest parameter must be of an array type. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes.ts(12,6): error TS2370: A rest parameter must be of an array type. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes.ts(13,9): error TS1014: A rest parameter must be last in a parameter list. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes.ts(13,9): error TS2370: A rest parameter must be of an array type. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes.ts(13,23): error TS2370: A rest parameter must be of an array type. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes.ts(17,6): error TS2370: A rest parameter must be of an array type. diff --git a/tests/baselines/reference/restParametersOfNonArrayTypes2.errors.txt b/tests/baselines/reference/restParametersOfNonArrayTypes2.errors.txt index aeae6846dcc..654f053e8bb 100644 --- a/tests/baselines/reference/restParametersOfNonArrayTypes2.errors.txt +++ b/tests/baselines/reference/restParametersOfNonArrayTypes2.errors.txt @@ -1,5 +1,3 @@ -tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(17,9): error TS1014: A rest parameter must be last in a parameter list. -tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(44,9): error TS1014: A rest parameter must be last in a parameter list. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(7,14): error TS2370: A rest parameter must be of an array type. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(8,22): error TS2370: A rest parameter must be of an array type. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(9,11): error TS1014: A rest parameter must be last in a parameter list. @@ -7,6 +5,7 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfN tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(9,26): error TS2370: A rest parameter must be of an array type. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(12,9): error TS2370: A rest parameter must be of an array type. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(16,6): error TS2370: A rest parameter must be of an array type. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(17,9): error TS1014: A rest parameter must be last in a parameter list. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(17,9): error TS2370: A rest parameter must be of an array type. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(17,24): error TS2370: A rest parameter must be of an array type. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(21,6): error TS2370: A rest parameter must be of an array type. @@ -23,6 +22,7 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfN tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(36,35): error TS2370: A rest parameter must be of an array type. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(39,9): error TS2370: A rest parameter must be of an array type. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(43,6): error TS2370: A rest parameter must be of an array type. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(44,9): error TS1014: A rest parameter must be last in a parameter list. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(44,9): error TS2370: A rest parameter must be of an array type. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(44,33): error TS2370: A rest parameter must be of an array type. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(48,6): error TS2370: A rest parameter must be of an array type. diff --git a/tests/baselines/reference/restParametersWithArrayTypeAnnotations.errors.txt b/tests/baselines/reference/restParametersWithArrayTypeAnnotations.errors.txt index bd813e8fc55..06b2caefb9d 100644 --- a/tests/baselines/reference/restParametersWithArrayTypeAnnotations.errors.txt +++ b/tests/baselines/reference/restParametersWithArrayTypeAnnotations.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersWithArrayTypeAnnotations.ts(13,9): error TS1014: A rest parameter must be last in a parameter list. -tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersWithArrayTypeAnnotations.ts(40,9): error TS1014: A rest parameter must be last in a parameter list. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersWithArrayTypeAnnotations.ts(5,11): error TS1014: A rest parameter must be last in a parameter list. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersWithArrayTypeAnnotations.ts(13,9): error TS1014: A rest parameter must be last in a parameter list. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersWithArrayTypeAnnotations.ts(23,21): error TS1014: A rest parameter must be last in a parameter list. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersWithArrayTypeAnnotations.ts(32,11): error TS1014: A rest parameter must be last in a parameter list. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersWithArrayTypeAnnotations.ts(40,9): error TS1014: A rest parameter must be last in a parameter list. tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersWithArrayTypeAnnotations.ts(50,21): error TS1014: A rest parameter must be last in a parameter list. From c525877aaa2586f7ae2fee8682860a7775e87392 Mon Sep 17 00:00:00 2001 From: Yui T Date: Tue, 16 Dec 2014 13:35:31 -0800 Subject: [PATCH 68/78] Move grammar checking: moduleDeclaration; there are still errors from incomplete grammar migration --- src/compiler/checker.ts | 21 +++++++++++++++++++ src/compiler/parser.ts | 4 ++-- .../reference/declareAlreadySeen.errors.txt | 2 +- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index f2874ae5085..455442a6317 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -8880,6 +8880,27 @@ module ts { } function checkModuleDeclaration(node: ModuleDeclaration) { + // Grammar checking + if (!checkGrammarModifiers(node)) { + if (!isInAmbientContext(node) && node.name.kind === SyntaxKind.StringLiteral) { + grammarErrorOnNode(node.name, Diagnostics.Only_ambient_modules_can_use_quoted_names); + } + else if (node.name.kind === SyntaxKind.Identifier && node.body.kind === SyntaxKind.ModuleBlock) { + var statements = (node.body).statements; + for (var i = 0, n = statements.length; i < n; i++) { + var statement = statements[i]; + + if (statement.kind === SyntaxKind.ExportAssignment) { + // Export assignments are not allowed in an internal module + grammarErrorOnNode(statement, Diagnostics.An_export_assignment_cannot_be_used_in_an_internal_module); + } + else if (isExternalModuleImportDeclaration(statement)) { + grammarErrorOnNode(getExternalModuleImportDeclarationExpression(statement), Diagnostics.Import_declarations_in_an_internal_module_cannot_reference_an_external_module); + } + } + } + } + if (fullTypeCheck) { checkCollisionWithCapturedThisVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index f0c6fcc0e2a..4aa2eb6b203 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -4656,7 +4656,7 @@ module ts { //case SyntaxKind.MethodDeclaration: //case SyntaxKind.MethodSignature: //return checkMethod(node); - case SyntaxKind.ModuleDeclaration: return checkModuleDeclaration(node); + //case SyntaxKind.ModuleDeclaration: return checkModuleDeclaration(node); //case SyntaxKind.ObjectLiteralExpression: return checkObjectLiteralExpression(node); //case SyntaxKind.NumericLiteral: return checkNumericLiteral(node); //case SyntaxKind.Parameter: return checkParameter(node); @@ -5330,7 +5330,7 @@ module ts { //case SyntaxKind.MethodSignature: //case SyntaxKind.ClassDeclaration: case SyntaxKind.InterfaceDeclaration: - case SyntaxKind.ModuleDeclaration: + //case SyntaxKind.ModuleDeclaration: //case SyntaxKind.EnumDeclaration: case SyntaxKind.ExportAssignment: //case SyntaxKind.VariableStatement: diff --git a/tests/baselines/reference/declareAlreadySeen.errors.txt b/tests/baselines/reference/declareAlreadySeen.errors.txt index da671ad313a..d606b571478 100644 --- a/tests/baselines/reference/declareAlreadySeen.errors.txt +++ b/tests/baselines/reference/declareAlreadySeen.errors.txt @@ -1,6 +1,6 @@ -tests/cases/compiler/declareAlreadySeen.ts(5,13): error TS1030: 'declare' modifier already seen. tests/cases/compiler/declareAlreadySeen.ts(2,13): error TS1030: 'declare' modifier already seen. tests/cases/compiler/declareAlreadySeen.ts(3,13): error TS1030: 'declare' modifier already seen. +tests/cases/compiler/declareAlreadySeen.ts(5,13): error TS1030: 'declare' modifier already seen. tests/cases/compiler/declareAlreadySeen.ts(7,13): error TS1030: 'declare' modifier already seen. From 406576f1fc704234cd2081c023386b0e364ed1a2 Mon Sep 17 00:00:00 2001 From: Yui T Date: Tue, 16 Dec 2014 13:36:00 -0800 Subject: [PATCH 69/78] Move grammar checking: propertyDeclaration, propertySignature; there are still errors from incomplete grammar migration --- src/compiler/checker.ts | 26 +++++++++++++++++++ src/compiler/parser.ts | 10 +++---- .../accessibilityModifiers.errors.txt | 6 ++--- .../classWithOptionalParameter.errors.txt | 2 +- ...SignatureMustHaveTypeAnnotation.errors.txt | 2 +- ...ModuleWithStatementsOfEveryKind.errors.txt | 6 ++--- .../parserComputedPropertyName29.errors.txt | 2 +- 7 files changed, 40 insertions(+), 14 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 455442a6317..99df47de0eb 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -7232,6 +7232,9 @@ module ts { } function checkPropertyDeclaration(node: PropertyDeclaration) { + // Grammar checking + checkGrammarModifiers(node) || checkGrammarProperty(node); + checkVariableLikeDeclaration(node); } @@ -10701,6 +10704,29 @@ module ts { } } + function checkGrammarProperty(node: PropertyDeclaration) { + if (node.parent.kind === SyntaxKind.ClassDeclaration) { + if (checkGrammarForInvalidQuestionMark(node, node.questionToken, Diagnostics.A_class_member_cannot_be_declared_optional) || + checkGrammarForDisallowedComputedProperty(node.name, Diagnostics.Computed_property_names_are_not_allowed_in_class_property_declarations)) { + return true; + } + } + else if (node.parent.kind === SyntaxKind.InterfaceDeclaration) { + if (checkGrammarForDisallowedComputedProperty(node.name, Diagnostics.Computed_property_names_are_not_allowed_in_interfaces)) { + return true; + } + } + else if (node.parent.kind === SyntaxKind.TypeLiteral) { + if (checkGrammarForDisallowedComputedProperty(node.name, Diagnostics.Computed_property_names_are_not_allowed_in_type_literals)) { + return true; + } + } + + if (isInAmbientContext(node) && node.initializer) { + return grammarErrorOnFirstToken(node.initializer, Diagnostics.Initializers_are_not_allowed_in_ambient_contexts); + } + } + function grammarErrorAfterFirstToken(node: Node, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any): boolean { var sourceFile = getSourceFileOfNode(node); if (!hasParseDiagnostics(sourceFile)) { diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 4aa2eb6b203..edc9c8f8581 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -4662,9 +4662,9 @@ module ts { //case SyntaxKind.Parameter: return checkParameter(node); //case SyntaxKind.PostfixUnaryExpression: return checkPostfixUnaryExpression(node); //case SyntaxKind.PrefixUnaryExpression: return checkPrefixUnaryExpression(node); - case SyntaxKind.PropertyDeclaration: - case SyntaxKind.PropertySignature: - return checkProperty(node); + //case SyntaxKind.PropertyDeclaration: + //case SyntaxKind.PropertySignature: + //return checkProperty(node); //case SyntaxKind.ReturnStatement: return checkReturnStatement(node); //case SyntaxKind.SetAccessor: return checkSetAccessor(node); case SyntaxKind.SourceFile: return checkSourceFile(node); @@ -5324,8 +5324,8 @@ module ts { //case SyntaxKind.GetAccessor: //case SyntaxKind.SetAccessor: //case SyntaxKind.Constructor: - case SyntaxKind.PropertyDeclaration: - case SyntaxKind.PropertySignature: + //case SyntaxKind.PropertyDeclaration: + //case SyntaxKind.PropertySignature: //case SyntaxKind.MethodDeclaration: //case SyntaxKind.MethodSignature: //case SyntaxKind.ClassDeclaration: diff --git a/tests/baselines/reference/accessibilityModifiers.errors.txt b/tests/baselines/reference/accessibilityModifiers.errors.txt index 5650fca5931..1bf92139761 100644 --- a/tests/baselines/reference/accessibilityModifiers.errors.txt +++ b/tests/baselines/reference/accessibilityModifiers.errors.txt @@ -1,16 +1,16 @@ tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(22,12): error TS1029: 'private' modifier must precede 'static' modifier. -tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(27,12): error TS1029: 'protected' modifier must precede 'static' modifier. -tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(32,12): error TS1029: 'public' modifier must precede 'static' modifier. -tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(40,13): error TS1028: Accessibility modifier already seen. tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(23,12): error TS1029: 'private' modifier must precede 'static' modifier. tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(24,12): error TS1029: 'private' modifier must precede 'static' modifier. tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(25,12): error TS1029: 'private' modifier must precede 'static' modifier. +tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(27,12): error TS1029: 'protected' modifier must precede 'static' modifier. tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(28,12): error TS1029: 'protected' modifier must precede 'static' modifier. tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(29,12): error TS1029: 'protected' modifier must precede 'static' modifier. tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(30,12): error TS1029: 'protected' modifier must precede 'static' modifier. +tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(32,12): error TS1029: 'public' modifier must precede 'static' modifier. tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(33,12): error TS1029: 'public' modifier must precede 'static' modifier. tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(34,12): error TS1029: 'public' modifier must precede 'static' modifier. tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(35,12): error TS1029: 'public' modifier must precede 'static' modifier. +tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(40,13): error TS1028: Accessibility modifier already seen. tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(41,12): error TS1028: Accessibility modifier already seen. tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(42,13): error TS1028: Accessibility modifier already seen. tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts(43,12): error TS1028: Accessibility modifier already seen. diff --git a/tests/baselines/reference/classWithOptionalParameter.errors.txt b/tests/baselines/reference/classWithOptionalParameter.errors.txt index 3d1ba523d14..6e512c2a02e 100644 --- a/tests/baselines/reference/classWithOptionalParameter.errors.txt +++ b/tests/baselines/reference/classWithOptionalParameter.errors.txt @@ -1,6 +1,6 @@ tests/cases/conformance/types/namedTypes/classWithOptionalParameter.ts(4,6): error TS1112: A class member cannot be declared optional. -tests/cases/conformance/types/namedTypes/classWithOptionalParameter.ts(9,6): error TS1112: A class member cannot be declared optional. tests/cases/conformance/types/namedTypes/classWithOptionalParameter.ts(5,6): error TS1112: A class member cannot be declared optional. +tests/cases/conformance/types/namedTypes/classWithOptionalParameter.ts(9,6): error TS1112: A class member cannot be declared optional. tests/cases/conformance/types/namedTypes/classWithOptionalParameter.ts(10,6): error TS1112: A class member cannot be declared optional. diff --git a/tests/baselines/reference/indexSignatureMustHaveTypeAnnotation.errors.txt b/tests/baselines/reference/indexSignatureMustHaveTypeAnnotation.errors.txt index 7d348b2cdbc..294282d1e9e 100644 --- a/tests/baselines/reference/indexSignatureMustHaveTypeAnnotation.errors.txt +++ b/tests/baselines/reference/indexSignatureMustHaveTypeAnnotation.errors.txt @@ -1,6 +1,6 @@ tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(2,5): error TS1169: Computed property names are not allowed in interfaces. -tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(7,5): error TS1166: Computed property names are not allowed in class property declarations. tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(3,5): error TS1021: An index signature must have a type annotation. +tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(7,5): error TS1166: Computed property names are not allowed in class property declarations. tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(12,5): error TS1021: An index signature must have a type annotation. diff --git a/tests/baselines/reference/invalidModuleWithStatementsOfEveryKind.errors.txt b/tests/baselines/reference/invalidModuleWithStatementsOfEveryKind.errors.txt index 0d2ef3d6924..1169256aed6 100644 --- a/tests/baselines/reference/invalidModuleWithStatementsOfEveryKind.errors.txt +++ b/tests/baselines/reference/invalidModuleWithStatementsOfEveryKind.errors.txt @@ -1,23 +1,23 @@ tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(13,5): error TS1044: 'public' modifier cannot appear on a module element. -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(19,5): error TS1044: 'public' modifier cannot appear on a module element. tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(38,5): error TS1044: 'private' modifier cannot appear on a module element. -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(44,5): error TS1044: 'private' modifier cannot appear on a module element. tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(64,5): error TS1044: 'static' modifier cannot appear on a module element. -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(70,5): error TS1044: 'static' modifier cannot appear on a module element. tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(4,5): error TS1044: 'public' modifier cannot appear on a module element. tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(6,5): error TS1044: 'public' modifier cannot appear on a module element. tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(12,5): error TS1044: 'public' modifier cannot appear on a module element. tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(15,5): error TS1044: 'public' modifier cannot appear on a module element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(19,5): error TS1044: 'public' modifier cannot appear on a module element. tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(25,5): error TS1044: 'public' modifier cannot appear on a module element. tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(29,5): error TS1044: 'private' modifier cannot appear on a module element. tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(31,5): error TS1044: 'private' modifier cannot appear on a module element. tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(37,5): error TS1044: 'private' modifier cannot appear on a module element. tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(40,5): error TS1044: 'private' modifier cannot appear on a module element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(44,5): error TS1044: 'private' modifier cannot appear on a module element. tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(50,5): error TS1044: 'private' modifier cannot appear on a module element. tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(55,5): error TS1044: 'static' modifier cannot appear on a module element. tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(57,5): error TS1044: 'static' modifier cannot appear on a module element. tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(63,5): error TS1044: 'static' modifier cannot appear on a module element. tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(66,5): error TS1044: 'static' modifier cannot appear on a module element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(70,5): error TS1044: 'static' modifier cannot appear on a module element. tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(76,5): error TS1044: 'static' modifier cannot appear on a module element. diff --git a/tests/baselines/reference/parserComputedPropertyName29.errors.txt b/tests/baselines/reference/parserComputedPropertyName29.errors.txt index 13a15bf5f9d..691a240375a 100644 --- a/tests/baselines/reference/parserComputedPropertyName29.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName29.errors.txt @@ -1,6 +1,6 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName29.ts(3,5): error TS1166: Computed property names are not allowed in class property declarations. -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName29.ts(4,5): error TS1166: Computed property names are not allowed in class property declarations. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName29.ts(3,11): error TS2304: Cannot find name 'id'. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName29.ts(4,5): error TS1166: Computed property names are not allowed in class property declarations. ==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName29.ts (3 errors) ==== From a3e8b6c6d711d1d65b434651f7a71e0f646c8ef5 Mon Sep 17 00:00:00 2001 From: Yui T Date: Tue, 16 Dec 2014 13:47:57 -0800 Subject: [PATCH 70/78] Move grammar checking: interfaceDeclaration-remove it from checkModifiers in parser; there are still errors from incomplete grammar migration --- src/compiler/checker.ts | 2 +- src/compiler/diagnosticInformationMap.generated.ts | 2 +- src/compiler/diagnosticMessages.json | 3 ++- src/compiler/parser.ts | 2 +- .../invalidModuleWithStatementsOfEveryKind.errors.txt | 6 +++--- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 99df47de0eb..28a398ec40d 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -8614,7 +8614,7 @@ module ts { function checkInterfaceDeclaration(node: InterfaceDeclaration) { // Grammar checking - checkGrammarInterfaceDeclaration(node); + checkGrammarModifiers(node) || checkGrammarInterfaceDeclaration(node); checkTypeParameters(node.typeParameters); if (fullTypeCheck) { diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index 2cc658621fb..9885cdcca12 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -36,7 +36,7 @@ module ts { A_declare_modifier_cannot_be_used_in_an_already_ambient_context: { code: 1038, category: DiagnosticCategory.Error, key: "A 'declare' modifier cannot be used in an already ambient context.", isEarly: true }, Initializers_are_not_allowed_in_ambient_contexts: { code: 1039, category: DiagnosticCategory.Error, key: "Initializers are not allowed in ambient contexts.", isEarly: true }, _0_modifier_cannot_appear_on_a_module_element: { code: 1044, category: DiagnosticCategory.Error, key: "'{0}' modifier cannot appear on a module element.", isEarly: true }, - A_declare_modifier_cannot_be_used_with_an_interface_declaration: { code: 1045, category: DiagnosticCategory.Error, key: "A 'declare' modifier cannot be used with an interface declaration." }, + A_declare_modifier_cannot_be_used_with_an_interface_declaration: { code: 1045, category: DiagnosticCategory.Error, key: "A 'declare' modifier cannot be used with an interface declaration.", isEarly: true }, A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file: { code: 1046, category: DiagnosticCategory.Error, key: "A 'declare' modifier is required for a top level declaration in a .d.ts file." }, A_rest_parameter_cannot_be_optional: { code: 1047, category: DiagnosticCategory.Error, key: "A rest parameter cannot be optional.", isEarly: true }, A_rest_parameter_cannot_have_an_initializer: { code: 1048, category: DiagnosticCategory.Error, key: "A rest parameter cannot have an initializer.", isEarly: true }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 9bcd486513b..7f45cda8f04 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -160,7 +160,8 @@ }, "A 'declare' modifier cannot be used with an interface declaration.": { "category": "Error", - "code": 1045 + "code": 1045, + "isEarly": true }, "A 'declare' modifier is required for a top level declaration in a .d.ts file.": { "category": "Error", diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index edc9c8f8581..49871d790a2 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -5329,7 +5329,7 @@ module ts { //case SyntaxKind.MethodDeclaration: //case SyntaxKind.MethodSignature: //case SyntaxKind.ClassDeclaration: - case SyntaxKind.InterfaceDeclaration: + //case SyntaxKind.InterfaceDeclaration: //case SyntaxKind.ModuleDeclaration: //case SyntaxKind.EnumDeclaration: case SyntaxKind.ExportAssignment: diff --git a/tests/baselines/reference/invalidModuleWithStatementsOfEveryKind.errors.txt b/tests/baselines/reference/invalidModuleWithStatementsOfEveryKind.errors.txt index 1169256aed6..101ee0124cc 100644 --- a/tests/baselines/reference/invalidModuleWithStatementsOfEveryKind.errors.txt +++ b/tests/baselines/reference/invalidModuleWithStatementsOfEveryKind.errors.txt @@ -1,21 +1,21 @@ -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(13,5): error TS1044: 'public' modifier cannot appear on a module element. -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(38,5): error TS1044: 'private' modifier cannot appear on a module element. -tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(64,5): error TS1044: 'static' modifier cannot appear on a module element. tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(4,5): error TS1044: 'public' modifier cannot appear on a module element. tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(6,5): error TS1044: 'public' modifier cannot appear on a module element. tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(12,5): error TS1044: 'public' modifier cannot appear on a module element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(13,5): error TS1044: 'public' modifier cannot appear on a module element. tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(15,5): error TS1044: 'public' modifier cannot appear on a module element. tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(19,5): error TS1044: 'public' modifier cannot appear on a module element. tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(25,5): error TS1044: 'public' modifier cannot appear on a module element. tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(29,5): error TS1044: 'private' modifier cannot appear on a module element. tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(31,5): error TS1044: 'private' modifier cannot appear on a module element. tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(37,5): error TS1044: 'private' modifier cannot appear on a module element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(38,5): error TS1044: 'private' modifier cannot appear on a module element. tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(40,5): error TS1044: 'private' modifier cannot appear on a module element. tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(44,5): error TS1044: 'private' modifier cannot appear on a module element. tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(50,5): error TS1044: 'private' modifier cannot appear on a module element. tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(55,5): error TS1044: 'static' modifier cannot appear on a module element. tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(57,5): error TS1044: 'static' modifier cannot appear on a module element. tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(63,5): error TS1044: 'static' modifier cannot appear on a module element. +tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(64,5): error TS1044: 'static' modifier cannot appear on a module element. tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(66,5): error TS1044: 'static' modifier cannot appear on a module element. tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(70,5): error TS1044: 'static' modifier cannot appear on a module element. tests/cases/conformance/internalModules/moduleBody/invalidModuleWithStatementsOfEveryKind.ts(76,5): error TS1044: 'static' modifier cannot appear on a module element. From 8c76a4ebd3266969f99c94f52e4dd27077e1e292 Mon Sep 17 00:00:00 2001 From: Arnavion Date: Tue, 16 Dec 2014 15:28:36 -0800 Subject: [PATCH 71/78] Fail the surrounding Jake task if exec'd tool has non-zero exit code. --- Jakefile | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/Jakefile b/Jakefile index af0ddd0fed2..09b7e1efba4 100644 --- a/Jakefile +++ b/Jakefile @@ -465,14 +465,10 @@ function exec(cmd, completeHandler) { complete(); }); ex.addListener("error", function(e, status) { - console.error("Process exited with code " + status); - complete(); + fail("Process exited with code " + status); }) - try{ - ex.run(); - } catch(e) { - console.log('Exception: ' + e) - } + + ex.run(); } function cleanTestDirs() { From f1a2e41a8abc3b620b5ec8048098d7612c993f0d Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 16 Dec 2014 15:56:56 -0800 Subject: [PATCH 72/78] Sort diagnostics in our baseline output. This was we don't get noisy baselines just because a different phase of the compiler reported the diagnostic. This helps with Yui's refactoring work to move grammar checks into the type checker. --- src/harness/harness.ts | 10 + .../reference/ArrowFunction2.errors.txt | 6 +- .../reference/ArrowFunction3.errors.txt | 6 +- .../FunctionDeclaration5_es6.errors.txt | 12 +- .../MemberFunctionDeclaration6_es6.errors.txt | 2 +- .../MemberFunctionDeclaration8_es6.errors.txt | 6 +- .../reference/TemplateExpression1.errors.txt | 8 +- .../reference/TypeArgumentList1.errors.txt | 8 +- .../reference/YieldExpression8_es6.errors.txt | 2 +- ...rParameterAccessibilityModifier.errors.txt | 2 +- ...rs_spec_section-4.5_error-cases.errors.txt | 8 +- .../reference/aliasErrors.errors.txt | 4 +- .../reference/ambientErrors.errors.txt | 4 +- .../ambientWithStatements.errors.txt | 2 +- .../ambiguousGenericAssertion1.errors.txt | 6 +- .../reference/anonymousModules.errors.txt | 22 +- .../reference/anyIdenticalToItself.errors.txt | 2 +- .../reference/arrayTypeOfTypeOf.errors.txt | 18 +- .../arrowFunctionsMissingTokens.errors.txt | 2 +- .../assertInWrapSomeTypeParameter.errors.txt | 2 +- .../reference/assignmentLHSIsValue.errors.txt | 12 +- .../baselines/reference/autoLift2.errors.txt | 12 +- .../reference/badArrayIndex.errors.txt | 8 +- tests/baselines/reference/bases.errors.txt | 12 +- ...ressionWithMissingTypeArgument1.errors.txt | 8 +- ...OptionalParameterAndInitializer.errors.txt | 10 +- ...turesWithParameterInitializers2.errors.txt | 6 +- ...annotInvokeNewOnErrorExpression.errors.txt | 8 +- .../reference/classExpression.errors.txt | 6 +- .../classExtendingPrimitive.errors.txt | 6 +- .../classExtendsEveryObjectType.errors.txt | 4 +- .../reference/classUpdateTests.errors.txt | 12 +- ...uperAndLocalFunctionInAccessors.errors.txt | 6 +- ...sionSuperAndLocalVarInAccessors.errors.txt | 6 +- .../collisionSuperAndParameter.errors.txt | 2 +- ...xpressionAndLocalVarInAccessors.errors.txt | 6 +- .../compoundAssignmentLHSIsValue.errors.txt | 24 +- .../computedPropertyNames2.errors.txt | 12 +- .../computedPropertyNames3.errors.txt | 12 +- .../conflictMarkerTrivia1.errors.txt | 4 +- .../constDeclarations-errors.errors.txt | 2 +- ...nstDeclarations-invalidContexts.errors.txt | 2 +- ...torWithIncompleteTypeAnnotation.errors.txt | 134 ++++---- .../reference/createArray.errors.txt | 18 +- ...perCallsInNonConstructorMembers.errors.txt | 2 +- ...InstanceShadowingPublicInstance.errors.txt | 4 +- ...vateStaticShadowingPublicStatic.errors.txt | 4 +- ...ontShowCompilerGeneratedMembers.errors.txt | 4 +- .../reference/dottedModuleName.errors.txt | 6 +- .../duplicateClassElements.errors.txt | 20 +- .../duplicateObjectLiteralProperty.errors.txt | 2 +- ...duplicatePropertiesInStrictMode.errors.txt | 2 +- .../emptyGenericParamList.errors.txt | 8 +- .../emptyTypeArgumentList.errors.txt | 8 +- .../emptyTypeArgumentListWithNew.errors.txt | 8 +- ...umConflictsWithGlobalIdentifier.errors.txt | 6 +- .../reference/enumMemberResolution.errors.txt | 6 +- .../reference/errorSuperCalls.errors.txt | 2 +- .../errorSuperPropertyAccess.errors.txt | 16 +- .../errorsInGenericTypeReference.errors.txt | 2 +- .../reference/es6ClassTest2.errors.txt | 2 +- .../reference/es6ClassTest9.errors.txt | 6 +- .../baselines/reference/extension.errors.txt | 8 +- .../reference/externModule.errors.txt | 14 +- .../fatarrowfunctionsErrors.errors.txt | 22 +- ...rowfunctionsOptionalArgsErrors2.errors.txt | 18 +- ...rowfunctionsOptionalArgsErrors4.errors.txt | 2 +- .../fieldAndGetterWithSameName.errors.txt | 2 +- ...functionAndPropertyNameConflict.errors.txt | 2 +- ...gReturnStatementsAndExpressions.errors.txt | 2 +- .../genericReturnTypeFromGetter1.errors.txt | 2 +- ...eReferenceWithoutTypeArgument.d.errors.txt | 2 +- ...ypeReferenceWithoutTypeArgument.errors.txt | 2 +- ...peReferenceWithoutTypeArgument2.errors.txt | 2 +- ...peReferenceWithoutTypeArgument3.errors.txt | 2 +- ...ReturnTypeAndFunctionClassMerge.errors.txt | 2 +- .../getAndSetNotIdenticalType.errors.txt | 10 +- .../getAndSetNotIdenticalType2.errors.txt | 8 +- .../getAndSetNotIdenticalType3.errors.txt | 8 +- .../reference/gettersAndSetters.errors.txt | 4 +- .../gettersAndSettersAccessibility.errors.txt | 2 +- .../gettersAndSettersErrors.errors.txt | 8 +- tests/baselines/reference/giant.errors.txt | 304 +++++++++--------- .../illegalSuperCallsInConstructor.errors.txt | 8 +- .../implicitAnyCastedValue.errors.txt | 6 +- ...AndSetAccessorWithAnyReturnType.errors.txt | 10 +- ...implicitAnyInAmbientDeclaration.errors.txt | 2 +- ...licitAnyInAmbientDeclaration2.d.errors.txt | 2 +- .../importDeclWithClassModifiers.errors.txt | 18 +- .../importDeclWithDeclareModifier.errors.txt | 6 +- ...incompleteDottedExpressionAtEOF.errors.txt | 8 +- .../incrementAndDecrement.errors.txt | 2 +- ...natureWithAccessibilityModifier.errors.txt | 12 +- .../reference/indexTypeCheck.errors.txt | 4 +- .../reference/inferSetterParamType.errors.txt | 2 +- ...eMemberAccessorOverridingMethod.errors.txt | 4 +- ...eStaticAccessorOverridingMethod.errors.txt | 4 +- ...zerReferencingConstructorLocals.errors.txt | 4 +- ...eferencingConstructorParameters.errors.txt | 2 +- .../reference/innerModExport1.errors.txt | 6 +- .../reference/innerModExport2.errors.txt | 6 +- ...ropertiesInheritedIntoClassType.errors.txt | 2 +- .../instancePropertyInClassType.errors.txt | 2 +- .../instantiateTypeParameter.errors.txt | 2 +- .../reference/intTypeCheck.errors.txt | 48 +-- .../interfaceDeclaration4.errors.txt | 8 +- .../interfaceExtendingClass2.errors.txt | 2 +- .../reference/interfaceNaming1.errors.txt | 6 +- ...interfaceThatInheritsFromItself.errors.txt | 2 +- .../interfaceWithPrivateMember.errors.txt | 2 +- ...facesWithPredefinedTypesAsNames.errors.txt | 2 +- .../invalidUnicodeEscapeSequance3.errors.txt | 6 +- .../letAsIdentifierInStrictMode.errors.txt | 2 +- ...letDeclarations-invalidContexts.errors.txt | 2 +- .../baselines/reference/libMembers.errors.txt | 2 +- tests/baselines/reference/literals.errors.txt | 4 +- ...calNotOperatorInvalidOperations.errors.txt | 2 +- .../methodInAmbientClass1.errors.txt | 6 +- .../reference/missingArgument1.errors.txt | 6 +- .../moduleKeywordRepeatError.errors.txt | 8 +- ...negateOperatorInvalidOperations.errors.txt | 2 +- .../nestedClassDeclaration.errors.txt | 6 +- .../newExpressionWithCast.errors.txt | 6 +- .../reference/newOperator.errors.txt | 10 +- .../reference/noDefaultLib.errors.txt | 4 +- ...rConstrainsPropertyDeclarations.errors.txt | 8 +- .../numericNamedPropertyDuplicates.errors.txt | 2 +- ...onExpressionInFunctionParameter.errors.txt | 2 +- .../reference/objectLiteralErrors.errors.txt | 114 +++---- ...rthandPropertiesAssignmentError.errors.txt | 10 +- ...nmentErrorFromMissingIdentifier.errors.txt | 20 +- ...tiesErrorFromNotUsingIdentifier.errors.txt | 18 +- ...ectTypesWithOptionalProperties2.errors.txt | 12 +- .../optionalParamArgsTest.errors.txt | 6 +- .../optionalPropertiesSyntax.errors.txt | 12 +- ...overloadOnConstAsTypeAnnotation.errors.txt | 8 +- ...adingStaticFunctionsInFunctions.errors.txt | 22 +- .../parseErrorInHeritageClause1.errors.txt | 6 +- .../reference/parser0_004152.errors.txt | 90 +++--- .../reference/parser10.1.1-8gs.errors.txt | 2 +- .../reference/parser509698.errors.txt | 28 +- .../reference/parser512325.errors.txt | 6 +- .../reference/parser519458.errors.txt | 6 +- .../reference/parser521128.errors.txt | 8 +- .../reference/parserAccessors10.errors.txt | 6 +- .../parserArrowFunctionExpression2.errors.txt | 6 +- .../parserArrowFunctionExpression3.errors.txt | 14 +- .../reference/parserAstSpans1.errors.txt | 2 +- .../parserClassDeclaration1.errors.txt | 6 +- .../parserClassDeclaration2.errors.txt | 6 +- .../parserClassDeclaration3.errors.txt | 6 +- .../parserClassDeclaration4.errors.txt | 6 +- .../parserClassDeclaration5.errors.txt | 6 +- .../parserClassDeclaration6.errors.txt | 6 +- .../parserCommaInTypeMemberList2.errors.txt | 6 +- .../parserComputedPropertyName27.errors.txt | 6 +- .../parserComputedPropertyName29.errors.txt | 2 +- .../parserComputedPropertyName30.errors.txt | 2 +- .../parserComputedPropertyName33.errors.txt | 6 +- .../parserComputedPropertyName34.errors.txt | 2 +- .../parserComputedPropertyName5.errors.txt | 14 +- .../parserConstructorAmbiguity3.errors.txt | 8 +- .../parserConstructorDeclaration12.errors.txt | 42 +-- .../parserConstructorDeclaration8.errors.txt | 6 +- .../reference/parserEnum5.errors.txt | 8 +- ...EqualsGreaterThanAfterFunction1.errors.txt | 8 +- ...EqualsGreaterThanAfterFunction2.errors.txt | 6 +- ...parserErrorRecoveryIfStatement2.errors.txt | 2 +- ...parserErrorRecoveryIfStatement3.errors.txt | 2 +- ...parserErrorRecoveryIfStatement4.errors.txt | 2 +- ...parserErrorRecoveryIfStatement5.errors.txt | 14 +- ...parserErrorRecoveryIfStatement6.errors.txt | 2 +- ...rserErrorRecovery_ArgumentList1.errors.txt | 2 +- ...rserErrorRecovery_ArgumentList2.errors.txt | 6 +- ...rserErrorRecovery_ArgumentList3.errors.txt | 2 +- ...rserErrorRecovery_ArgumentList4.errors.txt | 2 +- ...rserErrorRecovery_ArgumentList5.errors.txt | 6 +- ...rserErrorRecovery_ArgumentList6.errors.txt | 8 +- ...rserErrorRecovery_ArgumentList7.errors.txt | 8 +- .../parserErrorRecovery_Block3.errors.txt | 2 +- ...very_ExtendsOrImplementsClause2.errors.txt | 6 +- ...very_ExtendsOrImplementsClause4.errors.txt | 6 +- ...very_ExtendsOrImplementsClause5.errors.txt | 12 +- ...overy_IncompleteMemberVariable2.errors.txt | 6 +- .../parserErrorRecovery_LeftShift1.errors.txt | 8 +- ...serErrorRecovery_ModuleElement2.errors.txt | 4 +- ...serErrorRecovery_ParameterList1.errors.txt | 6 +- ...serErrorRecovery_ParameterList2.errors.txt | 2 +- ...serErrorRecovery_ParameterList6.errors.txt | 6 +- ...rErrorRecovery_SwitchStatement1.errors.txt | 2 +- ...rErrorRecovery_SwitchStatement2.errors.txt | 2 +- .../parserForInStatement7.errors.txt | 6 +- .../reference/parserFuzz1.errors.txt | 16 +- ...arserGreaterThanTokenAmbiguity2.errors.txt | 8 +- ...arserGreaterThanTokenAmbiguity3.errors.txt | 8 +- ...arserGreaterThanTokenAmbiguity4.errors.txt | 8 +- .../parserIndexSignature2.errors.txt | 6 +- .../parserInterfaceDeclaration1.errors.txt | 6 +- ...parserKeywordsAsIdentifierName2.errors.txt | 8 +- ...erAccessAfterPostfixExpression1.errors.txt | 6 +- .../parserMemberAccessExpression1.errors.txt | 22 +- ...erMemberAccessOffOfGenericType1.errors.txt | 14 +- .../parserMissingLambdaOpenBrace1.errors.txt | 2 +- .../reference/parserMissingToken1.errors.txt | 8 +- ...rserModifierOnStatementInBlock2.errors.txt | 6 +- .../reference/parserNotRegex1.errors.txt | 2 +- ...rserObjectCreationArrayLiteral1.errors.txt | 8 +- ...rserObjectCreationArrayLiteral3.errors.txt | 8 +- .../reference/parserObjectType5.errors.txt | 2 +- .../reference/parserObjectType6.errors.txt | 2 +- .../parserParameterList10.errors.txt | 6 +- ...parserPostfixPostfixExpression1.errors.txt | 8 +- .../parserPostfixUnaryExpression1.errors.txt | 8 +- .../reference/parserRealSource10.errors.txt | 24 +- .../reference/parserRealSource11.errors.txt | 8 +- .../reference/parserRealSource7.errors.txt | 6 +- .../reference/parserRealSource9.errors.txt | 6 +- ...gularExpressionDivideAmbiguity4.errors.txt | 8 +- .../parserSkippedTokens16.errors.txt | 18 +- .../parserSkippedTokens17.errors.txt | 14 +- .../parserSkippedTokens18.errors.txt | 14 +- .../parserSkippedTokens20.errors.txt | 8 +- .../reference/parserStrictMode2.errors.txt | 4 +- .../parserSuperExpression2.errors.txt | 6 +- .../reference/parserTypeQuery3.errors.txt | 8 +- .../reference/parserTypeQuery4.errors.txt | 8 +- .../reference/parserTypeQuery8.errors.txt | 14 +- ...nfinishedTypeNameBeforeKeyword1.errors.txt | 12 +- .../parserUnterminatedGeneric1.errors.txt | 8 +- .../parserUnterminatedGeneric2.errors.txt | 32 +- .../reference/parserWithStatement2.errors.txt | 2 +- .../parserX_ArrowFunction2.errors.txt | 6 +- .../parserX_ArrowFunction3.errors.txt | 6 +- .../parserX_TypeArgumentList1.errors.txt | 8 +- .../reference/parserharness.errors.txt | 2 +- .../parservoidInQualifiedName2.errors.txt | 8 +- .../reference/primitiveMembers.errors.txt | 4 +- .../privacyGloImportParseErrors.errors.txt | 8 +- .../privacyImportParseErrors.errors.txt | 16 +- .../reference/privateIndexer2.errors.txt | 20 +- ...vateInstanceMemberAccessibility.errors.txt | 4 +- .../amd/invalidRootFile.errors.txt | 8 +- .../node/invalidRootFile.errors.txt | 8 +- ...SourceRootWithNoSourceMapOption.errors.txt | 4 +- ...SourceRootWithNoSourceMapOption.errors.txt | 4 +- .../noDefaultLib/amd/noDefaultLib.errors.txt | 28 +- .../noDefaultLib/node/noDefaultLib.errors.txt | 28 +- ...propertyAndAccessorWithSameName.errors.txt | 8 +- .../reference/propertyWrappedInTry.errors.txt | 10 +- .../reference/protectedMembers.errors.txt | 2 +- .../reservedNamesInAliases.errors.txt | 4 +- .../restParametersOfNonArrayTypes.errors.txt | 6 +- .../restParametersOfNonArrayTypes2.errors.txt | 12 +- .../reference/scanner10.1.1-8gs.errors.txt | 2 +- ...scannerUnexpectedNullCharacter1.errors.txt | Bin 811 -> 811 bytes .../staticPropertyNotInClassType.errors.txt | 4 +- .../reference/staticVisibility.errors.txt | 4 +- .../reference/staticsInAFunction.errors.txt | 22 +- ...rConstrainsPropertyDeclarations.errors.txt | 10 +- .../stringNamedPropertyDuplicates.errors.txt | 2 +- .../reference/superAccess2.errors.txt | 26 +- .../reference/superErrors.errors.txt | 36 +-- .../reference/superInLambdas.errors.txt | 4 +- .../reference/superPropertyAccess1.errors.txt | 2 +- .../reference/superPropertyAccess2.errors.txt | 2 +- .../superWithTypeArgument.errors.txt | 4 +- .../superWithTypeArgument2.errors.txt | 4 +- .../superWithTypeArgument3.errors.txt | 4 +- ...ect-literal-getters-and-setters.errors.txt | 4 +- ...ateStringsTypeArgumentInference.errors.txt | 16 +- ...tringsWithIncompatibleTypedTags.errors.txt | 14 +- ...eStringsWithOverloadResolution1.errors.txt | 12 +- ...eStringsWithOverloadResolution3.errors.txt | 16 +- ...hIncompleteTemplateExpressions3.errors.txt | 8 +- ...hIncompleteTemplateExpressions4.errors.txt | 8 +- ...hIncompleteTemplateExpressions5.errors.txt | 8 +- ...hIncompleteTemplateExpressions6.errors.txt | 8 +- ...teStringInFunctionParameterType.errors.txt | 12 +- ...tringInFunctionParameterTypeES6.errors.txt | 12 +- .../templateStringInModuleName.errors.txt | 24 +- .../templateStringInModuleNameES6.errors.txt | 24 +- .../templateStringInObjectLiteral.errors.txt | 6 +- ...emplateStringInObjectLiteralES6.errors.txt | 6 +- .../templateStringInPropertyName1.errors.txt | 6 +- .../templateStringInPropertyName2.errors.txt | 6 +- ...mplateStringInPropertyNameES6_1.errors.txt | 6 +- ...mplateStringInPropertyNameES6_2.errors.txt | 6 +- .../templateStringInTaggedTemplate.errors.txt | 8 +- ...tringsArrayTypeDefinedInES5Mode.errors.txt | 2 +- ...ringsArrayTypeNotDefinedES5Mode.errors.txt | 2 +- .../thisInInvalidContexts.errors.txt | 4 +- ...InInvalidContextsExternalModule.errors.txt | 8 +- ...trailingSeparatorInFunctionCall.errors.txt | 14 +- .../twoAccessorsWithSameName.errors.txt | 2 +- .../twoAccessorsWithSameName2.errors.txt | 8 +- .../typeAliasesForObjectTypes.errors.txt | 4 +- .../typeCheckTypeArgument.errors.txt | 28 +- .../typeOfThisInInstanceMember.errors.txt | 2 +- .../typeParameterConstraints1.errors.txt | 2 +- ...typeParametersInStaticAccessors.errors.txt | 2 +- .../typesWithPrivateConstructor.errors.txt | 2 +- .../unaryOperatorsInStrictMode.errors.txt | 14 +- .../unicodeIdentifierName2.errors.txt | 8 +- tests/baselines/reference/varBlock.errors.txt | 12 +- ...ariableDeclarationInStrictMode1.errors.txt | 2 +- .../reference/withStatementErrors.errors.txt | 2 +- 306 files changed, 1480 insertions(+), 1470 deletions(-) diff --git a/src/harness/harness.ts b/src/harness/harness.ts index 311e2db93ee..ac98f51fe70 100644 --- a/src/harness/harness.ts +++ b/src/harness/harness.ts @@ -1168,7 +1168,17 @@ module Harness { return errorOutput; } + function compareDiagnostics(d1: HarnessDiagnostic, d2: HarnessDiagnostic) { + return ts.compareValues(d1.filename, d2.filename) || + ts.compareValues(d1.start, d2.start) || + ts.compareValues(d1.end, d2.end) || + ts.compareValues(d1.code, d2.code) || + ts.compareValues(d1.message, d2.message) || + 0; + } + export function getErrorBaseline(inputFiles: { unitName: string; content: string }[], diagnostics: HarnessDiagnostic[]) { + diagnostics.sort(compareDiagnostics); var outputLines: string[] = []; // Count up all the errors we find so we don't miss any diff --git a/tests/baselines/reference/ArrowFunction2.errors.txt b/tests/baselines/reference/ArrowFunction2.errors.txt index 26e1f336cb6..3b9ba21f15a 100644 --- a/tests/baselines/reference/ArrowFunction2.errors.txt +++ b/tests/baselines/reference/ArrowFunction2.errors.txt @@ -1,12 +1,12 @@ -tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArrowFunctions/ArrowFunction2.ts(1,14): error TS1009: Trailing comma not allowed. tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArrowFunctions/ArrowFunction2.ts(1,13): error TS2304: Cannot find name 'b'. +tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArrowFunctions/ArrowFunction2.ts(1,14): error TS1009: Trailing comma not allowed. ==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArrowFunctions/ArrowFunction2.ts (2 errors) ==== var v = (a: b,) => { - ~ -!!! error TS1009: Trailing comma not allowed. ~ !!! error TS2304: Cannot find name 'b'. + ~ +!!! error TS1009: Trailing comma not allowed. }; \ No newline at end of file diff --git a/tests/baselines/reference/ArrowFunction3.errors.txt b/tests/baselines/reference/ArrowFunction3.errors.txt index a1287eca881..b931fcb1cd8 100644 --- a/tests/baselines/reference/ArrowFunction3.errors.txt +++ b/tests/baselines/reference/ArrowFunction3.errors.txt @@ -1,12 +1,12 @@ -tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArrowFunctions/ArrowFunction3.ts(1,14): error TS1110: Type expected. tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArrowFunctions/ArrowFunction3.ts(1,13): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement. +tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArrowFunctions/ArrowFunction3.ts(1,14): error TS1110: Type expected. ==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArrowFunctions/ArrowFunction3.ts (2 errors) ==== var v = (a): => { - ~~ -!!! error TS1110: Type expected. !!! error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement. + ~~ +!!! error TS1110: Type expected. }; \ No newline at end of file diff --git a/tests/baselines/reference/FunctionDeclaration5_es6.errors.txt b/tests/baselines/reference/FunctionDeclaration5_es6.errors.txt index 9a8be921795..a2ac8381fe2 100644 --- a/tests/baselines/reference/FunctionDeclaration5_es6.errors.txt +++ b/tests/baselines/reference/FunctionDeclaration5_es6.errors.txt @@ -1,17 +1,17 @@ -tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration5_es6.ts(1,14): error TS1138: Parameter declaration expected. -tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration5_es6.ts(1,19): error TS1005: ';' expected. tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration5_es6.ts(1,10): error TS2391: Function implementation is missing or not immediately following the declaration. +tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration5_es6.ts(1,14): error TS1138: Parameter declaration expected. tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration5_es6.ts(1,14): error TS2304: Cannot find name 'yield'. +tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration5_es6.ts(1,19): error TS1005: ';' expected. ==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration5_es6.ts (4 errors) ==== function*foo(yield) { - ~~~~~ -!!! error TS1138: Parameter declaration expected. - ~ -!!! error TS1005: ';' expected. ~~~ !!! error TS2391: Function implementation is missing or not immediately following the declaration. ~~~~~ +!!! error TS1138: Parameter declaration expected. + ~~~~~ !!! error TS2304: Cannot find name 'yield'. + ~ +!!! error TS1005: ';' expected. } \ No newline at end of file diff --git a/tests/baselines/reference/MemberFunctionDeclaration6_es6.errors.txt b/tests/baselines/reference/MemberFunctionDeclaration6_es6.errors.txt index b79a61c8866..911e91b8193 100644 --- a/tests/baselines/reference/MemberFunctionDeclaration6_es6.errors.txt +++ b/tests/baselines/reference/MemberFunctionDeclaration6_es6.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration6_es6.ts(3,1): error TS1005: '(' expected. tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration6_es6.ts(2,5): error TS2391: Function implementation is missing or not immediately following the declaration. +tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration6_es6.ts(3,1): error TS1005: '(' expected. ==== tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration6_es6.ts (2 errors) ==== diff --git a/tests/baselines/reference/MemberFunctionDeclaration8_es6.errors.txt b/tests/baselines/reference/MemberFunctionDeclaration8_es6.errors.txt index a946c17ff71..b21af664a69 100644 --- a/tests/baselines/reference/MemberFunctionDeclaration8_es6.errors.txt +++ b/tests/baselines/reference/MemberFunctionDeclaration8_es6.errors.txt @@ -1,6 +1,6 @@ +tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration8_es6.ts(4,9): error TS2304: Cannot find name 'a'. tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration8_es6.ts(4,12): error TS1127: Invalid character. tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration8_es6.ts(4,14): error TS1109: Expression expected. -tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration8_es6.ts(4,9): error TS2304: Cannot find name 'a'. tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration8_es6.ts(4,16): error TS2304: Cannot find name 'bar'. tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration8_es6.ts(5,12): error TS2304: Cannot find name 'bar'. @@ -10,12 +10,12 @@ tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration foo() { // Make sure we don't think of *bar as the start of a generator method. if (a) # * bar; + ~ +!!! error TS2304: Cannot find name 'a'. !!! error TS1127: Invalid character. ~ !!! error TS1109: Expression expected. - ~ -!!! error TS2304: Cannot find name 'a'. ~~~ !!! error TS2304: Cannot find name 'bar'. return bar; diff --git a/tests/baselines/reference/TemplateExpression1.errors.txt b/tests/baselines/reference/TemplateExpression1.errors.txt index c13b0fabd54..aa3b1674bf8 100644 --- a/tests/baselines/reference/TemplateExpression1.errors.txt +++ b/tests/baselines/reference/TemplateExpression1.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/es6/templates/TemplateExpression1.ts(1,19): error TS1005: '}' expected. tests/cases/conformance/es6/templates/TemplateExpression1.ts(1,17): error TS2304: Cannot find name 'a'. +tests/cases/conformance/es6/templates/TemplateExpression1.ts(1,19): error TS1005: '}' expected. ==== tests/cases/conformance/es6/templates/TemplateExpression1.ts (2 errors) ==== var v = `foo ${ a - -!!! error TS1005: '}' expected. ~ -!!! error TS2304: Cannot find name 'a'. \ No newline at end of file +!!! error TS2304: Cannot find name 'a'. + +!!! error TS1005: '}' expected. \ No newline at end of file diff --git a/tests/baselines/reference/TypeArgumentList1.errors.txt b/tests/baselines/reference/TypeArgumentList1.errors.txt index 16550c3ed37..4138f3f8cc5 100644 --- a/tests/baselines/reference/TypeArgumentList1.errors.txt +++ b/tests/baselines/reference/TypeArgumentList1.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/parser/ecmascript5/ErrorRecovery/TypeArgumentLists/TypeArgumentList1.ts(1,9): error TS1127: Invalid character. tests/cases/conformance/parser/ecmascript5/ErrorRecovery/TypeArgumentLists/TypeArgumentList1.ts(1,1): error TS2304: Cannot find name 'Foo'. +tests/cases/conformance/parser/ecmascript5/ErrorRecovery/TypeArgumentLists/TypeArgumentList1.ts(1,9): error TS1127: Invalid character. ==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/TypeArgumentLists/TypeArgumentList1.ts (2 errors) ==== Foo(4, 5, 6); - -!!! error TS1127: Invalid character. ~~~ -!!! error TS2304: Cannot find name 'Foo'. \ No newline at end of file +!!! error TS2304: Cannot find name 'Foo'. + +!!! error TS1127: Invalid character. \ No newline at end of file diff --git a/tests/baselines/reference/YieldExpression8_es6.errors.txt b/tests/baselines/reference/YieldExpression8_es6.errors.txt index 77bd03382aa..e8a4968fe1b 100644 --- a/tests/baselines/reference/YieldExpression8_es6.errors.txt +++ b/tests/baselines/reference/YieldExpression8_es6.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/es6/yieldExpressions/YieldExpression8_es6.ts(2,9): error TS9001: Generators are not currently supported. tests/cases/conformance/es6/yieldExpressions/YieldExpression8_es6.ts(1,1): error TS2304: Cannot find name 'yield'. +tests/cases/conformance/es6/yieldExpressions/YieldExpression8_es6.ts(2,9): error TS9001: Generators are not currently supported. ==== tests/cases/conformance/es6/yieldExpressions/YieldExpression8_es6.ts (2 errors) ==== diff --git a/tests/baselines/reference/accessorParameterAccessibilityModifier.errors.txt b/tests/baselines/reference/accessorParameterAccessibilityModifier.errors.txt index 401a0107d89..fad1d8ff10a 100644 --- a/tests/baselines/reference/accessorParameterAccessibilityModifier.errors.txt +++ b/tests/baselines/reference/accessorParameterAccessibilityModifier.errors.txt @@ -1,6 +1,6 @@ tests/cases/compiler/accessorParameterAccessibilityModifier.ts(3,9): error TS2369: A parameter property is only allowed in a constructor implementation. -tests/cases/compiler/accessorParameterAccessibilityModifier.ts(4,16): error TS2369: A parameter property is only allowed in a constructor implementation. tests/cases/compiler/accessorParameterAccessibilityModifier.ts(3,11): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/compiler/accessorParameterAccessibilityModifier.ts(4,16): error TS2369: A parameter property is only allowed in a constructor implementation. tests/cases/compiler/accessorParameterAccessibilityModifier.ts(4,18): error TS2369: A parameter property is only allowed in a constructor implementation. diff --git a/tests/baselines/reference/accessors_spec_section-4.5_error-cases.errors.txt b/tests/baselines/reference/accessors_spec_section-4.5_error-cases.errors.txt index 22fdeb099bc..981cb525625 100644 --- a/tests/baselines/reference/accessors_spec_section-4.5_error-cases.errors.txt +++ b/tests/baselines/reference/accessors_spec_section-4.5_error-cases.errors.txt @@ -1,15 +1,15 @@ tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(2,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(3,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(3,55): error TS2322: Type 'string' is not assignable to type 'number'. tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(5,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(5,54): error TS2322: Type 'string' is not assignable to type 'number'. tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(6,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(8,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(9,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(11,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(12,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(3,55): error TS2322: Type 'string' is not assignable to type 'number'. -tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(5,54): error TS2322: Type 'string' is not assignable to type 'number'. tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(9,52): error TS2322: Type 'number' is not assignable to type 'string'. +tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(11,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(11,51): error TS2322: Type 'number' is not assignable to type 'string'. +tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(12,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ==== tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts (12 errors) ==== diff --git a/tests/baselines/reference/aliasErrors.errors.txt b/tests/baselines/reference/aliasErrors.errors.txt index 20e68c5f800..a4c71fa9c5a 100644 --- a/tests/baselines/reference/aliasErrors.errors.txt +++ b/tests/baselines/reference/aliasErrors.errors.txt @@ -1,8 +1,8 @@ +tests/cases/compiler/aliasErrors.ts(11,1): error TS2304: Cannot find name 'no'. +tests/cases/compiler/aliasErrors.ts(12,1): error TS2304: Cannot find name 'no'. tests/cases/compiler/aliasErrors.ts(13,12): error TS1003: Identifier expected. tests/cases/compiler/aliasErrors.ts(14,12): error TS1003: Identifier expected. tests/cases/compiler/aliasErrors.ts(15,12): error TS1003: Identifier expected. -tests/cases/compiler/aliasErrors.ts(11,1): error TS2304: Cannot find name 'no'. -tests/cases/compiler/aliasErrors.ts(12,1): error TS2304: Cannot find name 'no'. tests/cases/compiler/aliasErrors.ts(16,1): error TS2304: Cannot find name 'undefined'. tests/cases/compiler/aliasErrors.ts(26,10): error TS2305: Module 'foo.bar.baz' has no exported member 'bar'. diff --git a/tests/baselines/reference/ambientErrors.errors.txt b/tests/baselines/reference/ambientErrors.errors.txt index 6fe7a25dfe9..c01b3316d44 100644 --- a/tests/baselines/reference/ambientErrors.errors.txt +++ b/tests/baselines/reference/ambientErrors.errors.txt @@ -1,4 +1,6 @@ tests/cases/conformance/ambient/ambientErrors.ts(2,15): error TS1039: Initializers are not allowed in ambient contexts. +tests/cases/conformance/ambient/ambientErrors.ts(6,1): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/conformance/ambient/ambientErrors.ts(17,22): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. tests/cases/conformance/ambient/ambientErrors.ts(20,24): error TS1037: A function implementation cannot be declared in an ambient context. tests/cases/conformance/ambient/ambientErrors.ts(24,5): error TS1066: Ambient enum elements can only have integer literal initializers. tests/cases/conformance/ambient/ambientErrors.ts(29,5): error TS1066: Ambient enum elements can only have integer literal initializers. @@ -9,8 +11,6 @@ tests/cases/conformance/ambient/ambientErrors.ts(38,13): error TS1039: Initializ tests/cases/conformance/ambient/ambientErrors.ts(39,23): error TS1111: A constructor implementation cannot be declared in an ambient context. tests/cases/conformance/ambient/ambientErrors.ts(40,14): error TS1037: A function implementation cannot be declared in an ambient context. tests/cases/conformance/ambient/ambientErrors.ts(41,22): error TS1037: A function implementation cannot be declared in an ambient context. -tests/cases/conformance/ambient/ambientErrors.ts(6,1): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/conformance/ambient/ambientErrors.ts(17,22): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. tests/cases/conformance/ambient/ambientErrors.ts(47,20): error TS2435: Ambient external modules cannot be nested in other modules. tests/cases/conformance/ambient/ambientErrors.ts(51,16): error TS2436: Ambient external module declaration cannot specify relative module name. tests/cases/conformance/ambient/ambientErrors.ts(57,5): error TS2309: An export assignment cannot be used in a module with other exported elements. diff --git a/tests/baselines/reference/ambientWithStatements.errors.txt b/tests/baselines/reference/ambientWithStatements.errors.txt index 4eef608bbec..2b592feb775 100644 --- a/tests/baselines/reference/ambientWithStatements.errors.txt +++ b/tests/baselines/reference/ambientWithStatements.errors.txt @@ -3,6 +3,7 @@ tests/cases/compiler/ambientWithStatements.ts(3,5): error TS1036: Statements are tests/cases/compiler/ambientWithStatements.ts(4,5): error TS1036: Statements are not allowed in ambient contexts. tests/cases/compiler/ambientWithStatements.ts(5,5): error TS1036: Statements are not allowed in ambient contexts. tests/cases/compiler/ambientWithStatements.ts(7,5): error TS1036: Statements are not allowed in ambient contexts. +tests/cases/compiler/ambientWithStatements.ts(7,15): error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. tests/cases/compiler/ambientWithStatements.ts(8,5): error TS1036: Statements are not allowed in ambient contexts. tests/cases/compiler/ambientWithStatements.ts(9,5): error TS1036: Statements are not allowed in ambient contexts. tests/cases/compiler/ambientWithStatements.ts(10,5): error TS1036: Statements are not allowed in ambient contexts. @@ -11,7 +12,6 @@ tests/cases/compiler/ambientWithStatements.ts(12,5): error TS1036: Statements ar tests/cases/compiler/ambientWithStatements.ts(18,5): error TS1036: Statements are not allowed in ambient contexts. tests/cases/compiler/ambientWithStatements.ts(19,5): error TS1036: Statements are not allowed in ambient contexts. tests/cases/compiler/ambientWithStatements.ts(25,5): error TS1036: Statements are not allowed in ambient contexts. -tests/cases/compiler/ambientWithStatements.ts(7,15): error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. tests/cases/compiler/ambientWithStatements.ts(25,11): error TS2410: All symbols within a 'with' block will be resolved to 'any'. diff --git a/tests/baselines/reference/ambiguousGenericAssertion1.errors.txt b/tests/baselines/reference/ambiguousGenericAssertion1.errors.txt index d97cdc95ac8..54b463109b1 100644 --- a/tests/baselines/reference/ambiguousGenericAssertion1.errors.txt +++ b/tests/baselines/reference/ambiguousGenericAssertion1.errors.txt @@ -1,8 +1,8 @@ tests/cases/compiler/ambiguousGenericAssertion1.ts(4,10): error TS1109: Expression expected. +tests/cases/compiler/ambiguousGenericAssertion1.ts(4,15): error TS2304: Cannot find name 'x'. tests/cases/compiler/ambiguousGenericAssertion1.ts(4,16): error TS1005: ')' expected. tests/cases/compiler/ambiguousGenericAssertion1.ts(4,19): error TS1005: ',' expected. tests/cases/compiler/ambiguousGenericAssertion1.ts(4,21): error TS1005: ';' expected. -tests/cases/compiler/ambiguousGenericAssertion1.ts(4,15): error TS2304: Cannot find name 'x'. ==== tests/cases/compiler/ambiguousGenericAssertion1.ts (5 errors) ==== @@ -12,12 +12,12 @@ tests/cases/compiler/ambiguousGenericAssertion1.ts(4,15): error TS2304: Cannot f var r3 = <(x: T) => T>f; // ambiguous, appears to the parser as a << operation ~~ !!! error TS1109: Expression expected. + ~ +!!! error TS2304: Cannot find name 'x'. ~ !!! error TS1005: ')' expected. ~ !!! error TS1005: ',' expected. ~~ !!! error TS1005: ';' expected. - ~ -!!! error TS2304: Cannot find name 'x'. \ No newline at end of file diff --git a/tests/baselines/reference/anonymousModules.errors.txt b/tests/baselines/reference/anonymousModules.errors.txt index 43b3d544a8b..eed6442692f 100644 --- a/tests/baselines/reference/anonymousModules.errors.txt +++ b/tests/baselines/reference/anonymousModules.errors.txt @@ -1,24 +1,24 @@ +tests/cases/compiler/anonymousModules.ts(1,1): error TS2304: Cannot find name 'module'. tests/cases/compiler/anonymousModules.ts(1,8): error TS1005: ';' expected. tests/cases/compiler/anonymousModules.ts(2,2): error TS1129: Statement expected. tests/cases/compiler/anonymousModules.ts(2,2): error TS1148: Cannot compile external modules unless the '--module' flag is provided. +tests/cases/compiler/anonymousModules.ts(4,2): error TS2304: Cannot find name 'module'. tests/cases/compiler/anonymousModules.ts(4,9): error TS1005: ';' expected. tests/cases/compiler/anonymousModules.ts(5,3): error TS1129: Statement expected. -tests/cases/compiler/anonymousModules.ts(6,2): error TS1128: Declaration or statement expected. -tests/cases/compiler/anonymousModules.ts(10,9): error TS1005: ';' expected. -tests/cases/compiler/anonymousModules.ts(13,1): error TS1128: Declaration or statement expected. -tests/cases/compiler/anonymousModules.ts(1,1): error TS2304: Cannot find name 'module'. -tests/cases/compiler/anonymousModules.ts(4,2): error TS2304: Cannot find name 'module'. tests/cases/compiler/anonymousModules.ts(5,14): error TS2395: Individual declarations in merged declaration bar must be all exported or all local. +tests/cases/compiler/anonymousModules.ts(6,2): error TS1128: Declaration or statement expected. tests/cases/compiler/anonymousModules.ts(8,6): error TS2395: Individual declarations in merged declaration bar must be all exported or all local. tests/cases/compiler/anonymousModules.ts(10,2): error TS2304: Cannot find name 'module'. +tests/cases/compiler/anonymousModules.ts(10,9): error TS1005: ';' expected. +tests/cases/compiler/anonymousModules.ts(13,1): error TS1128: Declaration or statement expected. ==== tests/cases/compiler/anonymousModules.ts (13 errors) ==== module { - ~ -!!! error TS1005: ';' expected. ~~~~~~ !!! error TS2304: Cannot find name 'module'. + ~ +!!! error TS1005: ';' expected. export var foo = 1; ~~~~~~ !!! error TS1129: Statement expected. @@ -26,10 +26,10 @@ tests/cases/compiler/anonymousModules.ts(10,2): error TS2304: Cannot find name ' !!! error TS1148: Cannot compile external modules unless the '--module' flag is provided. module { - ~ -!!! error TS1005: ';' expected. ~~~~~~ !!! error TS2304: Cannot find name 'module'. + ~ +!!! error TS1005: ';' expected. export var bar = 1; ~~~~~~ !!! error TS1129: Statement expected. @@ -44,10 +44,10 @@ tests/cases/compiler/anonymousModules.ts(10,2): error TS2304: Cannot find name ' !!! error TS2395: Individual declarations in merged declaration bar must be all exported or all local. module { - ~ -!!! error TS1005: ';' expected. ~~~~~~ !!! error TS2304: Cannot find name 'module'. + ~ +!!! error TS1005: ';' expected. var x = bar; } } diff --git a/tests/baselines/reference/anyIdenticalToItself.errors.txt b/tests/baselines/reference/anyIdenticalToItself.errors.txt index ea8583a6a75..6b82f3af73c 100644 --- a/tests/baselines/reference/anyIdenticalToItself.errors.txt +++ b/tests/baselines/reference/anyIdenticalToItself.errors.txt @@ -1,6 +1,6 @@ +tests/cases/compiler/anyIdenticalToItself.ts(1,1): error TS2394: Overload signature is not compatible with function implementation. tests/cases/compiler/anyIdenticalToItself.ts(6,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/anyIdenticalToItself.ts(10,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/anyIdenticalToItself.ts(1,1): error TS2394: Overload signature is not compatible with function implementation. ==== tests/cases/compiler/anyIdenticalToItself.ts (3 errors) ==== diff --git a/tests/baselines/reference/arrayTypeOfTypeOf.errors.txt b/tests/baselines/reference/arrayTypeOfTypeOf.errors.txt index 0d294461592..41446dfceab 100644 --- a/tests/baselines/reference/arrayTypeOfTypeOf.errors.txt +++ b/tests/baselines/reference/arrayTypeOfTypeOf.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayTypeOfTypeOf.ts(6,22): error TS1005: '=' expected. -tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayTypeOfTypeOf.ts(6,30): error TS1109: Expression expected. -tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayTypeOfTypeOf.ts(7,22): error TS1005: '=' expected. -tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayTypeOfTypeOf.ts(7,32): error TS1109: Expression expected. tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayTypeOfTypeOf.ts(6,5): error TS2322: Type 'number' is not assignable to type 'ArrayConstructor'. Property 'isArray' is missing in type 'Number'. +tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayTypeOfTypeOf.ts(6,22): error TS1005: '=' expected. +tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayTypeOfTypeOf.ts(6,30): error TS1109: Expression expected. tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayTypeOfTypeOf.ts(7,5): error TS2322: Type 'number' is not assignable to type 'ArrayConstructor'. +tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayTypeOfTypeOf.ts(7,22): error TS1005: '=' expected. +tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayTypeOfTypeOf.ts(7,32): error TS1109: Expression expected. ==== tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayTypeOfTypeOf.ts (6 errors) ==== @@ -14,17 +14,17 @@ tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayTypeOfTypeOf.ts( var xs: typeof x[]; // Not an error. This is equivalent to Array var xs2: typeof Array; var xs3: typeof Array; + ~~~ +!!! error TS2322: Type 'number' is not assignable to type 'ArrayConstructor'. +!!! error TS2322: Property 'isArray' is missing in type 'Number'. ~ !!! error TS1005: '=' expected. ~ !!! error TS1109: Expression expected. + var xs4: typeof Array; ~~~ !!! error TS2322: Type 'number' is not assignable to type 'ArrayConstructor'. -!!! error TS2322: Property 'isArray' is missing in type 'Number'. - var xs4: typeof Array; ~ !!! error TS1005: '=' expected. ~ -!!! error TS1109: Expression expected. - ~~~ -!!! error TS2322: Type 'number' is not assignable to type 'ArrayConstructor'. \ No newline at end of file +!!! error TS1109: Expression expected. \ No newline at end of file diff --git a/tests/baselines/reference/arrowFunctionsMissingTokens.errors.txt b/tests/baselines/reference/arrowFunctionsMissingTokens.errors.txt index 128e22d119e..ee87a6b8dd4 100644 --- a/tests/baselines/reference/arrowFunctionsMissingTokens.errors.txt +++ b/tests/baselines/reference/arrowFunctionsMissingTokens.errors.txt @@ -19,9 +19,9 @@ tests/cases/compiler/arrowFunctionsMissingTokens.ts(41,5): error TS1128: Declara tests/cases/compiler/arrowFunctionsMissingTokens.ts(42,1): error TS1128: Declaration or statement expected. tests/cases/compiler/arrowFunctionsMissingTokens.ts(45,14): error TS1109: Expression expected. tests/cases/compiler/arrowFunctionsMissingTokens.ts(47,21): error TS1005: '=>' expected. +tests/cases/compiler/arrowFunctionsMissingTokens.ts(49,14): error TS2304: Cannot find name 'x'. tests/cases/compiler/arrowFunctionsMissingTokens.ts(51,35): error TS1005: '=>' expected. tests/cases/compiler/arrowFunctionsMissingTokens.ts(53,41): error TS1005: '=>' expected. -tests/cases/compiler/arrowFunctionsMissingTokens.ts(49,14): error TS2304: Cannot find name 'x'. ==== tests/cases/compiler/arrowFunctionsMissingTokens.ts (24 errors) ==== diff --git a/tests/baselines/reference/assertInWrapSomeTypeParameter.errors.txt b/tests/baselines/reference/assertInWrapSomeTypeParameter.errors.txt index f9019661fb5..c5492e42e42 100644 --- a/tests/baselines/reference/assertInWrapSomeTypeParameter.errors.txt +++ b/tests/baselines/reference/assertInWrapSomeTypeParameter.errors.txt @@ -1,5 +1,5 @@ -tests/cases/compiler/assertInWrapSomeTypeParameter.ts(2,26): error TS1005: '>' expected. tests/cases/compiler/assertInWrapSomeTypeParameter.ts(1,9): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. +tests/cases/compiler/assertInWrapSomeTypeParameter.ts(2,26): error TS1005: '>' expected. ==== tests/cases/compiler/assertInWrapSomeTypeParameter.ts (2 errors) ==== diff --git a/tests/baselines/reference/assignmentLHSIsValue.errors.txt b/tests/baselines/reference/assignmentLHSIsValue.errors.txt index f019bfdf6ca..cf747b44b3e 100644 --- a/tests/baselines/reference/assignmentLHSIsValue.errors.txt +++ b/tests/baselines/reference/assignmentLHSIsValue.errors.txt @@ -1,9 +1,3 @@ -tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(35,9): error TS1128: Declaration or statement expected. -tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(42,36): error TS1034: 'super' must be followed by an argument list or member access. -tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(44,19): error TS1034: 'super' must be followed by an argument list or member access. -tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(46,27): error TS1034: 'super' must be followed by an argument list or member access. -tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(50,20): error TS1128: Declaration or statement expected. -tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(51,11): error TS1005: ';' expected. tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(6,21): error TS2364: Invalid left-hand side of assignment expression. tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(7,13): error TS2364: Invalid left-hand side of assignment expression. tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(8,21): error TS2364: Invalid left-hand side of assignment expression. @@ -19,8 +13,14 @@ tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(2 tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(30,1): error TS2364: Invalid left-hand side of assignment expression. tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(31,1): error TS2364: Invalid left-hand side of assignment expression. tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(32,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(35,9): error TS1128: Declaration or statement expected. tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(38,2): error TS2364: Invalid left-hand side of assignment expression. tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(38,6): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(42,36): error TS1034: 'super' must be followed by an argument list or member access. +tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(44,19): error TS1034: 'super' must be followed by an argument list or member access. +tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(46,27): error TS1034: 'super' must be followed by an argument list or member access. +tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(50,20): error TS1128: Declaration or statement expected. +tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(51,11): error TS1005: ';' expected. tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(54,1): error TS2364: Invalid left-hand side of assignment expression. tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(57,1): error TS2364: Invalid left-hand side of assignment expression. tests/cases/conformance/expressions/assignmentOperator/assignmentLHSIsValue.ts(58,1): error TS2364: Invalid left-hand side of assignment expression. diff --git a/tests/baselines/reference/autoLift2.errors.txt b/tests/baselines/reference/autoLift2.errors.txt index dbe9e98cd63..9af3d59420f 100644 --- a/tests/baselines/reference/autoLift2.errors.txt +++ b/tests/baselines/reference/autoLift2.errors.txt @@ -1,8 +1,8 @@ -tests/cases/compiler/autoLift2.ts(5,17): error TS1005: ';' expected. -tests/cases/compiler/autoLift2.ts(6,17): error TS1005: ';' expected. tests/cases/compiler/autoLift2.ts(5,14): error TS2339: Property 'foo' does not exist on type 'A'. +tests/cases/compiler/autoLift2.ts(5,17): error TS1005: ';' expected. tests/cases/compiler/autoLift2.ts(5,19): error TS2304: Cannot find name 'any'. tests/cases/compiler/autoLift2.ts(6,14): error TS2339: Property 'bar' does not exist on type 'A'. +tests/cases/compiler/autoLift2.ts(6,17): error TS1005: ';' expected. tests/cases/compiler/autoLift2.ts(6,19): error TS2304: Cannot find name 'any'. tests/cases/compiler/autoLift2.ts(12,11): error TS2339: Property 'foo' does not exist on type 'A'. tests/cases/compiler/autoLift2.ts(14,11): error TS2339: Property 'bar' does not exist on type 'A'. @@ -16,17 +16,17 @@ tests/cases/compiler/autoLift2.ts(18,33): error TS2339: Property 'bar' does not { constructor() { this.foo: any; - ~ -!!! error TS1005: ';' expected. ~~~ !!! error TS2339: Property 'foo' does not exist on type 'A'. + ~ +!!! error TS1005: ';' expected. ~~~ !!! error TS2304: Cannot find name 'any'. this.bar: any; - ~ -!!! error TS1005: ';' expected. ~~~ !!! error TS2339: Property 'bar' does not exist on type 'A'. + ~ +!!! error TS1005: ';' expected. ~~~ !!! error TS2304: Cannot find name 'any'. } diff --git a/tests/baselines/reference/badArrayIndex.errors.txt b/tests/baselines/reference/badArrayIndex.errors.txt index 818870f6c26..4830ff1f693 100644 --- a/tests/baselines/reference/badArrayIndex.errors.txt +++ b/tests/baselines/reference/badArrayIndex.errors.txt @@ -1,10 +1,10 @@ -tests/cases/compiler/badArrayIndex.ts(1,22): error TS1109: Expression expected. tests/cases/compiler/badArrayIndex.ts(1,15): error TS2304: Cannot find name 'number'. +tests/cases/compiler/badArrayIndex.ts(1,22): error TS1109: Expression expected. ==== tests/cases/compiler/badArrayIndex.ts (2 errors) ==== var results = number[]; - ~ -!!! error TS1109: Expression expected. ~~~~~~ -!!! error TS2304: Cannot find name 'number'. \ No newline at end of file +!!! error TS2304: Cannot find name 'number'. + ~ +!!! error TS1109: Expression expected. \ No newline at end of file diff --git a/tests/baselines/reference/bases.errors.txt b/tests/baselines/reference/bases.errors.txt index c9eabafaf80..c03a47d7532 100644 --- a/tests/baselines/reference/bases.errors.txt +++ b/tests/baselines/reference/bases.errors.txt @@ -1,11 +1,11 @@ -tests/cases/compiler/bases.ts(7,15): error TS1005: ';' expected. -tests/cases/compiler/bases.ts(13,15): error TS1005: ';' expected. tests/cases/compiler/bases.ts(7,14): error TS2339: Property 'y' does not exist on type 'B'. +tests/cases/compiler/bases.ts(7,15): error TS1005: ';' expected. tests/cases/compiler/bases.ts(7,17): error TS2304: Cannot find name 'any'. tests/cases/compiler/bases.ts(11,7): error TS2420: Class 'C' incorrectly implements interface 'I'. Property 'x' is missing in type 'C'. tests/cases/compiler/bases.ts(12,5): error TS2377: Constructors for derived classes must contain a 'super' call. tests/cases/compiler/bases.ts(13,14): error TS2339: Property 'x' does not exist on type 'C'. +tests/cases/compiler/bases.ts(13,15): error TS1005: ';' expected. tests/cases/compiler/bases.ts(13,17): error TS2304: Cannot find name 'any'. tests/cases/compiler/bases.ts(17,9): error TS2339: Property 'x' does not exist on type 'C'. tests/cases/compiler/bases.ts(18,9): error TS2339: Property 'y' does not exist on type 'C'. @@ -19,10 +19,10 @@ tests/cases/compiler/bases.ts(18,9): error TS2339: Property 'y' does not exist o class B { constructor() { this.y: any; - ~ -!!! error TS1005: ';' expected. ~ !!! error TS2339: Property 'y' does not exist on type 'B'. + ~ +!!! error TS1005: ';' expected. ~~~ !!! error TS2304: Cannot find name 'any'. } @@ -35,11 +35,11 @@ tests/cases/compiler/bases.ts(18,9): error TS2339: Property 'y' does not exist o constructor() { ~~~~~~~~~~~~~~~ this.x: any; - ~ -!!! error TS1005: ';' expected. ~~~~~~~~~~~~~~~~~~~~ ~ !!! error TS2339: Property 'x' does not exist on type 'C'. + ~ +!!! error TS1005: ';' expected. ~~~ !!! error TS2304: Cannot find name 'any'. } diff --git a/tests/baselines/reference/callExpressionWithMissingTypeArgument1.errors.txt b/tests/baselines/reference/callExpressionWithMissingTypeArgument1.errors.txt index c7005ffcc22..aef540d958a 100644 --- a/tests/baselines/reference/callExpressionWithMissingTypeArgument1.errors.txt +++ b/tests/baselines/reference/callExpressionWithMissingTypeArgument1.errors.txt @@ -1,10 +1,10 @@ -tests/cases/compiler/callExpressionWithMissingTypeArgument1.ts(1,7): error TS1110: Type expected. tests/cases/compiler/callExpressionWithMissingTypeArgument1.ts(1,1): error TS2304: Cannot find name 'Foo'. +tests/cases/compiler/callExpressionWithMissingTypeArgument1.ts(1,7): error TS1110: Type expected. ==== tests/cases/compiler/callExpressionWithMissingTypeArgument1.ts (2 errors) ==== Foo(); - ~ -!!! error TS1110: Type expected. ~~~ -!!! error TS2304: Cannot find name 'Foo'. \ No newline at end of file +!!! error TS2304: Cannot find name 'Foo'. + ~ +!!! error TS1110: Type expected. \ No newline at end of file diff --git a/tests/baselines/reference/callSignatureWithOptionalParameterAndInitializer.errors.txt b/tests/baselines/reference/callSignatureWithOptionalParameterAndInitializer.errors.txt index 35718ca9612..63a63309c31 100644 --- a/tests/baselines/reference/callSignatureWithOptionalParameterAndInitializer.errors.txt +++ b/tests/baselines/reference/callSignatureWithOptionalParameterAndInitializer.errors.txt @@ -3,17 +3,17 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWith tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(5,22): error TS1015: Parameter cannot have question mark and initializer. tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(15,9): error TS1015: Parameter cannot have question mark and initializer. tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(23,6): error TS1015: Parameter cannot have question mark and initializer. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(23,6): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(24,20): error TS1015: Parameter cannot have question mark and initializer. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(24,20): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(34,6): error TS1015: Parameter cannot have question mark and initializer. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(34,6): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(35,9): error TS1015: Parameter cannot have question mark and initializer. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(35,9): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(44,9): error TS1015: Parameter cannot have question mark and initializer. tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(45,32): error TS1015: Parameter cannot have question mark and initializer. -tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(46,9): error TS1015: Parameter cannot have question mark and initializer. -tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(23,6): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. -tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(24,20): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. -tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(34,6): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. -tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(35,9): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(45,32): error TS2322: Type 'string' is not assignable to type 'number'. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(46,9): error TS1015: Parameter cannot have question mark and initializer. ==== tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts (16 errors) ==== diff --git a/tests/baselines/reference/callSignaturesWithParameterInitializers2.errors.txt b/tests/baselines/reference/callSignaturesWithParameterInitializers2.errors.txt index 1801bd42e4d..2d3dc55dcec 100644 --- a/tests/baselines/reference/callSignaturesWithParameterInitializers2.errors.txt +++ b/tests/baselines/reference/callSignaturesWithParameterInitializers2.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithParameterInitializers2.ts(20,15): error TS1005: '{' expected. tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithParameterInitializers2.ts(4,14): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithParameterInitializers2.ts(11,9): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithParameterInitializers2.ts(20,5): error TS2300: Duplicate identifier 'foo'. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithParameterInitializers2.ts(20,15): error TS1005: '{' expected. tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithParameterInitializers2.ts(21,5): error TS2300: Duplicate identifier 'foo'. @@ -30,10 +30,10 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWit var b = { foo(x = 1), // error - ~ -!!! error TS1005: '{' expected. ~~~ !!! error TS2300: Duplicate identifier 'foo'. + ~ +!!! error TS1005: '{' expected. foo(x = 1) { }, // error ~~~ !!! error TS2300: Duplicate identifier 'foo'. diff --git a/tests/baselines/reference/cannotInvokeNewOnErrorExpression.errors.txt b/tests/baselines/reference/cannotInvokeNewOnErrorExpression.errors.txt index cfb9287cdbc..fab981a8571 100644 --- a/tests/baselines/reference/cannotInvokeNewOnErrorExpression.errors.txt +++ b/tests/baselines/reference/cannotInvokeNewOnErrorExpression.errors.txt @@ -1,5 +1,5 @@ -tests/cases/compiler/cannotInvokeNewOnErrorExpression.ts(5,21): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. tests/cases/compiler/cannotInvokeNewOnErrorExpression.ts(5,15): error TS2339: Property 'ClassA' does not exist on type 'typeof M'. +tests/cases/compiler/cannotInvokeNewOnErrorExpression.ts(5,21): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. ==== tests/cases/compiler/cannotInvokeNewOnErrorExpression.ts (2 errors) ==== @@ -8,7 +8,7 @@ tests/cases/compiler/cannotInvokeNewOnErrorExpression.ts(5,15): error TS2339: Pr class ClassA {} } var t = new M.ClassA[]; - ~~ -!!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. ~~~~~~ -!!! error TS2339: Property 'ClassA' does not exist on type 'typeof M'. \ No newline at end of file +!!! error TS2339: Property 'ClassA' does not exist on type 'typeof M'. + ~~ +!!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. \ No newline at end of file diff --git a/tests/baselines/reference/classExpression.errors.txt b/tests/baselines/reference/classExpression.errors.txt index 5a2bc4fd179..f5028814acc 100644 --- a/tests/baselines/reference/classExpression.errors.txt +++ b/tests/baselines/reference/classExpression.errors.txt @@ -1,10 +1,10 @@ tests/cases/conformance/classes/classExpression.ts(1,9): error TS1109: Expression expected. tests/cases/conformance/classes/classExpression.ts(5,10): error TS1109: Expression expected. tests/cases/conformance/classes/classExpression.ts(5,16): error TS1005: ':' expected. +tests/cases/conformance/classes/classExpression.ts(5,16): error TS2304: Cannot find name 'C2'. tests/cases/conformance/classes/classExpression.ts(5,19): error TS1005: ',' expected. tests/cases/conformance/classes/classExpression.ts(7,1): error TS1128: Declaration or statement expected. tests/cases/conformance/classes/classExpression.ts(10,13): error TS1109: Expression expected. -tests/cases/conformance/classes/classExpression.ts(5,16): error TS2304: Cannot find name 'C2'. ==== tests/cases/conformance/classes/classExpression.ts (7 errors) ==== @@ -19,10 +19,10 @@ tests/cases/conformance/classes/classExpression.ts(5,16): error TS2304: Cannot f !!! error TS1109: Expression expected. ~~ !!! error TS1005: ':' expected. - ~ -!!! error TS1005: ',' expected. ~~ !!! error TS2304: Cannot find name 'C2'. + ~ +!!! error TS1005: ',' expected. } } ~ diff --git a/tests/baselines/reference/classExtendingPrimitive.errors.txt b/tests/baselines/reference/classExtendingPrimitive.errors.txt index b27f1bc29d5..d46439eba1c 100644 --- a/tests/baselines/reference/classExtendingPrimitive.errors.txt +++ b/tests/baselines/reference/classExtendingPrimitive.errors.txt @@ -1,11 +1,11 @@ -tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(7,19): error TS1133: Type reference expected. -tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(9,19): error TS1133: Type reference expected. -tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(9,24): error TS1005: ';' expected. tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(3,17): error TS2304: Cannot find name 'number'. tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(4,18): error TS2304: Cannot find name 'string'. tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(5,18): error TS2304: Cannot find name 'boolean'. tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(6,18): error TS2304: Cannot find name 'Void'. +tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(7,19): error TS1133: Type reference expected. tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(8,18): error TS2304: Cannot find name 'Null'. +tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(9,19): error TS1133: Type reference expected. +tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(9,24): error TS1005: ';' expected. tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(10,18): error TS2304: Cannot find name 'undefined'. tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(11,18): error TS2304: Cannot find name 'Undefined'. tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(14,18): error TS2311: A class may only extend another class. diff --git a/tests/baselines/reference/classExtendsEveryObjectType.errors.txt b/tests/baselines/reference/classExtendsEveryObjectType.errors.txt index 031caf19e26..f1870d71391 100644 --- a/tests/baselines/reference/classExtendsEveryObjectType.errors.txt +++ b/tests/baselines/reference/classExtendsEveryObjectType.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType.ts(16,18): error TS1133: Type reference expected. -tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType.ts(16,20): error TS1005: ';' expected. tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType.ts(4,17): error TS2311: A class may only extend another class. tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType.ts(8,18): error TS2304: Cannot find name 'x'. tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType.ts(11,18): error TS2304: Cannot find name 'M'. tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType.ts(14,18): error TS2304: Cannot find name 'foo'. +tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType.ts(16,18): error TS1133: Type reference expected. +tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType.ts(16,20): error TS1005: ';' expected. ==== tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType.ts (6 errors) ==== diff --git a/tests/baselines/reference/classUpdateTests.errors.txt b/tests/baselines/reference/classUpdateTests.errors.txt index 6bfd7518855..5d5c4a36ab3 100644 --- a/tests/baselines/reference/classUpdateTests.errors.txt +++ b/tests/baselines/reference/classUpdateTests.errors.txt @@ -1,9 +1,3 @@ -tests/cases/compiler/classUpdateTests.ts(93,3): error TS1129: Statement expected. -tests/cases/compiler/classUpdateTests.ts(95,1): error TS1128: Declaration or statement expected. -tests/cases/compiler/classUpdateTests.ts(99,3): error TS1129: Statement expected. -tests/cases/compiler/classUpdateTests.ts(101,1): error TS1128: Declaration or statement expected. -tests/cases/compiler/classUpdateTests.ts(105,3): error TS1129: Statement expected. -tests/cases/compiler/classUpdateTests.ts(111,3): error TS1129: Statement expected. tests/cases/compiler/classUpdateTests.ts(34,2): error TS2377: Constructors for derived classes must contain a 'super' call. tests/cases/compiler/classUpdateTests.ts(43,18): error TS2335: 'super' can only be referenced in a derived class. tests/cases/compiler/classUpdateTests.ts(46,17): error TS2311: A class may only extend another class. @@ -14,7 +8,13 @@ tests/cases/compiler/classUpdateTests.ts(63,7): error TS2415: Class 'L' incorrec tests/cases/compiler/classUpdateTests.ts(69,7): error TS2415: Class 'M' incorrectly extends base class 'G'. Property 'p1' is private in type 'M' but not in type 'G'. tests/cases/compiler/classUpdateTests.ts(70,2): error TS2376: A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties. +tests/cases/compiler/classUpdateTests.ts(93,3): error TS1129: Statement expected. +tests/cases/compiler/classUpdateTests.ts(95,1): error TS1128: Declaration or statement expected. +tests/cases/compiler/classUpdateTests.ts(99,3): error TS1129: Statement expected. +tests/cases/compiler/classUpdateTests.ts(101,1): error TS1128: Declaration or statement expected. +tests/cases/compiler/classUpdateTests.ts(105,3): error TS1129: Statement expected. tests/cases/compiler/classUpdateTests.ts(105,15): error TS2339: Property 'p1' does not exist on type 'Q'. +tests/cases/compiler/classUpdateTests.ts(111,3): error TS1129: Statement expected. tests/cases/compiler/classUpdateTests.ts(111,16): error TS2339: Property 'p1' does not exist on type 'R'. diff --git a/tests/baselines/reference/collisionSuperAndLocalFunctionInAccessors.errors.txt b/tests/baselines/reference/collisionSuperAndLocalFunctionInAccessors.errors.txt index 15ad1e0e8e7..6a459b222c7 100644 --- a/tests/baselines/reference/collisionSuperAndLocalFunctionInAccessors.errors.txt +++ b/tests/baselines/reference/collisionSuperAndLocalFunctionInAccessors.errors.txt @@ -1,12 +1,12 @@ tests/cases/compiler/collisionSuperAndLocalFunctionInAccessors.ts(4,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/collisionSuperAndLocalFunctionInAccessors.ts(9,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/collisionSuperAndLocalFunctionInAccessors.ts(15,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/collisionSuperAndLocalFunctionInAccessors.ts(20,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/collisionSuperAndLocalFunctionInAccessors.ts(26,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/collisionSuperAndLocalFunctionInAccessors.ts(33,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/collisionSuperAndLocalFunctionInAccessors.ts(16,9): error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. +tests/cases/compiler/collisionSuperAndLocalFunctionInAccessors.ts(20,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/collisionSuperAndLocalFunctionInAccessors.ts(21,9): error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. +tests/cases/compiler/collisionSuperAndLocalFunctionInAccessors.ts(26,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/collisionSuperAndLocalFunctionInAccessors.ts(28,13): error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. +tests/cases/compiler/collisionSuperAndLocalFunctionInAccessors.ts(33,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/collisionSuperAndLocalFunctionInAccessors.ts(35,13): error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. diff --git a/tests/baselines/reference/collisionSuperAndLocalVarInAccessors.errors.txt b/tests/baselines/reference/collisionSuperAndLocalVarInAccessors.errors.txt index 47c52c2582e..7e0f80f0658 100644 --- a/tests/baselines/reference/collisionSuperAndLocalVarInAccessors.errors.txt +++ b/tests/baselines/reference/collisionSuperAndLocalVarInAccessors.errors.txt @@ -1,12 +1,12 @@ tests/cases/compiler/collisionSuperAndLocalVarInAccessors.ts(3,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/collisionSuperAndLocalVarInAccessors.ts(7,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/collisionSuperAndLocalVarInAccessors.ts(12,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/collisionSuperAndLocalVarInAccessors.ts(16,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/collisionSuperAndLocalVarInAccessors.ts(21,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/collisionSuperAndLocalVarInAccessors.ts(27,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/collisionSuperAndLocalVarInAccessors.ts(13,13): error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. +tests/cases/compiler/collisionSuperAndLocalVarInAccessors.ts(16,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/collisionSuperAndLocalVarInAccessors.ts(17,13): error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. +tests/cases/compiler/collisionSuperAndLocalVarInAccessors.ts(21,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/collisionSuperAndLocalVarInAccessors.ts(23,17): error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. +tests/cases/compiler/collisionSuperAndLocalVarInAccessors.ts(27,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/collisionSuperAndLocalVarInAccessors.ts(29,17): error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. diff --git a/tests/baselines/reference/collisionSuperAndParameter.errors.txt b/tests/baselines/reference/collisionSuperAndParameter.errors.txt index b3dcdbf1be8..65dddd95d48 100644 --- a/tests/baselines/reference/collisionSuperAndParameter.errors.txt +++ b/tests/baselines/reference/collisionSuperAndParameter.errors.txt @@ -1,7 +1,7 @@ tests/cases/compiler/collisionSuperAndParameter.ts(12,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/collisionSuperAndParameter.ts(26,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/collisionSuperAndParameter.ts(17,22): error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. tests/cases/compiler/collisionSuperAndParameter.ts(21,7): error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. +tests/cases/compiler/collisionSuperAndParameter.ts(26,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/collisionSuperAndParameter.ts(26,11): error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. tests/cases/compiler/collisionSuperAndParameter.ts(32,19): error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. tests/cases/compiler/collisionSuperAndParameter.ts(35,17): error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. diff --git a/tests/baselines/reference/collisionThisExpressionAndLocalVarInAccessors.errors.txt b/tests/baselines/reference/collisionThisExpressionAndLocalVarInAccessors.errors.txt index 951a349be2b..cbe371c5934 100644 --- a/tests/baselines/reference/collisionThisExpressionAndLocalVarInAccessors.errors.txt +++ b/tests/baselines/reference/collisionThisExpressionAndLocalVarInAccessors.errors.txt @@ -1,10 +1,10 @@ tests/cases/compiler/collisionThisExpressionAndLocalVarInAccessors.ts(2,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/collisionThisExpressionAndLocalVarInAccessors.ts(12,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/collisionThisExpressionAndLocalVarInAccessors.ts(24,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/collisionThisExpressionAndLocalVarInAccessors.ts(34,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/collisionThisExpressionAndLocalVarInAccessors.ts(5,21): error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. +tests/cases/compiler/collisionThisExpressionAndLocalVarInAccessors.ts(12,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/collisionThisExpressionAndLocalVarInAccessors.ts(15,21): error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. +tests/cases/compiler/collisionThisExpressionAndLocalVarInAccessors.ts(24,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/collisionThisExpressionAndLocalVarInAccessors.ts(25,13): error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. +tests/cases/compiler/collisionThisExpressionAndLocalVarInAccessors.ts(34,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/collisionThisExpressionAndLocalVarInAccessors.ts(35,13): error TS2399: Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference. diff --git a/tests/baselines/reference/compoundAssignmentLHSIsValue.errors.txt b/tests/baselines/reference/compoundAssignmentLHSIsValue.errors.txt index af662869b5b..7b26fc4bf9e 100644 --- a/tests/baselines/reference/compoundAssignmentLHSIsValue.errors.txt +++ b/tests/baselines/reference/compoundAssignmentLHSIsValue.errors.txt @@ -1,15 +1,3 @@ -tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(58,9): error TS1128: Declaration or statement expected. -tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(59,9): error TS1128: Declaration or statement expected. -tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(69,15): error TS1034: 'super' must be followed by an argument list or member access. -tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(70,15): error TS1034: 'super' must be followed by an argument list or member access. -tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(74,15): error TS1034: 'super' must be followed by an argument list or member access. -tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(75,15): error TS1034: 'super' must be followed by an argument list or member access. -tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(79,15): error TS1034: 'super' must be followed by an argument list or member access. -tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(80,15): error TS1034: 'super' must be followed by an argument list or member access. -tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(85,21): error TS1128: Declaration or statement expected. -tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(86,21): error TS1128: Declaration or statement expected. -tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(87,11): error TS1005: ';' expected. -tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(88,11): error TS1005: ';' expected. tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(7,9): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(8,9): error TS2364: Invalid left-hand side of assignment expression. tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(11,9): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. @@ -40,8 +28,20 @@ tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsVa tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(53,1): error TS2364: Invalid left-hand side of assignment expression. tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(54,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(55,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(58,9): error TS1128: Declaration or statement expected. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(59,9): error TS1128: Declaration or statement expected. tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(62,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(63,1): error TS2364: Invalid left-hand side of assignment expression. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(69,15): error TS1034: 'super' must be followed by an argument list or member access. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(70,15): error TS1034: 'super' must be followed by an argument list or member access. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(74,15): error TS1034: 'super' must be followed by an argument list or member access. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(75,15): error TS1034: 'super' must be followed by an argument list or member access. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(79,15): error TS1034: 'super' must be followed by an argument list or member access. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(80,15): error TS1034: 'super' must be followed by an argument list or member access. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(85,21): error TS1128: Declaration or statement expected. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(86,21): error TS1128: Declaration or statement expected. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(87,11): error TS1005: ';' expected. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(88,11): error TS1005: ';' expected. tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(91,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(92,1): error TS2364: Invalid left-hand side of assignment expression. tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(95,1): error TS2364: Invalid left-hand side of assignment expression. diff --git a/tests/baselines/reference/computedPropertyNames2.errors.txt b/tests/baselines/reference/computedPropertyNames2.errors.txt index e7cc84a8f6e..3dd4ac01d5f 100644 --- a/tests/baselines/reference/computedPropertyNames2.errors.txt +++ b/tests/baselines/reference/computedPropertyNames2.errors.txt @@ -1,11 +1,11 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts(4,5): error TS9002: Computed property names are not currently supported. tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts(5,12): error TS9002: Computed property names are not currently supported. +tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts(6,9): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts(6,9): error TS9002: Computed property names are not currently supported. tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts(7,9): error TS9002: Computed property names are not currently supported. +tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts(8,16): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts(8,16): error TS9002: Computed property names are not currently supported. tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts(9,16): error TS9002: Computed property names are not currently supported. -tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts(6,9): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. -tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts(8,16): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. ==== tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts (8 errors) ==== @@ -20,17 +20,17 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts(8,16): !!! error TS9002: Computed property names are not currently supported. get [accessorName]() { } ~~~~~~~~~~~~~~ -!!! error TS9002: Computed property names are not currently supported. - ~~~~~~~~~~~~~~ !!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. + ~~~~~~~~~~~~~~ +!!! error TS9002: Computed property names are not currently supported. set [accessorName](v) { } ~~~~~~~~~~~~~~ !!! error TS9002: Computed property names are not currently supported. static get [accessorName]() { } ~~~~~~~~~~~~~~ -!!! error TS9002: Computed property names are not currently supported. - ~~~~~~~~~~~~~~ !!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. + ~~~~~~~~~~~~~~ +!!! error TS9002: Computed property names are not currently supported. static set [accessorName](v) { } ~~~~~~~~~~~~~~ !!! error TS9002: Computed property names are not currently supported. diff --git a/tests/baselines/reference/computedPropertyNames3.errors.txt b/tests/baselines/reference/computedPropertyNames3.errors.txt index a1d6e09421b..084a1f8889f 100644 --- a/tests/baselines/reference/computedPropertyNames3.errors.txt +++ b/tests/baselines/reference/computedPropertyNames3.errors.txt @@ -1,11 +1,11 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(3,5): error TS9002: Computed property names are not currently supported. tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(4,12): error TS9002: Computed property names are not currently supported. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(5,9): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(5,9): error TS9002: Computed property names are not currently supported. tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(6,9): error TS9002: Computed property names are not currently supported. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(7,16): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(7,16): error TS9002: Computed property names are not currently supported. tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(8,16): error TS9002: Computed property names are not currently supported. -tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(5,9): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. -tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(7,16): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. ==== tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts (8 errors) ==== @@ -19,17 +19,17 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(7,16): !!! error TS9002: Computed property names are not currently supported. get [delete id]() { } ~~~~~~~~~~~ -!!! error TS9002: Computed property names are not currently supported. - ~~~~~~~~~~~ !!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. + ~~~~~~~~~~~ +!!! error TS9002: Computed property names are not currently supported. set [[0, 1]](v) { } ~~~~~~~~ !!! error TS9002: Computed property names are not currently supported. static get [""]() { } ~~~~~~~~~~~~ -!!! error TS9002: Computed property names are not currently supported. - ~~~~~~~~~~~~ !!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. + ~~~~~~~~~~~~ +!!! error TS9002: Computed property names are not currently supported. static set [id.toString()](v) { } ~~~~~~~~~~~~~~~ !!! error TS9002: Computed property names are not currently supported. diff --git a/tests/baselines/reference/conflictMarkerTrivia1.errors.txt b/tests/baselines/reference/conflictMarkerTrivia1.errors.txt index 79513821a00..06303378417 100644 --- a/tests/baselines/reference/conflictMarkerTrivia1.errors.txt +++ b/tests/baselines/reference/conflictMarkerTrivia1.errors.txt @@ -1,8 +1,8 @@ tests/cases/compiler/conflictMarkerTrivia1.ts(2,1): error TS1184: Merge conflict marker encountered. -tests/cases/compiler/conflictMarkerTrivia1.ts(4,1): error TS1184: Merge conflict marker encountered. -tests/cases/compiler/conflictMarkerTrivia1.ts(6,1): error TS1184: Merge conflict marker encountered. tests/cases/compiler/conflictMarkerTrivia1.ts(3,5): error TS2300: Duplicate identifier 'v'. +tests/cases/compiler/conflictMarkerTrivia1.ts(4,1): error TS1184: Merge conflict marker encountered. tests/cases/compiler/conflictMarkerTrivia1.ts(5,5): error TS2300: Duplicate identifier 'v'. +tests/cases/compiler/conflictMarkerTrivia1.ts(6,1): error TS1184: Merge conflict marker encountered. ==== tests/cases/compiler/conflictMarkerTrivia1.ts (5 errors) ==== diff --git a/tests/baselines/reference/constDeclarations-errors.errors.txt b/tests/baselines/reference/constDeclarations-errors.errors.txt index d87007474a1..c0ae6635c5e 100644 --- a/tests/baselines/reference/constDeclarations-errors.errors.txt +++ b/tests/baselines/reference/constDeclarations-errors.errors.txt @@ -5,9 +5,9 @@ tests/cases/compiler/constDeclarations-errors.ts(5,11): error TS1155: 'const' de tests/cases/compiler/constDeclarations-errors.ts(5,15): error TS1155: 'const' declarations must be initialized tests/cases/compiler/constDeclarations-errors.ts(5,27): error TS1155: 'const' declarations must be initialized tests/cases/compiler/constDeclarations-errors.ts(8,11): error TS1155: 'const' declarations must be initialized +tests/cases/compiler/constDeclarations-errors.ts(11,27): error TS2449: The operand of an increment or decrement operator cannot be a constant. tests/cases/compiler/constDeclarations-errors.ts(14,11): error TS1155: 'const' declarations must be initialized tests/cases/compiler/constDeclarations-errors.ts(17,20): error TS1155: 'const' declarations must be initialized -tests/cases/compiler/constDeclarations-errors.ts(11,27): error TS2449: The operand of an increment or decrement operator cannot be a constant. ==== tests/cases/compiler/constDeclarations-errors.ts (10 errors) ==== diff --git a/tests/baselines/reference/constDeclarations-invalidContexts.errors.txt b/tests/baselines/reference/constDeclarations-invalidContexts.errors.txt index 745ef305ac6..930f2d8d813 100644 --- a/tests/baselines/reference/constDeclarations-invalidContexts.errors.txt +++ b/tests/baselines/reference/constDeclarations-invalidContexts.errors.txt @@ -2,12 +2,12 @@ tests/cases/compiler/constDeclarations-invalidContexts.ts(4,5): error TS1156: 'c tests/cases/compiler/constDeclarations-invalidContexts.ts(6,5): error TS1156: 'const' declarations can only be declared inside a block. tests/cases/compiler/constDeclarations-invalidContexts.ts(9,5): error TS1156: 'const' declarations can only be declared inside a block. tests/cases/compiler/constDeclarations-invalidContexts.ts(12,5): error TS1156: 'const' declarations can only be declared inside a block. +tests/cases/compiler/constDeclarations-invalidContexts.ts(16,7): error TS2410: All symbols within a 'with' block will be resolved to 'any'. tests/cases/compiler/constDeclarations-invalidContexts.ts(17,5): error TS1156: 'const' declarations can only be declared inside a block. tests/cases/compiler/constDeclarations-invalidContexts.ts(20,5): error TS1156: 'const' declarations can only be declared inside a block. tests/cases/compiler/constDeclarations-invalidContexts.ts(23,5): error TS1156: 'const' declarations can only be declared inside a block. tests/cases/compiler/constDeclarations-invalidContexts.ts(26,12): error TS1156: 'const' declarations can only be declared inside a block. tests/cases/compiler/constDeclarations-invalidContexts.ts(29,29): error TS1156: 'const' declarations can only be declared inside a block. -tests/cases/compiler/constDeclarations-invalidContexts.ts(16,7): error TS2410: All symbols within a 'with' block will be resolved to 'any'. ==== tests/cases/compiler/constDeclarations-invalidContexts.ts (10 errors) ==== diff --git a/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.errors.txt b/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.errors.txt index ed7843ad45e..6b394fec4d6 100644 --- a/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.errors.txt +++ b/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.errors.txt @@ -1,87 +1,87 @@ +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(11,1): error TS2304: Cannot find name 'module'. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(11,19): error TS1005: ';' expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(22,35): error TS1005: ')' expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(22,39): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(24,28): error TS1005: ':' expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(24,29): error TS1005: ',' expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(27,18): error TS1129: Statement expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(27,26): error TS2304: Cannot find name 'bfs'. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(28,30): error TS1005: '=' expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(31,18): error TS1109: Expression expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(34,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(34,26): error TS1005: ';' expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(34,28): error TS2304: Cannot find name 'bfs'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(35,21): error TS2365: Operator '!=' cannot be applied to types 'boolean' and 'number'. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(38,17): error TS1109: Expression expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(40,28): error TS2304: Cannot find name 'bfs'. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(40,41): error TS1005: ';' expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(40,45): error TS1002: Unterminated string literal. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(41,21): error TS2365: Operator '!=' cannot be applied to types 'boolean' and 'number'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(47,17): error TS2304: Cannot find name 'console'. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(49,13): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(53,13): error TS2304: Cannot find name 'console'. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(58,5): error TS1128: Declaration or statement expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(69,13): error TS1109: Expression expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(72,37): error TS1127: Invalid character. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(81,13): error TS1109: Expression expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(89,23): error TS2364: Invalid left-hand side of assignment expression. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(90,13): error TS1109: Expression expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(105,29): error TS1109: Expression expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(106,13): error TS1109: Expression expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(108,24): error TS2365: Operator '+' cannot be applied to types 'number' and 'boolean'. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(138,13): error TS1109: Expression expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(141,32): error TS1005: '{' expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(143,13): error TS1005: 'try' expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(159,24): error TS1109: Expression expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(159,30): error TS1005: '(' expected. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(205,28): error TS1109: Expression expected. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(218,10): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(218,36): error TS1005: ';' expected. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(227,13): error TS1109: Expression expected. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(234,14): error TS1005: '{' expected. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(235,9): error TS1128: Declaration or statement expected. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(235,27): error TS1005: ',' expected. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(235,36): error TS1005: ';' expected. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(238,9): error TS1128: Declaration or statement expected. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(238,26): error TS1005: ';' expected. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(241,5): error TS1128: Declaration or statement expected. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(254,69): error TS1110: Type expected. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(256,9): error TS1128: Declaration or statement expected. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(256,31): error TS1005: ',' expected. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,9): error TS1128: Declaration or statement expected. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,27): error TS1135: Argument expression expected. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,33): error TS1005: '(' expected. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,43): error TS1109: Expression expected. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,60): error TS1005: ';' expected. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,65): error TS1109: Expression expected. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,16): error TS1005: ';' expected. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,35): error TS1109: Expression expected. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,55): error TS1005: ';' expected. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(261,1): error TS1128: Declaration or statement expected. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(11,1): error TS2304: Cannot find name 'module'. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(22,39): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(27,26): error TS2304: Cannot find name 'bfs'. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(34,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(34,28): error TS2304: Cannot find name 'bfs'. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(35,21): error TS2365: Operator '!=' cannot be applied to types 'boolean' and 'number'. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(40,28): error TS2304: Cannot find name 'bfs'. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(41,21): error TS2365: Operator '!=' cannot be applied to types 'boolean' and 'number'. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(47,17): error TS2304: Cannot find name 'console'. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(53,13): error TS2304: Cannot find name 'console'. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(89,23): error TS2364: Invalid left-hand side of assignment expression. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(108,24): error TS2365: Operator '+' cannot be applied to types 'number' and 'boolean'. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(159,31): error TS2304: Cannot find name 'Property'. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(166,13): error TS2365: Operator '+=' cannot be applied to types 'number' and 'void'. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(180,40): error TS2447: The '^' operator is not allowed for boolean types. Consider using '!==' instead. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(205,28): error TS1109: Expression expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(213,16): error TS2304: Cannot find name 'bool'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(218,10): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(218,29): error TS2304: Cannot find name 'yield'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(218,36): error TS1005: ';' expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(223,23): error TS2304: Cannot find name 'bool'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(227,13): error TS1109: Expression expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(234,14): error TS1005: '{' expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(235,9): error TS1128: Declaration or statement expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(235,16): error TS2304: Cannot find name 'method1'. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(235,24): error TS2304: Cannot find name 'val'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(235,27): error TS1005: ',' expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(235,28): error TS2304: Cannot find name 'number'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(235,36): error TS1005: ';' expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(238,9): error TS1128: Declaration or statement expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(238,16): error TS2304: Cannot find name 'method2'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(238,26): error TS1005: ';' expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(241,5): error TS1128: Declaration or statement expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(246,25): error TS2339: Property 'method1' does not exist on type 'B'. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(254,9): error TS2390: Constructor implementation is missing. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(254,21): error TS2369: A parameter property is only allowed in a constructor implementation. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(254,44): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(254,69): error TS1110: Type expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(256,9): error TS1128: Declaration or statement expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(256,16): error TS2304: Cannot find name 'Overloads'. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(256,26): error TS2304: Cannot find name 'value'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(256,31): error TS1005: ',' expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(256,33): error TS2304: Cannot find name 'string'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,9): error TS1128: Declaration or statement expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,16): error TS2304: Cannot find name 'Overloads'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,27): error TS1135: Argument expression expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,33): error TS1005: '(' expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,35): error TS2304: Cannot find name 'string'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,43): error TS1109: Expression expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,52): error TS2304: Cannot find name 'string'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,60): error TS1005: ';' expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,65): error TS1109: Expression expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,9): error TS2304: Cannot find name 'public'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,16): error TS1005: ';' expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,16): error TS2304: Cannot find name 'DefaultValue'. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,29): error TS2304: Cannot find name 'value'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,35): error TS1109: Expression expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,37): error TS2304: Cannot find name 'string'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,55): error TS1005: ';' expected. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(261,1): error TS1128: Declaration or statement expected. ==== tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts (84 errors) ==== @@ -96,10 +96,10 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,37): error T } import fs = module("fs"); - ~ -!!! error TS1005: ';' expected. ~~~~~~~~~~~~~~~~~~ !!! error TS2304: Cannot find name 'module'. + ~ +!!! error TS1005: ';' expected. module TypeScriptAllInOne { @@ -117,11 +117,11 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,37): error T return 1; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~ !!! error TS1005: ':' expected. ~ !!! error TS1005: ',' expected. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ } ~~~~~~~~~~~~~~~~~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. @@ -142,10 +142,10 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,37): error T retValue = bfs.TYPES(); - ~ -!!! error TS1005: ';' expected. ~~~~~~~~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~ +!!! error TS1005: ';' expected. ~~~ !!! error TS2304: Cannot find name 'bfs'. if (retValue != 0) { @@ -158,12 +158,12 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,37): error T !!! error TS1109: Expression expected. retValue = bfs.OPERATOR ' ); + ~~~ +!!! error TS2304: Cannot find name 'bfs'. ~~~~ !!! error TS1005: ';' expected. !!! error TS1002: Unterminated string literal. - ~~~ -!!! error TS2304: Cannot find name 'bfs'. if (retValue != 0) { ~~~~~~~~~~~~~ !!! error TS2365: Operator '!=' cannot be applied to types 'boolean' and 'number'. @@ -390,10 +390,10 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,37): error T case d = () => { yield 0; }; ~~~~ !!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. - ~ -!!! error TS1005: ';' expected. ~~~~~ !!! error TS2304: Cannot find name 'yield'. + ~ +!!! error TS1005: ';' expected. public get Property() { return 0; } public Member() { return 0; @@ -419,25 +419,25 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,37): error T public method1(val:number) { ~~~~~~ !!! error TS1128: Declaration or statement expected. - ~ -!!! error TS1005: ',' expected. - ~ -!!! error TS1005: ';' expected. ~~~~~~~ !!! error TS2304: Cannot find name 'method1'. ~~~ !!! error TS2304: Cannot find name 'val'. + ~ +!!! error TS1005: ',' expected. ~~~~~~ !!! error TS2304: Cannot find name 'number'. + ~ +!!! error TS1005: ';' expected. return val; } public method2() { ~~~~~~ !!! error TS1128: Declaration or statement expected. - ~ -!!! error TS1005: ';' expected. ~~~~~~~ !!! error TS2304: Cannot find name 'method2'. + ~ +!!! error TS1005: ';' expected. return 2 * this.method1(2); } } @@ -458,61 +458,61 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(259,37): error T private otherValue = 42; constructor(private value: number, public name: string) : } - ~ -!!! error TS1110: Type expected. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2390: Constructor implementation is missing. ~~~~~~~~~~~~~~~~~~~~~ !!! error TS2369: A parameter property is only allowed in a constructor implementation. ~~~~~~~~~~~~~~~~~~~ !!! error TS2369: A parameter property is only allowed in a constructor implementation. + ~ +!!! error TS1110: Type expected. public Overloads(value: string); ~~~~~~ !!! error TS1128: Declaration or statement expected. - ~ -!!! error TS1005: ',' expected. ~~~~~~~~~ !!! error TS2304: Cannot find name 'Overloads'. ~~~~~ !!! error TS2304: Cannot find name 'value'. + ~ +!!! error TS1005: ',' expected. ~~~~~~ !!! error TS2304: Cannot find name 'string'. public Overloads( while : string, ...rest: string[]) { & ~~~~~~ !!! error TS1128: Declaration or statement expected. + ~~~~~~~~~ +!!! error TS2304: Cannot find name 'Overloads'. ~~~~~ !!! error TS1135: Argument expression expected. ~ !!! error TS1005: '(' expected. + ~~~~~~ +!!! error TS2304: Cannot find name 'string'. ~~~ !!! error TS1109: Expression expected. + ~~~~~~ +!!! error TS2304: Cannot find name 'string'. ~ !!! error TS1005: ';' expected. ~ !!! error TS1109: Expression expected. - ~~~~~~~~~ -!!! error TS2304: Cannot find name 'Overloads'. - ~~~~~~ -!!! error TS2304: Cannot find name 'string'. - ~~~~~~ -!!! error TS2304: Cannot find name 'string'. public DefaultValue(value?: string = "Hello") { } - ~~~~~~~~~~~~ -!!! error TS1005: ';' expected. - ~ -!!! error TS1109: Expression expected. - ~ -!!! error TS1005: ';' expected. ~~~~~~ !!! error TS2304: Cannot find name 'public'. ~~~~~~~~~~~~ +!!! error TS1005: ';' expected. + ~~~~~~~~~~~~ !!! error TS2304: Cannot find name 'DefaultValue'. ~~~~~ !!! error TS2304: Cannot find name 'value'. + ~ +!!! error TS1109: Expression expected. ~~~~~~ !!! error TS2304: Cannot find name 'string'. + ~ +!!! error TS1005: ';' expected. } } ~ diff --git a/tests/baselines/reference/createArray.errors.txt b/tests/baselines/reference/createArray.errors.txt index 6f79c4b47d2..31f6b880030 100644 --- a/tests/baselines/reference/createArray.errors.txt +++ b/tests/baselines/reference/createArray.errors.txt @@ -1,18 +1,18 @@ +tests/cases/compiler/createArray.ts(1,12): error TS2304: Cannot find name 'number'. tests/cases/compiler/createArray.ts(1,18): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. tests/cases/compiler/createArray.ts(6,6): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. -tests/cases/compiler/createArray.ts(7,19): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. -tests/cases/compiler/createArray.ts(8,18): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. -tests/cases/compiler/createArray.ts(1,12): error TS2304: Cannot find name 'number'. tests/cases/compiler/createArray.ts(7,12): error TS2304: Cannot find name 'boolean'. +tests/cases/compiler/createArray.ts(7,19): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. tests/cases/compiler/createArray.ts(8,12): error TS2304: Cannot find name 'string'. +tests/cases/compiler/createArray.ts(8,18): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. ==== tests/cases/compiler/createArray.ts (7 errors) ==== var na=new number[]; - ~~ -!!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. ~~~~~~ !!! error TS2304: Cannot find name 'number'. + ~~ +!!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. class C { } @@ -21,15 +21,15 @@ tests/cases/compiler/createArray.ts(8,12): error TS2304: Cannot find name 'strin ~~ !!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. var ba=new boolean[]; - ~~ -!!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. ~~~~~~~ !!! error TS2304: Cannot find name 'boolean'. - var sa=new string[]; - ~~ + ~~ !!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. + var sa=new string[]; ~~~~~~ !!! error TS2304: Cannot find name 'string'. + ~~ +!!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. function f(s:string):number { return 0; } if (ba[14]) { diff --git a/tests/baselines/reference/derivedClassSuperCallsInNonConstructorMembers.errors.txt b/tests/baselines/reference/derivedClassSuperCallsInNonConstructorMembers.errors.txt index ca589fb13ed..f465afbccad 100644 --- a/tests/baselines/reference/derivedClassSuperCallsInNonConstructorMembers.errors.txt +++ b/tests/baselines/reference/derivedClassSuperCallsInNonConstructorMembers.errors.txt @@ -1,9 +1,9 @@ tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(8,8): error TS1110: Type expected. -tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(20,15): error TS1110: Type expected. tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts(8,8): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors 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(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(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,15): error TS1110: Type 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(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(25,9): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors diff --git a/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingPublicInstance.errors.txt b/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingPublicInstance.errors.txt index bbe47bb9544..6aeb5a7ec23 100644 --- a/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingPublicInstance.errors.txt +++ b/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingPublicInstance.errors.txt @@ -1,9 +1,9 @@ tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateInstanceShadowingPublicInstance.ts(7,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateInstanceShadowingPublicInstance.ts(8,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateInstanceShadowingPublicInstance.ts(18,17): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateInstanceShadowingPublicInstance.ts(19,17): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateInstanceShadowingPublicInstance.ts(12,7): error TS2415: Class 'Derived' incorrectly extends base class 'Base'. Property 'x' is private in type 'Derived' but not in type 'Base'. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateInstanceShadowingPublicInstance.ts(18,17): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateInstanceShadowingPublicInstance.ts(19,17): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateInstanceShadowingPublicInstance.ts(22,14): error TS2339: Property 'x' does not exist on type 'typeof Base'. tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateInstanceShadowingPublicInstance.ts(23,18): error TS2339: Property 'x' does not exist on type 'typeof Derived'. tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateInstanceShadowingPublicInstance.ts(25,15): error TS2339: Property 'fn' does not exist on type 'typeof Base'. diff --git a/tests/baselines/reference/derivedClassWithPrivateStaticShadowingPublicStatic.errors.txt b/tests/baselines/reference/derivedClassWithPrivateStaticShadowingPublicStatic.errors.txt index cfdf1381282..2e5d6f57c86 100644 --- a/tests/baselines/reference/derivedClassWithPrivateStaticShadowingPublicStatic.errors.txt +++ b/tests/baselines/reference/derivedClassWithPrivateStaticShadowingPublicStatic.errors.txt @@ -1,9 +1,9 @@ tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateStaticShadowingPublicStatic.ts(7,23): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateStaticShadowingPublicStatic.ts(8,23): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateStaticShadowingPublicStatic.ts(19,24): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateStaticShadowingPublicStatic.ts(20,24): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateStaticShadowingPublicStatic.ts(13,7): error TS2417: Class static side 'typeof Derived' incorrectly extends base class static side 'typeof Base'. Property 'x' is private in type 'typeof Derived' but not in type 'typeof Base'. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateStaticShadowingPublicStatic.ts(19,24): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateStaticShadowingPublicStatic.ts(20,24): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateStaticShadowingPublicStatic.ts(24,10): error TS2341: Property 'x' is private and only accessible within class 'Derived'. tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateStaticShadowingPublicStatic.ts(27,10): error TS2341: Property 'fn' is private and only accessible within class 'Derived'. tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateStaticShadowingPublicStatic.ts(32,10): error TS2341: Property 'a' is private and only accessible within class 'Derived'. diff --git a/tests/baselines/reference/dontShowCompilerGeneratedMembers.errors.txt b/tests/baselines/reference/dontShowCompilerGeneratedMembers.errors.txt index 5f6f15791f6..c13a6b5fe2a 100644 --- a/tests/baselines/reference/dontShowCompilerGeneratedMembers.errors.txt +++ b/tests/baselines/reference/dontShowCompilerGeneratedMembers.errors.txt @@ -1,7 +1,7 @@ -tests/cases/compiler/dontShowCompilerGeneratedMembers.ts(3,6): error TS1139: Type parameter declaration expected. -tests/cases/compiler/dontShowCompilerGeneratedMembers.ts(4,1): error TS1109: Expression expected. tests/cases/compiler/dontShowCompilerGeneratedMembers.ts(1,5): error TS2322: Type 'number' is not assignable to type '{ (): any; x: number; }'. Property 'x' is missing in type 'Number'. +tests/cases/compiler/dontShowCompilerGeneratedMembers.ts(3,6): error TS1139: Type parameter declaration expected. +tests/cases/compiler/dontShowCompilerGeneratedMembers.ts(4,1): error TS1109: Expression expected. ==== tests/cases/compiler/dontShowCompilerGeneratedMembers.ts (3 errors) ==== diff --git a/tests/baselines/reference/dottedModuleName.errors.txt b/tests/baselines/reference/dottedModuleName.errors.txt index 9d9de6ee230..462ce1dbce0 100644 --- a/tests/baselines/reference/dottedModuleName.errors.txt +++ b/tests/baselines/reference/dottedModuleName.errors.txt @@ -1,5 +1,5 @@ -tests/cases/compiler/dottedModuleName.ts(3,29): error TS1144: '{' or ';' expected. tests/cases/compiler/dottedModuleName.ts(3,18): error TS2391: Function implementation is missing or not immediately following the declaration. +tests/cases/compiler/dottedModuleName.ts(3,29): error TS1144: '{' or ';' expected. tests/cases/compiler/dottedModuleName.ts(3,33): error TS2304: Cannot find name 'x'. @@ -7,10 +7,10 @@ tests/cases/compiler/dottedModuleName.ts(3,33): error TS2304: Cannot find name ' module M { export module N { export function f(x:number)=>2*x; - ~~ -!!! error TS1144: '{' or ';' expected. ~ !!! error TS2391: Function implementation is missing or not immediately following the declaration. + ~~ +!!! error TS1144: '{' or ';' expected. ~ !!! error TS2304: Cannot find name 'x'. export module X.Y.Z { diff --git a/tests/baselines/reference/duplicateClassElements.errors.txt b/tests/baselines/reference/duplicateClassElements.errors.txt index 004e68314fd..9dfec7a2908 100644 --- a/tests/baselines/reference/duplicateClassElements.errors.txt +++ b/tests/baselines/reference/duplicateClassElements.errors.txt @@ -1,27 +1,27 @@ -tests/cases/compiler/duplicateClassElements.ts(9,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/duplicateClassElements.ts(12,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/duplicateClassElements.ts(15,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/duplicateClassElements.ts(18,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/duplicateClassElements.ts(23,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/duplicateClassElements.ts(26,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/duplicateClassElements.ts(29,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/duplicateClassElements.ts(32,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/duplicateClassElements.ts(36,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/duplicateClassElements.ts(39,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/duplicateClassElements.ts(2,12): error TS2300: Duplicate identifier 'a'. tests/cases/compiler/duplicateClassElements.ts(3,12): error TS2300: Duplicate identifier 'a'. tests/cases/compiler/duplicateClassElements.ts(4,12): error TS2393: Duplicate function implementation. tests/cases/compiler/duplicateClassElements.ts(6,12): error TS2393: Duplicate function implementation. tests/cases/compiler/duplicateClassElements.ts(8,12): error TS2300: Duplicate identifier 'x'. +tests/cases/compiler/duplicateClassElements.ts(9,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/duplicateClassElements.ts(9,9): error TS2300: Duplicate identifier 'x'. +tests/cases/compiler/duplicateClassElements.ts(12,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/duplicateClassElements.ts(12,9): error TS2300: Duplicate identifier 'x'. +tests/cases/compiler/duplicateClassElements.ts(15,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/duplicateClassElements.ts(18,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/duplicateClassElements.ts(21,12): error TS2300: Duplicate identifier 'z'. +tests/cases/compiler/duplicateClassElements.ts(23,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/duplicateClassElements.ts(23,9): error TS2300: Duplicate identifier 'z'. +tests/cases/compiler/duplicateClassElements.ts(26,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/duplicateClassElements.ts(26,9): error TS2300: Duplicate identifier 'z'. +tests/cases/compiler/duplicateClassElements.ts(29,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/duplicateClassElements.ts(29,9): error TS2300: Duplicate identifier 'x2'. +tests/cases/compiler/duplicateClassElements.ts(32,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/duplicateClassElements.ts(32,9): error TS2300: Duplicate identifier 'x2'. tests/cases/compiler/duplicateClassElements.ts(34,12): error TS2300: Duplicate identifier 'x2'. +tests/cases/compiler/duplicateClassElements.ts(36,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/duplicateClassElements.ts(36,9): error TS2300: Duplicate identifier 'z2'. +tests/cases/compiler/duplicateClassElements.ts(39,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/duplicateClassElements.ts(39,9): error TS2300: Duplicate identifier 'z2'. tests/cases/compiler/duplicateClassElements.ts(41,12): error TS2300: Duplicate identifier 'z2'. diff --git a/tests/baselines/reference/duplicateObjectLiteralProperty.errors.txt b/tests/baselines/reference/duplicateObjectLiteralProperty.errors.txt index 05dfdc82404..0dd5febe496 100644 --- a/tests/baselines/reference/duplicateObjectLiteralProperty.errors.txt +++ b/tests/baselines/reference/duplicateObjectLiteralProperty.errors.txt @@ -1,4 +1,3 @@ -tests/cases/compiler/duplicateObjectLiteralProperty.ts(16,9): error TS1118: An object literal cannot have multiple get/set accessors with the same name. tests/cases/compiler/duplicateObjectLiteralProperty.ts(2,5): error TS2300: Duplicate identifier 'a'. tests/cases/compiler/duplicateObjectLiteralProperty.ts(4,5): error TS2300: Duplicate identifier 'a'. tests/cases/compiler/duplicateObjectLiteralProperty.ts(5,5): error TS2300: Duplicate identifier '\u0061'. @@ -7,6 +6,7 @@ tests/cases/compiler/duplicateObjectLiteralProperty.ts(7,9): error TS2300: Dupli tests/cases/compiler/duplicateObjectLiteralProperty.ts(8,9): error TS2300: Duplicate identifier '"c"'. tests/cases/compiler/duplicateObjectLiteralProperty.ts(14,9): error TS2300: Duplicate identifier 'a'. tests/cases/compiler/duplicateObjectLiteralProperty.ts(15,9): error TS2300: Duplicate identifier 'a'. +tests/cases/compiler/duplicateObjectLiteralProperty.ts(16,9): error TS1118: An object literal cannot have multiple get/set accessors with the same name. tests/cases/compiler/duplicateObjectLiteralProperty.ts(16,9): error TS2300: Duplicate identifier 'a'. diff --git a/tests/baselines/reference/duplicatePropertiesInStrictMode.errors.txt b/tests/baselines/reference/duplicatePropertiesInStrictMode.errors.txt index 6ae8518677d..b3d868dbe7e 100644 --- a/tests/baselines/reference/duplicatePropertiesInStrictMode.errors.txt +++ b/tests/baselines/reference/duplicatePropertiesInStrictMode.errors.txt @@ -1,5 +1,5 @@ -tests/cases/compiler/duplicatePropertiesInStrictMode.ts(4,3): error TS1117: An object literal cannot have multiple properties with the same name in strict mode. tests/cases/compiler/duplicatePropertiesInStrictMode.ts(3,3): error TS2300: Duplicate identifier 'x'. +tests/cases/compiler/duplicatePropertiesInStrictMode.ts(4,3): error TS1117: An object literal cannot have multiple properties with the same name in strict mode. tests/cases/compiler/duplicatePropertiesInStrictMode.ts(4,3): error TS2300: Duplicate identifier 'x'. diff --git a/tests/baselines/reference/emptyGenericParamList.errors.txt b/tests/baselines/reference/emptyGenericParamList.errors.txt index 361e5a2fc21..ed1046d0f49 100644 --- a/tests/baselines/reference/emptyGenericParamList.errors.txt +++ b/tests/baselines/reference/emptyGenericParamList.errors.txt @@ -1,11 +1,11 @@ -tests/cases/compiler/emptyGenericParamList.ts(2,9): error TS1099: Type argument list cannot be empty. tests/cases/compiler/emptyGenericParamList.ts(2,8): error TS2314: Generic type 'I' requires 1 type argument(s). +tests/cases/compiler/emptyGenericParamList.ts(2,9): error TS1099: Type argument list cannot be empty. ==== tests/cases/compiler/emptyGenericParamList.ts (2 errors) ==== class I {} var x: I<>; - ~~ -!!! error TS1099: Type argument list cannot be empty. ~~~ -!!! error TS2314: Generic type 'I' requires 1 type argument(s). \ No newline at end of file +!!! error TS2314: Generic type 'I' requires 1 type argument(s). + ~~ +!!! error TS1099: Type argument list cannot be empty. \ No newline at end of file diff --git a/tests/baselines/reference/emptyTypeArgumentList.errors.txt b/tests/baselines/reference/emptyTypeArgumentList.errors.txt index 51efea14cb1..9f252b127a1 100644 --- a/tests/baselines/reference/emptyTypeArgumentList.errors.txt +++ b/tests/baselines/reference/emptyTypeArgumentList.errors.txt @@ -1,11 +1,11 @@ -tests/cases/compiler/emptyTypeArgumentList.ts(2,4): error TS1099: Type argument list cannot be empty. tests/cases/compiler/emptyTypeArgumentList.ts(2,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/emptyTypeArgumentList.ts(2,4): error TS1099: Type argument list cannot be empty. ==== tests/cases/compiler/emptyTypeArgumentList.ts (2 errors) ==== function foo() { } foo<>(); - ~~ -!!! error TS1099: Type argument list cannot be empty. ~~~~~~~ -!!! error TS2346: Supplied parameters do not match any signature of call target. \ No newline at end of file +!!! error TS2346: Supplied parameters do not match any signature of call target. + ~~ +!!! error TS1099: Type argument list cannot be empty. \ No newline at end of file diff --git a/tests/baselines/reference/emptyTypeArgumentListWithNew.errors.txt b/tests/baselines/reference/emptyTypeArgumentListWithNew.errors.txt index 538d0abb264..799e35d0d47 100644 --- a/tests/baselines/reference/emptyTypeArgumentListWithNew.errors.txt +++ b/tests/baselines/reference/emptyTypeArgumentListWithNew.errors.txt @@ -1,11 +1,11 @@ -tests/cases/compiler/emptyTypeArgumentListWithNew.ts(2,8): error TS1099: Type argument list cannot be empty. tests/cases/compiler/emptyTypeArgumentListWithNew.ts(2,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/emptyTypeArgumentListWithNew.ts(2,8): error TS1099: Type argument list cannot be empty. ==== tests/cases/compiler/emptyTypeArgumentListWithNew.ts (2 errors) ==== class foo { } new foo<>(); - ~~ -!!! error TS1099: Type argument list cannot be empty. ~~~~~~~~~~~ -!!! error TS2346: Supplied parameters do not match any signature of call target. \ No newline at end of file +!!! error TS2346: Supplied parameters do not match any signature of call target. + ~~ +!!! error TS1099: Type argument list cannot be empty. \ No newline at end of file diff --git a/tests/baselines/reference/enumConflictsWithGlobalIdentifier.errors.txt b/tests/baselines/reference/enumConflictsWithGlobalIdentifier.errors.txt index e6859558f74..e2ae62fe5e0 100644 --- a/tests/baselines/reference/enumConflictsWithGlobalIdentifier.errors.txt +++ b/tests/baselines/reference/enumConflictsWithGlobalIdentifier.errors.txt @@ -1,5 +1,5 @@ -tests/cases/compiler/enumConflictsWithGlobalIdentifier.ts(4,29): error TS1003: Identifier expected. tests/cases/compiler/enumConflictsWithGlobalIdentifier.ts(4,9): error TS2304: Cannot find name 'IgnoreRulesSpecific'. +tests/cases/compiler/enumConflictsWithGlobalIdentifier.ts(4,29): error TS1003: Identifier expected. ==== tests/cases/compiler/enumConflictsWithGlobalIdentifier.ts (2 errors) ==== @@ -7,9 +7,9 @@ tests/cases/compiler/enumConflictsWithGlobalIdentifier.ts(4,9): error TS2304: Ca IgnoreRulesSpecific = 0, } var x = IgnoreRulesSpecific. - -!!! error TS1003: Identifier expected. ~~~~~~~~~~~~~~~~~~~ !!! error TS2304: Cannot find name 'IgnoreRulesSpecific'. + +!!! error TS1003: Identifier expected. var y = Position.IgnoreRulesSpecific; \ No newline at end of file diff --git a/tests/baselines/reference/enumMemberResolution.errors.txt b/tests/baselines/reference/enumMemberResolution.errors.txt index f446c0d7909..5520c01873e 100644 --- a/tests/baselines/reference/enumMemberResolution.errors.txt +++ b/tests/baselines/reference/enumMemberResolution.errors.txt @@ -1,5 +1,5 @@ -tests/cases/compiler/enumMemberResolution.ts(4,29): error TS1003: Identifier expected. tests/cases/compiler/enumMemberResolution.ts(4,9): error TS2304: Cannot find name 'IgnoreRulesSpecific'. +tests/cases/compiler/enumMemberResolution.ts(4,29): error TS1003: Identifier expected. ==== tests/cases/compiler/enumMemberResolution.ts (2 errors) ==== @@ -7,10 +7,10 @@ tests/cases/compiler/enumMemberResolution.ts(4,9): error TS2304: Cannot find nam IgnoreRulesSpecific = 0 } var x = IgnoreRulesSpecific. // error - -!!! error TS1003: Identifier expected. ~~~~~~~~~~~~~~~~~~~ !!! error TS2304: Cannot find name 'IgnoreRulesSpecific'. + +!!! error TS1003: Identifier expected. var y = 1; var z = Position2.IgnoreRulesSpecific; // no error \ No newline at end of file diff --git a/tests/baselines/reference/errorSuperCalls.errors.txt b/tests/baselines/reference/errorSuperCalls.errors.txt index 82c0a4e8279..cd1aa23f14d 100644 --- a/tests/baselines/reference/errorSuperCalls.errors.txt +++ b/tests/baselines/reference/errorSuperCalls.errors.txt @@ -1,4 +1,3 @@ -tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(46,14): error TS1034: 'super' must be followed by an argument list or member access. tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(4,9): error TS2335: 'super' can only be referenced in a derived class. tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(9,9): error TS2335: 'super' can only be referenced in a derived class. tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(14,9): error TS2335: 'super' can only be referenced in a derived class. @@ -8,6 +7,7 @@ tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(26,9): error T tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(30,16): error TS2335: 'super' can only be referenced in a derived class. tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(34,9): error TS2335: 'super' can only be referenced in a derived class. tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(38,9): error TS2335: 'super' can only be referenced in a derived class. +tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(46,14): error TS1034: 'super' must be followed by an argument list or member access. tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(58,9): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(62,9): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(67,9): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors diff --git a/tests/baselines/reference/errorSuperPropertyAccess.errors.txt b/tests/baselines/reference/errorSuperPropertyAccess.errors.txt index e192e99b87f..b273b1b6f45 100644 --- a/tests/baselines/reference/errorSuperPropertyAccess.errors.txt +++ b/tests/baselines/reference/errorSuperPropertyAccess.errors.txt @@ -1,11 +1,3 @@ -tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(24,23): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(29,23): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(64,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(68,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(94,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(98,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(113,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(119,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(6,17): error TS2335: 'super' can only be referenced in a derived class. tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(7,17): error TS2335: 'super' can only be referenced in a derived class. tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(11,17): error TS2335: 'super' can only be referenced in a derived class. @@ -13,24 +5,32 @@ tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(15,9): error TS2335: 'super' can only be referenced in a derived class. tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(16,9): error TS2335: 'super' can only be referenced in a derived class. tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(21,9): error TS2335: 'super' can only be referenced in a derived class. +tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(24,23): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(25,9): error TS2335: 'super' can only be referenced in a derived class. +tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(29,23): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(30,9): error TS2335: 'super' can only be referenced in a derived class. tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(57,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(61,23): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword +tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(64,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(65,23): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword +tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(68,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(69,19): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(73,13): error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(76,40): error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(87,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(91,23): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword +tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(94,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(95,23): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword +tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(98,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(99,19): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(109,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(110,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(111,9): error TS2341: Property 'privateStaticFunc' is private and only accessible within class 'SomeBase'. +tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(113,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(114,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(115,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(116,9): error TS2341: Property 'privateStaticFunc' is private and only accessible within class 'SomeBase'. +tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(119,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(120,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(121,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(122,9): error TS2341: Property 'privateStaticFunc' is private and only accessible within class 'SomeBase'. diff --git a/tests/baselines/reference/errorsInGenericTypeReference.errors.txt b/tests/baselines/reference/errorsInGenericTypeReference.errors.txt index dcb5018f035..729b4db5440 100644 --- a/tests/baselines/reference/errorsInGenericTypeReference.errors.txt +++ b/tests/baselines/reference/errorsInGenericTypeReference.errors.txt @@ -1,8 +1,8 @@ -tests/cases/compiler/errorsInGenericTypeReference.ts(25,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/errorsInGenericTypeReference.ts(12,17): error TS2304: Cannot find name 'V'. tests/cases/compiler/errorsInGenericTypeReference.ts(18,31): error TS2304: Cannot find name 'V'. tests/cases/compiler/errorsInGenericTypeReference.ts(23,29): error TS2304: Cannot find name 'V'. tests/cases/compiler/errorsInGenericTypeReference.ts(24,36): error TS2304: Cannot find name 'V'. +tests/cases/compiler/errorsInGenericTypeReference.ts(25,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/errorsInGenericTypeReference.ts(25,27): error TS2304: Cannot find name 'V'. tests/cases/compiler/errorsInGenericTypeReference.ts(26,24): error TS2304: Cannot find name 'V'. tests/cases/compiler/errorsInGenericTypeReference.ts(31,36): error TS2304: Cannot find name 'V'. diff --git a/tests/baselines/reference/es6ClassTest2.errors.txt b/tests/baselines/reference/es6ClassTest2.errors.txt index bf87a809b77..0b68e1cd784 100644 --- a/tests/baselines/reference/es6ClassTest2.errors.txt +++ b/tests/baselines/reference/es6ClassTest2.errors.txt @@ -1,6 +1,6 @@ +tests/cases/compiler/es6ClassTest2.ts(17,1): error TS2304: Cannot find name 'console'. tests/cases/compiler/es6ClassTest2.ts(30,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/es6ClassTest2.ts(35,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/es6ClassTest2.ts(17,1): error TS2304: Cannot find name 'console'. ==== tests/cases/compiler/es6ClassTest2.ts (3 errors) ==== diff --git a/tests/baselines/reference/es6ClassTest9.errors.txt b/tests/baselines/reference/es6ClassTest9.errors.txt index ae7d1ba92d5..21d9fccc2e5 100644 --- a/tests/baselines/reference/es6ClassTest9.errors.txt +++ b/tests/baselines/reference/es6ClassTest9.errors.txt @@ -1,17 +1,17 @@ +tests/cases/compiler/es6ClassTest9.ts(1,15): error TS2300: Duplicate identifier 'foo'. tests/cases/compiler/es6ClassTest9.ts(1,18): error TS1005: '{' expected. tests/cases/compiler/es6ClassTest9.ts(1,19): error TS1109: Expression expected. -tests/cases/compiler/es6ClassTest9.ts(1,15): error TS2300: Duplicate identifier 'foo'. tests/cases/compiler/es6ClassTest9.ts(2,10): error TS2300: Duplicate identifier 'foo'. ==== tests/cases/compiler/es6ClassTest9.ts (4 errors) ==== declare class foo(); + ~~~ +!!! error TS2300: Duplicate identifier 'foo'. ~ !!! error TS1005: '{' expected. ~ !!! error TS1109: Expression expected. - ~~~ -!!! error TS2300: Duplicate identifier 'foo'. function foo() {} ~~~ !!! error TS2300: Duplicate identifier 'foo'. diff --git a/tests/baselines/reference/extension.errors.txt b/tests/baselines/reference/extension.errors.txt index e55f15f4381..d643cd9e30b 100644 --- a/tests/baselines/reference/extension.errors.txt +++ b/tests/baselines/reference/extension.errors.txt @@ -1,7 +1,7 @@ -tests/cases/compiler/extension.ts(16,5): error TS1128: Declaration or statement expected. -tests/cases/compiler/extension.ts(16,22): error TS1005: ';' expected. 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 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'. @@ -27,10 +27,10 @@ tests/cases/compiler/extension.ts(22,3): error TS2339: Property 'pe' does not ex export extension class C { ~~~~~~ !!! error TS1128: Declaration or statement expected. - ~~~~~ -!!! error TS1005: ';' expected. ~~~~~~~~~ !!! 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 49b1598f06e..eff17eb8586 100644 --- a/tests/baselines/reference/externModule.errors.txt +++ b/tests/baselines/reference/externModule.errors.txt @@ -1,28 +1,28 @@ +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 TS2304: Cannot find name 'module'. tests/cases/compiler/externModule.ts(1,16): error TS1005: ';' expected. tests/cases/compiler/externModule.ts(2,5): error TS1129: Statement expected. tests/cases/compiler/externModule.ts(2,18): error TS1148: Cannot compile external modules unless the '--module' flag is provided. -tests/cases/compiler/externModule.ts(30,1): error TS1128: Declaration or statement expected. -tests/cases/compiler/externModule.ts(1,1): error TS2304: Cannot find name 'declare'. -tests/cases/compiler/externModule.ts(1,9): error TS2304: Cannot find name 'module'. 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. tests/cases/compiler/externModule.ts(20,13): error TS2391: Function implementation is missing or not immediately following the declaration. tests/cases/compiler/externModule.ts(26,13): error TS2391: Function implementation is missing or not immediately following the declaration. tests/cases/compiler/externModule.ts(28,13): error TS2391: Function implementation is missing or not immediately following the declaration. +tests/cases/compiler/externModule.ts(30,1): error TS1128: Declaration or statement expected. ==== tests/cases/compiler/externModule.ts (13 errors) ==== declare module { - ~~~~~~ -!!! error TS1005: ';' expected. - ~ -!!! error TS1005: ';' expected. ~~~~~~~ !!! error TS2304: Cannot find name 'declare'. ~~~~~~ +!!! error TS1005: ';' expected. + ~~~~~~ !!! error TS2304: Cannot find name 'module'. + ~ +!!! error TS1005: ';' expected. export class XDate { ~~~~~~ !!! error TS1129: Statement expected. diff --git a/tests/baselines/reference/fatarrowfunctionsErrors.errors.txt b/tests/baselines/reference/fatarrowfunctionsErrors.errors.txt index c3ad9b9c159..35df1a5f397 100644 --- a/tests/baselines/reference/fatarrowfunctionsErrors.errors.txt +++ b/tests/baselines/reference/fatarrowfunctionsErrors.errors.txt @@ -1,21 +1,21 @@ +tests/cases/compiler/fatarrowfunctionsErrors.ts(1,1): error TS2304: Cannot find name 'foo'. +tests/cases/compiler/fatarrowfunctionsErrors.ts(2,1): error TS2304: Cannot find name 'foo'. tests/cases/compiler/fatarrowfunctionsErrors.ts(2,8): error TS1005: ',' expected. tests/cases/compiler/fatarrowfunctionsErrors.ts(2,18): error TS1005: ':' expected. tests/cases/compiler/fatarrowfunctionsErrors.ts(2,19): error TS1005: ',' expected. tests/cases/compiler/fatarrowfunctionsErrors.ts(2,20): error TS1128: Declaration or statement expected. tests/cases/compiler/fatarrowfunctionsErrors.ts(2,21): error TS1128: Declaration or statement expected. +tests/cases/compiler/fatarrowfunctionsErrors.ts(3,1): error TS2304: Cannot find name 'foo'. +tests/cases/compiler/fatarrowfunctionsErrors.ts(4,1): error TS2304: Cannot find name 'foo'. +tests/cases/compiler/fatarrowfunctionsErrors.ts(5,9): error TS2304: Cannot find name 'x'. tests/cases/compiler/fatarrowfunctionsErrors.ts(5,10): error TS1005: ',' expected. tests/cases/compiler/fatarrowfunctionsErrors.ts(5,18): error TS1005: ';' expected. +tests/cases/compiler/fatarrowfunctionsErrors.ts(5,21): error TS2304: Cannot find name 'x'. +tests/cases/compiler/fatarrowfunctionsErrors.ts(5,23): error TS2304: Cannot find name 'x'. tests/cases/compiler/fatarrowfunctionsErrors.ts(9,19): error TS1005: '=>' expected. tests/cases/compiler/fatarrowfunctionsErrors.ts(10,27): error TS1005: '=>' expected. tests/cases/compiler/fatarrowfunctionsErrors.ts(11,21): error TS1005: '=>' expected. tests/cases/compiler/fatarrowfunctionsErrors.ts(12,23): error TS1005: '=>' expected. -tests/cases/compiler/fatarrowfunctionsErrors.ts(1,1): error TS2304: Cannot find name 'foo'. -tests/cases/compiler/fatarrowfunctionsErrors.ts(2,1): error TS2304: Cannot find name 'foo'. -tests/cases/compiler/fatarrowfunctionsErrors.ts(3,1): error TS2304: Cannot find name 'foo'. -tests/cases/compiler/fatarrowfunctionsErrors.ts(4,1): error TS2304: Cannot find name 'foo'. -tests/cases/compiler/fatarrowfunctionsErrors.ts(5,9): error TS2304: Cannot find name 'x'. -tests/cases/compiler/fatarrowfunctionsErrors.ts(5,21): error TS2304: Cannot find name 'x'. -tests/cases/compiler/fatarrowfunctionsErrors.ts(5,23): error TS2304: Cannot find name 'x'. ==== tests/cases/compiler/fatarrowfunctionsErrors.ts (18 errors) ==== @@ -23,6 +23,8 @@ tests/cases/compiler/fatarrowfunctionsErrors.ts(5,23): error TS2304: Cannot find ~~~ !!! error TS2304: Cannot find name 'foo'. foo((1)=>{return 0;}); + ~~~ +!!! error TS2304: Cannot find name 'foo'. ~~ !!! error TS1005: ',' expected. ~ @@ -33,8 +35,6 @@ tests/cases/compiler/fatarrowfunctionsErrors.ts(5,23): error TS2304: Cannot find !!! error TS1128: Declaration or statement expected. ~ !!! error TS1128: Declaration or statement expected. - ~~~ -!!! error TS2304: Cannot find name 'foo'. foo((x?)=>{return x;}) ~~~ !!! error TS2304: Cannot find name 'foo'. @@ -42,12 +42,12 @@ tests/cases/compiler/fatarrowfunctionsErrors.ts(5,23): error TS2304: Cannot find ~~~ !!! error TS2304: Cannot find name 'foo'. var y = x:number => x*x; + ~ +!!! error TS2304: Cannot find name 'x'. ~ !!! error TS1005: ',' expected. ~~ !!! error TS1005: ';' expected. - ~ -!!! error TS2304: Cannot find name 'x'. ~ !!! error TS2304: Cannot find name 'x'. ~ diff --git a/tests/baselines/reference/fatarrowfunctionsOptionalArgsErrors2.errors.txt b/tests/baselines/reference/fatarrowfunctionsOptionalArgsErrors2.errors.txt index ce237236ca7..6ac472e0e02 100644 --- a/tests/baselines/reference/fatarrowfunctionsOptionalArgsErrors2.errors.txt +++ b/tests/baselines/reference/fatarrowfunctionsOptionalArgsErrors2.errors.txt @@ -1,32 +1,32 @@ -tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors2.ts(1,23): error TS1005: ';' expected. -tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors2.ts(2,23): error TS1005: ';' expected. -tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors2.ts(4,17): error TS1005: ';' expected. tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors2.ts(1,12): error TS2304: Cannot find name 'a'. tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors2.ts(1,16): error TS2304: Cannot find name 'b'. tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors2.ts(1,19): error TS2304: Cannot find name 'c'. +tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors2.ts(1,23): error TS1005: ';' expected. tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors2.ts(1,26): error TS2304: Cannot find name 'a'. tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors2.ts(1,28): error TS2304: Cannot find name 'b'. tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors2.ts(1,30): error TS2304: Cannot find name 'c'. tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors2.ts(2,13): error TS2304: Cannot find name 'a'. tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors2.ts(2,17): error TS2304: Cannot find name 'b'. tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors2.ts(2,20): error TS2304: Cannot find name 'c'. +tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors2.ts(2,23): error TS1005: ';' expected. tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors2.ts(2,26): error TS2304: Cannot find name 'a'. tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors2.ts(2,28): error TS2304: Cannot find name 'b'. tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors2.ts(2,30): error TS2304: Cannot find name 'c'. tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors2.ts(4,13): error TS2304: Cannot find name 'a'. +tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors2.ts(4,17): error TS1005: ';' expected. tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors2.ts(4,20): error TS2304: Cannot find name 'a'. ==== tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors2.ts (17 errors) ==== var tt1 = (a, (b, c)) => a+b+c; - ~~ -!!! error TS1005: ';' expected. ~ !!! error TS2304: Cannot find name 'a'. ~ !!! error TS2304: Cannot find name 'b'. ~ !!! error TS2304: Cannot find name 'c'. + ~~ +!!! error TS1005: ';' expected. ~ !!! error TS2304: Cannot find name 'a'. ~ @@ -34,14 +34,14 @@ tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors2.ts(4,20): error TS2304 ~ !!! error TS2304: Cannot find name 'c'. var tt2 = ((a), b, c) => a+b+c; - ~~ -!!! error TS1005: ';' expected. ~ !!! error TS2304: Cannot find name 'a'. ~ !!! error TS2304: Cannot find name 'b'. ~ !!! error TS2304: Cannot find name 'c'. + ~~ +!!! error TS1005: ';' expected. ~ !!! error TS2304: Cannot find name 'a'. ~ @@ -50,9 +50,9 @@ tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors2.ts(4,20): error TS2304 !!! error TS2304: Cannot find name 'c'. var tt3 = ((a)) => a; - ~~ -!!! error TS1005: ';' expected. ~ !!! error TS2304: Cannot find name 'a'. + ~~ +!!! error TS1005: ';' expected. ~ !!! error TS2304: Cannot find name 'a'. \ No newline at end of file diff --git a/tests/baselines/reference/fatarrowfunctionsOptionalArgsErrors4.errors.txt b/tests/baselines/reference/fatarrowfunctionsOptionalArgsErrors4.errors.txt index 8de0eb92a02..fe9df3c2fb3 100644 --- a/tests/baselines/reference/fatarrowfunctionsOptionalArgsErrors4.errors.txt +++ b/tests/baselines/reference/fatarrowfunctionsOptionalArgsErrors4.errors.txt @@ -3,9 +3,9 @@ tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors4.ts(2,15): error TS1015 tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors4.ts(3,21): error TS1015: Parameter cannot have question mark and initializer. tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors4.ts(4,7): error TS1015: Parameter cannot have question mark and initializer. tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors4.ts(4,39): error TS1015: Parameter cannot have question mark and initializer. +tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors4.ts(6,5): error TS2304: Cannot find name 'foo'. tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors4.ts(17,10): error TS1015: Parameter cannot have question mark and initializer. tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors4.ts(19,13): error TS1015: Parameter cannot have question mark and initializer. -tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors4.ts(6,5): error TS2304: Cannot find name 'foo'. ==== tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors4.ts (8 errors) ==== diff --git a/tests/baselines/reference/fieldAndGetterWithSameName.errors.txt b/tests/baselines/reference/fieldAndGetterWithSameName.errors.txt index dd2374f2447..e78ccce2b83 100644 --- a/tests/baselines/reference/fieldAndGetterWithSameName.errors.txt +++ b/tests/baselines/reference/fieldAndGetterWithSameName.errors.txt @@ -1,5 +1,5 @@ -tests/cases/compiler/fieldAndGetterWithSameName.ts(3,7): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/fieldAndGetterWithSameName.ts(2,5): error TS2300: Duplicate identifier 'x'. +tests/cases/compiler/fieldAndGetterWithSameName.ts(3,7): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/fieldAndGetterWithSameName.ts(3,7): error TS2300: Duplicate identifier 'x'. diff --git a/tests/baselines/reference/functionAndPropertyNameConflict.errors.txt b/tests/baselines/reference/functionAndPropertyNameConflict.errors.txt index 640844064c4..a976048d0e3 100644 --- a/tests/baselines/reference/functionAndPropertyNameConflict.errors.txt +++ b/tests/baselines/reference/functionAndPropertyNameConflict.errors.txt @@ -1,5 +1,5 @@ -tests/cases/compiler/functionAndPropertyNameConflict.ts(3,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/functionAndPropertyNameConflict.ts(2,12): error TS2300: Duplicate identifier 'aaaaa'. +tests/cases/compiler/functionAndPropertyNameConflict.ts(3,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/functionAndPropertyNameConflict.ts(3,16): error TS2300: Duplicate identifier 'aaaaa'. diff --git a/tests/baselines/reference/functionsMissingReturnStatementsAndExpressions.errors.txt b/tests/baselines/reference/functionsMissingReturnStatementsAndExpressions.errors.txt index 11ceb2aa3dd..2c5ff15f863 100644 --- a/tests/baselines/reference/functionsMissingReturnStatementsAndExpressions.errors.txt +++ b/tests/baselines/reference/functionsMissingReturnStatementsAndExpressions.errors.txt @@ -1,8 +1,8 @@ -tests/cases/compiler/functionsMissingReturnStatementsAndExpressions.ts(117,5): error TS1003: Identifier expected. tests/cases/compiler/functionsMissingReturnStatementsAndExpressions.ts(2,16): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement. tests/cases/compiler/functionsMissingReturnStatementsAndExpressions.ts(64,17): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement. tests/cases/compiler/functionsMissingReturnStatementsAndExpressions.ts(94,16): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. tests/cases/compiler/functionsMissingReturnStatementsAndExpressions.ts(112,16): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/compiler/functionsMissingReturnStatementsAndExpressions.ts(117,5): error TS1003: Identifier expected. ==== tests/cases/compiler/functionsMissingReturnStatementsAndExpressions.ts (5 errors) ==== diff --git a/tests/baselines/reference/genericReturnTypeFromGetter1.errors.txt b/tests/baselines/reference/genericReturnTypeFromGetter1.errors.txt index 8215d687443..6f5f68064a6 100644 --- a/tests/baselines/reference/genericReturnTypeFromGetter1.errors.txt +++ b/tests/baselines/reference/genericReturnTypeFromGetter1.errors.txt @@ -1,5 +1,5 @@ -tests/cases/compiler/genericReturnTypeFromGetter1.ts(6,7): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/genericReturnTypeFromGetter1.ts(5,18): error TS2314: Generic type 'A' requires 1 type argument(s). +tests/cases/compiler/genericReturnTypeFromGetter1.ts(6,7): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ==== tests/cases/compiler/genericReturnTypeFromGetter1.ts (2 errors) ==== diff --git a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.d.errors.txt b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.d.errors.txt index f646ac4725e..6c98d419dec 100644 --- a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.d.errors.txt +++ b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.d.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.d.ts(12,19): error TS1023: An index signature parameter type must be 'string' or 'number'. tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.d.ts(8,16): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.d.ts(10,21): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.d.ts(11,22): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.d.ts(11,26): error TS2314: Generic type 'C' requires 1 type argument(s). +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.d.ts(12,19): error TS1023: An index signature parameter type must be 'string' or 'number'. tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.d.ts(12,22): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.d.ts(12,26): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.d.ts(14,23): error TS2314: Generic type 'C' requires 1 type argument(s). diff --git a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.errors.txt b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.errors.txt index a8627f3f18e..d57f3c2fc0d 100644 --- a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.errors.txt +++ b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(12,11): error TS1023: An index signature parameter type must be 'string' or 'number'. tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(8,8): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(10,13): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(11,14): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(11,18): error TS2314: Generic type 'C' requires 1 type argument(s). +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(12,11): error TS1023: An index signature parameter type must be 'string' or 'number'. tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(12,14): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(12,18): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(14,13): error TS2314: Generic type 'C' requires 1 type argument(s). diff --git a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.errors.txt b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.errors.txt index 1802d0385c4..745da9aa106 100644 --- a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.errors.txt +++ b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(12,11): error TS1023: An index signature parameter type must be 'string' or 'number'. tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(8,8): error TS2314: Generic type 'I' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(10,13): error TS2314: Generic type 'I' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(11,14): error TS2314: Generic type 'I' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(11,18): error TS2314: Generic type 'I' requires 1 type argument(s). +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(12,11): error TS1023: An index signature parameter type must be 'string' or 'number'. tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(12,14): error TS2314: Generic type 'I' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(12,18): error TS2314: Generic type 'I' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(14,13): error TS2314: Generic type 'I' requires 1 type argument(s). diff --git a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument3.errors.txt b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument3.errors.txt index 41774da0d00..1fec52356a2 100644 --- a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument3.errors.txt +++ b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument3.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument3.ts(12,19): error TS1023: An index signature parameter type must be 'string' or 'number'. tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument3.ts(8,16): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument3.ts(10,21): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument3.ts(11,22): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument3.ts(11,26): error TS2314: Generic type 'C' requires 1 type argument(s). +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument3.ts(12,19): error TS1023: An index signature parameter type must be 'string' or 'number'. tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument3.ts(12,22): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument3.ts(12,26): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument3.ts(14,23): error TS2314: Generic type 'C' requires 1 type argument(s). diff --git a/tests/baselines/reference/getAccessorWithImpliedReturnTypeAndFunctionClassMerge.errors.txt b/tests/baselines/reference/getAccessorWithImpliedReturnTypeAndFunctionClassMerge.errors.txt index a7e8155c220..a11b0f0ad9e 100644 --- a/tests/baselines/reference/getAccessorWithImpliedReturnTypeAndFunctionClassMerge.errors.txt +++ b/tests/baselines/reference/getAccessorWithImpliedReturnTypeAndFunctionClassMerge.errors.txt @@ -1,10 +1,10 @@ -tests/cases/compiler/getAccessorWithImpliedReturnTypeAndFunctionClassMerge.ts(21,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/getAccessorWithImpliedReturnTypeAndFunctionClassMerge.ts(1,18): error TS2300: Duplicate identifier '_'. tests/cases/compiler/getAccessorWithImpliedReturnTypeAndFunctionClassMerge.ts(1,41): error TS2304: Cannot find name '_'. tests/cases/compiler/getAccessorWithImpliedReturnTypeAndFunctionClassMerge.ts(2,18): error TS2300: Duplicate identifier '_'. tests/cases/compiler/getAccessorWithImpliedReturnTypeAndFunctionClassMerge.ts(2,34): error TS2304: Cannot find name '_'. tests/cases/compiler/getAccessorWithImpliedReturnTypeAndFunctionClassMerge.ts(4,16): error TS2300: Duplicate identifier '_'. tests/cases/compiler/getAccessorWithImpliedReturnTypeAndFunctionClassMerge.ts(15,15): error TS2300: Duplicate identifier '_'. +tests/cases/compiler/getAccessorWithImpliedReturnTypeAndFunctionClassMerge.ts(21,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ==== tests/cases/compiler/getAccessorWithImpliedReturnTypeAndFunctionClassMerge.ts (7 errors) ==== diff --git a/tests/baselines/reference/getAndSetNotIdenticalType.errors.txt b/tests/baselines/reference/getAndSetNotIdenticalType.errors.txt index 5fe2e7ae321..6c55f966eee 100644 --- a/tests/baselines/reference/getAndSetNotIdenticalType.errors.txt +++ b/tests/baselines/reference/getAndSetNotIdenticalType.errors.txt @@ -1,23 +1,23 @@ -tests/cases/compiler/getAndSetNotIdenticalType.ts(2,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/getAndSetNotIdenticalType.ts(5,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/getAndSetNotIdenticalType.ts(2,5): error TS2380: 'get' and 'set' accessor must have the same type. +tests/cases/compiler/getAndSetNotIdenticalType.ts(2,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/getAndSetNotIdenticalType.ts(5,5): error TS2380: 'get' and 'set' accessor must have the same type. +tests/cases/compiler/getAndSetNotIdenticalType.ts(5,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ==== tests/cases/compiler/getAndSetNotIdenticalType.ts (4 errors) ==== class C { get x(): number { + ~~~~~~~~~~~~~~~~~ ~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. - ~~~~~~~~~~~~~~~~~ return 1; ~~~~~~~~~~~~~~~~~ } ~~~~~ !!! error TS2380: 'get' and 'set' accessor must have the same type. set x(v: string) { } - ~ -!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~~~~~~~~~~~~~~~~~~~ !!! error TS2380: 'get' and 'set' accessor must have the same type. + ~ +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. } \ No newline at end of file diff --git a/tests/baselines/reference/getAndSetNotIdenticalType2.errors.txt b/tests/baselines/reference/getAndSetNotIdenticalType2.errors.txt index 69d367bb21c..5cdb9b3a36f 100644 --- a/tests/baselines/reference/getAndSetNotIdenticalType2.errors.txt +++ b/tests/baselines/reference/getAndSetNotIdenticalType2.errors.txt @@ -1,7 +1,7 @@ -tests/cases/compiler/getAndSetNotIdenticalType2.ts(5,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/getAndSetNotIdenticalType2.ts(8,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/getAndSetNotIdenticalType2.ts(5,5): error TS2380: 'get' and 'set' accessor must have the same type. +tests/cases/compiler/getAndSetNotIdenticalType2.ts(5,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/getAndSetNotIdenticalType2.ts(8,5): error TS2380: 'get' and 'set' accessor must have the same type. +tests/cases/compiler/getAndSetNotIdenticalType2.ts(8,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/getAndSetNotIdenticalType2.ts(9,9): error TS2322: Type 'A' is not assignable to type 'A'. Type 'string' is not assignable to type 'T'. @@ -12,18 +12,18 @@ tests/cases/compiler/getAndSetNotIdenticalType2.ts(9,9): error TS2322: Type 'A { data: A; get x(): A { + ~~~~~~~~~~~~~~~ ~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. - ~~~~~~~~~~~~~~~ return this.data; ~~~~~~~~~~~~~~~~~~~~~~~~~ } ~~~~~ !!! error TS2380: 'get' and 'set' accessor must have the same type. set x(v: A) { + ~~~~~~~~~~~~~~~~~~~~~ ~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. - ~~~~~~~~~~~~~~~~~~~~~ this.data = v; ~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~ diff --git a/tests/baselines/reference/getAndSetNotIdenticalType3.errors.txt b/tests/baselines/reference/getAndSetNotIdenticalType3.errors.txt index bca86419f62..0aac384f7c3 100644 --- a/tests/baselines/reference/getAndSetNotIdenticalType3.errors.txt +++ b/tests/baselines/reference/getAndSetNotIdenticalType3.errors.txt @@ -1,7 +1,7 @@ -tests/cases/compiler/getAndSetNotIdenticalType3.ts(5,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/getAndSetNotIdenticalType3.ts(8,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/getAndSetNotIdenticalType3.ts(5,5): error TS2380: 'get' and 'set' accessor must have the same type. +tests/cases/compiler/getAndSetNotIdenticalType3.ts(5,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/getAndSetNotIdenticalType3.ts(8,5): error TS2380: 'get' and 'set' accessor must have the same type. +tests/cases/compiler/getAndSetNotIdenticalType3.ts(8,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/getAndSetNotIdenticalType3.ts(9,9): error TS2322: Type 'A' is not assignable to type 'A'. Type 'string' is not assignable to type 'number'. @@ -12,18 +12,18 @@ tests/cases/compiler/getAndSetNotIdenticalType3.ts(9,9): error TS2322: Type 'A { data: A; get x(): A { + ~~~~~~~~~~~~~~~~~~~~ ~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. - ~~~~~~~~~~~~~~~~~~~~ return this.data; ~~~~~~~~~~~~~~~~~~~~~~~~~ } ~~~~~ !!! error TS2380: 'get' and 'set' accessor must have the same type. set x(v: A) { + ~~~~~~~~~~~~~~~~~~~~~ ~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. - ~~~~~~~~~~~~~~~~~~~~~ this.data = v; ~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~ diff --git a/tests/baselines/reference/gettersAndSetters.errors.txt b/tests/baselines/reference/gettersAndSetters.errors.txt index 2c287f30497..a4cc4b585e2 100644 --- a/tests/baselines/reference/gettersAndSetters.errors.txt +++ b/tests/baselines/reference/gettersAndSetters.errors.txt @@ -2,10 +2,10 @@ tests/cases/compiler/gettersAndSetters.ts(7,16): error TS1056: Accessors are onl tests/cases/compiler/gettersAndSetters.ts(8,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/gettersAndSetters.ts(10,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/gettersAndSetters.ts(11,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/gettersAndSetters.ts(29,30): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/gettersAndSetters.ts(29,53): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/gettersAndSetters.ts(25,13): error TS2339: Property 'Baz' does not exist on type 'C'. tests/cases/compiler/gettersAndSetters.ts(26,3): error TS2339: Property 'Baz' does not exist on type 'C'. +tests/cases/compiler/gettersAndSetters.ts(29,30): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/gettersAndSetters.ts(29,53): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ==== tests/cases/compiler/gettersAndSetters.ts (8 errors) ==== diff --git a/tests/baselines/reference/gettersAndSettersAccessibility.errors.txt b/tests/baselines/reference/gettersAndSettersAccessibility.errors.txt index ddb8e95e5eb..faccaab8fdf 100644 --- a/tests/baselines/reference/gettersAndSettersAccessibility.errors.txt +++ b/tests/baselines/reference/gettersAndSettersAccessibility.errors.txt @@ -1,6 +1,6 @@ tests/cases/compiler/gettersAndSettersAccessibility.ts(2,14): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/gettersAndSettersAccessibility.ts(3,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/gettersAndSettersAccessibility.ts(2,14): error TS2379: Getter and setter accessors do not agree in visibility. +tests/cases/compiler/gettersAndSettersAccessibility.ts(3,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/gettersAndSettersAccessibility.ts(3,13): error TS2379: Getter and setter accessors do not agree in visibility. diff --git a/tests/baselines/reference/gettersAndSettersErrors.errors.txt b/tests/baselines/reference/gettersAndSettersErrors.errors.txt index 95fb571d9b8..db2d4c5bc87 100644 --- a/tests/baselines/reference/gettersAndSettersErrors.errors.txt +++ b/tests/baselines/reference/gettersAndSettersErrors.errors.txt @@ -1,13 +1,13 @@ tests/cases/compiler/gettersAndSettersErrors.ts(2,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/gettersAndSettersErrors.ts(2,16): error TS2300: Duplicate identifier 'Foo'. tests/cases/compiler/gettersAndSettersErrors.ts(3,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/gettersAndSettersErrors.ts(3,16): error TS2300: Duplicate identifier 'Foo'. +tests/cases/compiler/gettersAndSettersErrors.ts(5,12): error TS2300: Duplicate identifier 'Foo'. tests/cases/compiler/gettersAndSettersErrors.ts(6,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/gettersAndSettersErrors.ts(7,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/gettersAndSettersErrors.ts(11,17): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/gettersAndSettersErrors.ts(12,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/gettersAndSettersErrors.ts(2,16): error TS2300: Duplicate identifier 'Foo'. -tests/cases/compiler/gettersAndSettersErrors.ts(3,16): error TS2300: Duplicate identifier 'Foo'. -tests/cases/compiler/gettersAndSettersErrors.ts(5,12): error TS2300: Duplicate identifier 'Foo'. tests/cases/compiler/gettersAndSettersErrors.ts(11,17): error TS2379: Getter and setter accessors do not agree in visibility. +tests/cases/compiler/gettersAndSettersErrors.ts(12,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/gettersAndSettersErrors.ts(12,16): error TS2379: Getter and setter accessors do not agree in visibility. diff --git a/tests/baselines/reference/giant.errors.txt b/tests/baselines/reference/giant.errors.txt index f971c067768..6d34060d2ae 100644 --- a/tests/baselines/reference/giant.errors.txt +++ b/tests/baselines/reference/giant.errors.txt @@ -1,99 +1,201 @@ +tests/cases/compiler/giant.ts(23,12): error TS2300: Duplicate identifier 'pgF'. tests/cases/compiler/giant.ts(24,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/giant.ts(24,16): error TS2300: Duplicate identifier 'pgF'. +tests/cases/compiler/giant.ts(25,12): error TS2300: Duplicate identifier 'psF'. tests/cases/compiler/giant.ts(26,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/giant.ts(26,16): error TS2300: Duplicate identifier 'psF'. +tests/cases/compiler/giant.ts(27,13): error TS2300: Duplicate identifier 'rgF'. tests/cases/compiler/giant.ts(28,17): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/giant.ts(28,17): error TS2300: Duplicate identifier 'rgF'. +tests/cases/compiler/giant.ts(29,13): error TS2300: Duplicate identifier 'rsF'. tests/cases/compiler/giant.ts(30,17): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/giant.ts(30,17): error TS2300: Duplicate identifier 'rsF'. +tests/cases/compiler/giant.ts(33,12): error TS2300: Duplicate identifier 'tsF'. tests/cases/compiler/giant.ts(34,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/giant.ts(34,16): error TS2300: Duplicate identifier 'tsF'. +tests/cases/compiler/giant.ts(35,12): error TS2300: Duplicate identifier 'tgF'. tests/cases/compiler/giant.ts(36,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/giant.ts(36,16): error TS2300: Duplicate identifier 'tgF'. tests/cases/compiler/giant.ts(61,5): error TS1169: Computed property names are not allowed in interfaces. tests/cases/compiler/giant.ts(62,5): error TS1021: An index signature must have a type annotation. tests/cases/compiler/giant.ts(63,6): error TS1096: An index signature must have exactly one parameter. +tests/cases/compiler/giant.ts(76,5): error TS2386: Overload signatures must all be optional or required. +tests/cases/compiler/giant.ts(87,16): error TS2300: Duplicate identifier 'pgF'. tests/cases/compiler/giant.ts(88,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/giant.ts(88,20): error TS2300: Duplicate identifier 'pgF'. +tests/cases/compiler/giant.ts(89,16): error TS2300: Duplicate identifier 'psF'. tests/cases/compiler/giant.ts(90,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/giant.ts(90,20): error TS2300: Duplicate identifier 'psF'. +tests/cases/compiler/giant.ts(91,17): error TS2300: Duplicate identifier 'rgF'. tests/cases/compiler/giant.ts(92,21): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/giant.ts(92,21): error TS2300: Duplicate identifier 'rgF'. +tests/cases/compiler/giant.ts(93,17): error TS2300: Duplicate identifier 'rsF'. tests/cases/compiler/giant.ts(94,21): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/giant.ts(94,21): error TS2300: Duplicate identifier 'rsF'. +tests/cases/compiler/giant.ts(97,16): error TS2300: Duplicate identifier 'tsF'. tests/cases/compiler/giant.ts(98,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/giant.ts(98,20): error TS2300: Duplicate identifier 'tsF'. +tests/cases/compiler/giant.ts(99,16): error TS2300: Duplicate identifier 'tgF'. tests/cases/compiler/giant.ts(100,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/giant.ts(100,20): error TS2300: Duplicate identifier 'tgF'. tests/cases/compiler/giant.ts(125,9): error TS1169: Computed property names are not allowed in interfaces. tests/cases/compiler/giant.ts(126,9): error TS1021: An index signature must have a type annotation. tests/cases/compiler/giant.ts(127,10): error TS1096: An index signature must have exactly one parameter. +tests/cases/compiler/giant.ts(140,9): error TS2386: Overload signatures must all be optional or required. tests/cases/compiler/giant.ts(154,39): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(166,16): error TS2300: Duplicate identifier 'pgF'. tests/cases/compiler/giant.ts(167,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/giant.ts(167,20): error TS2300: Duplicate identifier 'pgF'. +tests/cases/compiler/giant.ts(168,16): error TS2300: Duplicate identifier 'psF'. tests/cases/compiler/giant.ts(169,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/giant.ts(169,20): error TS2300: Duplicate identifier 'psF'. +tests/cases/compiler/giant.ts(170,17): error TS2300: Duplicate identifier 'rgF'. tests/cases/compiler/giant.ts(171,21): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/giant.ts(171,21): error TS2300: Duplicate identifier 'rgF'. +tests/cases/compiler/giant.ts(172,17): error TS2300: Duplicate identifier 'rsF'. tests/cases/compiler/giant.ts(173,21): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/giant.ts(173,21): error TS2300: Duplicate identifier 'rsF'. +tests/cases/compiler/giant.ts(176,16): error TS2300: Duplicate identifier 'tsF'. tests/cases/compiler/giant.ts(177,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/giant.ts(177,20): error TS2300: Duplicate identifier 'tsF'. +tests/cases/compiler/giant.ts(178,16): error TS2300: Duplicate identifier 'tgF'. tests/cases/compiler/giant.ts(179,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/giant.ts(179,20): error TS2300: Duplicate identifier 'tgF'. tests/cases/compiler/giant.ts(204,9): error TS1169: Computed property names are not allowed in interfaces. tests/cases/compiler/giant.ts(205,9): error TS1021: An index signature must have a type annotation. tests/cases/compiler/giant.ts(206,10): error TS1096: An index signature must have exactly one parameter. +tests/cases/compiler/giant.ts(219,9): error TS2386: Overload signatures must all be optional or required. tests/cases/compiler/giant.ts(233,39): error TS1037: A function implementation cannot be declared in an ambient context. tests/cases/compiler/giant.ts(238,35): error TS1037: A function implementation cannot be declared in an ambient context. tests/cases/compiler/giant.ts(240,24): error TS1111: A constructor implementation cannot be declared in an ambient context. tests/cases/compiler/giant.ts(243,21): error TS1037: A function implementation cannot be declared in an ambient context. tests/cases/compiler/giant.ts(244,22): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(245,16): error TS2300: Duplicate identifier 'pgF'. tests/cases/compiler/giant.ts(245,22): error TS1037: A function implementation cannot be declared in an ambient context. tests/cases/compiler/giant.ts(246,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/giant.ts(246,20): error TS2300: Duplicate identifier 'pgF'. +tests/cases/compiler/giant.ts(247,16): error TS2300: Duplicate identifier 'psF'. tests/cases/compiler/giant.ts(247,31): error TS1037: A function implementation cannot be declared in an ambient context. tests/cases/compiler/giant.ts(248,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/giant.ts(248,20): error TS2300: Duplicate identifier 'psF'. +tests/cases/compiler/giant.ts(249,17): error TS2300: Duplicate identifier 'rgF'. tests/cases/compiler/giant.ts(249,23): error TS1037: A function implementation cannot be declared in an ambient context. tests/cases/compiler/giant.ts(250,21): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/giant.ts(250,21): error TS2300: Duplicate identifier 'rgF'. +tests/cases/compiler/giant.ts(251,17): error TS2300: Duplicate identifier 'rsF'. tests/cases/compiler/giant.ts(251,32): error TS1037: A function implementation cannot be declared in an ambient context. tests/cases/compiler/giant.ts(252,21): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/giant.ts(252,21): error TS2300: Duplicate identifier 'rsF'. tests/cases/compiler/giant.ts(254,21): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(255,16): error TS2300: Duplicate identifier 'tsF'. tests/cases/compiler/giant.ts(255,31): error TS1037: A function implementation cannot be declared in an ambient context. tests/cases/compiler/giant.ts(256,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/giant.ts(256,20): error TS2300: Duplicate identifier 'tsF'. +tests/cases/compiler/giant.ts(257,16): error TS2300: Duplicate identifier 'tgF'. tests/cases/compiler/giant.ts(257,22): error TS1037: A function implementation cannot be declared in an ambient context. tests/cases/compiler/giant.ts(258,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/giant.ts(258,20): error TS2300: Duplicate identifier 'tgF'. tests/cases/compiler/giant.ts(262,22): error TS1037: A function implementation cannot be declared in an ambient context. tests/cases/compiler/giant.ts(262,25): error TS1036: Statements are not allowed in ambient contexts. tests/cases/compiler/giant.ts(267,30): error TS1037: A function implementation cannot be declared in an ambient context. tests/cases/compiler/giant.ts(267,33): error TS1036: Statements are not allowed in ambient contexts. +tests/cases/compiler/giant.ts(281,12): error TS2300: Duplicate identifier 'pgF'. tests/cases/compiler/giant.ts(282,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/giant.ts(282,16): error TS2300: Duplicate identifier 'pgF'. +tests/cases/compiler/giant.ts(283,12): error TS2300: Duplicate identifier 'psF'. tests/cases/compiler/giant.ts(284,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/giant.ts(284,16): error TS2300: Duplicate identifier 'psF'. +tests/cases/compiler/giant.ts(285,13): error TS2300: Duplicate identifier 'rgF'. tests/cases/compiler/giant.ts(286,17): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/giant.ts(286,17): error TS2300: Duplicate identifier 'rgF'. +tests/cases/compiler/giant.ts(287,13): error TS2300: Duplicate identifier 'rsF'. tests/cases/compiler/giant.ts(288,17): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/giant.ts(288,17): error TS2300: Duplicate identifier 'rsF'. +tests/cases/compiler/giant.ts(291,12): error TS2300: Duplicate identifier 'tsF'. tests/cases/compiler/giant.ts(292,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/giant.ts(292,16): error TS2300: Duplicate identifier 'tsF'. +tests/cases/compiler/giant.ts(293,12): error TS2300: Duplicate identifier 'tgF'. tests/cases/compiler/giant.ts(294,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/giant.ts(294,16): error TS2300: Duplicate identifier 'tgF'. tests/cases/compiler/giant.ts(319,5): error TS1169: Computed property names are not allowed in interfaces. tests/cases/compiler/giant.ts(320,5): error TS1021: An index signature must have a type annotation. tests/cases/compiler/giant.ts(321,6): error TS1096: An index signature must have exactly one parameter. +tests/cases/compiler/giant.ts(334,5): error TS2386: Overload signatures must all be optional or required. +tests/cases/compiler/giant.ts(345,16): error TS2300: Duplicate identifier 'pgF'. tests/cases/compiler/giant.ts(346,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/giant.ts(346,20): error TS2300: Duplicate identifier 'pgF'. +tests/cases/compiler/giant.ts(347,16): error TS2300: Duplicate identifier 'psF'. tests/cases/compiler/giant.ts(348,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/giant.ts(348,20): error TS2300: Duplicate identifier 'psF'. +tests/cases/compiler/giant.ts(349,17): error TS2300: Duplicate identifier 'rgF'. tests/cases/compiler/giant.ts(350,21): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/giant.ts(350,21): error TS2300: Duplicate identifier 'rgF'. +tests/cases/compiler/giant.ts(351,17): error TS2300: Duplicate identifier 'rsF'. tests/cases/compiler/giant.ts(352,21): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/giant.ts(352,21): error TS2300: Duplicate identifier 'rsF'. +tests/cases/compiler/giant.ts(355,16): error TS2300: Duplicate identifier 'tsF'. tests/cases/compiler/giant.ts(356,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/giant.ts(356,20): error TS2300: Duplicate identifier 'tsF'. +tests/cases/compiler/giant.ts(357,16): error TS2300: Duplicate identifier 'tgF'. tests/cases/compiler/giant.ts(358,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/giant.ts(358,20): error TS2300: Duplicate identifier 'tgF'. tests/cases/compiler/giant.ts(383,9): error TS1169: Computed property names are not allowed in interfaces. tests/cases/compiler/giant.ts(384,9): error TS1021: An index signature must have a type annotation. tests/cases/compiler/giant.ts(385,10): error TS1096: An index signature must have exactly one parameter. +tests/cases/compiler/giant.ts(398,9): error TS2386: Overload signatures must all be optional or required. tests/cases/compiler/giant.ts(412,39): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(424,16): error TS2300: Duplicate identifier 'pgF'. tests/cases/compiler/giant.ts(425,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/giant.ts(425,20): error TS2300: Duplicate identifier 'pgF'. +tests/cases/compiler/giant.ts(426,16): error TS2300: Duplicate identifier 'psF'. tests/cases/compiler/giant.ts(427,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/giant.ts(427,20): error TS2300: Duplicate identifier 'psF'. +tests/cases/compiler/giant.ts(428,17): error TS2300: Duplicate identifier 'rgF'. tests/cases/compiler/giant.ts(429,21): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/giant.ts(429,21): error TS2300: Duplicate identifier 'rgF'. +tests/cases/compiler/giant.ts(430,17): error TS2300: Duplicate identifier 'rsF'. tests/cases/compiler/giant.ts(431,21): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/giant.ts(431,21): error TS2300: Duplicate identifier 'rsF'. +tests/cases/compiler/giant.ts(434,16): error TS2300: Duplicate identifier 'tsF'. tests/cases/compiler/giant.ts(435,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/giant.ts(435,20): error TS2300: Duplicate identifier 'tsF'. +tests/cases/compiler/giant.ts(436,16): error TS2300: Duplicate identifier 'tgF'. tests/cases/compiler/giant.ts(437,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/giant.ts(437,20): error TS2300: Duplicate identifier 'tgF'. tests/cases/compiler/giant.ts(462,9): error TS1169: Computed property names are not allowed in interfaces. tests/cases/compiler/giant.ts(463,9): error TS1021: An index signature must have a type annotation. tests/cases/compiler/giant.ts(464,10): error TS1096: An index signature must have exactly one parameter. +tests/cases/compiler/giant.ts(477,9): error TS2386: Overload signatures must all be optional or required. tests/cases/compiler/giant.ts(491,39): error TS1037: A function implementation cannot be declared in an ambient context. tests/cases/compiler/giant.ts(496,35): error TS1037: A function implementation cannot be declared in an ambient context. tests/cases/compiler/giant.ts(498,24): error TS1111: A constructor implementation cannot be declared in an ambient context. tests/cases/compiler/giant.ts(501,21): error TS1037: A function implementation cannot be declared in an ambient context. tests/cases/compiler/giant.ts(502,22): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(503,16): error TS2300: Duplicate identifier 'pgF'. tests/cases/compiler/giant.ts(503,22): error TS1037: A function implementation cannot be declared in an ambient context. tests/cases/compiler/giant.ts(504,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/giant.ts(504,20): error TS2300: Duplicate identifier 'pgF'. +tests/cases/compiler/giant.ts(505,16): error TS2300: Duplicate identifier 'psF'. tests/cases/compiler/giant.ts(505,31): error TS1037: A function implementation cannot be declared in an ambient context. tests/cases/compiler/giant.ts(506,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/giant.ts(506,20): error TS2300: Duplicate identifier 'psF'. +tests/cases/compiler/giant.ts(507,17): error TS2300: Duplicate identifier 'rgF'. tests/cases/compiler/giant.ts(507,23): error TS1037: A function implementation cannot be declared in an ambient context. tests/cases/compiler/giant.ts(508,21): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/giant.ts(508,21): error TS2300: Duplicate identifier 'rgF'. +tests/cases/compiler/giant.ts(509,17): error TS2300: Duplicate identifier 'rsF'. tests/cases/compiler/giant.ts(509,32): error TS1037: A function implementation cannot be declared in an ambient context. tests/cases/compiler/giant.ts(510,21): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/giant.ts(510,21): error TS2300: Duplicate identifier 'rsF'. tests/cases/compiler/giant.ts(512,21): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(513,16): error TS2300: Duplicate identifier 'tsF'. tests/cases/compiler/giant.ts(513,31): error TS1037: A function implementation cannot be declared in an ambient context. tests/cases/compiler/giant.ts(514,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/giant.ts(514,20): error TS2300: Duplicate identifier 'tsF'. +tests/cases/compiler/giant.ts(515,16): error TS2300: Duplicate identifier 'tgF'. tests/cases/compiler/giant.ts(515,22): error TS1037: A function implementation cannot be declared in an ambient context. tests/cases/compiler/giant.ts(516,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/giant.ts(516,20): error TS2300: Duplicate identifier 'tgF'. tests/cases/compiler/giant.ts(520,22): error TS1037: A function implementation cannot be declared in an ambient context. tests/cases/compiler/giant.ts(520,25): error TS1036: Statements are not allowed in ambient contexts. tests/cases/compiler/giant.ts(525,30): error TS1037: A function implementation cannot be declared in an ambient context. @@ -102,19 +204,31 @@ tests/cases/compiler/giant.ts(532,31): error TS1037: A function implementation c tests/cases/compiler/giant.ts(534,20): error TS1111: A constructor implementation cannot be declared in an ambient context. tests/cases/compiler/giant.ts(537,17): error TS1037: A function implementation cannot be declared in an ambient context. tests/cases/compiler/giant.ts(538,18): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(539,12): error TS2300: Duplicate identifier 'pgF'. tests/cases/compiler/giant.ts(539,18): error TS1037: A function implementation cannot be declared in an ambient context. tests/cases/compiler/giant.ts(540,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/giant.ts(540,16): error TS2300: Duplicate identifier 'pgF'. +tests/cases/compiler/giant.ts(541,12): error TS2300: Duplicate identifier 'psF'. tests/cases/compiler/giant.ts(541,27): error TS1037: A function implementation cannot be declared in an ambient context. tests/cases/compiler/giant.ts(542,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/giant.ts(542,16): error TS2300: Duplicate identifier 'psF'. +tests/cases/compiler/giant.ts(543,13): error TS2300: Duplicate identifier 'rgF'. tests/cases/compiler/giant.ts(543,19): error TS1037: A function implementation cannot be declared in an ambient context. tests/cases/compiler/giant.ts(544,17): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/giant.ts(544,17): error TS2300: Duplicate identifier 'rgF'. +tests/cases/compiler/giant.ts(545,13): error TS2300: Duplicate identifier 'rsF'. tests/cases/compiler/giant.ts(545,28): error TS1037: A function implementation cannot be declared in an ambient context. tests/cases/compiler/giant.ts(546,17): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/giant.ts(546,17): error TS2300: Duplicate identifier 'rsF'. tests/cases/compiler/giant.ts(548,17): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(549,12): error TS2300: Duplicate identifier 'tsF'. tests/cases/compiler/giant.ts(549,27): error TS1037: A function implementation cannot be declared in an ambient context. tests/cases/compiler/giant.ts(550,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/giant.ts(550,16): error TS2300: Duplicate identifier 'tsF'. +tests/cases/compiler/giant.ts(551,12): error TS2300: Duplicate identifier 'tgF'. tests/cases/compiler/giant.ts(551,18): error TS1037: A function implementation cannot be declared in an ambient context. tests/cases/compiler/giant.ts(552,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/giant.ts(552,16): error TS2300: Duplicate identifier 'tgF'. tests/cases/compiler/giant.ts(556,18): error TS1037: A function implementation cannot be declared in an ambient context. tests/cases/compiler/giant.ts(556,21): error TS1036: Statements are not allowed in ambient contexts. tests/cases/compiler/giant.ts(558,24): error TS1111: A constructor implementation cannot be declared in an ambient context. @@ -123,6 +237,7 @@ tests/cases/compiler/giant.ts(563,21): error TS1037: A function implementation c tests/cases/compiler/giant.ts(587,9): error TS1169: Computed property names are not allowed in interfaces. tests/cases/compiler/giant.ts(588,9): error TS1021: An index signature must have a type annotation. tests/cases/compiler/giant.ts(589,10): error TS1096: An index signature must have exactly one parameter. +tests/cases/compiler/giant.ts(602,9): error TS2386: Overload signatures must all be optional or required. tests/cases/compiler/giant.ts(606,22): error TS1037: A function implementation cannot be declared in an ambient context. tests/cases/compiler/giant.ts(606,25): error TS1036: Statements are not allowed in ambient contexts. tests/cases/compiler/giant.ts(611,30): error TS1037: A function implementation cannot be declared in an ambient context. @@ -140,126 +255,11 @@ tests/cases/compiler/giant.ts(628,21): error TS1037: A function implementation c tests/cases/compiler/giant.ts(653,9): error TS1169: Computed property names are not allowed in interfaces. tests/cases/compiler/giant.ts(654,9): error TS1021: An index signature must have a type annotation. tests/cases/compiler/giant.ts(655,10): error TS1096: An index signature must have exactly one parameter. +tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all be optional or required. tests/cases/compiler/giant.ts(672,22): error TS1037: A function implementation cannot be declared in an ambient context. tests/cases/compiler/giant.ts(672,25): error TS1036: Statements are not allowed in ambient contexts. tests/cases/compiler/giant.ts(676,30): error TS1037: A function implementation cannot be declared in an ambient context. tests/cases/compiler/giant.ts(676,33): error TS1036: Statements are not allowed in ambient contexts. -tests/cases/compiler/giant.ts(23,12): error TS2300: Duplicate identifier 'pgF'. -tests/cases/compiler/giant.ts(24,16): error TS2300: Duplicate identifier 'pgF'. -tests/cases/compiler/giant.ts(25,12): error TS2300: Duplicate identifier 'psF'. -tests/cases/compiler/giant.ts(26,16): error TS2300: Duplicate identifier 'psF'. -tests/cases/compiler/giant.ts(27,13): error TS2300: Duplicate identifier 'rgF'. -tests/cases/compiler/giant.ts(28,17): error TS2300: Duplicate identifier 'rgF'. -tests/cases/compiler/giant.ts(29,13): error TS2300: Duplicate identifier 'rsF'. -tests/cases/compiler/giant.ts(30,17): error TS2300: Duplicate identifier 'rsF'. -tests/cases/compiler/giant.ts(33,12): error TS2300: Duplicate identifier 'tsF'. -tests/cases/compiler/giant.ts(34,16): error TS2300: Duplicate identifier 'tsF'. -tests/cases/compiler/giant.ts(35,12): error TS2300: Duplicate identifier 'tgF'. -tests/cases/compiler/giant.ts(36,16): error TS2300: Duplicate identifier 'tgF'. -tests/cases/compiler/giant.ts(76,5): error TS2386: Overload signatures must all be optional or required. -tests/cases/compiler/giant.ts(87,16): error TS2300: Duplicate identifier 'pgF'. -tests/cases/compiler/giant.ts(88,20): error TS2300: Duplicate identifier 'pgF'. -tests/cases/compiler/giant.ts(89,16): error TS2300: Duplicate identifier 'psF'. -tests/cases/compiler/giant.ts(90,20): error TS2300: Duplicate identifier 'psF'. -tests/cases/compiler/giant.ts(91,17): error TS2300: Duplicate identifier 'rgF'. -tests/cases/compiler/giant.ts(92,21): error TS2300: Duplicate identifier 'rgF'. -tests/cases/compiler/giant.ts(93,17): error TS2300: Duplicate identifier 'rsF'. -tests/cases/compiler/giant.ts(94,21): error TS2300: Duplicate identifier 'rsF'. -tests/cases/compiler/giant.ts(97,16): error TS2300: Duplicate identifier 'tsF'. -tests/cases/compiler/giant.ts(98,20): error TS2300: Duplicate identifier 'tsF'. -tests/cases/compiler/giant.ts(99,16): error TS2300: Duplicate identifier 'tgF'. -tests/cases/compiler/giant.ts(100,20): error TS2300: Duplicate identifier 'tgF'. -tests/cases/compiler/giant.ts(140,9): error TS2386: Overload signatures must all be optional or required. -tests/cases/compiler/giant.ts(166,16): error TS2300: Duplicate identifier 'pgF'. -tests/cases/compiler/giant.ts(167,20): error TS2300: Duplicate identifier 'pgF'. -tests/cases/compiler/giant.ts(168,16): error TS2300: Duplicate identifier 'psF'. -tests/cases/compiler/giant.ts(169,20): error TS2300: Duplicate identifier 'psF'. -tests/cases/compiler/giant.ts(170,17): error TS2300: Duplicate identifier 'rgF'. -tests/cases/compiler/giant.ts(171,21): error TS2300: Duplicate identifier 'rgF'. -tests/cases/compiler/giant.ts(172,17): error TS2300: Duplicate identifier 'rsF'. -tests/cases/compiler/giant.ts(173,21): error TS2300: Duplicate identifier 'rsF'. -tests/cases/compiler/giant.ts(176,16): error TS2300: Duplicate identifier 'tsF'. -tests/cases/compiler/giant.ts(177,20): error TS2300: Duplicate identifier 'tsF'. -tests/cases/compiler/giant.ts(178,16): error TS2300: Duplicate identifier 'tgF'. -tests/cases/compiler/giant.ts(179,20): error TS2300: Duplicate identifier 'tgF'. -tests/cases/compiler/giant.ts(219,9): error TS2386: Overload signatures must all be optional or required. -tests/cases/compiler/giant.ts(245,16): error TS2300: Duplicate identifier 'pgF'. -tests/cases/compiler/giant.ts(246,20): error TS2300: Duplicate identifier 'pgF'. -tests/cases/compiler/giant.ts(247,16): error TS2300: Duplicate identifier 'psF'. -tests/cases/compiler/giant.ts(248,20): error TS2300: Duplicate identifier 'psF'. -tests/cases/compiler/giant.ts(249,17): error TS2300: Duplicate identifier 'rgF'. -tests/cases/compiler/giant.ts(250,21): error TS2300: Duplicate identifier 'rgF'. -tests/cases/compiler/giant.ts(251,17): error TS2300: Duplicate identifier 'rsF'. -tests/cases/compiler/giant.ts(252,21): error TS2300: Duplicate identifier 'rsF'. -tests/cases/compiler/giant.ts(255,16): error TS2300: Duplicate identifier 'tsF'. -tests/cases/compiler/giant.ts(256,20): error TS2300: Duplicate identifier 'tsF'. -tests/cases/compiler/giant.ts(257,16): error TS2300: Duplicate identifier 'tgF'. -tests/cases/compiler/giant.ts(258,20): error TS2300: Duplicate identifier 'tgF'. -tests/cases/compiler/giant.ts(281,12): error TS2300: Duplicate identifier 'pgF'. -tests/cases/compiler/giant.ts(282,16): error TS2300: Duplicate identifier 'pgF'. -tests/cases/compiler/giant.ts(283,12): error TS2300: Duplicate identifier 'psF'. -tests/cases/compiler/giant.ts(284,16): error TS2300: Duplicate identifier 'psF'. -tests/cases/compiler/giant.ts(285,13): error TS2300: Duplicate identifier 'rgF'. -tests/cases/compiler/giant.ts(286,17): error TS2300: Duplicate identifier 'rgF'. -tests/cases/compiler/giant.ts(287,13): error TS2300: Duplicate identifier 'rsF'. -tests/cases/compiler/giant.ts(288,17): error TS2300: Duplicate identifier 'rsF'. -tests/cases/compiler/giant.ts(291,12): error TS2300: Duplicate identifier 'tsF'. -tests/cases/compiler/giant.ts(292,16): error TS2300: Duplicate identifier 'tsF'. -tests/cases/compiler/giant.ts(293,12): error TS2300: Duplicate identifier 'tgF'. -tests/cases/compiler/giant.ts(294,16): error TS2300: Duplicate identifier 'tgF'. -tests/cases/compiler/giant.ts(334,5): error TS2386: Overload signatures must all be optional or required. -tests/cases/compiler/giant.ts(345,16): error TS2300: Duplicate identifier 'pgF'. -tests/cases/compiler/giant.ts(346,20): error TS2300: Duplicate identifier 'pgF'. -tests/cases/compiler/giant.ts(347,16): error TS2300: Duplicate identifier 'psF'. -tests/cases/compiler/giant.ts(348,20): error TS2300: Duplicate identifier 'psF'. -tests/cases/compiler/giant.ts(349,17): error TS2300: Duplicate identifier 'rgF'. -tests/cases/compiler/giant.ts(350,21): error TS2300: Duplicate identifier 'rgF'. -tests/cases/compiler/giant.ts(351,17): error TS2300: Duplicate identifier 'rsF'. -tests/cases/compiler/giant.ts(352,21): error TS2300: Duplicate identifier 'rsF'. -tests/cases/compiler/giant.ts(355,16): error TS2300: Duplicate identifier 'tsF'. -tests/cases/compiler/giant.ts(356,20): error TS2300: Duplicate identifier 'tsF'. -tests/cases/compiler/giant.ts(357,16): error TS2300: Duplicate identifier 'tgF'. -tests/cases/compiler/giant.ts(358,20): error TS2300: Duplicate identifier 'tgF'. -tests/cases/compiler/giant.ts(398,9): error TS2386: Overload signatures must all be optional or required. -tests/cases/compiler/giant.ts(424,16): error TS2300: Duplicate identifier 'pgF'. -tests/cases/compiler/giant.ts(425,20): error TS2300: Duplicate identifier 'pgF'. -tests/cases/compiler/giant.ts(426,16): error TS2300: Duplicate identifier 'psF'. -tests/cases/compiler/giant.ts(427,20): error TS2300: Duplicate identifier 'psF'. -tests/cases/compiler/giant.ts(428,17): error TS2300: Duplicate identifier 'rgF'. -tests/cases/compiler/giant.ts(429,21): error TS2300: Duplicate identifier 'rgF'. -tests/cases/compiler/giant.ts(430,17): error TS2300: Duplicate identifier 'rsF'. -tests/cases/compiler/giant.ts(431,21): error TS2300: Duplicate identifier 'rsF'. -tests/cases/compiler/giant.ts(434,16): error TS2300: Duplicate identifier 'tsF'. -tests/cases/compiler/giant.ts(435,20): error TS2300: Duplicate identifier 'tsF'. -tests/cases/compiler/giant.ts(436,16): error TS2300: Duplicate identifier 'tgF'. -tests/cases/compiler/giant.ts(437,20): error TS2300: Duplicate identifier 'tgF'. -tests/cases/compiler/giant.ts(477,9): error TS2386: Overload signatures must all be optional or required. -tests/cases/compiler/giant.ts(503,16): error TS2300: Duplicate identifier 'pgF'. -tests/cases/compiler/giant.ts(504,20): error TS2300: Duplicate identifier 'pgF'. -tests/cases/compiler/giant.ts(505,16): error TS2300: Duplicate identifier 'psF'. -tests/cases/compiler/giant.ts(506,20): error TS2300: Duplicate identifier 'psF'. -tests/cases/compiler/giant.ts(507,17): error TS2300: Duplicate identifier 'rgF'. -tests/cases/compiler/giant.ts(508,21): error TS2300: Duplicate identifier 'rgF'. -tests/cases/compiler/giant.ts(509,17): error TS2300: Duplicate identifier 'rsF'. -tests/cases/compiler/giant.ts(510,21): error TS2300: Duplicate identifier 'rsF'. -tests/cases/compiler/giant.ts(513,16): error TS2300: Duplicate identifier 'tsF'. -tests/cases/compiler/giant.ts(514,20): error TS2300: Duplicate identifier 'tsF'. -tests/cases/compiler/giant.ts(515,16): error TS2300: Duplicate identifier 'tgF'. -tests/cases/compiler/giant.ts(516,20): error TS2300: Duplicate identifier 'tgF'. -tests/cases/compiler/giant.ts(539,12): error TS2300: Duplicate identifier 'pgF'. -tests/cases/compiler/giant.ts(540,16): error TS2300: Duplicate identifier 'pgF'. -tests/cases/compiler/giant.ts(541,12): error TS2300: Duplicate identifier 'psF'. -tests/cases/compiler/giant.ts(542,16): error TS2300: Duplicate identifier 'psF'. -tests/cases/compiler/giant.ts(543,13): error TS2300: Duplicate identifier 'rgF'. -tests/cases/compiler/giant.ts(544,17): error TS2300: Duplicate identifier 'rgF'. -tests/cases/compiler/giant.ts(545,13): error TS2300: Duplicate identifier 'rsF'. -tests/cases/compiler/giant.ts(546,17): error TS2300: Duplicate identifier 'rsF'. -tests/cases/compiler/giant.ts(549,12): error TS2300: Duplicate identifier 'tsF'. -tests/cases/compiler/giant.ts(550,16): error TS2300: Duplicate identifier 'tsF'. -tests/cases/compiler/giant.ts(551,12): error TS2300: Duplicate identifier 'tgF'. -tests/cases/compiler/giant.ts(552,16): error TS2300: Duplicate identifier 'tgF'. -tests/cases/compiler/giant.ts(602,9): error TS2386: Overload signatures must all be optional or required. -tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all be optional or required. ==== tests/cases/compiler/giant.ts (262 errors) ==== @@ -652,40 +652,40 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all ~ !!! error TS1037: A function implementation cannot be declared in an ambient context. public pgF() { } - ~ -!!! error TS1037: A function implementation cannot be declared in an ambient context. ~~~ !!! error TS2300: Duplicate identifier 'pgF'. + ~ +!!! error TS1037: A function implementation cannot be declared in an ambient context. public get pgF() ~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~~ !!! error TS2300: Duplicate identifier 'pgF'. public psF(param:any) { } - ~ -!!! error TS1037: A function implementation cannot be declared in an ambient context. ~~~ !!! error TS2300: Duplicate identifier 'psF'. + ~ +!!! error TS1037: A function implementation cannot be declared in an ambient context. public set psF(param:any) ~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~~ !!! error TS2300: Duplicate identifier 'psF'. private rgF() { } - ~ -!!! error TS1037: A function implementation cannot be declared in an ambient context. ~~~ !!! error TS2300: Duplicate identifier 'rgF'. + ~ +!!! error TS1037: A function implementation cannot be declared in an ambient context. private get rgF() ~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~~ !!! error TS2300: Duplicate identifier 'rgF'. private rsF(param:any) { } - ~ -!!! error TS1037: A function implementation cannot be declared in an ambient context. ~~~ !!! error TS2300: Duplicate identifier 'rsF'. + ~ +!!! error TS1037: A function implementation cannot be declared in an ambient context. private set rsF(param:any) ~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. @@ -696,20 +696,20 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all ~ !!! error TS1037: A function implementation cannot be declared in an ambient context. static tsF(param:any) { } - ~ -!!! error TS1037: A function implementation cannot be declared in an ambient context. ~~~ !!! error TS2300: Duplicate identifier 'tsF'. + ~ +!!! error TS1037: A function implementation cannot be declared in an ambient context. static set tsF(param:any) ~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~~ !!! error TS2300: Duplicate identifier 'tsF'. static tgF() { } - ~ -!!! error TS1037: A function implementation cannot be declared in an ambient context. ~~~ !!! error TS2300: Duplicate identifier 'tgF'. + ~ +!!! error TS1037: A function implementation cannot be declared in an ambient context. static get tgF() ~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. @@ -1112,40 +1112,40 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all ~ !!! error TS1037: A function implementation cannot be declared in an ambient context. public pgF() { } - ~ -!!! error TS1037: A function implementation cannot be declared in an ambient context. ~~~ !!! error TS2300: Duplicate identifier 'pgF'. + ~ +!!! error TS1037: A function implementation cannot be declared in an ambient context. public get pgF() ~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~~ !!! error TS2300: Duplicate identifier 'pgF'. public psF(param:any) { } - ~ -!!! error TS1037: A function implementation cannot be declared in an ambient context. ~~~ !!! error TS2300: Duplicate identifier 'psF'. + ~ +!!! error TS1037: A function implementation cannot be declared in an ambient context. public set psF(param:any) ~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~~ !!! error TS2300: Duplicate identifier 'psF'. private rgF() { } - ~ -!!! error TS1037: A function implementation cannot be declared in an ambient context. ~~~ !!! error TS2300: Duplicate identifier 'rgF'. + ~ +!!! error TS1037: A function implementation cannot be declared in an ambient context. private get rgF() ~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~~ !!! error TS2300: Duplicate identifier 'rgF'. private rsF(param:any) { } - ~ -!!! error TS1037: A function implementation cannot be declared in an ambient context. ~~~ !!! error TS2300: Duplicate identifier 'rsF'. + ~ +!!! error TS1037: A function implementation cannot be declared in an ambient context. private set rsF(param:any) ~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. @@ -1156,20 +1156,20 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all ~ !!! error TS1037: A function implementation cannot be declared in an ambient context. static tsF(param:any) { } - ~ -!!! error TS1037: A function implementation cannot be declared in an ambient context. ~~~ !!! error TS2300: Duplicate identifier 'tsF'. + ~ +!!! error TS1037: A function implementation cannot be declared in an ambient context. static set tsF(param:any) ~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~~ !!! error TS2300: Duplicate identifier 'tsF'. static tgF() { } - ~ -!!! error TS1037: A function implementation cannot be declared in an ambient context. ~~~ !!! error TS2300: Duplicate identifier 'tgF'. + ~ +!!! error TS1037: A function implementation cannot be declared in an ambient context. static get tgF() ~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. @@ -1214,40 +1214,40 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all ~ !!! error TS1037: A function implementation cannot be declared in an ambient context. public pgF() { } - ~ -!!! error TS1037: A function implementation cannot be declared in an ambient context. ~~~ !!! error TS2300: Duplicate identifier 'pgF'. + ~ +!!! error TS1037: A function implementation cannot be declared in an ambient context. public get pgF() ~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~~ !!! error TS2300: Duplicate identifier 'pgF'. public psF(param:any) { } - ~ -!!! error TS1037: A function implementation cannot be declared in an ambient context. ~~~ !!! error TS2300: Duplicate identifier 'psF'. + ~ +!!! error TS1037: A function implementation cannot be declared in an ambient context. public set psF(param:any) ~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~~ !!! error TS2300: Duplicate identifier 'psF'. private rgF() { } - ~ -!!! error TS1037: A function implementation cannot be declared in an ambient context. ~~~ !!! error TS2300: Duplicate identifier 'rgF'. + ~ +!!! error TS1037: A function implementation cannot be declared in an ambient context. private get rgF() ~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~~ !!! error TS2300: Duplicate identifier 'rgF'. private rsF(param:any) { } - ~ -!!! error TS1037: A function implementation cannot be declared in an ambient context. ~~~ !!! error TS2300: Duplicate identifier 'rsF'. + ~ +!!! error TS1037: A function implementation cannot be declared in an ambient context. private set rsF(param:any) ~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. @@ -1258,20 +1258,20 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all ~ !!! error TS1037: A function implementation cannot be declared in an ambient context. static tsF(param:any) { } - ~ -!!! error TS1037: A function implementation cannot be declared in an ambient context. ~~~ !!! error TS2300: Duplicate identifier 'tsF'. + ~ +!!! error TS1037: A function implementation cannot be declared in an ambient context. static set tsF(param:any) ~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~~ !!! error TS2300: Duplicate identifier 'tsF'. static tgF() { } - ~ -!!! error TS1037: A function implementation cannot be declared in an ambient context. ~~~ !!! error TS2300: Duplicate identifier 'tgF'. + ~ +!!! error TS1037: A function implementation cannot be declared in an ambient context. static get tgF() ~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. diff --git a/tests/baselines/reference/illegalSuperCallsInConstructor.errors.txt b/tests/baselines/reference/illegalSuperCallsInConstructor.errors.txt index 6b86209b5b1..a07fbea75d8 100644 --- a/tests/baselines/reference/illegalSuperCallsInConstructor.errors.txt +++ b/tests/baselines/reference/illegalSuperCallsInConstructor.errors.txt @@ -1,10 +1,10 @@ -tests/cases/compiler/illegalSuperCallsInConstructor.ts(11,17): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/illegalSuperCallsInConstructor.ts(15,17): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/illegalSuperCallsInConstructor.ts(6,5): error TS2377: Constructors for derived classes must contain a 'super' call. tests/cases/compiler/illegalSuperCallsInConstructor.ts(7,24): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors tests/cases/compiler/illegalSuperCallsInConstructor.ts(8,26): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors tests/cases/compiler/illegalSuperCallsInConstructor.ts(9,32): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors +tests/cases/compiler/illegalSuperCallsInConstructor.ts(11,17): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/illegalSuperCallsInConstructor.ts(12,17): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors +tests/cases/compiler/illegalSuperCallsInConstructor.ts(15,17): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/illegalSuperCallsInConstructor.ts(16,17): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors @@ -31,9 +31,9 @@ tests/cases/compiler/illegalSuperCallsInConstructor.ts(16,17): error TS2337: Sup var r5 = { ~~~~~~~~~~~~~~~~~~ get foo() { + ~~~~~~~~~~~~~~~~~~~~~~~ ~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. - ~~~~~~~~~~~~~~~~~~~~~~~ super(); ~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~ @@ -43,9 +43,9 @@ tests/cases/compiler/illegalSuperCallsInConstructor.ts(16,17): error TS2337: Sup }, ~~~~~~~~~~~~~~ set foo(v: number) { + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ super(); ~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~ diff --git a/tests/baselines/reference/implicitAnyCastedValue.errors.txt b/tests/baselines/reference/implicitAnyCastedValue.errors.txt index 4b88cb0a8b4..613aa4820d2 100644 --- a/tests/baselines/reference/implicitAnyCastedValue.errors.txt +++ b/tests/baselines/reference/implicitAnyCastedValue.errors.txt @@ -1,9 +1,9 @@ -tests/cases/compiler/implicitAnyCastedValue.ts(12,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/implicitAnyCastedValue.ts(28,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/implicitAnyCastedValue.ts(32,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/implicitAnyCastedValue.ts(10,5): error TS7008: Member 'bar' implicitly has an 'any' type. tests/cases/compiler/implicitAnyCastedValue.ts(11,5): error TS7008: Member 'foo' implicitly has an 'any' type. +tests/cases/compiler/implicitAnyCastedValue.ts(12,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/implicitAnyCastedValue.ts(26,5): error TS7008: Member 'getValue' implicitly has an 'any' type. +tests/cases/compiler/implicitAnyCastedValue.ts(28,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/implicitAnyCastedValue.ts(32,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/implicitAnyCastedValue.ts(41,1): error TS7010: 'notCastedNull', which lacks return-type annotation, implicitly has an 'any' return type. tests/cases/compiler/implicitAnyCastedValue.ts(53,24): error TS7006: Parameter 'x' implicitly has an 'any' type. tests/cases/compiler/implicitAnyCastedValue.ts(62,24): error TS7006: Parameter 'x' implicitly has an 'any' type. diff --git a/tests/baselines/reference/implicitAnyGetAndSetAccessorWithAnyReturnType.errors.txt b/tests/baselines/reference/implicitAnyGetAndSetAccessorWithAnyReturnType.errors.txt index 9f2dc9ce949..4d9008cd56a 100644 --- a/tests/baselines/reference/implicitAnyGetAndSetAccessorWithAnyReturnType.errors.txt +++ b/tests/baselines/reference/implicitAnyGetAndSetAccessorWithAnyReturnType.errors.txt @@ -1,11 +1,11 @@ +tests/cases/compiler/implicitAnyGetAndSetAccessorWithAnyReturnType.ts(3,5): error TS7008: Member 'getAndSet' implicitly has an 'any' type. tests/cases/compiler/implicitAnyGetAndSetAccessorWithAnyReturnType.ts(4,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/implicitAnyGetAndSetAccessorWithAnyReturnType.ts(9,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/implicitAnyGetAndSetAccessorWithAnyReturnType.ts(15,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/implicitAnyGetAndSetAccessorWithAnyReturnType.ts(20,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/implicitAnyGetAndSetAccessorWithAnyReturnType.ts(3,5): error TS7008: Member 'getAndSet' implicitly has an 'any' type. tests/cases/compiler/implicitAnyGetAndSetAccessorWithAnyReturnType.ts(15,5): error TS7016: Property 'haveOnlySet' implicitly has type 'any', because its 'set' accessor lacks a type annotation. +tests/cases/compiler/implicitAnyGetAndSetAccessorWithAnyReturnType.ts(15,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/implicitAnyGetAndSetAccessorWithAnyReturnType.ts(15,28): error TS7006: Parameter 'newXValue' implicitly has an 'any' type. tests/cases/compiler/implicitAnyGetAndSetAccessorWithAnyReturnType.ts(20,5): error TS7010: 'haveOnlyGet', which lacks return-type annotation, implicitly has an 'any' return type. +tests/cases/compiler/implicitAnyGetAndSetAccessorWithAnyReturnType.ts(20,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ==== tests/cases/compiler/implicitAnyGetAndSetAccessorWithAnyReturnType.ts (8 errors) ==== @@ -30,9 +30,9 @@ tests/cases/compiler/implicitAnyGetAndSetAccessorWithAnyReturnType.ts(20,5): err class SetterOnly { public set haveOnlySet(newXValue) { // error at "haveOnlySet, newXValue" + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~ !!! error TS7006: Parameter 'newXValue' implicitly has an 'any' type. } @@ -42,9 +42,9 @@ tests/cases/compiler/implicitAnyGetAndSetAccessorWithAnyReturnType.ts(20,5): err class GetterOnly { public get haveOnlyGet() { // error at "haveOnlyGet" + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ return null; ~~~~~~~~~~~~~~~~~~~~ } diff --git a/tests/baselines/reference/implicitAnyInAmbientDeclaration.errors.txt b/tests/baselines/reference/implicitAnyInAmbientDeclaration.errors.txt index 6ec975e33ea..4775ec0511b 100644 --- a/tests/baselines/reference/implicitAnyInAmbientDeclaration.errors.txt +++ b/tests/baselines/reference/implicitAnyInAmbientDeclaration.errors.txt @@ -1,7 +1,7 @@ -tests/cases/compiler/implicitAnyInAmbientDeclaration.ts(8,9): error TS1089: 'private' modifier cannot appear on a constructor declaration. tests/cases/compiler/implicitAnyInAmbientDeclaration.ts(3,9): error TS7008: Member 'publicMember' implicitly has an 'any' type. tests/cases/compiler/implicitAnyInAmbientDeclaration.ts(6,9): error TS7010: 'publicFunction', which lacks return-type annotation, implicitly has an 'any' return type. tests/cases/compiler/implicitAnyInAmbientDeclaration.ts(6,31): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/implicitAnyInAmbientDeclaration.ts(8,9): error TS1089: 'private' modifier cannot appear on a constructor declaration. ==== tests/cases/compiler/implicitAnyInAmbientDeclaration.ts (4 errors) ==== diff --git a/tests/baselines/reference/implicitAnyInAmbientDeclaration2.d.errors.txt b/tests/baselines/reference/implicitAnyInAmbientDeclaration2.d.errors.txt index 726c408aced..260dc6c9899 100644 --- a/tests/baselines/reference/implicitAnyInAmbientDeclaration2.d.errors.txt +++ b/tests/baselines/reference/implicitAnyInAmbientDeclaration2.d.errors.txt @@ -1,10 +1,10 @@ -tests/cases/compiler/implicitAnyInAmbientDeclaration2.d.ts(9,5): error TS1089: 'private' modifier cannot appear on a constructor declaration. tests/cases/compiler/implicitAnyInAmbientDeclaration2.d.ts(1,1): error TS7010: 'foo', which lacks return-type annotation, implicitly has an 'any' return type. tests/cases/compiler/implicitAnyInAmbientDeclaration2.d.ts(1,22): error TS7006: Parameter 'x' implicitly has an 'any' type. tests/cases/compiler/implicitAnyInAmbientDeclaration2.d.ts(2,13): error TS7005: Variable 'bar' implicitly has an 'any' type. tests/cases/compiler/implicitAnyInAmbientDeclaration2.d.ts(4,5): error TS7008: Member 'publicMember' implicitly has an 'any' type. tests/cases/compiler/implicitAnyInAmbientDeclaration2.d.ts(7,5): error TS7010: 'publicFunction', which lacks return-type annotation, implicitly has an 'any' return type. tests/cases/compiler/implicitAnyInAmbientDeclaration2.d.ts(7,27): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/implicitAnyInAmbientDeclaration2.d.ts(9,5): error TS1089: 'private' modifier cannot appear on a constructor declaration. tests/cases/compiler/implicitAnyInAmbientDeclaration2.d.ts(13,24): error TS7006: Parameter 'publicConsParam' implicitly has an 'any' type. diff --git a/tests/baselines/reference/importDeclWithClassModifiers.errors.txt b/tests/baselines/reference/importDeclWithClassModifiers.errors.txt index 7555ac366c4..19d30ae1b63 100644 --- a/tests/baselines/reference/importDeclWithClassModifiers.errors.txt +++ b/tests/baselines/reference/importDeclWithClassModifiers.errors.txt @@ -1,9 +1,9 @@ -tests/cases/compiler/importDeclWithClassModifiers.ts(5,8): error TS1044: 'public' modifier cannot appear on a module element. -tests/cases/compiler/importDeclWithClassModifiers.ts(6,8): error TS1044: 'private' modifier cannot appear on a module element. -tests/cases/compiler/importDeclWithClassModifiers.ts(7,8): error TS1044: 'static' modifier cannot appear on a module element. tests/cases/compiler/importDeclWithClassModifiers.ts(5,1): error TS2305: Module 'x' has no exported member 'c'. +tests/cases/compiler/importDeclWithClassModifiers.ts(5,8): error TS1044: 'public' modifier cannot appear on a module element. tests/cases/compiler/importDeclWithClassModifiers.ts(6,1): error TS2305: Module 'x' has no exported member 'c'. +tests/cases/compiler/importDeclWithClassModifiers.ts(6,8): error TS1044: 'private' modifier cannot appear on a module element. tests/cases/compiler/importDeclWithClassModifiers.ts(7,1): error TS2305: Module 'x' has no exported member 'c'. +tests/cases/compiler/importDeclWithClassModifiers.ts(7,8): error TS1044: 'static' modifier cannot appear on a module element. ==== tests/cases/compiler/importDeclWithClassModifiers.ts (6 errors) ==== @@ -12,19 +12,19 @@ tests/cases/compiler/importDeclWithClassModifiers.ts(7,1): error TS2305: Module } } export public import a = x.c; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2305: Module 'x' has no exported member 'c'. ~~~~~~ !!! error TS1044: 'public' modifier cannot appear on a module element. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2305: Module 'x' has no exported member 'c'. export private import b = x.c; - ~~~~~~~ -!!! error TS1044: 'private' modifier cannot appear on a module element. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2305: Module 'x' has no exported member 'c'. + ~~~~~~~ +!!! error TS1044: 'private' modifier cannot appear on a module element. export static import c = x.c; - ~~~~~~ -!!! error TS1044: 'static' modifier cannot appear on a module element. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2305: Module 'x' has no exported member 'c'. + ~~~~~~ +!!! error TS1044: 'static' modifier cannot appear on a module element. var b: a; \ No newline at end of file diff --git a/tests/baselines/reference/importDeclWithDeclareModifier.errors.txt b/tests/baselines/reference/importDeclWithDeclareModifier.errors.txt index 35c91e38dc5..dc7462a699f 100644 --- a/tests/baselines/reference/importDeclWithDeclareModifier.errors.txt +++ b/tests/baselines/reference/importDeclWithDeclareModifier.errors.txt @@ -1,6 +1,6 @@ tests/cases/compiler/importDeclWithDeclareModifier.ts(5,1): error TS1148: Cannot compile external modules unless the '--module' flag is provided. -tests/cases/compiler/importDeclWithDeclareModifier.ts(5,9): error TS1029: 'export' modifier must precede 'declare' modifier. tests/cases/compiler/importDeclWithDeclareModifier.ts(5,1): error TS2305: Module 'x' has no exported member 'c'. +tests/cases/compiler/importDeclWithDeclareModifier.ts(5,9): error TS1029: 'export' modifier must precede 'declare' modifier. ==== tests/cases/compiler/importDeclWithDeclareModifier.ts (3 errors) ==== @@ -11,9 +11,9 @@ tests/cases/compiler/importDeclWithDeclareModifier.ts(5,1): error TS2305: Module declare export import a = x.c; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS1148: Cannot compile external modules unless the '--module' flag is provided. - ~~~~~~ -!!! error TS1029: 'export' modifier must precede 'declare' modifier. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2305: Module 'x' has no exported member 'c'. + ~~~~~~ +!!! error TS1029: 'export' modifier must precede 'declare' modifier. var b: a; \ No newline at end of file diff --git a/tests/baselines/reference/incompleteDottedExpressionAtEOF.errors.txt b/tests/baselines/reference/incompleteDottedExpressionAtEOF.errors.txt index b338129db8c..fe5d93ec6c1 100644 --- a/tests/baselines/reference/incompleteDottedExpressionAtEOF.errors.txt +++ b/tests/baselines/reference/incompleteDottedExpressionAtEOF.errors.txt @@ -1,11 +1,11 @@ -tests/cases/compiler/incompleteDottedExpressionAtEOF.ts(2,18): error TS1003: Identifier expected. tests/cases/compiler/incompleteDottedExpressionAtEOF.ts(2,10): error TS2304: Cannot find name 'window'. +tests/cases/compiler/incompleteDottedExpressionAtEOF.ts(2,18): error TS1003: Identifier expected. ==== tests/cases/compiler/incompleteDottedExpressionAtEOF.ts (2 errors) ==== // used to leak __missing into error message var p2 = window. - -!!! error TS1003: Identifier expected. ~~~~~~ -!!! error TS2304: Cannot find name 'window'. \ No newline at end of file +!!! error TS2304: Cannot find name 'window'. + +!!! error TS1003: Identifier expected. \ No newline at end of file diff --git a/tests/baselines/reference/incrementAndDecrement.errors.txt b/tests/baselines/reference/incrementAndDecrement.errors.txt index f8a718c5f06..7cbf8cbc0fe 100644 --- a/tests/baselines/reference/incrementAndDecrement.errors.txt +++ b/tests/baselines/reference/incrementAndDecrement.errors.txt @@ -1,8 +1,8 @@ +tests/cases/conformance/expressions/operators/incrementAndDecrement.ts(5,9): error TS2304: Cannot find name 'window'. tests/cases/conformance/expressions/operators/incrementAndDecrement.ts(8,5): error TS1005: ';' expected. tests/cases/conformance/expressions/operators/incrementAndDecrement.ts(11,5): error TS1005: ';' expected. tests/cases/conformance/expressions/operators/incrementAndDecrement.ts(14,5): error TS1005: ';' expected. tests/cases/conformance/expressions/operators/incrementAndDecrement.ts(17,5): error TS1005: ';' expected. -tests/cases/conformance/expressions/operators/incrementAndDecrement.ts(5,9): error TS2304: Cannot find name 'window'. tests/cases/conformance/expressions/operators/incrementAndDecrement.ts(24,3): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. tests/cases/conformance/expressions/operators/incrementAndDecrement.ts(25,3): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. tests/cases/conformance/expressions/operators/incrementAndDecrement.ts(26,3): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. diff --git a/tests/baselines/reference/indexSignatureWithAccessibilityModifier.errors.txt b/tests/baselines/reference/indexSignatureWithAccessibilityModifier.errors.txt index 6c836e268d6..84577dd5cae 100644 --- a/tests/baselines/reference/indexSignatureWithAccessibilityModifier.errors.txt +++ b/tests/baselines/reference/indexSignatureWithAccessibilityModifier.errors.txt @@ -1,22 +1,22 @@ -tests/cases/compiler/indexSignatureWithAccessibilityModifier.ts(2,13): error TS1018: An index signature parameter cannot have an accessibility modifier. -tests/cases/compiler/indexSignatureWithAccessibilityModifier.ts(6,13): error TS1018: An index signature parameter cannot have an accessibility modifier. tests/cases/compiler/indexSignatureWithAccessibilityModifier.ts(2,6): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/compiler/indexSignatureWithAccessibilityModifier.ts(2,13): error TS1018: An index signature parameter cannot have an accessibility modifier. tests/cases/compiler/indexSignatureWithAccessibilityModifier.ts(6,6): error TS2369: A parameter property is only allowed in a constructor implementation. +tests/cases/compiler/indexSignatureWithAccessibilityModifier.ts(6,13): error TS1018: An index signature parameter cannot have an accessibility modifier. ==== tests/cases/compiler/indexSignatureWithAccessibilityModifier.ts (4 errors) ==== interface I { [public x: string]: string; - ~ -!!! error TS1018: An index signature parameter cannot have an accessibility modifier. ~~~~~~~~~~~~~~~~ !!! error TS2369: A parameter property is only allowed in a constructor implementation. + ~ +!!! error TS1018: An index signature parameter cannot have an accessibility modifier. } class C { [public x: string]: string - ~ -!!! error TS1018: An index signature parameter cannot have an accessibility modifier. ~~~~~~~~~~~~~~~~ !!! error TS2369: A parameter property is only allowed in a constructor implementation. + ~ +!!! error TS1018: An index signature parameter cannot have an accessibility modifier. } \ No newline at end of file diff --git a/tests/baselines/reference/indexTypeCheck.errors.txt b/tests/baselines/reference/indexTypeCheck.errors.txt index efa02c3ff1f..03d0e2ce8ed 100644 --- a/tests/baselines/reference/indexTypeCheck.errors.txt +++ b/tests/baselines/reference/indexTypeCheck.errors.txt @@ -1,10 +1,10 @@ tests/cases/compiler/indexTypeCheck.ts(2,2): error TS1021: An index signature must have a type annotation. tests/cases/compiler/indexTypeCheck.ts(3,2): error TS1021: An index signature must have a type annotation. -tests/cases/compiler/indexTypeCheck.ts(32,3): error TS1096: An index signature must have exactly one parameter. -tests/cases/compiler/indexTypeCheck.ts(36,3): error TS1023: An index signature parameter type must be 'string' or 'number'. tests/cases/compiler/indexTypeCheck.ts(17,2): error TS2413: Numeric index type 'number' is not assignable to string index type 'string'. tests/cases/compiler/indexTypeCheck.ts(22,2): error TS2413: Numeric index type 'Orange' is not assignable to string index type 'Yellow'. tests/cases/compiler/indexTypeCheck.ts(27,2): error TS2413: Numeric index type 'number' is not assignable to string index type 'string'. +tests/cases/compiler/indexTypeCheck.ts(32,3): error TS1096: An index signature must have exactly one parameter. +tests/cases/compiler/indexTypeCheck.ts(36,3): error TS1023: An index signature parameter type must be 'string' or 'number'. tests/cases/compiler/indexTypeCheck.ts(51,1): error TS2342: An index expression argument must be of type 'string', 'number', or 'any'. diff --git a/tests/baselines/reference/inferSetterParamType.errors.txt b/tests/baselines/reference/inferSetterParamType.errors.txt index c9232d3fac7..2ae2a16f9d2 100644 --- a/tests/baselines/reference/inferSetterParamType.errors.txt +++ b/tests/baselines/reference/inferSetterParamType.errors.txt @@ -1,8 +1,8 @@ tests/cases/compiler/inferSetterParamType.ts(3,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/inferSetterParamType.ts(6,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/inferSetterParamType.ts(12,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/inferSetterParamType.ts(15,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/inferSetterParamType.ts(13,16): error TS2322: Type 'number' is not assignable to type 'string'. +tests/cases/compiler/inferSetterParamType.ts(15,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ==== tests/cases/compiler/inferSetterParamType.ts (5 errors) ==== diff --git a/tests/baselines/reference/inheritanceMemberAccessorOverridingMethod.errors.txt b/tests/baselines/reference/inheritanceMemberAccessorOverridingMethod.errors.txt index 54f5fcc2a34..6fde83e08b0 100644 --- a/tests/baselines/reference/inheritanceMemberAccessorOverridingMethod.errors.txt +++ b/tests/baselines/reference/inheritanceMemberAccessorOverridingMethod.errors.txt @@ -1,9 +1,9 @@ -tests/cases/compiler/inheritanceMemberAccessorOverridingMethod.ts(8,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/inheritanceMemberAccessorOverridingMethod.ts(11,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/inheritanceMemberAccessorOverridingMethod.ts(7,7): error TS2415: Class 'b' incorrectly extends base class 'a'. Types of property 'x' are incompatible. Type 'string' is not assignable to type '() => string'. +tests/cases/compiler/inheritanceMemberAccessorOverridingMethod.ts(8,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/inheritanceMemberAccessorOverridingMethod.ts(8,9): error TS2423: Class 'a' defines instance member function 'x', but extended class 'b' defines it as instance member accessor. +tests/cases/compiler/inheritanceMemberAccessorOverridingMethod.ts(11,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ==== tests/cases/compiler/inheritanceMemberAccessorOverridingMethod.ts (4 errors) ==== diff --git a/tests/baselines/reference/inheritanceStaticAccessorOverridingMethod.errors.txt b/tests/baselines/reference/inheritanceStaticAccessorOverridingMethod.errors.txt index 026c2b51ac9..38b1ed61fac 100644 --- a/tests/baselines/reference/inheritanceStaticAccessorOverridingMethod.errors.txt +++ b/tests/baselines/reference/inheritanceStaticAccessorOverridingMethod.errors.txt @@ -1,8 +1,8 @@ -tests/cases/compiler/inheritanceStaticAccessorOverridingMethod.ts(8,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/inheritanceStaticAccessorOverridingMethod.ts(11,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/inheritanceStaticAccessorOverridingMethod.ts(7,7): error TS2417: Class static side 'typeof b' incorrectly extends base class static side 'typeof a'. Types of property 'x' are incompatible. Type 'string' is not assignable to type '() => string'. +tests/cases/compiler/inheritanceStaticAccessorOverridingMethod.ts(8,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/compiler/inheritanceStaticAccessorOverridingMethod.ts(11,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ==== tests/cases/compiler/inheritanceStaticAccessorOverridingMethod.ts (3 errors) ==== diff --git a/tests/baselines/reference/initializerReferencingConstructorLocals.errors.txt b/tests/baselines/reference/initializerReferencingConstructorLocals.errors.txt index 896552cabd5..a3909e481f6 100644 --- a/tests/baselines/reference/initializerReferencingConstructorLocals.errors.txt +++ b/tests/baselines/reference/initializerReferencingConstructorLocals.errors.txt @@ -1,13 +1,13 @@ -tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorLocals.ts(7,15): error TS1003: Identifier expected. -tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorLocals.ts(17,15): error TS1003: Identifier expected. tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorLocals.ts(4,9): error TS2304: Cannot find name 'z'. tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorLocals.ts(5,15): error TS2304: Cannot find name 'z'. tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorLocals.ts(6,14): error TS2339: Property 'z' does not exist on type 'C'. +tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorLocals.ts(7,15): error TS1003: Identifier expected. tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorLocals.ts(7,20): error TS2339: Property 'z' does not exist on type 'C'. tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorLocals.ts(9,9): error TS2304: Cannot find name 'z'. tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorLocals.ts(14,9): error TS2304: Cannot find name 'z'. tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorLocals.ts(15,15): error TS2304: Cannot find name 'z'. tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorLocals.ts(16,14): error TS2339: Property 'z' does not exist on type 'D'. +tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorLocals.ts(17,15): error TS1003: Identifier expected. tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorLocals.ts(17,20): error TS2339: Property 'z' does not exist on type 'D'. tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorLocals.ts(19,9): error TS2304: Cannot find name 'z'. diff --git a/tests/baselines/reference/initializerReferencingConstructorParameters.errors.txt b/tests/baselines/reference/initializerReferencingConstructorParameters.errors.txt index 465e3c42167..623bd535745 100644 --- a/tests/baselines/reference/initializerReferencingConstructorParameters.errors.txt +++ b/tests/baselines/reference/initializerReferencingConstructorParameters.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorParameters.ts(17,15): error TS1003: Identifier expected. tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorParameters.ts(4,9): error TS2304: Cannot find name 'x'. tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorParameters.ts(5,15): error TS2304: Cannot find name 'x'. tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorParameters.ts(10,9): error TS2304: Cannot find name 'x'. tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorParameters.ts(11,15): error TS2304: Cannot find name 'x'. +tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorParameters.ts(17,15): error TS1003: Identifier expected. tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorParameters.ts(23,9): error TS2304: Cannot find name 'x'. diff --git a/tests/baselines/reference/innerModExport1.errors.txt b/tests/baselines/reference/innerModExport1.errors.txt index 11e9cdc01d1..25cc83104a8 100644 --- a/tests/baselines/reference/innerModExport1.errors.txt +++ b/tests/baselines/reference/innerModExport1.errors.txt @@ -1,8 +1,8 @@ +tests/cases/compiler/innerModExport1.ts(5,5): error TS2304: Cannot find name 'module'. tests/cases/compiler/innerModExport1.ts(5,12): error TS1005: ';' expected. tests/cases/compiler/innerModExport1.ts(7,9): error TS1129: Statement expected. tests/cases/compiler/innerModExport1.ts(14,5): error TS1148: Cannot compile external modules unless the '--module' flag is provided. tests/cases/compiler/innerModExport1.ts(17,1): error TS1128: Declaration or statement expected. -tests/cases/compiler/innerModExport1.ts(5,5): error TS2304: Cannot find name 'module'. ==== tests/cases/compiler/innerModExport1.ts (5 errors) ==== @@ -11,10 +11,10 @@ tests/cases/compiler/innerModExport1.ts(5,5): error TS2304: Cannot find name 'mo // inner mod 1 var non_export_var: number; module { - ~ -!!! error TS1005: ';' expected. ~~~~~~ !!! error TS2304: Cannot find name 'module'. + ~ +!!! error TS1005: ';' expected. 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 1adcc46d441..1456e976372 100644 --- a/tests/baselines/reference/innerModExport2.errors.txt +++ b/tests/baselines/reference/innerModExport2.errors.txt @@ -1,8 +1,8 @@ +tests/cases/compiler/innerModExport2.ts(5,5): error TS2304: Cannot find name 'module'. tests/cases/compiler/innerModExport2.ts(5,12): error TS1005: ';' expected. tests/cases/compiler/innerModExport2.ts(7,9): error TS1129: Statement expected. tests/cases/compiler/innerModExport2.ts(15,5): error TS1148: Cannot compile external modules unless the '--module' flag is provided. tests/cases/compiler/innerModExport2.ts(18,1): error TS1128: Declaration or statement expected. -tests/cases/compiler/innerModExport2.ts(5,5): error TS2304: Cannot find name 'module'. tests/cases/compiler/innerModExport2.ts(20,7): error TS2339: Property 'NonExportFunc' does not exist on type 'typeof Outer'. @@ -12,10 +12,10 @@ tests/cases/compiler/innerModExport2.ts(20,7): error TS2339: Property 'NonExport // inner mod 1 var non_export_var: number; module { - ~ -!!! error TS1005: ';' expected. ~~~~~~ !!! error TS2304: Cannot find name 'module'. + ~ +!!! error TS1005: ';' expected. var non_export_var = 0; export var export_var = 1; ~~~~~~ diff --git a/tests/baselines/reference/instancePropertiesInheritedIntoClassType.errors.txt b/tests/baselines/reference/instancePropertiesInheritedIntoClassType.errors.txt index fbd64e5018e..340b5081866 100644 --- a/tests/baselines/reference/instancePropertiesInheritedIntoClassType.errors.txt +++ b/tests/baselines/reference/instancePropertiesInheritedIntoClassType.errors.txt @@ -1,8 +1,8 @@ tests/cases/conformance/classes/members/classTypes/instancePropertiesInheritedIntoClassType.ts(4,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/classes/members/classTypes/instancePropertiesInheritedIntoClassType.ts(7,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/classes/members/classTypes/instancePropertiesInheritedIntoClassType.ts(19,14): error TS2349: Cannot invoke an expression whose type lacks a call signature. tests/cases/conformance/classes/members/classTypes/instancePropertiesInheritedIntoClassType.ts(26,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/classes/members/classTypes/instancePropertiesInheritedIntoClassType.ts(29,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/classes/members/classTypes/instancePropertiesInheritedIntoClassType.ts(19,14): error TS2349: Cannot invoke an expression whose type lacks a call signature. tests/cases/conformance/classes/members/classTypes/instancePropertiesInheritedIntoClassType.ts(41,14): error TS2349: Cannot invoke an expression whose type lacks a call signature. diff --git a/tests/baselines/reference/instancePropertyInClassType.errors.txt b/tests/baselines/reference/instancePropertyInClassType.errors.txt index 9a7dce0f0cd..d14607d81bc 100644 --- a/tests/baselines/reference/instancePropertyInClassType.errors.txt +++ b/tests/baselines/reference/instancePropertyInClassType.errors.txt @@ -1,8 +1,8 @@ tests/cases/conformance/classes/members/classTypes/instancePropertyInClassType.ts(4,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/classes/members/classTypes/instancePropertyInClassType.ts(7,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/classes/members/classTypes/instancePropertyInClassType.ts(17,14): error TS2349: Cannot invoke an expression whose type lacks a call signature. tests/cases/conformance/classes/members/classTypes/instancePropertyInClassType.ts(24,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/classes/members/classTypes/instancePropertyInClassType.ts(27,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/classes/members/classTypes/instancePropertyInClassType.ts(17,14): error TS2349: Cannot invoke an expression whose type lacks a call signature. tests/cases/conformance/classes/members/classTypes/instancePropertyInClassType.ts(37,14): error TS2349: Cannot invoke an expression whose type lacks a call signature. diff --git a/tests/baselines/reference/instantiateTypeParameter.errors.txt b/tests/baselines/reference/instantiateTypeParameter.errors.txt index f56f8a761dd..e8685251f9c 100644 --- a/tests/baselines/reference/instantiateTypeParameter.errors.txt +++ b/tests/baselines/reference/instantiateTypeParameter.errors.txt @@ -1,6 +1,6 @@ tests/cases/compiler/instantiateTypeParameter.ts(2,5): error TS1131: Property or signature expected. -tests/cases/compiler/instantiateTypeParameter.ts(3,1): error TS1128: Declaration or statement expected. tests/cases/compiler/instantiateTypeParameter.ts(2,12): error TS2304: Cannot find name 'T'. +tests/cases/compiler/instantiateTypeParameter.ts(3,1): error TS1128: Declaration or statement expected. ==== tests/cases/compiler/instantiateTypeParameter.ts (3 errors) ==== diff --git a/tests/baselines/reference/intTypeCheck.errors.txt b/tests/baselines/reference/intTypeCheck.errors.txt index 64655f1bd35..5f7c213a916 100644 --- a/tests/baselines/reference/intTypeCheck.errors.txt +++ b/tests/baselines/reference/intTypeCheck.errors.txt @@ -1,11 +1,3 @@ -tests/cases/compiler/intTypeCheck.ts(104,20): error TS1109: Expression expected. -tests/cases/compiler/intTypeCheck.ts(118,21): error TS1109: Expression expected. -tests/cases/compiler/intTypeCheck.ts(132,21): error TS1109: Expression expected. -tests/cases/compiler/intTypeCheck.ts(146,21): error TS1109: Expression expected. -tests/cases/compiler/intTypeCheck.ts(160,21): error TS1109: Expression expected. -tests/cases/compiler/intTypeCheck.ts(174,21): error TS1109: Expression expected. -tests/cases/compiler/intTypeCheck.ts(188,21): error TS1109: Expression expected. -tests/cases/compiler/intTypeCheck.ts(202,21): error TS1109: Expression expected. tests/cases/compiler/intTypeCheck.ts(83,5): error TS2386: Overload signatures must all be optional or required. tests/cases/compiler/intTypeCheck.ts(97,5): error TS2322: Type 'Object' is not assignable to type 'i1'. Property 'p' is missing in type 'Object'. @@ -16,6 +8,7 @@ tests/cases/compiler/intTypeCheck.ts(101,5): error TS2322: Type '() => void' is Property 'p' is missing in type '() => void'. tests/cases/compiler/intTypeCheck.ts(104,5): error TS2322: Type 'boolean' is not assignable to type 'i1'. Property 'p' is missing in type 'Boolean'. +tests/cases/compiler/intTypeCheck.ts(104,20): error TS1109: Expression expected. tests/cases/compiler/intTypeCheck.ts(104,21): error TS2304: Cannot find name 'i1'. tests/cases/compiler/intTypeCheck.ts(105,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. tests/cases/compiler/intTypeCheck.ts(110,5): error TS2322: Type '{}' is not assignable to type 'i2'. @@ -23,6 +16,7 @@ tests/cases/compiler/intTypeCheck.ts(111,5): error TS2322: Type 'Object' is not tests/cases/compiler/intTypeCheck.ts(112,17): error TS2350: Only a void function can be called with the 'new' keyword. tests/cases/compiler/intTypeCheck.ts(113,5): error TS2322: Type 'Base' is not assignable to type 'i2'. tests/cases/compiler/intTypeCheck.ts(118,5): error TS2322: Type 'boolean' is not assignable to type 'i2'. +tests/cases/compiler/intTypeCheck.ts(118,21): error TS1109: Expression expected. tests/cases/compiler/intTypeCheck.ts(118,22): error TS2304: Cannot find name 'i2'. tests/cases/compiler/intTypeCheck.ts(119,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. tests/cases/compiler/intTypeCheck.ts(124,5): error TS2322: Type '{}' is not assignable to type 'i3'. @@ -30,6 +24,7 @@ tests/cases/compiler/intTypeCheck.ts(125,5): error TS2322: Type 'Object' is not tests/cases/compiler/intTypeCheck.ts(127,5): error TS2322: Type 'Base' is not assignable to type 'i3'. tests/cases/compiler/intTypeCheck.ts(129,5): error TS2322: Type '() => void' is not assignable to type 'i3'. tests/cases/compiler/intTypeCheck.ts(132,5): error TS2322: Type 'boolean' is not assignable to type 'i3'. +tests/cases/compiler/intTypeCheck.ts(132,21): error TS1109: Expression expected. tests/cases/compiler/intTypeCheck.ts(132,22): error TS2304: Cannot find name 'i3'. tests/cases/compiler/intTypeCheck.ts(133,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. tests/cases/compiler/intTypeCheck.ts(139,5): error TS2322: Type 'Object' is not assignable to type 'i4'. @@ -41,6 +36,7 @@ tests/cases/compiler/intTypeCheck.ts(143,5): error TS2322: Type '() => void' is Index signature is missing in type '() => void'. tests/cases/compiler/intTypeCheck.ts(146,5): error TS2322: Type 'boolean' is not assignable to type 'i4'. Index signature is missing in type 'Boolean'. +tests/cases/compiler/intTypeCheck.ts(146,21): error TS1109: Expression expected. tests/cases/compiler/intTypeCheck.ts(146,22): error TS2304: Cannot find name 'i4'. tests/cases/compiler/intTypeCheck.ts(147,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. tests/cases/compiler/intTypeCheck.ts(152,5): error TS2322: Type '{}' is not assignable to type 'i5'. @@ -54,6 +50,7 @@ tests/cases/compiler/intTypeCheck.ts(157,5): error TS2322: Type '() => void' is Property 'p' is missing in type '() => void'. tests/cases/compiler/intTypeCheck.ts(160,5): error TS2322: Type 'boolean' is not assignable to type 'i5'. Property 'p' is missing in type 'Boolean'. +tests/cases/compiler/intTypeCheck.ts(160,21): error TS1109: Expression expected. tests/cases/compiler/intTypeCheck.ts(160,22): error TS2304: Cannot find name 'i5'. tests/cases/compiler/intTypeCheck.ts(161,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. tests/cases/compiler/intTypeCheck.ts(166,5): error TS2322: Type '{}' is not assignable to type 'i6'. @@ -63,6 +60,7 @@ tests/cases/compiler/intTypeCheck.ts(169,5): error TS2322: Type 'Base' is not as tests/cases/compiler/intTypeCheck.ts(171,5): error TS2322: Type '() => void' is not assignable to type 'i6'. Type 'void' is not assignable to type 'number'. tests/cases/compiler/intTypeCheck.ts(174,5): error TS2322: Type 'boolean' is not assignable to type 'i6'. +tests/cases/compiler/intTypeCheck.ts(174,21): error TS1109: Expression expected. tests/cases/compiler/intTypeCheck.ts(174,22): error TS2304: Cannot find name 'i6'. tests/cases/compiler/intTypeCheck.ts(175,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. tests/cases/compiler/intTypeCheck.ts(180,5): error TS2322: Type '{}' is not assignable to type 'i7'. @@ -70,6 +68,7 @@ tests/cases/compiler/intTypeCheck.ts(181,5): error TS2322: Type 'Object' is not tests/cases/compiler/intTypeCheck.ts(183,17): error TS2352: Neither type 'Base' nor type 'i7' is assignable to the other. tests/cases/compiler/intTypeCheck.ts(185,5): error TS2322: Type '() => void' is not assignable to type 'i7'. tests/cases/compiler/intTypeCheck.ts(188,5): error TS2322: Type 'boolean' is not assignable to type 'i7'. +tests/cases/compiler/intTypeCheck.ts(188,21): error TS1109: Expression expected. tests/cases/compiler/intTypeCheck.ts(188,22): error TS2304: Cannot find name 'i7'. tests/cases/compiler/intTypeCheck.ts(189,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. tests/cases/compiler/intTypeCheck.ts(195,5): error TS2322: Type 'Object' is not assignable to type 'i8'. @@ -81,6 +80,7 @@ tests/cases/compiler/intTypeCheck.ts(199,5): error TS2322: Type '() => void' is Index signature is missing in type '() => void'. tests/cases/compiler/intTypeCheck.ts(202,5): error TS2322: Type 'boolean' is not assignable to type 'i8'. Index signature is missing in type 'Boolean'. +tests/cases/compiler/intTypeCheck.ts(202,21): error TS1109: Expression expected. tests/cases/compiler/intTypeCheck.ts(202,22): error TS2304: Cannot find name 'i8'. tests/cases/compiler/intTypeCheck.ts(203,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. @@ -203,11 +203,11 @@ tests/cases/compiler/intTypeCheck.ts(203,17): error TS2351: Cannot use 'new' wit //var obj7: i1 = function foo() { }; var obj8: i1 = anyVar; var obj9: i1 = new anyVar; - ~ -!!! error TS1109: Expression expected. ~~~~ !!! error TS2322: Type 'boolean' is not assignable to type 'i1'. !!! error TS2322: Property 'p' is missing in type 'Boolean'. + ~ +!!! error TS1109: Expression expected. ~~ !!! error TS2304: Cannot find name 'i1'. var obj10: i1 = new {}; @@ -234,10 +234,10 @@ tests/cases/compiler/intTypeCheck.ts(203,17): error TS2351: Cannot use 'new' wit //var obj18: i2 = function foo() { }; var obj19: i2 = anyVar; var obj20: i2 = new anyVar; - ~ -!!! error TS1109: Expression expected. ~~~~~ !!! error TS2322: Type 'boolean' is not assignable to type 'i2'. + ~ +!!! error TS1109: Expression expected. ~~ !!! error TS2304: Cannot find name 'i2'. var obj21: i2 = new {}; @@ -264,10 +264,10 @@ tests/cases/compiler/intTypeCheck.ts(203,17): error TS2351: Cannot use 'new' wit //var obj29: i3 = function foo() { }; var obj30: i3 = anyVar; var obj31: i3 = new anyVar; - ~ -!!! error TS1109: Expression expected. ~~~~~ !!! error TS2322: Type 'boolean' is not assignable to type 'i3'. + ~ +!!! error TS1109: Expression expected. ~~ !!! error TS2304: Cannot find name 'i3'. var obj32: i3 = new {}; @@ -297,11 +297,11 @@ tests/cases/compiler/intTypeCheck.ts(203,17): error TS2351: Cannot use 'new' wit //var obj40: i4 = function foo() { }; var obj41: i4 = anyVar; var obj42: i4 = new anyVar; - ~ -!!! error TS1109: Expression expected. ~~~~~ !!! error TS2322: Type 'boolean' is not assignable to type 'i4'. !!! error TS2322: Index signature is missing in type 'Boolean'. + ~ +!!! error TS1109: Expression expected. ~~ !!! error TS2304: Cannot find name 'i4'. var obj43: i4 = new {}; @@ -334,11 +334,11 @@ tests/cases/compiler/intTypeCheck.ts(203,17): error TS2351: Cannot use 'new' wit //var obj51: i5 = function foo() { }; var obj52: i5 = anyVar; var obj53: i5 = new anyVar; - ~ -!!! error TS1109: Expression expected. ~~~~~ !!! error TS2322: Type 'boolean' is not assignable to type 'i5'. !!! error TS2322: Property 'p' is missing in type 'Boolean'. + ~ +!!! error TS1109: Expression expected. ~~ !!! error TS2304: Cannot find name 'i5'. var obj54: i5 = new {}; @@ -368,10 +368,10 @@ tests/cases/compiler/intTypeCheck.ts(203,17): error TS2351: Cannot use 'new' wit //var obj62: i6 = function foo() { }; var obj63: i6 = anyVar; var obj64: i6 = new anyVar; - ~ -!!! error TS1109: Expression expected. ~~~~~ !!! error TS2322: Type 'boolean' is not assignable to type 'i6'. + ~ +!!! error TS1109: Expression expected. ~~ !!! error TS2304: Cannot find name 'i6'. var obj65: i6 = new {}; @@ -398,10 +398,10 @@ tests/cases/compiler/intTypeCheck.ts(203,17): error TS2351: Cannot use 'new' wit //var obj73: i7 = function foo() { }; var obj74: i7 = anyVar; var obj75: i7 = new anyVar; - ~ -!!! error TS1109: Expression expected. ~~~~~ !!! error TS2322: Type 'boolean' is not assignable to type 'i7'. + ~ +!!! error TS1109: Expression expected. ~~ !!! error TS2304: Cannot find name 'i7'. var obj76: i7 = new {}; @@ -431,11 +431,11 @@ tests/cases/compiler/intTypeCheck.ts(203,17): error TS2351: Cannot use 'new' wit //var obj84: i8 = function foo() { }; var obj85: i8 = anyVar; var obj86: i8 = new anyVar; - ~ -!!! error TS1109: Expression expected. ~~~~~ !!! error TS2322: Type 'boolean' is not assignable to type 'i8'. !!! error TS2322: Index signature is missing in type 'Boolean'. + ~ +!!! error TS1109: Expression expected. ~~ !!! error TS2304: Cannot find name 'i8'. var obj87: i8 = new {}; diff --git a/tests/baselines/reference/interfaceDeclaration4.errors.txt b/tests/baselines/reference/interfaceDeclaration4.errors.txt index 520c0c2cadf..d59f063ea11 100644 --- a/tests/baselines/reference/interfaceDeclaration4.errors.txt +++ b/tests/baselines/reference/interfaceDeclaration4.errors.txt @@ -1,5 +1,3 @@ -tests/cases/compiler/interfaceDeclaration4.ts(39,14): error TS1005: '{' expected. -tests/cases/compiler/interfaceDeclaration4.ts(39,18): error TS1005: ';' expected. tests/cases/compiler/interfaceDeclaration4.ts(18,11): error TS2430: Interface 'I3' incorrectly extends interface 'I1'. Types of property 'item' are incompatible. Type 'number' is not assignable to type 'string'. @@ -7,7 +5,9 @@ tests/cases/compiler/interfaceDeclaration4.ts(27,7): error TS2420: Class 'C2' in Property 'item' is missing in type 'C2'. tests/cases/compiler/interfaceDeclaration4.ts(36,7): error TS2420: Class 'C3' incorrectly implements interface 'I1'. Property 'item' is missing in type 'C3'. +tests/cases/compiler/interfaceDeclaration4.ts(39,14): error TS1005: '{' expected. 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) ==== @@ -62,8 +62,8 @@ tests/cases/compiler/interfaceDeclaration4.ts(39,15): error TS2304: Cannot find interface Foo.I1 { } ~ !!! error TS1005: '{' expected. - ~ -!!! error TS1005: ';' expected. ~~ !!! error TS2304: Cannot find name 'I1'. + ~ +!!! error TS1005: ';' expected. \ No newline at end of file diff --git a/tests/baselines/reference/interfaceExtendingClass2.errors.txt b/tests/baselines/reference/interfaceExtendingClass2.errors.txt index 1e07199686b..3b394d4922a 100644 --- a/tests/baselines/reference/interfaceExtendingClass2.errors.txt +++ b/tests/baselines/reference/interfaceExtendingClass2.errors.txt @@ -1,7 +1,7 @@ +tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClass2.ts(11,5): error TS2411: Property 'a' of type '{ toString: () => {}; }' is not assignable to string index type 'Object'. tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClass2.ts(13,13): error TS1131: Property or signature expected. tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClass2.ts(14,9): error TS1128: Declaration or statement expected. tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClass2.ts(15,5): error TS1128: Declaration or statement expected. -tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClass2.ts(11,5): error TS2411: Property 'a' of type '{ toString: () => {}; }' is not assignable to string index type 'Object'. ==== tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClass2.ts (4 errors) ==== diff --git a/tests/baselines/reference/interfaceNaming1.errors.txt b/tests/baselines/reference/interfaceNaming1.errors.txt index 67158ce6109..99e0b5c02fa 100644 --- a/tests/baselines/reference/interfaceNaming1.errors.txt +++ b/tests/baselines/reference/interfaceNaming1.errors.txt @@ -1,15 +1,15 @@ -tests/cases/compiler/interfaceNaming1.ts(1,11): error TS1005: ';' expected. tests/cases/compiler/interfaceNaming1.ts(1,1): error TS2304: Cannot find name 'interface'. +tests/cases/compiler/interfaceNaming1.ts(1,11): error TS1005: ';' expected. tests/cases/compiler/interfaceNaming1.ts(3,1): error TS2304: Cannot find name 'interface'. tests/cases/compiler/interfaceNaming1.ts(3,13): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ==== tests/cases/compiler/interfaceNaming1.ts (4 errors) ==== interface { } - ~ -!!! error TS1005: ';' expected. ~~~~~~~~~ !!! error TS2304: Cannot find name 'interface'. + ~ +!!! error TS1005: ';' expected. interface interface{ } interface & { } ~~~~~~~~~ diff --git a/tests/baselines/reference/interfaceThatInheritsFromItself.errors.txt b/tests/baselines/reference/interfaceThatInheritsFromItself.errors.txt index 440650717bd..b1e47347117 100644 --- a/tests/baselines/reference/interfaceThatInheritsFromItself.errors.txt +++ b/tests/baselines/reference/interfaceThatInheritsFromItself.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/interfaces/interfaceDeclarations/interfaceThatInheritsFromItself.ts(10,15): error TS1176: Interface declaration cannot have 'implements' clause. tests/cases/conformance/interfaces/interfaceDeclarations/interfaceThatInheritsFromItself.ts(1,11): error TS2310: Type 'Foo' recursively references itself as a base type. tests/cases/conformance/interfaces/interfaceDeclarations/interfaceThatInheritsFromItself.ts(4,11): error TS2310: Type 'Foo2' recursively references itself as a base type. tests/cases/conformance/interfaces/interfaceDeclarations/interfaceThatInheritsFromItself.ts(7,11): error TS2310: Type 'Foo3' recursively references itself as a base type. +tests/cases/conformance/interfaces/interfaceDeclarations/interfaceThatInheritsFromItself.ts(10,15): error TS1176: Interface declaration cannot have 'implements' clause. ==== tests/cases/conformance/interfaces/interfaceDeclarations/interfaceThatInheritsFromItself.ts (4 errors) ==== diff --git a/tests/baselines/reference/interfaceWithPrivateMember.errors.txt b/tests/baselines/reference/interfaceWithPrivateMember.errors.txt index e019ff9d9a1..7f2542b45a1 100644 --- a/tests/baselines/reference/interfaceWithPrivateMember.errors.txt +++ b/tests/baselines/reference/interfaceWithPrivateMember.errors.txt @@ -1,8 +1,8 @@ tests/cases/conformance/types/namedTypes/interfaceWithPrivateMember.ts(4,5): error TS1131: Property or signature expected. tests/cases/conformance/types/namedTypes/interfaceWithPrivateMember.ts(8,5): error TS1131: Property or signature expected. tests/cases/conformance/types/namedTypes/interfaceWithPrivateMember.ts(12,5): error TS1131: Property or signature expected. -tests/cases/conformance/types/namedTypes/interfaceWithPrivateMember.ts(13,1): error TS1128: Declaration or statement expected. tests/cases/conformance/types/namedTypes/interfaceWithPrivateMember.ts(12,16): error TS2304: Cannot find name 'string'. +tests/cases/conformance/types/namedTypes/interfaceWithPrivateMember.ts(13,1): error TS1128: Declaration or statement expected. ==== tests/cases/conformance/types/namedTypes/interfaceWithPrivateMember.ts (5 errors) ==== diff --git a/tests/baselines/reference/interfacesWithPredefinedTypesAsNames.errors.txt b/tests/baselines/reference/interfacesWithPredefinedTypesAsNames.errors.txt index 20ef6f7a39d..91cd267b596 100644 --- a/tests/baselines/reference/interfacesWithPredefinedTypesAsNames.errors.txt +++ b/tests/baselines/reference/interfacesWithPredefinedTypesAsNames.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/interfaces/interfaceDeclarations/interfacesWithPredefinedTypesAsNames.ts(5,11): error TS1003: Identifier expected. tests/cases/conformance/interfaces/interfaceDeclarations/interfacesWithPredefinedTypesAsNames.ts(1,11): error TS2427: Interface name cannot be 'any' tests/cases/conformance/interfaces/interfaceDeclarations/interfacesWithPredefinedTypesAsNames.ts(2,11): error TS2427: Interface name cannot be 'number' 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,11): error TS1003: Identifier expected. ==== tests/cases/conformance/interfaces/interfaceDeclarations/interfacesWithPredefinedTypesAsNames.ts (5 errors) ==== diff --git a/tests/baselines/reference/invalidUnicodeEscapeSequance3.errors.txt b/tests/baselines/reference/invalidUnicodeEscapeSequance3.errors.txt index 93120be44bd..45674e698b6 100644 --- a/tests/baselines/reference/invalidUnicodeEscapeSequance3.errors.txt +++ b/tests/baselines/reference/invalidUnicodeEscapeSequance3.errors.txt @@ -1,13 +1,13 @@ -tests/cases/compiler/invalidUnicodeEscapeSequance3.ts(1,2): error TS1127: Invalid character. tests/cases/compiler/invalidUnicodeEscapeSequance3.ts(1,1): error TS2304: Cannot find name 'a'. +tests/cases/compiler/invalidUnicodeEscapeSequance3.ts(1,2): error TS1127: Invalid character. tests/cases/compiler/invalidUnicodeEscapeSequance3.ts(1,3): error TS2304: Cannot find name 'u'. ==== tests/cases/compiler/invalidUnicodeEscapeSequance3.ts (3 errors) ==== a\u - -!!! error TS1127: Invalid character. ~ !!! error TS2304: Cannot find name 'a'. + +!!! error TS1127: Invalid character. ~ !!! error TS2304: Cannot find name 'u'. \ No newline at end of file diff --git a/tests/baselines/reference/letAsIdentifierInStrictMode.errors.txt b/tests/baselines/reference/letAsIdentifierInStrictMode.errors.txt index e332535e23b..65411f23da9 100644 --- a/tests/baselines/reference/letAsIdentifierInStrictMode.errors.txt +++ b/tests/baselines/reference/letAsIdentifierInStrictMode.errors.txt @@ -1,9 +1,9 @@ tests/cases/compiler/letAsIdentifierInStrictMode.ts(2,5): error TS1134: Variable declaration expected. tests/cases/compiler/letAsIdentifierInStrictMode.ts(2,9): error TS1134: Variable declaration expected. tests/cases/compiler/letAsIdentifierInStrictMode.ts(2,11): error TS1134: Variable declaration expected. +tests/cases/compiler/letAsIdentifierInStrictMode.ts(3,5): error TS2300: Duplicate identifier 'a'. tests/cases/compiler/letAsIdentifierInStrictMode.ts(4,5): error TS1134: Variable declaration expected. tests/cases/compiler/letAsIdentifierInStrictMode.ts(4,7): error TS1134: Variable declaration expected. -tests/cases/compiler/letAsIdentifierInStrictMode.ts(3,5): error TS2300: Duplicate identifier 'a'. tests/cases/compiler/letAsIdentifierInStrictMode.ts(6,1): error TS2300: Duplicate identifier 'a'. diff --git a/tests/baselines/reference/letDeclarations-invalidContexts.errors.txt b/tests/baselines/reference/letDeclarations-invalidContexts.errors.txt index ad0c0f741b5..f8115718b80 100644 --- a/tests/baselines/reference/letDeclarations-invalidContexts.errors.txt +++ b/tests/baselines/reference/letDeclarations-invalidContexts.errors.txt @@ -2,12 +2,12 @@ tests/cases/compiler/letDeclarations-invalidContexts.ts(4,5): error TS1157: 'let tests/cases/compiler/letDeclarations-invalidContexts.ts(6,5): error TS1157: 'let' declarations can only be declared inside a block. tests/cases/compiler/letDeclarations-invalidContexts.ts(9,5): error TS1157: 'let' declarations can only be declared inside a block. tests/cases/compiler/letDeclarations-invalidContexts.ts(12,5): error TS1157: 'let' declarations can only be declared inside a block. +tests/cases/compiler/letDeclarations-invalidContexts.ts(16,7): error TS2410: All symbols within a 'with' block will be resolved to 'any'. tests/cases/compiler/letDeclarations-invalidContexts.ts(17,5): error TS1157: 'let' declarations can only be declared inside a block. tests/cases/compiler/letDeclarations-invalidContexts.ts(20,5): error TS1157: 'let' declarations can only be declared inside a block. tests/cases/compiler/letDeclarations-invalidContexts.ts(23,5): error TS1157: 'let' declarations can only be declared inside a block. tests/cases/compiler/letDeclarations-invalidContexts.ts(26,12): error TS1157: 'let' declarations can only be declared inside a block. tests/cases/compiler/letDeclarations-invalidContexts.ts(29,29): error TS1157: 'let' declarations can only be declared inside a block. -tests/cases/compiler/letDeclarations-invalidContexts.ts(16,7): error TS2410: All symbols within a 'with' block will be resolved to 'any'. ==== tests/cases/compiler/letDeclarations-invalidContexts.ts (10 errors) ==== diff --git a/tests/baselines/reference/libMembers.errors.txt b/tests/baselines/reference/libMembers.errors.txt index a6af67821b3..4b025b9a95b 100644 --- a/tests/baselines/reference/libMembers.errors.txt +++ b/tests/baselines/reference/libMembers.errors.txt @@ -1,5 +1,5 @@ -tests/cases/compiler/libMembers.ts(9,16): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. tests/cases/compiler/libMembers.ts(4,3): error TS2339: Property 'subby' does not exist on type 'string'. +tests/cases/compiler/libMembers.ts(9,16): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. tests/cases/compiler/libMembers.ts(12,15): error TS2339: Property 'prototype' does not exist on type 'C'. diff --git a/tests/baselines/reference/literals.errors.txt b/tests/baselines/reference/literals.errors.txt index f33d26af7a4..d43e89bb4db 100644 --- a/tests/baselines/reference/literals.errors.txt +++ b/tests/baselines/reference/literals.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/expressions/literals/literals.ts(20,9): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. -tests/cases/conformance/expressions/literals/literals.ts(25,10): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. tests/cases/conformance/expressions/literals/literals.ts(9,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/literals/literals.ts(9,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/literals/literals.ts(10,9): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/literals/literals.ts(10,21): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/literals/literals.ts(20,9): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. +tests/cases/conformance/expressions/literals/literals.ts(25,10): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. ==== tests/cases/conformance/expressions/literals/literals.ts (6 errors) ==== diff --git a/tests/baselines/reference/logicalNotOperatorInvalidOperations.errors.txt b/tests/baselines/reference/logicalNotOperatorInvalidOperations.errors.txt index 3267d60a13a..07262962b08 100644 --- a/tests/baselines/reference/logicalNotOperatorInvalidOperations.errors.txt +++ b/tests/baselines/reference/logicalNotOperatorInvalidOperations.errors.txt @@ -1,7 +1,7 @@ tests/cases/conformance/expressions/unaryOperators/logicalNotOperator/logicalNotOperatorInvalidOperations.ts(5,17): error TS1005: ',' expected. tests/cases/conformance/expressions/unaryOperators/logicalNotOperator/logicalNotOperatorInvalidOperations.ts(5,18): error TS1109: Expression expected. -tests/cases/conformance/expressions/unaryOperators/logicalNotOperator/logicalNotOperatorInvalidOperations.ts(11,16): error TS1109: Expression expected. tests/cases/conformance/expressions/unaryOperators/logicalNotOperator/logicalNotOperatorInvalidOperations.ts(8,16): error TS2365: Operator '+' cannot be applied to types 'boolean' and 'number'. +tests/cases/conformance/expressions/unaryOperators/logicalNotOperator/logicalNotOperatorInvalidOperations.ts(11,16): error TS1109: Expression expected. ==== tests/cases/conformance/expressions/unaryOperators/logicalNotOperator/logicalNotOperatorInvalidOperations.ts (4 errors) ==== diff --git a/tests/baselines/reference/methodInAmbientClass1.errors.txt b/tests/baselines/reference/methodInAmbientClass1.errors.txt index 3bf8f8af12a..2c99dfdde0a 100644 --- a/tests/baselines/reference/methodInAmbientClass1.errors.txt +++ b/tests/baselines/reference/methodInAmbientClass1.errors.txt @@ -1,13 +1,13 @@ -tests/cases/compiler/methodInAmbientClass1.ts(2,20): error TS1037: A function implementation cannot be declared in an ambient context. tests/cases/compiler/methodInAmbientClass1.ts(2,12): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement. +tests/cases/compiler/methodInAmbientClass1.ts(2,20): error TS1037: A function implementation cannot be declared in an ambient context. ==== tests/cases/compiler/methodInAmbientClass1.ts (2 errors) ==== declare class Foo { fn(): boolean { - ~ -!!! error TS1037: A function implementation cannot be declared in an ambient context. ~~~~~~~ !!! error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement. + ~ +!!! error TS1037: A function implementation cannot be declared in an ambient context. } } \ No newline at end of file diff --git a/tests/baselines/reference/missingArgument1.errors.txt b/tests/baselines/reference/missingArgument1.errors.txt index 02911e3c9b5..ba2bb0892f2 100644 --- a/tests/baselines/reference/missingArgument1.errors.txt +++ b/tests/baselines/reference/missingArgument1.errors.txt @@ -1,16 +1,16 @@ -tests/cases/compiler/missingArgument1.ts(1,7): error TS1135: Argument expression expected. tests/cases/compiler/missingArgument1.ts(1,1): error TS2304: Cannot find name 'foo'. tests/cases/compiler/missingArgument1.ts(1,5): error TS2304: Cannot find name 'a'. +tests/cases/compiler/missingArgument1.ts(1,7): error TS1135: Argument expression expected. tests/cases/compiler/missingArgument1.ts(1,8): error TS2304: Cannot find name 'b'. ==== tests/cases/compiler/missingArgument1.ts (4 errors) ==== foo(a,,b); - -!!! error TS1135: Argument expression expected. ~~~ !!! error TS2304: Cannot find name 'foo'. ~ !!! error TS2304: Cannot find name 'a'. + +!!! error TS1135: Argument expression expected. ~ !!! error TS2304: Cannot find name 'b'. \ No newline at end of file diff --git a/tests/baselines/reference/moduleKeywordRepeatError.errors.txt b/tests/baselines/reference/moduleKeywordRepeatError.errors.txt index d3f5924e193..d77acf4f4d1 100644 --- a/tests/baselines/reference/moduleKeywordRepeatError.errors.txt +++ b/tests/baselines/reference/moduleKeywordRepeatError.errors.txt @@ -1,12 +1,12 @@ -tests/cases/compiler/moduleKeywordRepeatError.ts(3,15): error TS1005: ';' expected. tests/cases/compiler/moduleKeywordRepeatError.ts(3,1): error TS2304: Cannot find name 'module'. +tests/cases/compiler/moduleKeywordRepeatError.ts(3,15): error TS1005: ';' expected. ==== tests/cases/compiler/moduleKeywordRepeatError.ts (2 errors) ==== // "module.module { }" should raise a syntax error module.module { } - ~ -!!! error TS1005: ';' expected. ~~~~~~ -!!! error TS2304: Cannot find name 'module'. \ No newline at end of file +!!! error TS2304: Cannot find name 'module'. + ~ +!!! error TS1005: ';' expected. \ No newline at end of file diff --git a/tests/baselines/reference/negateOperatorInvalidOperations.errors.txt b/tests/baselines/reference/negateOperatorInvalidOperations.errors.txt index ac59b71bbc3..3bc5689d170 100644 --- a/tests/baselines/reference/negateOperatorInvalidOperations.errors.txt +++ b/tests/baselines/reference/negateOperatorInvalidOperations.errors.txt @@ -1,13 +1,13 @@ tests/cases/conformance/expressions/unaryOperators/negateOperator/negateOperatorInvalidOperations.ts(4,15): error TS1109: Expression expected. tests/cases/conformance/expressions/unaryOperators/negateOperator/negateOperatorInvalidOperations.ts(4,25): error TS1005: '=' expected. tests/cases/conformance/expressions/unaryOperators/negateOperator/negateOperatorInvalidOperations.ts(4,26): error TS1109: Expression expected. -tests/cases/conformance/expressions/unaryOperators/negateOperator/negateOperatorInvalidOperations.ts(12,14): error TS1109: Expression expected. tests/cases/conformance/expressions/unaryOperators/negateOperator/negateOperatorInvalidOperations.ts(7,17): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/unaryOperators/negateOperator/negateOperatorInvalidOperations.ts(7,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/unaryOperators/negateOperator/negateOperatorInvalidOperations.ts(8,17): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/unaryOperators/negateOperator/negateOperatorInvalidOperations.ts(8,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/unaryOperators/negateOperator/negateOperatorInvalidOperations.ts(9,17): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/unaryOperators/negateOperator/negateOperatorInvalidOperations.ts(9,29): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/negateOperator/negateOperatorInvalidOperations.ts(12,14): error TS1109: Expression expected. ==== tests/cases/conformance/expressions/unaryOperators/negateOperator/negateOperatorInvalidOperations.ts (10 errors) ==== diff --git a/tests/baselines/reference/nestedClassDeclaration.errors.txt b/tests/baselines/reference/nestedClassDeclaration.errors.txt index f3145467231..f5c5e41ad99 100644 --- a/tests/baselines/reference/nestedClassDeclaration.errors.txt +++ b/tests/baselines/reference/nestedClassDeclaration.errors.txt @@ -3,9 +3,9 @@ tests/cases/conformance/classes/nestedClassDeclaration.ts(7,1): error TS1128: De tests/cases/conformance/classes/nestedClassDeclaration.ts(10,5): error TS1129: Statement expected. tests/cases/conformance/classes/nestedClassDeclaration.ts(12,1): error TS1128: Declaration or statement expected. tests/cases/conformance/classes/nestedClassDeclaration.ts(15,11): error TS1005: ':' expected. +tests/cases/conformance/classes/nestedClassDeclaration.ts(15,11): error TS2304: Cannot find name 'C4'. tests/cases/conformance/classes/nestedClassDeclaration.ts(15,14): error TS1005: ',' expected. tests/cases/conformance/classes/nestedClassDeclaration.ts(17,1): error TS1128: Declaration or statement expected. -tests/cases/conformance/classes/nestedClassDeclaration.ts(15,11): error TS2304: Cannot find name 'C4'. ==== tests/cases/conformance/classes/nestedClassDeclaration.ts (8 errors) ==== @@ -34,10 +34,10 @@ tests/cases/conformance/classes/nestedClassDeclaration.ts(15,11): error TS2304: class C4 { ~~ !!! error TS1005: ':' expected. - ~ -!!! error TS1005: ',' expected. ~~ !!! error TS2304: Cannot find name 'C4'. + ~ +!!! error TS1005: ',' expected. } } ~ diff --git a/tests/baselines/reference/newExpressionWithCast.errors.txt b/tests/baselines/reference/newExpressionWithCast.errors.txt index 858fd81f0ee..c8f44b96ae2 100644 --- a/tests/baselines/reference/newExpressionWithCast.errors.txt +++ b/tests/baselines/reference/newExpressionWithCast.errors.txt @@ -1,6 +1,6 @@ -tests/cases/compiler/newExpressionWithCast.ts(8,17): error TS1109: Expression expected. tests/cases/compiler/newExpressionWithCast.ts(4,12): error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. tests/cases/compiler/newExpressionWithCast.ts(8,13): error TS2365: Operator '>' cannot be applied to types 'boolean' and 'void'. +tests/cases/compiler/newExpressionWithCast.ts(8,17): error TS1109: Expression expected. tests/cases/compiler/newExpressionWithCast.ts(8,18): error TS2304: Cannot find name 'any'. @@ -15,10 +15,10 @@ tests/cases/compiler/newExpressionWithCast.ts(8,18): error TS2304: Cannot find n function Test2() { } // parse error var test2 = new Test2(); - ~ -!!! error TS1109: Expression expected. ~~~~~~~~~~~~~~~~ !!! error TS2365: Operator '>' cannot be applied to types 'boolean' and 'void'. + ~ +!!! error TS1109: Expression expected. ~~~ !!! error TS2304: Cannot find name 'any'. diff --git a/tests/baselines/reference/newOperator.errors.txt b/tests/baselines/reference/newOperator.errors.txt index 33e2d806d3e..50a25a16a2c 100644 --- a/tests/baselines/reference/newOperator.errors.txt +++ b/tests/baselines/reference/newOperator.errors.txt @@ -1,14 +1,14 @@ -tests/cases/compiler/newOperator.ts(18,20): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. -tests/cases/compiler/newOperator.ts(22,1): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. -tests/cases/compiler/newOperator.ts(44,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/newOperator.ts(3,13): error TS2304: Cannot find name 'ifc'. tests/cases/compiler/newOperator.ts(10,10): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. tests/cases/compiler/newOperator.ts(11,10): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. tests/cases/compiler/newOperator.ts(12,5): error TS2304: Cannot find name 'string'. tests/cases/compiler/newOperator.ts(18,14): error TS2304: Cannot find name 'string'. +tests/cases/compiler/newOperator.ts(18,20): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. tests/cases/compiler/newOperator.ts(21,1): error TS2304: Cannot find name 'string'. +tests/cases/compiler/newOperator.ts(22,1): error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. tests/cases/compiler/newOperator.ts(28,13): error TS2304: Cannot find name 'q'. tests/cases/compiler/newOperator.ts(31,10): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +tests/cases/compiler/newOperator.ts(44,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ==== tests/cases/compiler/newOperator.ts (11 errors) ==== @@ -38,10 +38,10 @@ tests/cases/compiler/newOperator.ts(31,10): error TS2351: Cannot use 'new' with // Various spacing var t3 = new string[]( ); - ~~ -!!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. ~~~~~~ !!! error TS2304: Cannot find name 'string'. + ~~ +!!! error TS1150: 'new T[]' cannot be used to create an array. Use 'new Array()' instead. var t4 = new string diff --git a/tests/baselines/reference/noDefaultLib.errors.txt b/tests/baselines/reference/noDefaultLib.errors.txt index 02098950055..b8f42ba7c33 100644 --- a/tests/baselines/reference/noDefaultLib.errors.txt +++ b/tests/baselines/reference/noDefaultLib.errors.txt @@ -1,10 +1,10 @@ -error TS2318: Cannot find global type 'Boolean'. error TS2318: Cannot find global type 'IArguments'. +error TS2318: Cannot find global type 'Boolean'. tests/cases/compiler/noDefaultLib.ts(4,11): error TS2317: Global type 'Array' must have 1 type parameter(s). -!!! error TS2318: Cannot find global type 'Boolean'. !!! error TS2318: Cannot find global type 'IArguments'. +!!! error TS2318: Cannot find global type 'Boolean'. ==== tests/cases/compiler/noDefaultLib.ts (1 errors) ==== /// var x; diff --git a/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations.errors.txt b/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations.errors.txt index bd9a0bcbc93..35673eb3072 100644 --- a/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations.errors.txt +++ b/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations.errors.txt @@ -1,10 +1,8 @@ +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(18,5): error TS2412: Property '2.0' of type 'number' is not assignable to numeric index type 'string'. +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(21,5): error TS2412: Property '3.0' of type 'MyNumber' is not assignable to numeric index type 'string'. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(23,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(26,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(36,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(90,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(93,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(18,5): error TS2412: Property '2.0' of type 'number' is not assignable to numeric index type 'string'. -tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(21,5): error TS2412: Property '3.0' of type 'MyNumber' is not assignable to numeric index type 'string'. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(50,5): error TS2412: Property '2.0' of type 'number' is not assignable to numeric index type 'string'. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(68,5): error TS2412: Property '2.0' of type 'number' is not assignable to numeric index type 'string'. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(78,5): error TS2322: Type '{ [x: number]: string | number; 1.0: string; 2.0: number; a: string; b: number; c: () => void; "d": string; "e": number; "3.0": string; "4.0": number; f: any; X: string; foo(): string; }' is not assignable to type '{ [x: number]: string; }'. @@ -12,6 +10,8 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerCo Type 'string | number' is not assignable to type 'string'. Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(88,9): error TS2304: Cannot find name 'Myn'. +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(90,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(93,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ==== tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts (11 errors) ==== diff --git a/tests/baselines/reference/numericNamedPropertyDuplicates.errors.txt b/tests/baselines/reference/numericNamedPropertyDuplicates.errors.txt index c5890d7c98c..1c5eeb36b27 100644 --- a/tests/baselines/reference/numericNamedPropertyDuplicates.errors.txt +++ b/tests/baselines/reference/numericNamedPropertyDuplicates.errors.txt @@ -1,4 +1,3 @@ -tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericNamedPropertyDuplicates.ts(20,5): error TS1005: ',' expected. tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericNamedPropertyDuplicates.ts(2,5): error TS2300: Duplicate identifier '1'. tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericNamedPropertyDuplicates.ts(3,5): error TS2300: Duplicate identifier '1.0'. tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericNamedPropertyDuplicates.ts(4,12): error TS2300: Duplicate identifier '2'. @@ -8,6 +7,7 @@ tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericNamedP tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericNamedPropertyDuplicates.ts(14,5): error TS2300: Duplicate identifier '1'. tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericNamedPropertyDuplicates.ts(15,5): error TS2300: Duplicate identifier '1'. tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericNamedPropertyDuplicates.ts(19,5): error TS2300: Duplicate identifier '2'. +tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericNamedPropertyDuplicates.ts(20,5): error TS1005: ',' expected. tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericNamedPropertyDuplicates.ts(20,5): error TS2300: Duplicate identifier '2'. diff --git a/tests/baselines/reference/objectCreationExpressionInFunctionParameter.errors.txt b/tests/baselines/reference/objectCreationExpressionInFunctionParameter.errors.txt index 89693f4bced..bd9e021494c 100644 --- a/tests/baselines/reference/objectCreationExpressionInFunctionParameter.errors.txt +++ b/tests/baselines/reference/objectCreationExpressionInFunctionParameter.errors.txt @@ -1,5 +1,5 @@ -tests/cases/compiler/objectCreationExpressionInFunctionParameter.ts(6,2): error TS1128: Declaration or statement expected. tests/cases/compiler/objectCreationExpressionInFunctionParameter.ts(5,24): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. +tests/cases/compiler/objectCreationExpressionInFunctionParameter.ts(6,2): error TS1128: Declaration or statement expected. ==== tests/cases/compiler/objectCreationExpressionInFunctionParameter.ts (2 errors) ==== diff --git a/tests/baselines/reference/objectLiteralErrors.errors.txt b/tests/baselines/reference/objectLiteralErrors.errors.txt index 97cbdc32266..19935f52bdc 100644 --- a/tests/baselines/reference/objectLiteralErrors.errors.txt +++ b/tests/baselines/reference/objectLiteralErrors.errors.txt @@ -1,22 +1,3 @@ -tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(17,19): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. -tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(23,22): error TS1119: An object literal cannot have property and accessor with the same name. -tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(24,23): error TS1119: An object literal cannot have property and accessor with the same name. -tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(25,22): error TS1119: An object literal cannot have property and accessor with the same name. -tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(26,25): error TS1119: An object literal cannot have property and accessor with the same name. -tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(27,23): error TS1119: An object literal cannot have property and accessor with the same name. -tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(28,22): error TS1119: An object literal cannot have property and accessor with the same name. -tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(29,24): error TS1119: An object literal cannot have property and accessor with the same name. -tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(30,24): error TS1119: An object literal cannot have property and accessor with the same name. -tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(31,24): error TS1119: An object literal cannot have property and accessor with the same name. -tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(32,25): error TS1119: An object literal cannot have property and accessor with the same name. -tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(33,25): error TS1119: An object literal cannot have property and accessor with the same name. -tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(34,23): error TS1119: An object literal cannot have property and accessor with the same name. -tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(35,23): error TS1119: An object literal cannot have property and accessor with the same name. -tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(36,23): error TS1119: An object literal cannot have property and accessor with the same name. -tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(37,23): error TS1119: An object literal cannot have property and accessor with the same name. -tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(38,27): error TS1119: An object literal cannot have property and accessor with the same name. -tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(39,26): error TS1119: An object literal cannot have property and accessor with the same name. -tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(40,46): error TS1119: An object literal cannot have property and accessor with the same name. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(3,12): error TS2300: Duplicate identifier 'a'. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(3,18): error TS2300: Duplicate identifier 'a'. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(4,12): error TS2300: Duplicate identifier 'a'. @@ -46,6 +27,7 @@ tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(15,19) tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(16,13): error TS2300: Duplicate identifier '0'. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(16,19): error TS2300: Duplicate identifier '0x0'. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(17,13): error TS2300: Duplicate identifier '0'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(17,19): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(17,19): error TS2300: Duplicate identifier '000'. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(18,13): error TS2300: Duplicate identifier '"100"'. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(18,23): error TS2300: Duplicate identifier '1e2'. @@ -54,40 +36,58 @@ tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(19,22) tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(20,13): error TS2300: Duplicate identifier 'a'. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(20,25): error TS2300: Duplicate identifier 'a'. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(23,12): error TS2300: Duplicate identifier 'a'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(23,22): error TS1119: An object literal cannot have property and accessor with the same name. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(23,22): error TS2300: Duplicate identifier 'a'. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(24,12): error TS2300: Duplicate identifier 'a'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(24,23): error TS1119: An object literal cannot have property and accessor with the same name. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(24,23): error TS2300: Duplicate identifier 'a'. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(25,12): error TS2300: Duplicate identifier 'a'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(25,22): error TS1119: An object literal cannot have property and accessor with the same name. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(25,22): error TS2300: Duplicate identifier 'a'. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(26,12): error TS2300: Duplicate identifier 'a'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(26,25): error TS1119: An object literal cannot have property and accessor with the same name. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(26,25): error TS2300: Duplicate identifier 'a'. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(27,12): error TS2300: Duplicate identifier 'a'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(27,23): error TS1119: An object literal cannot have property and accessor with the same name. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(27,23): error TS2300: Duplicate identifier 'a'. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(28,12): error TS2300: Duplicate identifier 'a'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(28,22): error TS1119: An object literal cannot have property and accessor with the same name. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(28,22): error TS2300: Duplicate identifier ''a''. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(29,12): error TS2300: Duplicate identifier ''a''. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(29,24): error TS1119: An object literal cannot have property and accessor with the same name. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(29,24): error TS2300: Duplicate identifier 'a'. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(30,12): error TS2300: Duplicate identifier ''a''. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(30,24): error TS1119: An object literal cannot have property and accessor with the same name. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(30,24): error TS2300: Duplicate identifier '"a"'. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(31,12): error TS2300: Duplicate identifier ''a''. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(31,24): error TS1119: An object literal cannot have property and accessor with the same name. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(31,24): error TS2300: Duplicate identifier ''a''. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(32,13): error TS2300: Duplicate identifier '"a"'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(32,25): error TS1119: An object literal cannot have property and accessor with the same name. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(32,25): error TS2300: Duplicate identifier ''a''. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(33,13): error TS2300: Duplicate identifier '1.0'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(33,25): error TS1119: An object literal cannot have property and accessor with the same name. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(33,25): error TS2300: Duplicate identifier ''1''. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(34,13): error TS2300: Duplicate identifier '0'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(34,23): error TS1119: An object literal cannot have property and accessor with the same name. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(34,23): error TS2300: Duplicate identifier '0'. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(35,13): error TS2300: Duplicate identifier '0'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(35,23): error TS1119: An object literal cannot have property and accessor with the same name. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(35,23): error TS2300: Duplicate identifier '0'. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(36,13): error TS2300: Duplicate identifier '0'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(36,23): error TS1119: An object literal cannot have property and accessor with the same name. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(36,23): error TS2300: Duplicate identifier '0x0'. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(37,13): error TS2300: Duplicate identifier '0'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(37,23): error TS1119: An object literal cannot have property and accessor with the same name. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(37,23): error TS2300: Duplicate identifier '000'. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(38,13): error TS2300: Duplicate identifier '"100"'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(38,27): error TS1119: An object literal cannot have property and accessor with the same name. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(38,27): error TS2300: Duplicate identifier '1e2'. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(39,13): error TS2300: Duplicate identifier '0x20'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(39,26): error TS1119: An object literal cannot have property and accessor with the same name. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(39,26): error TS2300: Duplicate identifier '3.2e1'. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(40,13): error TS2300: Duplicate identifier 'a'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(40,46): error TS1119: An object literal cannot have property and accessor with the same name. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(40,46): error TS2300: Duplicate identifier 'a'. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(43,12): error TS2380: 'get' and 'set' accessor must have the same type. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(43,43): error TS2380: 'get' and 'set' accessor must have the same type. @@ -170,11 +170,11 @@ tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(45,51) ~~~ !!! error TS2300: Duplicate identifier '0x0'. var e14 = { 0: 0, 000: 0 }; - ~~~ -!!! error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. ~ !!! error TS2300: Duplicate identifier '0'. ~~~ +!!! error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. + ~~~ !!! error TS2300: Duplicate identifier '000'. var e15 = { "100": 0, 1e2: 0 }; ~~~~~ @@ -194,130 +194,130 @@ tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(45,51) // Accessor and property with the same name var f1 = { a: 0, get a() { return 0; } }; - ~ -!!! error TS1119: An object literal cannot have property and accessor with the same name. ~ !!! error TS2300: Duplicate identifier 'a'. ~ +!!! error TS1119: An object literal cannot have property and accessor with the same name. + ~ !!! error TS2300: Duplicate identifier 'a'. var f2 = { a: '', get a() { return ''; } }; - ~ -!!! error TS1119: An object literal cannot have property and accessor with the same name. ~ !!! error TS2300: Duplicate identifier 'a'. ~ +!!! error TS1119: An object literal cannot have property and accessor with the same name. + ~ !!! error TS2300: Duplicate identifier 'a'. var f3 = { a: 0, get a() { return ''; } }; - ~ -!!! error TS1119: An object literal cannot have property and accessor with the same name. ~ !!! error TS2300: Duplicate identifier 'a'. ~ +!!! error TS1119: An object literal cannot have property and accessor with the same name. + ~ !!! error TS2300: Duplicate identifier 'a'. var f4 = { a: true, get a() { return false; } }; - ~ -!!! error TS1119: An object literal cannot have property and accessor with the same name. ~ !!! error TS2300: Duplicate identifier 'a'. ~ +!!! error TS1119: An object literal cannot have property and accessor with the same name. + ~ !!! error TS2300: Duplicate identifier 'a'. var f5 = { a: {}, get a() { return {}; } }; - ~ -!!! error TS1119: An object literal cannot have property and accessor with the same name. ~ !!! error TS2300: Duplicate identifier 'a'. ~ +!!! error TS1119: An object literal cannot have property and accessor with the same name. + ~ !!! error TS2300: Duplicate identifier 'a'. var f6 = { a: 0, get 'a'() { return 0; } }; - ~~~ -!!! error TS1119: An object literal cannot have property and accessor with the same name. ~ !!! error TS2300: Duplicate identifier 'a'. ~~~ +!!! error TS1119: An object literal cannot have property and accessor with the same name. + ~~~ !!! error TS2300: Duplicate identifier ''a''. var f7 = { 'a': 0, get a() { return 0; } }; - ~ -!!! error TS1119: An object literal cannot have property and accessor with the same name. ~~~ !!! error TS2300: Duplicate identifier ''a''. ~ +!!! error TS1119: An object literal cannot have property and accessor with the same name. + ~ !!! error TS2300: Duplicate identifier 'a'. var f8 = { 'a': 0, get "a"() { return 0; } }; - ~~~ -!!! error TS1119: An object literal cannot have property and accessor with the same name. ~~~ !!! error TS2300: Duplicate identifier ''a''. ~~~ +!!! error TS1119: An object literal cannot have property and accessor with the same name. + ~~~ !!! error TS2300: Duplicate identifier '"a"'. var f9 = { 'a': 0, get 'a'() { return 0; } }; - ~~~ -!!! error TS1119: An object literal cannot have property and accessor with the same name. ~~~ !!! error TS2300: Duplicate identifier ''a''. ~~~ +!!! error TS1119: An object literal cannot have property and accessor with the same name. + ~~~ !!! error TS2300: Duplicate identifier ''a''. var f10 = { "a": 0, get 'a'() { return 0; } }; - ~~~ -!!! error TS1119: An object literal cannot have property and accessor with the same name. ~~~ !!! error TS2300: Duplicate identifier '"a"'. ~~~ +!!! error TS1119: An object literal cannot have property and accessor with the same name. + ~~~ !!! error TS2300: Duplicate identifier ''a''. var f11 = { 1.0: 0, get '1'() { return 0; } }; - ~~~ -!!! error TS1119: An object literal cannot have property and accessor with the same name. ~~~ !!! error TS2300: Duplicate identifier '1.0'. ~~~ +!!! error TS1119: An object literal cannot have property and accessor with the same name. + ~~~ !!! error TS2300: Duplicate identifier ''1''. var f12 = { 0: 0, get 0() { return 0; } }; - ~ -!!! error TS1119: An object literal cannot have property and accessor with the same name. ~ !!! error TS2300: Duplicate identifier '0'. ~ +!!! error TS1119: An object literal cannot have property and accessor with the same name. + ~ !!! error TS2300: Duplicate identifier '0'. var f13 = { 0: 0, get 0() { return 0; } }; - ~ -!!! error TS1119: An object literal cannot have property and accessor with the same name. ~ !!! error TS2300: Duplicate identifier '0'. ~ +!!! error TS1119: An object literal cannot have property and accessor with the same name. + ~ !!! error TS2300: Duplicate identifier '0'. var f14 = { 0: 0, get 0x0() { return 0; } }; - ~~~ -!!! error TS1119: An object literal cannot have property and accessor with the same name. ~ !!! error TS2300: Duplicate identifier '0'. ~~~ +!!! error TS1119: An object literal cannot have property and accessor with the same name. + ~~~ !!! error TS2300: Duplicate identifier '0x0'. var f14 = { 0: 0, get 000() { return 0; } }; - ~~~ -!!! error TS1119: An object literal cannot have property and accessor with the same name. ~ !!! error TS2300: Duplicate identifier '0'. ~~~ +!!! error TS1119: An object literal cannot have property and accessor with the same name. + ~~~ !!! error TS2300: Duplicate identifier '000'. var f15 = { "100": 0, get 1e2() { return 0; } }; - ~~~ -!!! error TS1119: An object literal cannot have property and accessor with the same name. ~~~~~ !!! error TS2300: Duplicate identifier '"100"'. ~~~ +!!! error TS1119: An object literal cannot have property and accessor with the same name. + ~~~ !!! error TS2300: Duplicate identifier '1e2'. var f16 = { 0x20: 0, get 3.2e1() { return 0; } }; - ~~~~~ -!!! error TS1119: An object literal cannot have property and accessor with the same name. ~~~~ !!! error TS2300: Duplicate identifier '0x20'. ~~~~~ +!!! error TS1119: An object literal cannot have property and accessor with the same name. + ~~~~~ !!! error TS2300: Duplicate identifier '3.2e1'. var f17 = { a: 0, get b() { return 1; }, get a() { return 0; } }; - ~ -!!! error TS1119: An object literal cannot have property and accessor with the same name. ~ !!! error TS2300: Duplicate identifier 'a'. ~ +!!! error TS1119: An object literal cannot have property and accessor with the same name. + ~ !!! error TS2300: Duplicate identifier 'a'. // Get and set accessor with mismatched type annotations diff --git a/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentError.errors.txt b/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentError.errors.txt index 2db47d0f7ae..ef762013989 100644 --- a/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentError.errors.txt +++ b/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentError.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentError.ts(5,16): error TS1131: Property or signature expected. -tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentError.ts(5,25): error TS1128: Declaration or statement expected. -tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentError.ts(6,53): error TS1005: ';' expected. tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentError.ts(4,5): error TS2322: Type '{ name: string; id: number; }' is not assignable to type '{ b: string; id: number; }'. Property 'b' is missing in type '{ name: string; id: number; }'. +tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentError.ts(5,16): error TS1131: Property or signature expected. tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentError.ts(5,22): error TS2403: Subsequent variable declarations must have the same type. Variable 'id' must be of type 'number', but here has type 'any'. +tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentError.ts(5,25): error TS1128: Declaration or statement expected. +tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentError.ts(6,53): error TS1005: ';' expected. tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentError.ts(6,79): error TS2322: Type '{ name: string; id: number; }' is not assignable to type '{ id: string; name: number; }'. Types of property 'id' are incompatible. Type 'number' is not assignable to type 'string'. @@ -23,10 +23,10 @@ tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPr var person1: { name, id }; // error: can't use short-hand property assignment in type position ~~~~ !!! error TS1131: Property or signature expected. - ~ -!!! error TS1128: Declaration or statement expected. ~~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'id' must be of type 'number', but here has type 'any'. + ~ +!!! error TS1128: Declaration or statement expected. function foo(name: string, id: number): { id: string, name: number } { return { name, id }; } // error ~ !!! error TS1005: ';' expected. diff --git a/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.errors.txt b/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.errors.txt index 708bbb0935f..b10ef656cd0 100644 --- a/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.errors.txt +++ b/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.errors.txt @@ -1,17 +1,17 @@ -tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.ts(5,55): error TS1005: ';' expected. -tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.ts(6,55): error TS1005: ';' expected. -tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.ts(7,16): error TS1131: Property or signature expected. -tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.ts(7,25): error TS1128: Declaration or statement expected. -tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.ts(8,28): error TS1005: ';' expected. tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.ts(4,5): error TS2322: Type '{ name: string; id: number; }' is not assignable to type '{ b: string; id: number; }'. Property 'b' is missing in type '{ name: string; id: number; }'. +tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.ts(5,55): error TS1005: ';' expected. tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.ts(5,79): error TS2322: Type '{ name: string; id: number; }' is not assignable to type '{ name: number; id: string; }'. Types of property 'name' are incompatible. Type 'string' is not assignable to type 'number'. +tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.ts(6,55): error TS1005: ';' expected. +tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.ts(7,16): error TS1131: Property or signature expected. tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.ts(7,22): error TS2403: Subsequent variable declarations must have the same type. Variable 'id' must be of type 'number', but here has type 'any'. +tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.ts(7,25): error TS1128: Declaration or statement expected. tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.ts(8,5): error TS2322: Type '{ name: number; id: string; }' is not assignable to type '{ name: string; id: number; }'. Types of property 'name' are incompatible. Type 'number' is not assignable to type 'string'. +tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.ts(8,28): error TS1005: ';' expected. ==== tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.ts (9 errors) ==== @@ -35,14 +35,14 @@ tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPr var person1: { name, id }; // error : Can't use shorthand in the type position ~~~~ !!! error TS1131: Property or signature expected. - ~ -!!! error TS1128: Declaration or statement expected. ~~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'id' must be of type 'number', but here has type 'any'. + ~ +!!! error TS1128: Declaration or statement expected. var person2: { name: string, id: number } = bar("hello", 5); - ~ -!!! error TS1005: ';' expected. ~~~~~~~ !!! error TS2322: Type '{ name: number; id: string; }' is not assignable to type '{ name: string; id: number; }'. !!! error TS2322: Types of property 'name' are incompatible. -!!! error TS2322: Type 'number' is not assignable to type 'string'. \ No newline at end of file +!!! error TS2322: Type 'number' is not assignable to type 'string'. + ~ +!!! error TS1005: ';' expected. \ No newline at end of file diff --git a/tests/baselines/reference/objectLiteralShorthandPropertiesErrorFromNotUsingIdentifier.errors.txt b/tests/baselines/reference/objectLiteralShorthandPropertiesErrorFromNotUsingIdentifier.errors.txt index cc92b9a0381..80bfb49883b 100644 --- a/tests/baselines/reference/objectLiteralShorthandPropertiesErrorFromNotUsingIdentifier.errors.txt +++ b/tests/baselines/reference/objectLiteralShorthandPropertiesErrorFromNotUsingIdentifier.errors.txt @@ -7,13 +7,13 @@ tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPr tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesErrorFromNotUsingIdentifier.ts(9,8): error TS1005: ':' expected. tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesErrorFromNotUsingIdentifier.ts(10,10): error TS1005: ':' expected. tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesErrorFromNotUsingIdentifier.ts(12,1): error TS1005: ':' expected. +tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesErrorFromNotUsingIdentifier.ts(15,5): error TS2300: Duplicate identifier 'a'. tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesErrorFromNotUsingIdentifier.ts(15,6): error TS1005: ':' expected. +tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesErrorFromNotUsingIdentifier.ts(16,5): error TS2300: Duplicate identifier 'a'. tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesErrorFromNotUsingIdentifier.ts(16,6): error TS1005: ':' expected. +tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesErrorFromNotUsingIdentifier.ts(17,5): error TS2300: Duplicate identifier 'a'. tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesErrorFromNotUsingIdentifier.ts(17,6): error TS1005: ':' expected. tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesErrorFromNotUsingIdentifier.ts(20,17): error TS1005: ':' expected. -tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesErrorFromNotUsingIdentifier.ts(15,5): error TS2300: Duplicate identifier 'a'. -tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesErrorFromNotUsingIdentifier.ts(16,5): error TS2300: Duplicate identifier 'a'. -tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesErrorFromNotUsingIdentifier.ts(17,5): error TS2300: Duplicate identifier 'a'. ==== tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesErrorFromNotUsingIdentifier.ts (16 errors) ==== @@ -50,20 +50,20 @@ tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPr var x = { a.b, - ~ -!!! error TS1005: ':' expected. ~ !!! error TS2300: Duplicate identifier 'a'. + ~ +!!! error TS1005: ':' expected. a["ss"], - ~ -!!! error TS1005: ':' expected. ~ !!! error TS2300: Duplicate identifier 'a'. + ~ +!!! error TS1005: ':' expected. a[1], - ~ -!!! error TS1005: ':' expected. ~ !!! error TS2300: Duplicate identifier 'a'. + ~ +!!! error TS1005: ':' expected. }; var v = { class }; // error diff --git a/tests/baselines/reference/objectTypesWithOptionalProperties2.errors.txt b/tests/baselines/reference/objectTypesWithOptionalProperties2.errors.txt index 533834baea7..227df7111c5 100644 --- a/tests/baselines/reference/objectTypesWithOptionalProperties2.errors.txt +++ b/tests/baselines/reference/objectTypesWithOptionalProperties2.errors.txt @@ -2,17 +2,17 @@ tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWith tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties2.ts(4,9): error TS1131: Property or signature expected. tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties2.ts(8,8): error TS1005: ';' expected. tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties2.ts(8,9): error TS1131: Property or signature expected. +tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties2.ts(12,5): error TS2391: Function implementation is missing or not immediately following the declaration. tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties2.ts(12,8): error TS1144: '{' or ';' expected. tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties2.ts(12,9): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties2.ts(16,8): error TS1005: ';' expected. tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties2.ts(16,9): error TS1131: Property or signature expected. +tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties2.ts(20,5): error TS2391: Function implementation is missing or not immediately following the declaration. tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties2.ts(20,8): error TS1144: '{' or ';' expected. tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties2.ts(20,9): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties2.ts(25,8): error TS1005: '{' expected. tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties2.ts(25,9): error TS1136: Property assignment expected. tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties2.ts(26,1): error TS1005: ':' expected. -tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties2.ts(12,5): error TS2391: Function implementation is missing or not immediately following the declaration. -tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties2.ts(20,5): error TS2391: Function implementation is missing or not immediately following the declaration. ==== tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties2.ts (15 errors) ==== @@ -36,12 +36,12 @@ tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWith class C { x()?: number; // error + ~ +!!! error TS2391: Function implementation is missing or not immediately following the declaration. ~ !!! error TS1144: '{' or ';' expected. ~ !!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. - ~ -!!! error TS2391: Function implementation is missing or not immediately following the declaration. } interface I2 { @@ -54,12 +54,12 @@ tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWith class C2 { x()?: T; // error + ~ +!!! error TS2391: Function implementation is missing or not immediately following the declaration. ~ !!! error TS1144: '{' or ';' expected. ~ !!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. - ~ -!!! error TS2391: Function implementation is missing or not immediately following the declaration. } diff --git a/tests/baselines/reference/optionalParamArgsTest.errors.txt b/tests/baselines/reference/optionalParamArgsTest.errors.txt index a8ce88e494e..3c4d2e37be9 100644 --- a/tests/baselines/reference/optionalParamArgsTest.errors.txt +++ b/tests/baselines/reference/optionalParamArgsTest.errors.txt @@ -1,6 +1,6 @@ -tests/cases/compiler/optionalParamArgsTest.ts(35,47): error TS1016: A required parameter cannot follow an optional parameter. tests/cases/compiler/optionalParamArgsTest.ts(31,12): error TS2393: Duplicate function implementation. tests/cases/compiler/optionalParamArgsTest.ts(35,12): error TS2393: Duplicate function implementation. +tests/cases/compiler/optionalParamArgsTest.ts(35,47): error TS1016: A required parameter cannot follow an optional parameter. tests/cases/compiler/optionalParamArgsTest.ts(99,1): error TS2346: Supplied parameters do not match any signature of call target. tests/cases/compiler/optionalParamArgsTest.ts(100,1): error TS2346: Supplied parameters do not match any signature of call target. tests/cases/compiler/optionalParamArgsTest.ts(101,1): error TS2346: Supplied parameters do not match any signature of call target. @@ -61,10 +61,10 @@ tests/cases/compiler/optionalParamArgsTest.ts(118,1): error TS2346: Supplied par // Negative test // "Optional parameters may only be followed by other optional parameters" public C1M5(C1M5A1:number,C1M5A2:number=0,C1M5A3:number) { return C1M5A1 + C1M5A2; } - ~~~~~~ -!!! error TS1016: A required parameter cannot follow an optional parameter. ~~~~ !!! error TS2393: Duplicate function implementation. + ~~~~~~ +!!! error TS1016: A required parameter cannot follow an optional parameter. } class C2 extends C1 { diff --git a/tests/baselines/reference/optionalPropertiesSyntax.errors.txt b/tests/baselines/reference/optionalPropertiesSyntax.errors.txt index daeb7c7a268..f0a9995ba6f 100644 --- a/tests/baselines/reference/optionalPropertiesSyntax.errors.txt +++ b/tests/baselines/reference/optionalPropertiesSyntax.errors.txt @@ -1,15 +1,15 @@ +tests/cases/compiler/optionalPropertiesSyntax.ts(4,5): error TS2386: Overload signatures must all be optional or required. tests/cases/compiler/optionalPropertiesSyntax.ts(11,7): error TS1005: ';' expected. tests/cases/compiler/optionalPropertiesSyntax.ts(11,8): error TS1131: Property or signature expected. tests/cases/compiler/optionalPropertiesSyntax.ts(12,5): error TS1131: Property or signature expected. tests/cases/compiler/optionalPropertiesSyntax.ts(18,11): error TS1005: ';' expected. tests/cases/compiler/optionalPropertiesSyntax.ts(18,12): error TS1131: Property or signature expected. -tests/cases/compiler/optionalPropertiesSyntax.ts(32,18): error TS1005: ';' expected. -tests/cases/compiler/optionalPropertiesSyntax.ts(32,19): error TS1131: Property or signature expected. -tests/cases/compiler/optionalPropertiesSyntax.ts(33,5): error TS1131: Property or signature expected. -tests/cases/compiler/optionalPropertiesSyntax.ts(4,5): error TS2386: Overload signatures must all be optional or required. tests/cases/compiler/optionalPropertiesSyntax.ts(24,5): error TS2300: Duplicate identifier 'prop'. tests/cases/compiler/optionalPropertiesSyntax.ts(25,5): error TS2300: Duplicate identifier 'prop'. tests/cases/compiler/optionalPropertiesSyntax.ts(32,5): error TS2375: Duplicate number index signature. +tests/cases/compiler/optionalPropertiesSyntax.ts(32,18): error TS1005: ';' expected. +tests/cases/compiler/optionalPropertiesSyntax.ts(32,19): error TS1131: Property or signature expected. +tests/cases/compiler/optionalPropertiesSyntax.ts(33,5): error TS1131: Property or signature expected. tests/cases/compiler/optionalPropertiesSyntax.ts(33,7): error TS2375: Duplicate number index signature. tests/cases/compiler/optionalPropertiesSyntax.ts(34,5): error TS2375: Duplicate number index signature. @@ -63,12 +63,12 @@ tests/cases/compiler/optionalPropertiesSyntax.ts(34,5): error TS2375: Duplicate //Index signatures can't be optional [idx: number]: any; [idx: number]?: any; //err + ~~~~~~~~~~~~~ +!!! error TS2375: Duplicate number index signature. ~ !!! error TS1005: ';' expected. ~ !!! error TS1131: Property or signature expected. - ~~~~~~~~~~~~~ -!!! error TS2375: Duplicate number index signature. ? [idx: number]: any; //err ~ !!! error TS1131: Property or signature expected. diff --git a/tests/baselines/reference/overloadOnConstAsTypeAnnotation.errors.txt b/tests/baselines/reference/overloadOnConstAsTypeAnnotation.errors.txt index 70530d409b3..079951880ab 100644 --- a/tests/baselines/reference/overloadOnConstAsTypeAnnotation.errors.txt +++ b/tests/baselines/reference/overloadOnConstAsTypeAnnotation.errors.txt @@ -1,10 +1,10 @@ -tests/cases/compiler/overloadOnConstAsTypeAnnotation.ts(1,37): error TS1005: ';' expected. tests/cases/compiler/overloadOnConstAsTypeAnnotation.ts(1,8): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/compiler/overloadOnConstAsTypeAnnotation.ts(1,37): error TS1005: ';' expected. ==== tests/cases/compiler/overloadOnConstAsTypeAnnotation.ts (2 errors) ==== var f: (x: 'hi') => number = ('hi') => { return 1; }; - ~~ -!!! error TS1005: ';' expected. ~~~~~~~~~~~~~~~~~~~ -!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. \ No newline at end of file +!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. + ~~ +!!! error TS1005: ';' expected. \ No newline at end of file diff --git a/tests/baselines/reference/overloadingStaticFunctionsInFunctions.errors.txt b/tests/baselines/reference/overloadingStaticFunctionsInFunctions.errors.txt index 7d101598129..e340e5596cd 100644 --- a/tests/baselines/reference/overloadingStaticFunctionsInFunctions.errors.txt +++ b/tests/baselines/reference/overloadingStaticFunctionsInFunctions.errors.txt @@ -1,17 +1,17 @@ tests/cases/compiler/overloadingStaticFunctionsInFunctions.ts(1,14): error TS1005: '(' expected. tests/cases/compiler/overloadingStaticFunctionsInFunctions.ts(2,3): error TS1129: Statement expected. -tests/cases/compiler/overloadingStaticFunctionsInFunctions.ts(3,3): error TS1129: Statement expected. -tests/cases/compiler/overloadingStaticFunctionsInFunctions.ts(3,19): error TS1005: ',' expected. -tests/cases/compiler/overloadingStaticFunctionsInFunctions.ts(4,3): error TS1129: Statement expected. -tests/cases/compiler/overloadingStaticFunctionsInFunctions.ts(4,20): error TS1109: Expression expected. -tests/cases/compiler/overloadingStaticFunctionsInFunctions.ts(4,25): error TS1005: ';' expected. tests/cases/compiler/overloadingStaticFunctionsInFunctions.ts(2,10): error TS2304: Cannot find name 'test'. +tests/cases/compiler/overloadingStaticFunctionsInFunctions.ts(3,3): error TS1129: Statement expected. tests/cases/compiler/overloadingStaticFunctionsInFunctions.ts(3,10): error TS2304: Cannot find name 'test'. tests/cases/compiler/overloadingStaticFunctionsInFunctions.ts(3,15): error TS2304: Cannot find name 'name'. +tests/cases/compiler/overloadingStaticFunctionsInFunctions.ts(3,19): error TS1005: ',' expected. tests/cases/compiler/overloadingStaticFunctionsInFunctions.ts(3,20): error TS2304: Cannot find name 'string'. +tests/cases/compiler/overloadingStaticFunctionsInFunctions.ts(4,3): error TS1129: Statement expected. tests/cases/compiler/overloadingStaticFunctionsInFunctions.ts(4,10): error TS2304: Cannot find name 'test'. tests/cases/compiler/overloadingStaticFunctionsInFunctions.ts(4,15): error TS2304: Cannot find name 'name'. +tests/cases/compiler/overloadingStaticFunctionsInFunctions.ts(4,20): error TS1109: Expression expected. tests/cases/compiler/overloadingStaticFunctionsInFunctions.ts(4,21): error TS2304: Cannot find name 'any'. +tests/cases/compiler/overloadingStaticFunctionsInFunctions.ts(4,25): error TS1005: ';' expected. ==== tests/cases/compiler/overloadingStaticFunctionsInFunctions.ts (14 errors) ==== @@ -26,25 +26,25 @@ tests/cases/compiler/overloadingStaticFunctionsInFunctions.ts(4,21): error TS230 static test(name:string) ~~~~~~ !!! error TS1129: Statement expected. - ~ -!!! error TS1005: ',' expected. ~~~~ !!! error TS2304: Cannot find name 'test'. ~~~~ !!! error TS2304: Cannot find name 'name'. + ~ +!!! error TS1005: ',' expected. ~~~~~~ !!! error TS2304: Cannot find name 'string'. static test(name?:any){ } ~~~~~~ !!! error TS1129: Statement expected. - ~ -!!! error TS1109: Expression expected. - ~ -!!! error TS1005: ';' expected. ~~~~ !!! error TS2304: Cannot find name 'test'. ~~~~ !!! error TS2304: Cannot find name 'name'. + ~ +!!! error TS1109: Expression expected. ~~~ !!! error TS2304: Cannot find name 'any'. + ~ +!!! error TS1005: ';' expected. } \ No newline at end of file diff --git a/tests/baselines/reference/parseErrorInHeritageClause1.errors.txt b/tests/baselines/reference/parseErrorInHeritageClause1.errors.txt index 944cdd78e24..67564442b3a 100644 --- a/tests/baselines/reference/parseErrorInHeritageClause1.errors.txt +++ b/tests/baselines/reference/parseErrorInHeritageClause1.errors.txt @@ -1,11 +1,11 @@ -tests/cases/compiler/parseErrorInHeritageClause1.ts(1,19): error TS1127: Invalid character. tests/cases/compiler/parseErrorInHeritageClause1.ts(1,17): error TS2304: Cannot find name 'A'. +tests/cases/compiler/parseErrorInHeritageClause1.ts(1,19): error TS1127: Invalid character. ==== tests/cases/compiler/parseErrorInHeritageClause1.ts (2 errors) ==== class C extends A # { - -!!! error TS1127: Invalid character. ~ !!! error TS2304: Cannot find name 'A'. + +!!! error TS1127: Invalid character. } \ No newline at end of file diff --git a/tests/baselines/reference/parser0_004152.errors.txt b/tests/baselines/reference/parser0_004152.errors.txt index cfd6161a48e..97b9bfe34a6 100644 --- a/tests/baselines/reference/parser0_004152.errors.txt +++ b/tests/baselines/reference/parser0_004152.errors.txt @@ -1,38 +1,38 @@ tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(1,14): error TS1148: Cannot compile external modules unless the '--module' flag is provided. +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,48): error TS2300: Duplicate identifier '3'. 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. +tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,54): error TS2300: Duplicate identifier '3'. tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,55): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,57): error TS2300: Duplicate identifier '3'. tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,58): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,60): error TS2300: Duplicate identifier '3'. tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,61): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,63): error TS2300: Duplicate identifier '0'. tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,64): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,66): error TS2300: Duplicate identifier '3'. tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,67): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,69): error TS2300: Duplicate identifier '3'. tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,70): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,72): error TS2300: Duplicate identifier '3'. tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,73): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,75): error TS2300: Duplicate identifier '3'. tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,76): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,78): error TS2300: Duplicate identifier '3'. tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,79): error TS1005: ';' expected. +tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,81): error TS2300: Duplicate identifier '3'. tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,82): error TS1005: ';' expected. +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,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(2,98): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. -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,48): error TS2300: Duplicate identifier '3'. -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,54): error TS2300: Duplicate identifier '3'. -tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,57): error TS2300: Duplicate identifier '3'. -tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,60): error TS2300: Duplicate identifier '3'. -tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,63): error TS2300: Duplicate identifier '0'. -tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,66): error TS2300: Duplicate identifier '3'. -tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,69): error TS2300: Duplicate identifier '3'. -tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,72): error TS2300: Duplicate identifier '3'. -tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,75): error TS2300: Duplicate identifier '3'. -tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,78): error TS2300: Duplicate identifier '3'. -tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(2,81): error TS2300: Duplicate identifier '3'. -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,96): error TS2300: Duplicate identifier '0'. tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(3,25): error TS2304: Cannot find name 'SeedCoords'. @@ -41,74 +41,74 @@ tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts(3,25): error T ~~~~ !!! error TS1148: Cannot compile external modules unless the '--module' flag is provided. private position = new DisplayPosition([), 3, 3, 3, 3, 3, 0, 3, 3, 3, 3, 3, 3, 0], NoMove, 0); + ~~~~~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'DisplayPosition'. ~ !!! error TS1137: Expression or comma expected. ~ !!! error TS1005: ';' expected. + ~ +!!! error TS2300: Duplicate identifier '3'. ~ !!! error TS1005: ';' expected. + ~ +!!! error TS2300: Duplicate identifier '3'. ~ !!! error TS1005: ';' expected. + ~ +!!! error TS2300: Duplicate identifier '3'. ~ !!! error TS1005: ';' expected. + ~ +!!! error TS2300: Duplicate identifier '3'. ~ !!! error TS1005: ';' expected. + ~ +!!! error TS2300: Duplicate identifier '3'. ~ !!! error TS1005: ';' expected. + ~ +!!! error TS2300: Duplicate identifier '0'. ~ !!! error TS1005: ';' expected. + ~ +!!! error TS2300: Duplicate identifier '3'. ~ !!! error TS1005: ';' expected. + ~ +!!! error TS2300: Duplicate identifier '3'. ~ !!! error TS1005: ';' expected. + ~ +!!! error TS2300: Duplicate identifier '3'. ~ !!! error TS1005: ';' expected. + ~ +!!! error TS2300: Duplicate identifier '3'. ~ !!! error TS1005: ';' expected. + ~ +!!! error TS2300: Duplicate identifier '3'. ~ !!! error TS1005: ';' expected. + ~ +!!! error TS2300: Duplicate identifier '3'. ~ !!! error TS1005: ';' expected. + ~ +!!! error TS2300: Duplicate identifier '0'. ~ !!! error TS1005: ';' expected. ~ !!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. ~ !!! error TS1005: ';' expected. + ~ +!!! error TS2300: Duplicate identifier '0'. ~ !!! error TS1005: ';' expected. ~ !!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. - ~~~~~~~~~~~~~~~ -!!! error TS2304: Cannot find name 'DisplayPosition'. - ~ -!!! error TS2300: Duplicate identifier '3'. - ~ -!!! error TS2300: Duplicate identifier '3'. - ~ -!!! error TS2300: Duplicate identifier '3'. - ~ -!!! error TS2300: Duplicate identifier '3'. - ~ -!!! error TS2300: Duplicate identifier '3'. - ~ -!!! error TS2300: Duplicate identifier '0'. - ~ -!!! error TS2300: Duplicate identifier '3'. - ~ -!!! error TS2300: Duplicate identifier '3'. - ~ -!!! error TS2300: Duplicate identifier '3'. - ~ -!!! error TS2300: Duplicate identifier '3'. - ~ -!!! error TS2300: Duplicate identifier '3'. - ~ -!!! error TS2300: Duplicate identifier '3'. - ~ -!!! error TS2300: Duplicate identifier '0'. - ~ -!!! error TS2300: Duplicate identifier '0'. private prevConfig: SeedCoords[][]; ~~~~~~~~~~ !!! error TS2304: Cannot find name 'SeedCoords'. diff --git a/tests/baselines/reference/parser10.1.1-8gs.errors.txt b/tests/baselines/reference/parser10.1.1-8gs.errors.txt index 459ad40ab72..c396c982bb8 100644 --- a/tests/baselines/reference/parser10.1.1-8gs.errors.txt +++ b/tests/baselines/reference/parser10.1.1-8gs.errors.txt @@ -1,7 +1,7 @@ +tests/cases/conformance/parser/ecmascript5/parser10.1.1-8gs.ts(16,7): error TS2304: Cannot find name 'NotEarlyError'. tests/cases/conformance/parser/ecmascript5/parser10.1.1-8gs.ts(17,5): error TS1134: Variable declaration expected. tests/cases/conformance/parser/ecmascript5/parser10.1.1-8gs.ts(17,12): error TS1134: Variable declaration expected. tests/cases/conformance/parser/ecmascript5/parser10.1.1-8gs.ts(17,14): error TS1134: Variable declaration expected. -tests/cases/conformance/parser/ecmascript5/parser10.1.1-8gs.ts(16,7): error TS2304: Cannot find name 'NotEarlyError'. ==== tests/cases/conformance/parser/ecmascript5/parser10.1.1-8gs.ts (4 errors) ==== diff --git a/tests/baselines/reference/parser509698.errors.txt b/tests/baselines/reference/parser509698.errors.txt index 2aaaec18dc2..85485dd6501 100644 --- a/tests/baselines/reference/parser509698.errors.txt +++ b/tests/baselines/reference/parser509698.errors.txt @@ -1,21 +1,21 @@ -error TS2318: Cannot find global type 'Array'. -error TS2318: Cannot find global type 'Boolean'. -error TS2318: Cannot find global type 'Function'. -error TS2318: Cannot find global type 'IArguments'. -error TS2318: Cannot find global type 'Number'. -error TS2318: Cannot find global type 'Object'. -error TS2318: Cannot find global type 'RegExp'. error TS2318: Cannot find global type 'String'. +error TS2318: Cannot find global type 'RegExp'. +error TS2318: Cannot find global type 'Object'. +error TS2318: Cannot find global type 'Number'. +error TS2318: Cannot find global type 'IArguments'. +error TS2318: Cannot find global type 'Function'. +error TS2318: Cannot find global type 'Boolean'. +error TS2318: Cannot find global type 'Array'. -!!! error TS2318: Cannot find global type 'Array'. -!!! error TS2318: Cannot find global type 'Boolean'. -!!! error TS2318: Cannot find global type 'Function'. -!!! error TS2318: Cannot find global type 'IArguments'. -!!! error TS2318: Cannot find global type 'Number'. -!!! error TS2318: Cannot find global type 'Object'. -!!! error TS2318: Cannot find global type 'RegExp'. !!! error TS2318: Cannot find global type 'String'. +!!! error TS2318: Cannot find global type 'RegExp'. +!!! error TS2318: Cannot find global type 'Object'. +!!! error TS2318: Cannot find global type 'Number'. +!!! error TS2318: Cannot find global type 'IArguments'. +!!! error TS2318: Cannot find global type 'Function'. +!!! error TS2318: Cannot find global type 'Boolean'. +!!! error TS2318: Cannot find global type 'Array'. ==== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509698.ts (0 errors) ==== ///