From 59b1e4610210e31949ee076622a5bb4e164e9064 Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Wed, 30 Jul 2014 16:27:13 -0700 Subject: [PATCH 1/2] disallow statements between overloads --- src/compiler/checker.ts | 96 +++++++++++++++---- .../diagnosticInformationMap.generated.ts | 7 +- src/compiler/diagnosticMessages.json | 19 +++- .../reference/ClassDeclaration10.errors.txt | 6 +- .../reference/ClassDeclaration11.errors.txt | 2 +- .../reference/ClassDeclaration13.errors.txt | 4 +- .../reference/ClassDeclaration14.errors.txt | 6 +- .../reference/ClassDeclaration15.errors.txt | 4 +- .../reference/ClassDeclaration21.errors.txt | 4 +- .../reference/ClassDeclaration22.errors.txt | 4 +- .../reference/ClassDeclaration25.errors.txt | 8 +- .../reference/ClassDeclaration8.errors.txt | 2 +- .../reference/ClassDeclaration9.errors.txt | 4 +- .../reference/FunctionDeclaration3.errors.txt | 4 +- .../reference/FunctionDeclaration4.errors.txt | 6 +- .../reference/FunctionDeclaration6.errors.txt | 4 +- .../reference/FunctionDeclaration7.errors.txt | 4 +- ...CompatFunctionsWithOptionalArgs.errors.txt | 4 +- .../reference/callOverloads1.errors.txt | 4 +- .../reference/callOverloads2.errors.txt | 8 +- .../reference/callOverloads3.errors.txt | 4 +- .../reference/callOverloads4.errors.txt | 4 +- .../reference/callOverloads5.errors.txt | 4 +- .../classOverloadForFunction2.errors.txt | 4 +- ...erloadImplementationOfWrongName.errors.txt | 4 +- ...rloadImplementationOfWrongName2.errors.txt | 8 +- .../crashOnMethodSignatures.errors.txt | 4 +- .../reference/dottedModuleName.errors.txt | 4 +- .../reference/externModule.errors.txt | 23 +++-- .../functionNameConflicts.errors.txt | 4 +- .../functionOverloadErrors.errors.txt | 4 +- ...erloadImplementationOfWrongName.errors.txt | 6 +- ...rloadImplementationOfWrongName2.errors.txt | 8 +- .../reference/functionOverloads1.errors.txt | 6 ++ .../reference/functionOverloads3.errors.txt | 4 +- .../functionOverloadsOutOfOrder.errors.txt | 8 +- .../incorrectClassOverloadChain.errors.txt | 4 +- .../baselines/reference/indexer2A.errors.txt | 4 +- ...OverloadMixingStaticAndInstance.errors.txt | 32 +++---- ...ixingStaticAndInstanceOverloads.errors.txt | 22 +++-- ...ectTypesWithOptionalProperties2.errors.txt | 8 +- .../overloadModifiersMustAgree.errors.txt | 4 +- .../parserClassDeclaration10.errors.txt | 6 +- .../parserClassDeclaration11.errors.txt | 2 +- .../parserClassDeclaration13.errors.txt | 4 +- .../parserClassDeclaration14.errors.txt | 6 +- .../parserClassDeclaration15.errors.txt | 4 +- .../parserClassDeclaration21.errors.txt | 4 +- .../parserClassDeclaration22.errors.txt | 4 +- .../parserClassDeclaration25.errors.txt | 8 +- .../parserClassDeclaration8.errors.txt | 2 +- .../parserClassDeclaration9.errors.txt | 4 +- .../parserConstructorDeclaration8.errors.txt | 2 +- ...EqualsGreaterThanAfterFunction1.errors.txt | 4 +- ...EqualsGreaterThanAfterFunction2.errors.txt | 4 +- ...EqualsGreaterThanAfterFunction1.errors.txt | 4 +- ...EqualsGreaterThanAfterFunction2.errors.txt | 4 +- ...serErrorRecovery_ParameterList6.errors.txt | 4 +- .../parserFunctionDeclaration3.errors.txt | 4 +- .../parserFunctionDeclaration4.errors.txt | 6 +- .../parserFunctionDeclaration6.errors.txt | 4 +- .../parserFunctionDeclaration7.errors.txt | 4 +- .../parserModuleDeclaration10.errors.txt | 8 +- .../parserSkippedTokens16.errors.txt | 4 +- .../staticClassMemberError.errors.txt | 4 +- 65 files changed, 275 insertions(+), 198 deletions(-) create mode 100644 tests/baselines/reference/functionOverloads1.errors.txt diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index a28aab5d69b7e..6bb7635843d26 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -4872,47 +4872,101 @@ module ts { var hasOverloads = false; var bodyDeclaration: FunctionDeclaration; var lastSeenNonAmbientDeclaration: FunctionDeclaration; + var previousDeclaration: FunctionDeclaration; + var declarations = symbol.declarations; var isConstructor = (symbol.flags & SymbolFlags.Constructor) !== 0; + + function reportImplementationExpectedError(node: FunctionDeclaration): void { + var seen = false; + var subsequentNode = forEachChild(node.parent, c => { + if (seen) { + return c; + } + else { + seen = c === node; + } + }); + if (subsequentNode) { + if (subsequentNode.kind === node.kind) { + var errorNode: Node = (subsequentNode).name || subsequentNode; + if (node.name && (subsequentNode).name && node.name.text === (subsequentNode).name.text) { + // the only situation when this is possible (same kind\same name but different symbol) - mixed static and instance class members + Debug.assert(node.kind === SyntaxKind.Method); + Debug.assert((node.flags & NodeFlags.Static) !== (subsequentNode.flags & NodeFlags.Static)); + var diagnostic = node.flags & NodeFlags.Static ? Diagnostics.Function_overload_must_be_static : Diagnostics.Function_overload_must_not_be_static; + error(errorNode, diagnostic); + return; + } + else if ((subsequentNode).body) { + error(errorNode, Diagnostics.Function_implementation_name_must_be_0, identifierToString(node.name)); + return; + } + } + } + var errorNode: Node = node.name || node; + if (isConstructor) { + error(errorNode, Diagnostics.Constructor_implementation_is_missing); + } + else { + error(errorNode, Diagnostics.Function_implementation_is_missing); + } + } + + // when checking exported function declarations across modules check only duplicate implementations + // names and consistensy of modifiers are verified when we check local symbol + var isExportSymbolInsideModule = symbol.parent && symbol.parent.flags & SymbolFlags.Module; for (var i = 0; i < declarations.length; i++) { var node = declarations[i]; + var inAmbientContext = isInAmbientContext(node); + var inAmbientContextOrInterface = node.parent.kind === SyntaxKind.InterfaceDeclaration || node.parent.kind === SyntaxKind.TypeLiteral || inAmbientContext; + if (inAmbientContextOrInterface) { + // check if declarations are consecutive only if they are non-ambient + // 1. ambient declarations can be interleaved + // i.e. this is legal + // declare function foo(); + // declare function bar(); + // declare function foo(); + // 2. mixing ambient and non-ambient declarations is a separate error that will be reported - do not want to report an extra one + previousDeclaration = undefined; + } + if (node.kind === SyntaxKind.FunctionDeclaration || node.kind === SyntaxKind.Method || node.kind === SyntaxKind.Constructor) { var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; allNodeFlags &= currentNodeFlags; - var inAmbientContext = isInAmbientContext(node); - var inAmbientContextOrInterface = node.parent.kind === SyntaxKind.InterfaceDeclaration || node.parent.kind === SyntaxKind.TypeLiteral || inAmbientContext; - if (!inAmbientContextOrInterface) { - lastSeenNonAmbientDeclaration = node; + if (node.body && bodyDeclaration) { + if (isConstructor) { + error(node, Diagnostics.Multiple_constructor_implementations_are_not_allowed); + } + else { + error(node, Diagnostics.Duplicate_function_implementation); + } + } + else if (!isExportSymbolInsideModule && previousDeclaration && previousDeclaration.parent === node.parent && previousDeclaration.end !== node.pos) { + reportImplementationExpectedError(previousDeclaration); } if (node.body) { - if (bodyDeclaration) { - if (isConstructor) { - error(node, Diagnostics.Multiple_constructor_implementations_are_not_allowed); - } - else { - error(node, Diagnostics.Duplicate_function_implementation); - } - } - else { + if (!bodyDeclaration) { bodyDeclaration = node; } } else { hasOverloads = true; } + + previousDeclaration = node; + + if (!inAmbientContextOrInterface) { + lastSeenNonAmbientDeclaration = node; + } } } - if (lastSeenNonAmbientDeclaration && !lastSeenNonAmbientDeclaration.body) { - if (isConstructor) { - error(lastSeenNonAmbientDeclaration, Diagnostics.Constructor_implementation_expected); - } - else { - error(lastSeenNonAmbientDeclaration, Diagnostics.Function_implementation_expected); - } + if (!isExportSymbolInsideModule && lastSeenNonAmbientDeclaration && !lastSeenNonAmbientDeclaration.body) { + reportImplementationExpectedError(lastSeenNonAmbientDeclaration); } if (hasOverloads) { @@ -4985,7 +5039,7 @@ module ts { } }); - var commonDeclarationSpace = exportedDeclarationSpaces & nonExportedDeclarationSpaces + var commonDeclarationSpace = exportedDeclarationSpaces & nonExportedDeclarationSpaces; if (commonDeclarationSpace) { // declaration spaces for exported and non-exported declarations intersect diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index 080bee226de36..3301cd8da4705 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -158,9 +158,12 @@ module ts { Duplicate_number_index_signature: { code: 2233, category: DiagnosticCategory.Error, key: "Duplicate number index signature." }, All_declarations_of_an_interface_must_have_identical_type_parameters: { code: 2234, category: DiagnosticCategory.Error, key: "All declarations of an interface must have identical type parameters." }, Expression_resolves_to_variable_declaration_i_that_compiler_uses_to_initialize_rest_parameter: { code: 2235, category: DiagnosticCategory.Error, key: "Expression resolves to variable declaration '_i' that compiler uses to initialize rest parameter." }, - Constructor_implementation_expected: { code: 2240, category: DiagnosticCategory.Error, key: "Constructor implementation expected." }, + Function_implementation_name_must_be_0: { code: 2239, category: DiagnosticCategory.Error, key: "Function implementation name must be '{0}'." }, + Constructor_implementation_is_missing: { code: 2240, category: DiagnosticCategory.Error, key: "Constructor implementation is missing." }, An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements: { code: 2245, category: DiagnosticCategory.Error, key: "An export assignment cannot be used in a module with other exported elements." }, A_parameter_property_is_only_allowed_in_a_constructor_implementation: { code: 2246, category: DiagnosticCategory.Error, key: "A parameter property is only allowed in a constructor implementation." }, + Function_overload_must_be_static: { code: 2247, category: DiagnosticCategory.Error, key: "Function overload must be static." }, + Function_overload_must_not_be_static: { code: 2248, category: DiagnosticCategory.Error, key: "Function overload must not be static." }, Circular_definition_of_import_alias_0: { code: 3000, category: DiagnosticCategory.Error, key: "Circular definition of import alias '{0}'." }, Cannot_find_name_0: { code: 3001, category: DiagnosticCategory.Error, key: "Cannot find name '{0}'." }, Module_0_has_no_exported_member_1: { code: 3002, category: DiagnosticCategory.Error, key: "Module '{0}' has no exported member '{1}'." }, @@ -276,7 +279,7 @@ module ts { Types_of_parameters_0_and_1_are_incompatible_Colon: { code: -9999999, category: DiagnosticCategory.Error, key: "Types of parameters '{0}' and '{1}' are incompatible:" }, Unknown_identifier_0: { code: -9999999, category: DiagnosticCategory.Error, key: "Unknown identifier '{0}'." }, Property_0_is_inaccessible: { code: -9999999, category: DiagnosticCategory.Error, key: "Property '{0}' is inaccessible." }, - Function_implementation_expected: { code: -9999999, category: DiagnosticCategory.Error, key: "Function implementation expected." }, + Function_implementation_is_missing: { code: -9999999, category: DiagnosticCategory.Error, key: "Function implementation is missing." }, Property_0_of_type_1_is_not_assignable_to_string_index_type_2: { code: -9999999, category: DiagnosticCategory.Error, key: "Property '{0}' of type '{1}' is not assignable to string index type '{2}'." }, Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2: { code: -9999999, category: DiagnosticCategory.Error, key: "Property '{0}' of type '{1}' is not assignable to numeric index type '{2}'." }, Numeric_index_type_0_is_not_assignable_to_string_index_type_1: { code: -9999999, category: DiagnosticCategory.Error, key: "Numeric index type '{0}' is not assignable to string index type '{1}'." }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 6e6efa9bbab24..f9fdf66639e6b 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -623,8 +623,12 @@ "Expression resolves to variable declaration '_i' that compiler uses to initialize rest parameter.": { "category": "Error", "code": 2235 - }, - "Constructor implementation expected.": { + }, + "Function implementation name must be '{0}'.": { + "category": "Error", + "code": 2239 + }, + "Constructor implementation is missing.": { "category": "Error", "code": 2240 }, @@ -636,6 +640,14 @@ "category": "Error", "code": 2246 }, + "Function overload must be static.": { + "category": "Error", + "code": 2247 + }, + "Function overload must not be static.": { + "category": "Error", + "code": 2248 + }, "Circular definition of import alias '{0}'.": { "category": "Error", "code": 3000 @@ -900,7 +912,6 @@ "category": "Error", "code": 7020 }, - "Variable declaration list cannot be empty.": { "category": "Error", "code": -9999999 @@ -1121,7 +1132,7 @@ "category": "Error", "code": -9999999 }, - "Function implementation expected.": { + "Function implementation is missing.": { "category": "Error", "code": -9999999 }, diff --git a/tests/baselines/reference/ClassDeclaration10.errors.txt b/tests/baselines/reference/ClassDeclaration10.errors.txt index e6da67e4f2ab2..b14c22d1b63ab 100644 --- a/tests/baselines/reference/ClassDeclaration10.errors.txt +++ b/tests/baselines/reference/ClassDeclaration10.errors.txt @@ -2,8 +2,8 @@ class C { constructor(); ~~~~~~~~~~~~~~ -!!! Constructor implementation expected. +!!! Constructor implementation is missing. foo(); - ~~~~~~ -!!! Function implementation expected. + ~~~ +!!! Function implementation is missing. } \ No newline at end of file diff --git a/tests/baselines/reference/ClassDeclaration11.errors.txt b/tests/baselines/reference/ClassDeclaration11.errors.txt index dd121f25ad965..b92a04cec6c08 100644 --- a/tests/baselines/reference/ClassDeclaration11.errors.txt +++ b/tests/baselines/reference/ClassDeclaration11.errors.txt @@ -2,6 +2,6 @@ class C { constructor(); ~~~~~~~~~~~~~~ -!!! Constructor implementation expected. +!!! Constructor implementation is missing. foo() { } } \ No newline at end of file diff --git a/tests/baselines/reference/ClassDeclaration13.errors.txt b/tests/baselines/reference/ClassDeclaration13.errors.txt index d4794f73042cf..406d41c20def0 100644 --- a/tests/baselines/reference/ClassDeclaration13.errors.txt +++ b/tests/baselines/reference/ClassDeclaration13.errors.txt @@ -1,7 +1,7 @@ ==== tests/cases/compiler/ClassDeclaration13.ts (1 errors) ==== class C { foo(); - ~~~~~~ -!!! Function implementation expected. bar() { } + ~~~ +!!! Function implementation name must be 'foo'. } \ No newline at end of file diff --git a/tests/baselines/reference/ClassDeclaration14.errors.txt b/tests/baselines/reference/ClassDeclaration14.errors.txt index afac27ca995ed..be56741d65665 100644 --- a/tests/baselines/reference/ClassDeclaration14.errors.txt +++ b/tests/baselines/reference/ClassDeclaration14.errors.txt @@ -1,9 +1,9 @@ ==== tests/cases/compiler/ClassDeclaration14.ts (2 errors) ==== class C { foo(); - ~~~~~~ -!!! Function implementation expected. + ~~~ +!!! Function implementation is missing. constructor(); ~~~~~~~~~~~~~~ -!!! Constructor implementation expected. +!!! Constructor implementation is missing. } \ No newline at end of file diff --git a/tests/baselines/reference/ClassDeclaration15.errors.txt b/tests/baselines/reference/ClassDeclaration15.errors.txt index e2ae4582bebf6..de98a14880de5 100644 --- a/tests/baselines/reference/ClassDeclaration15.errors.txt +++ b/tests/baselines/reference/ClassDeclaration15.errors.txt @@ -1,7 +1,7 @@ ==== tests/cases/compiler/ClassDeclaration15.ts (1 errors) ==== class C { foo(); - ~~~~~~ -!!! Function implementation expected. + ~~~ +!!! Function implementation is missing. constructor() { } } \ No newline at end of file diff --git a/tests/baselines/reference/ClassDeclaration21.errors.txt b/tests/baselines/reference/ClassDeclaration21.errors.txt index 1afcbb3265363..8b49f1df54375 100644 --- a/tests/baselines/reference/ClassDeclaration21.errors.txt +++ b/tests/baselines/reference/ClassDeclaration21.errors.txt @@ -1,7 +1,7 @@ ==== tests/cases/compiler/ClassDeclaration21.ts (1 errors) ==== class C { 0(); - ~~~~ -!!! Function implementation expected. 1() { } + ~ +!!! Function implementation name must be '0'. } \ No newline at end of file diff --git a/tests/baselines/reference/ClassDeclaration22.errors.txt b/tests/baselines/reference/ClassDeclaration22.errors.txt index 6336ee0f6aa77..34832185e127b 100644 --- a/tests/baselines/reference/ClassDeclaration22.errors.txt +++ b/tests/baselines/reference/ClassDeclaration22.errors.txt @@ -1,7 +1,7 @@ ==== tests/cases/compiler/ClassDeclaration22.ts (1 errors) ==== class C { "foo"(); - ~~~~~~~~ -!!! Function implementation expected. "bar"() { } + ~~~~~ +!!! Function implementation name must be '"foo"'. } \ No newline at end of file diff --git a/tests/baselines/reference/ClassDeclaration25.errors.txt b/tests/baselines/reference/ClassDeclaration25.errors.txt index cd247fc491d56..2d86bd80fa651 100644 --- a/tests/baselines/reference/ClassDeclaration25.errors.txt +++ b/tests/baselines/reference/ClassDeclaration25.errors.txt @@ -5,10 +5,10 @@ } class List implements IList { data(): U; - ~~~~~~~~~~ -!!! Function implementation expected. + ~~~~ +!!! Function implementation is missing. next(): string; - ~~~~~~~~~~~~~~~ -!!! Function implementation expected. + ~~~~ +!!! Function implementation is missing. } \ No newline at end of file diff --git a/tests/baselines/reference/ClassDeclaration8.errors.txt b/tests/baselines/reference/ClassDeclaration8.errors.txt index a98453f35dfd6..ebf1cadd7649d 100644 --- a/tests/baselines/reference/ClassDeclaration8.errors.txt +++ b/tests/baselines/reference/ClassDeclaration8.errors.txt @@ -2,5 +2,5 @@ class C { constructor(); ~~~~~~~~~~~~~~ -!!! Constructor implementation expected. +!!! Constructor implementation is missing. } \ No newline at end of file diff --git a/tests/baselines/reference/ClassDeclaration9.errors.txt b/tests/baselines/reference/ClassDeclaration9.errors.txt index 7ae1173947628..f8d51d26b4b77 100644 --- a/tests/baselines/reference/ClassDeclaration9.errors.txt +++ b/tests/baselines/reference/ClassDeclaration9.errors.txt @@ -1,6 +1,6 @@ ==== tests/cases/compiler/ClassDeclaration9.ts (1 errors) ==== class C { foo(); - ~~~~~~ -!!! Function implementation expected. + ~~~ +!!! Function implementation is missing. } \ No newline at end of file diff --git a/tests/baselines/reference/FunctionDeclaration3.errors.txt b/tests/baselines/reference/FunctionDeclaration3.errors.txt index a0f2601c3a818..c5a553ed9a47b 100644 --- a/tests/baselines/reference/FunctionDeclaration3.errors.txt +++ b/tests/baselines/reference/FunctionDeclaration3.errors.txt @@ -1,4 +1,4 @@ ==== tests/cases/compiler/FunctionDeclaration3.ts (1 errors) ==== function foo(); - ~~~~~~~~~~~~~~~ -!!! Function implementation expected. \ No newline at end of file + ~~~ +!!! Function implementation is missing. \ No newline at end of file diff --git a/tests/baselines/reference/FunctionDeclaration4.errors.txt b/tests/baselines/reference/FunctionDeclaration4.errors.txt index 1c03570a8fbd6..da15ad0efa4d5 100644 --- a/tests/baselines/reference/FunctionDeclaration4.errors.txt +++ b/tests/baselines/reference/FunctionDeclaration4.errors.txt @@ -1,5 +1,5 @@ ==== tests/cases/compiler/FunctionDeclaration4.ts (1 errors) ==== function foo(); - ~~~~~~~~~~~~~~~ -!!! Function implementation expected. - function bar() { } \ No newline at end of file + function bar() { } + ~~~ +!!! Function implementation name must be 'foo'. \ No newline at end of file diff --git a/tests/baselines/reference/FunctionDeclaration6.errors.txt b/tests/baselines/reference/FunctionDeclaration6.errors.txt index 056ad27c3fda4..c7e039cac1329 100644 --- a/tests/baselines/reference/FunctionDeclaration6.errors.txt +++ b/tests/baselines/reference/FunctionDeclaration6.errors.txt @@ -1,7 +1,7 @@ ==== tests/cases/compiler/FunctionDeclaration6.ts (1 errors) ==== { function foo(); - ~~~~~~~~~~~~~~~ -!!! Function implementation expected. function bar() { } + ~~~ +!!! Function implementation name must be 'foo'. } \ No newline at end of file diff --git a/tests/baselines/reference/FunctionDeclaration7.errors.txt b/tests/baselines/reference/FunctionDeclaration7.errors.txt index cf6ee375de538..8c7ae6f8bf323 100644 --- a/tests/baselines/reference/FunctionDeclaration7.errors.txt +++ b/tests/baselines/reference/FunctionDeclaration7.errors.txt @@ -1,6 +1,6 @@ ==== tests/cases/compiler/FunctionDeclaration7.ts (1 errors) ==== module M { function foo(); - ~~~~~~~~~~~~~~~ -!!! Function implementation expected. + ~~~ +!!! Function implementation is missing. } \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatFunctionsWithOptionalArgs.errors.txt b/tests/baselines/reference/assignmentCompatFunctionsWithOptionalArgs.errors.txt index 2abf97a25de44..1a4eaf303920e 100644 --- a/tests/baselines/reference/assignmentCompatFunctionsWithOptionalArgs.errors.txt +++ b/tests/baselines/reference/assignmentCompatFunctionsWithOptionalArgs.errors.txt @@ -1,7 +1,7 @@ ==== tests/cases/compiler/assignmentCompatFunctionsWithOptionalArgs.ts (3 errors) ==== function foo(x: { id: number; name?: string; }): void; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Function implementation expected. + ~~~ +!!! Function implementation is missing. foo({ id: 1234 }); // Ok foo({ id: 1234, name: "hello" }); // Ok foo({ id: 1234, name: false }); // Error, name of wrong type diff --git a/tests/baselines/reference/callOverloads1.errors.txt b/tests/baselines/reference/callOverloads1.errors.txt index 47a6b6c8e06dd..06aa8e6eeb7ea 100644 --- a/tests/baselines/reference/callOverloads1.errors.txt +++ b/tests/baselines/reference/callOverloads1.errors.txt @@ -8,8 +8,8 @@ } function Foo(); // error - ~~~~~~~~~~~~~~~ -!!! Function implementation expected. + ~~~ +!!! Function implementation is missing. ~~~ !!! Duplicate identifier 'Foo'. function F1(s:string); diff --git a/tests/baselines/reference/callOverloads2.errors.txt b/tests/baselines/reference/callOverloads2.errors.txt index 8d99dba63d68a..1649729048cf2 100644 --- a/tests/baselines/reference/callOverloads2.errors.txt +++ b/tests/baselines/reference/callOverloads2.errors.txt @@ -10,19 +10,19 @@ } function Foo(); - ~~~~~~~~~~~~~~~ -!!! Function implementation expected. ~~~ !!! Duplicate identifier 'Foo'. function F1(s:string) {return s;} + ~~ +!!! Function implementation name must be 'Foo'. function F1(a:any) { return a;} // error - duplicate identifier ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! Duplicate function implementation. function Goo(s:string); // error - no implementation - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! Function implementation expected. + ~~~ +!!! Function implementation is missing. declare function Gar(s:String); // expect no error diff --git a/tests/baselines/reference/callOverloads3.errors.txt b/tests/baselines/reference/callOverloads3.errors.txt index a2e4050579f43..eef63a648076f 100644 --- a/tests/baselines/reference/callOverloads3.errors.txt +++ b/tests/baselines/reference/callOverloads3.errors.txt @@ -4,8 +4,8 @@ ~~~ !!! Cannot find name 'Foo'. function Foo(s:string):Foo; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Function implementation expected. + ~~~ +!!! Function implementation is missing. ~~~ !!! Cannot find name 'Foo'. class Foo { diff --git a/tests/baselines/reference/callOverloads4.errors.txt b/tests/baselines/reference/callOverloads4.errors.txt index 36c0b97955e8a..053305c36572c 100644 --- a/tests/baselines/reference/callOverloads4.errors.txt +++ b/tests/baselines/reference/callOverloads4.errors.txt @@ -4,8 +4,8 @@ ~~~ !!! Cannot find name 'Foo'. function Foo(s:string):Foo; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Function implementation expected. + ~~~ +!!! Function implementation is missing. ~~~ !!! Cannot find name 'Foo'. class Foo { diff --git a/tests/baselines/reference/callOverloads5.errors.txt b/tests/baselines/reference/callOverloads5.errors.txt index ba667881530c0..e7ccb6c5a08bb 100644 --- a/tests/baselines/reference/callOverloads5.errors.txt +++ b/tests/baselines/reference/callOverloads5.errors.txt @@ -3,8 +3,8 @@ ~~~ !!! Cannot find name 'Foo'. function Foo(s:string):Foo; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Function implementation expected. + ~~~ +!!! Function implementation is missing. ~~~ !!! Cannot find name 'Foo'. class Foo { diff --git a/tests/baselines/reference/classOverloadForFunction2.errors.txt b/tests/baselines/reference/classOverloadForFunction2.errors.txt index d1e2135b94e81..be4ce08a9e5fe 100644 --- a/tests/baselines/reference/classOverloadForFunction2.errors.txt +++ b/tests/baselines/reference/classOverloadForFunction2.errors.txt @@ -1,7 +1,7 @@ ==== tests/cases/compiler/classOverloadForFunction2.ts (2 errors) ==== function bar(): string; - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! Function implementation expected. + ~~~ +!!! Function implementation is missing. class bar {} ~~~ !!! Duplicate identifier 'bar'. \ No newline at end of file diff --git a/tests/baselines/reference/classWithOverloadImplementationOfWrongName.errors.txt b/tests/baselines/reference/classWithOverloadImplementationOfWrongName.errors.txt index e939db8e41896..1d2d5bb0c705e 100644 --- a/tests/baselines/reference/classWithOverloadImplementationOfWrongName.errors.txt +++ b/tests/baselines/reference/classWithOverloadImplementationOfWrongName.errors.txt @@ -2,7 +2,7 @@ class C { foo(): string; foo(x): number; - ~~~~~~~~~~~~~~~ -!!! Function implementation expected. bar(x): any { } + ~~~ +!!! Function implementation name must be 'foo'. } \ No newline at end of file diff --git a/tests/baselines/reference/classWithOverloadImplementationOfWrongName2.errors.txt b/tests/baselines/reference/classWithOverloadImplementationOfWrongName2.errors.txt index 5c233b6c43c69..08aaa1239eb18 100644 --- a/tests/baselines/reference/classWithOverloadImplementationOfWrongName2.errors.txt +++ b/tests/baselines/reference/classWithOverloadImplementationOfWrongName2.errors.txt @@ -1,8 +1,10 @@ -==== tests/cases/compiler/classWithOverloadImplementationOfWrongName2.ts (1 errors) ==== +==== tests/cases/compiler/classWithOverloadImplementationOfWrongName2.ts (2 errors) ==== class C { foo(): string; bar(x): any { } + ~~~ +!!! Function implementation name must be 'foo'. foo(x): number; - ~~~~~~~~~~~~~~~ -!!! Function implementation expected. + ~~~ +!!! Function implementation is missing. } \ No newline at end of file diff --git a/tests/baselines/reference/crashOnMethodSignatures.errors.txt b/tests/baselines/reference/crashOnMethodSignatures.errors.txt index ceba3908f4363..f7b02a2bb4d31 100644 --- a/tests/baselines/reference/crashOnMethodSignatures.errors.txt +++ b/tests/baselines/reference/crashOnMethodSignatures.errors.txt @@ -1,7 +1,7 @@ ==== tests/cases/compiler/crashOnMethodSignatures.ts (1 errors) ==== class A { a(completed: () => any): void; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Function implementation expected. + ~ +!!! Function implementation is missing. } \ No newline at end of file diff --git a/tests/baselines/reference/dottedModuleName.errors.txt b/tests/baselines/reference/dottedModuleName.errors.txt index 5a207c96bd08b..5a2c975325762 100644 --- a/tests/baselines/reference/dottedModuleName.errors.txt +++ b/tests/baselines/reference/dottedModuleName.errors.txt @@ -4,8 +4,8 @@ export function f(x:number)=>2*x; ~~ !!! Block or ';' expected. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Function implementation expected. + ~ +!!! Function implementation is missing. ~ !!! Cannot find name 'x'. export module X.Y.Z { diff --git a/tests/baselines/reference/externModule.errors.txt b/tests/baselines/reference/externModule.errors.txt index afc072d0de37f..f7e4795e6b85d 100644 --- a/tests/baselines/reference/externModule.errors.txt +++ b/tests/baselines/reference/externModule.errors.txt @@ -14,11 +14,11 @@ ~~~~~ !!! Cannot compile external modules unless the '--module' flag is provided. public getDay():number; - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! Function implementation expected. + ~~~~~~ +!!! Function implementation is missing. public getXDate():number; - ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Function implementation expected. + ~~~~~~~~ +!!! Function implementation is missing. // etc. // Called as a function @@ -34,24 +34,23 @@ constructor(value: number); constructor(); ~~~~~~~~~~~~~~ -!!! Constructor implementation expected. +!!! Constructor implementation is missing. static parse(string: string): number; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Function implementation expected. + ~~~~~ +!!! Function implementation is missing. static UTC(year: number, month: number): number; static UTC(year: number, month: number, date: number): number; static UTC(year: number, month: number, date: number, hours: number): number; static UTC(year: number, month: number, date: number, hours: number, minutes: number): number; static UTC(year: number, month: number, date: number, hours: number, minutes: number, seconds: number): number; static UTC(year: number, month: number, date: number, hours: number, minutes: number, seconds: number, - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~ +!!! Function implementation is missing. ms: number): number; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Function implementation expected. static now(): number; - ~~~~~~~~~~~~~~~~~~~~~ -!!! Function implementation expected. + ~~~ +!!! Function implementation is missing. } } ~ diff --git a/tests/baselines/reference/functionNameConflicts.errors.txt b/tests/baselines/reference/functionNameConflicts.errors.txt index d71b6dc2e6921..0442a51324bdf 100644 --- a/tests/baselines/reference/functionNameConflicts.errors.txt +++ b/tests/baselines/reference/functionNameConflicts.errors.txt @@ -32,9 +32,9 @@ } function over(); - ~~~~~~~~~~~~~~~~ -!!! Function implementation expected. function overrr() { + ~~~~~~ +!!! Function implementation name must be 'over'. } \ No newline at end of file diff --git a/tests/baselines/reference/functionOverloadErrors.errors.txt b/tests/baselines/reference/functionOverloadErrors.errors.txt index 394607010ecbe..c2fcff7a943c8 100644 --- a/tests/baselines/reference/functionOverloadErrors.errors.txt +++ b/tests/baselines/reference/functionOverloadErrors.errors.txt @@ -1,4 +1,4 @@ -==== tests/cases/conformance/functions/functionOverloadErrors.ts (15 errors) ==== +==== tests/cases/conformance/functions/functionOverloadErrors.ts (14 errors) ==== //Function overload signature with initializer function fn1(x = 3); ~~~~~ @@ -86,8 +86,6 @@ //Function overloads with differing export module M { export function fn1(); - ~~~~~~~~~~~~~~~~~~~~~~ -!!! Function implementation expected. ~~~ !!! Overload signatures must all be exported or not exported. function fn1(n: string); diff --git a/tests/baselines/reference/functionOverloadImplementationOfWrongName.errors.txt b/tests/baselines/reference/functionOverloadImplementationOfWrongName.errors.txt index a948858122fd7..427595d1e0519 100644 --- a/tests/baselines/reference/functionOverloadImplementationOfWrongName.errors.txt +++ b/tests/baselines/reference/functionOverloadImplementationOfWrongName.errors.txt @@ -1,6 +1,6 @@ ==== tests/cases/compiler/functionOverloadImplementationOfWrongName.ts (1 errors) ==== function foo(x); function foo(x, y); - ~~~~~~~~~~~~~~~~~~~ -!!! Function implementation expected. - function bar() { } \ No newline at end of file + function bar() { } + ~~~ +!!! Function implementation name must be 'foo'. \ No newline at end of file diff --git a/tests/baselines/reference/functionOverloadImplementationOfWrongName2.errors.txt b/tests/baselines/reference/functionOverloadImplementationOfWrongName2.errors.txt index 371d06e6a6c23..a5216bebb405a 100644 --- a/tests/baselines/reference/functionOverloadImplementationOfWrongName2.errors.txt +++ b/tests/baselines/reference/functionOverloadImplementationOfWrongName2.errors.txt @@ -1,6 +1,8 @@ -==== tests/cases/compiler/functionOverloadImplementationOfWrongName2.ts (1 errors) ==== +==== tests/cases/compiler/functionOverloadImplementationOfWrongName2.ts (2 errors) ==== function foo(x); function bar() { } + ~~~ +!!! Function implementation name must be 'foo'. function foo(x, y); - ~~~~~~~~~~~~~~~~~~~ -!!! Function implementation expected. \ No newline at end of file + ~~~ +!!! Function implementation is missing. \ No newline at end of file diff --git a/tests/baselines/reference/functionOverloads1.errors.txt b/tests/baselines/reference/functionOverloads1.errors.txt new file mode 100644 index 0000000000000..71532313f44ce --- /dev/null +++ b/tests/baselines/reference/functionOverloads1.errors.txt @@ -0,0 +1,6 @@ +==== tests/cases/compiler/functionOverloads1.ts (1 errors) ==== + function foo(); + ~~~ +!!! Function implementation is missing. + 1+1; + function foo():string { return "a" } \ No newline at end of file diff --git a/tests/baselines/reference/functionOverloads3.errors.txt b/tests/baselines/reference/functionOverloads3.errors.txt index 791553cf9540b..79fca9f342c8a 100644 --- a/tests/baselines/reference/functionOverloads3.errors.txt +++ b/tests/baselines/reference/functionOverloads3.errors.txt @@ -1,4 +1,4 @@ ==== tests/cases/compiler/functionOverloads3.ts (1 errors) ==== function foo():string; - ~~~~~~~~~~~~~~~~~~~~~~ -!!! Function implementation expected. \ No newline at end of file + ~~~ +!!! Function implementation is missing. \ No newline at end of file diff --git a/tests/baselines/reference/functionOverloadsOutOfOrder.errors.txt b/tests/baselines/reference/functionOverloadsOutOfOrder.errors.txt index 64249e33c23fd..977d160a45a80 100644 --- a/tests/baselines/reference/functionOverloadsOutOfOrder.errors.txt +++ b/tests/baselines/reference/functionOverloadsOutOfOrder.errors.txt @@ -5,8 +5,8 @@ return ns.toString(); } private foo(s: string): string; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Function implementation expected. + ~~~ +!!! Function implementation is missing. } class e { @@ -15,6 +15,6 @@ } private foo(s: string): string; private foo(n: number): string; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Function implementation expected. + ~~~ +!!! Function implementation is missing. } \ No newline at end of file diff --git a/tests/baselines/reference/incorrectClassOverloadChain.errors.txt b/tests/baselines/reference/incorrectClassOverloadChain.errors.txt index 6521936b4d898..6c12e650d023e 100644 --- a/tests/baselines/reference/incorrectClassOverloadChain.errors.txt +++ b/tests/baselines/reference/incorrectClassOverloadChain.errors.txt @@ -2,7 +2,7 @@ class C { foo(): string; foo(x): number; - ~~~~~~~~~~~~~~~ -!!! Function implementation expected. + ~~~ +!!! Function implementation is missing. x = 1; } \ No newline at end of file diff --git a/tests/baselines/reference/indexer2A.errors.txt b/tests/baselines/reference/indexer2A.errors.txt index f1b7f6bb23f06..25d9145a11fe5 100644 --- a/tests/baselines/reference/indexer2A.errors.txt +++ b/tests/baselines/reference/indexer2A.errors.txt @@ -3,8 +3,8 @@ class IDirectChildrenMap { // Decided to enforce a semicolon after declarations hasOwnProperty(objectId: number): boolean - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Function implementation expected. + ~~~~~~~~~~~~~~ +!!! Function implementation is missing. [objectId: number]: IHeapObjectProperty[] } var directChildrenMap = {}; \ No newline at end of file diff --git a/tests/baselines/reference/memberFunctionOverloadMixingStaticAndInstance.errors.txt b/tests/baselines/reference/memberFunctionOverloadMixingStaticAndInstance.errors.txt index 08e1eb4e35d81..6c1c18c32166b 100644 --- a/tests/baselines/reference/memberFunctionOverloadMixingStaticAndInstance.errors.txt +++ b/tests/baselines/reference/memberFunctionOverloadMixingStaticAndInstance.errors.txt @@ -1,36 +1,36 @@ ==== tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionOverloadMixingStaticAndInstance.ts (8 errors) ==== class C { foo(); - ~~~~~~ -!!! Function implementation expected. static foo(); // error - ~~~~~~~~~~~~~ -!!! Function implementation expected. + ~~~ +!!! Function implementation is missing. + ~~~ +!!! Function overload must not be static. } class D { static foo(); - ~~~~~~~~~~~~~ -!!! Function implementation expected. foo(); // error - ~~~~~~ -!!! Function implementation expected. + ~~~ +!!! Function implementation is missing. + ~~~ +!!! Function overload must be static. } class E { foo(x: T); - ~~~~~~~~~~ -!!! Function implementation expected. static foo(x: number); // error - ~~~~~~~~~~~~~~~~~~~~~~ -!!! Function implementation expected. + ~~~ +!!! Function implementation is missing. + ~~~ +!!! Function overload must not be static. } class F { static foo(x: number); - ~~~~~~~~~~~~~~~~~~~~~~ -!!! Function implementation expected. foo(x: T); // error - ~~~~~~~~~~ -!!! Function implementation expected. + ~~~ +!!! Function implementation is missing. + ~~~ +!!! Function overload must be static. } \ No newline at end of file diff --git a/tests/baselines/reference/mixingStaticAndInstanceOverloads.errors.txt b/tests/baselines/reference/mixingStaticAndInstanceOverloads.errors.txt index db7dcf5bf6ec9..300d9d0309fe5 100644 --- a/tests/baselines/reference/mixingStaticAndInstanceOverloads.errors.txt +++ b/tests/baselines/reference/mixingStaticAndInstanceOverloads.errors.txt @@ -1,35 +1,39 @@ -==== tests/cases/compiler/mixingStaticAndInstanceOverloads.ts (4 errors) ==== +==== tests/cases/compiler/mixingStaticAndInstanceOverloads.ts (6 errors) ==== class C1 { // ERROR foo1(n: number); foo1(s: string); - ~~~~~~~~~~~~~~~~ -!!! Function implementation expected. static foo1(a) { } + ~~~~ +!!! Function overload must not be static. } class C2 { // ERROR static foo2(n: number); static foo2(s: string); - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! Function implementation expected. foo2(a) { } + ~~~~ +!!! Function overload must be static. } class C3 { // ERROR foo3(n: number); static foo3(s: string); - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! Function implementation expected. + ~~~~ +!!! Function overload must not be static. foo3(a) { } + ~~~~ +!!! Function overload must be static. } class C4 { // ERROR static foo4(n: number); foo4(s: string); - ~~~~~~~~~~~~~~~~ -!!! Function implementation expected. + ~~~~ +!!! Function overload must be static. static foo4(a) { } + ~~~~ +!!! Function overload must not be static. } class C5 { // OK diff --git a/tests/baselines/reference/objectTypesWithOptionalProperties2.errors.txt b/tests/baselines/reference/objectTypesWithOptionalProperties2.errors.txt index 96ed619a37ab8..ee417a928e518 100644 --- a/tests/baselines/reference/objectTypesWithOptionalProperties2.errors.txt +++ b/tests/baselines/reference/objectTypesWithOptionalProperties2.errors.txt @@ -23,8 +23,8 @@ !!! Block or ';' expected. ~ !!! Unexpected token. A constructor, method, accessor, or property was expected. - ~~~ -!!! Function implementation expected. + ~ +!!! Function implementation is missing. } interface I2 { @@ -41,8 +41,8 @@ !!! Block or ';' expected. ~ !!! Unexpected token. A constructor, method, accessor, or property was expected. - ~~~ -!!! Function implementation expected. + ~ +!!! Function implementation is missing. } diff --git a/tests/baselines/reference/overloadModifiersMustAgree.errors.txt b/tests/baselines/reference/overloadModifiersMustAgree.errors.txt index adb535ce385fe..f2aa56b8e4d0b 100644 --- a/tests/baselines/reference/overloadModifiersMustAgree.errors.txt +++ b/tests/baselines/reference/overloadModifiersMustAgree.errors.txt @@ -1,4 +1,4 @@ -==== tests/cases/compiler/overloadModifiersMustAgree.ts (5 errors) ==== +==== tests/cases/compiler/overloadModifiersMustAgree.ts (4 errors) ==== class baz { public foo(); ~~~ @@ -10,8 +10,6 @@ ~~~ !!! Overload signatures must all be ambient or non-ambient. export function bar(s: string); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Function implementation expected. ~~~ !!! Overload signatures must all be exported or not exported. function bar(s?: string) { } diff --git a/tests/baselines/reference/parserClassDeclaration10.errors.txt b/tests/baselines/reference/parserClassDeclaration10.errors.txt index d210a3b668894..10ef6a300a553 100644 --- a/tests/baselines/reference/parserClassDeclaration10.errors.txt +++ b/tests/baselines/reference/parserClassDeclaration10.errors.txt @@ -2,8 +2,8 @@ class C { constructor(); ~~~~~~~~~~~~~~ -!!! Constructor implementation expected. +!!! Constructor implementation is missing. foo(); - ~~~~~~ -!!! Function implementation expected. + ~~~ +!!! Function implementation is missing. } \ No newline at end of file diff --git a/tests/baselines/reference/parserClassDeclaration11.errors.txt b/tests/baselines/reference/parserClassDeclaration11.errors.txt index 56636378b7d4c..061711a137fb7 100644 --- a/tests/baselines/reference/parserClassDeclaration11.errors.txt +++ b/tests/baselines/reference/parserClassDeclaration11.errors.txt @@ -2,6 +2,6 @@ class C { constructor(); ~~~~~~~~~~~~~~ -!!! Constructor implementation expected. +!!! Constructor implementation is missing. foo() { } } \ No newline at end of file diff --git a/tests/baselines/reference/parserClassDeclaration13.errors.txt b/tests/baselines/reference/parserClassDeclaration13.errors.txt index 4a03b85cd2110..18f4c4e16a25c 100644 --- a/tests/baselines/reference/parserClassDeclaration13.errors.txt +++ b/tests/baselines/reference/parserClassDeclaration13.errors.txt @@ -1,7 +1,7 @@ ==== tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration13.ts (1 errors) ==== class C { foo(); - ~~~~~~ -!!! Function implementation expected. bar() { } + ~~~ +!!! Function implementation name must be 'foo'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserClassDeclaration14.errors.txt b/tests/baselines/reference/parserClassDeclaration14.errors.txt index 8c6dd5f553210..dbc94ceb5548c 100644 --- a/tests/baselines/reference/parserClassDeclaration14.errors.txt +++ b/tests/baselines/reference/parserClassDeclaration14.errors.txt @@ -1,9 +1,9 @@ ==== tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration14.ts (2 errors) ==== class C { foo(); - ~~~~~~ -!!! Function implementation expected. + ~~~ +!!! Function implementation is missing. constructor(); ~~~~~~~~~~~~~~ -!!! Constructor implementation expected. +!!! Constructor implementation is missing. } \ No newline at end of file diff --git a/tests/baselines/reference/parserClassDeclaration15.errors.txt b/tests/baselines/reference/parserClassDeclaration15.errors.txt index 2117ee45517c7..45bc3398e880e 100644 --- a/tests/baselines/reference/parserClassDeclaration15.errors.txt +++ b/tests/baselines/reference/parserClassDeclaration15.errors.txt @@ -1,7 +1,7 @@ ==== tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration15.ts (1 errors) ==== class C { foo(); - ~~~~~~ -!!! Function implementation expected. + ~~~ +!!! Function implementation is missing. constructor() { } } \ No newline at end of file diff --git a/tests/baselines/reference/parserClassDeclaration21.errors.txt b/tests/baselines/reference/parserClassDeclaration21.errors.txt index 033c739e62ae8..e74fb243df5b3 100644 --- a/tests/baselines/reference/parserClassDeclaration21.errors.txt +++ b/tests/baselines/reference/parserClassDeclaration21.errors.txt @@ -1,7 +1,7 @@ ==== tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration21.ts (1 errors) ==== class C { 0(); - ~~~~ -!!! Function implementation expected. 1() { } + ~ +!!! Function implementation name must be '0'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserClassDeclaration22.errors.txt b/tests/baselines/reference/parserClassDeclaration22.errors.txt index c1d9cc44866b3..56ead1ff80de7 100644 --- a/tests/baselines/reference/parserClassDeclaration22.errors.txt +++ b/tests/baselines/reference/parserClassDeclaration22.errors.txt @@ -1,7 +1,7 @@ ==== tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration22.ts (1 errors) ==== class C { "foo"(); - ~~~~~~~~ -!!! Function implementation expected. "bar"() { } + ~~~~~ +!!! Function implementation name must be '"foo"'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserClassDeclaration25.errors.txt b/tests/baselines/reference/parserClassDeclaration25.errors.txt index 2e5181ec11124..3ac19df284c06 100644 --- a/tests/baselines/reference/parserClassDeclaration25.errors.txt +++ b/tests/baselines/reference/parserClassDeclaration25.errors.txt @@ -5,10 +5,10 @@ } class List implements IList { data(): U; - ~~~~~~~~~~ -!!! Function implementation expected. + ~~~~ +!!! Function implementation is missing. next(): string; - ~~~~~~~~~~~~~~~ -!!! Function implementation expected. + ~~~~ +!!! Function implementation is missing. } \ No newline at end of file diff --git a/tests/baselines/reference/parserClassDeclaration8.errors.txt b/tests/baselines/reference/parserClassDeclaration8.errors.txt index 37c3b56cbaf0c..33aa43d2ab887 100644 --- a/tests/baselines/reference/parserClassDeclaration8.errors.txt +++ b/tests/baselines/reference/parserClassDeclaration8.errors.txt @@ -2,5 +2,5 @@ class C { constructor(); ~~~~~~~~~~~~~~ -!!! Constructor implementation expected. +!!! Constructor implementation is missing. } \ No newline at end of file diff --git a/tests/baselines/reference/parserClassDeclaration9.errors.txt b/tests/baselines/reference/parserClassDeclaration9.errors.txt index 2a197c90d30eb..f1e6ed44e3ac7 100644 --- a/tests/baselines/reference/parserClassDeclaration9.errors.txt +++ b/tests/baselines/reference/parserClassDeclaration9.errors.txt @@ -1,6 +1,6 @@ ==== tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration9.ts (1 errors) ==== class C { foo(); - ~~~~~~ -!!! Function implementation expected. + ~~~ +!!! Function implementation is missing. } \ No newline at end of file diff --git a/tests/baselines/reference/parserConstructorDeclaration8.errors.txt b/tests/baselines/reference/parserConstructorDeclaration8.errors.txt index 83c602a0b2fef..c437a9b9e3764 100644 --- a/tests/baselines/reference/parserConstructorDeclaration8.errors.txt +++ b/tests/baselines/reference/parserConstructorDeclaration8.errors.txt @@ -5,5 +5,5 @@ ~ !!! '(' expected. ~~~~~~~~~~~~~~~~~~~ -!!! Constructor implementation expected. +!!! Constructor implementation is missing. } \ No newline at end of file diff --git a/tests/baselines/reference/parserEqualsGreaterThanAfterFunction1.errors.txt b/tests/baselines/reference/parserEqualsGreaterThanAfterFunction1.errors.txt index 7a6540844398e..7b9a64333b3cd 100644 --- a/tests/baselines/reference/parserEqualsGreaterThanAfterFunction1.errors.txt +++ b/tests/baselines/reference/parserEqualsGreaterThanAfterFunction1.errors.txt @@ -2,5 +2,5 @@ function => ~~ !!! Identifier expected. - ~~~~~~~~ -!!! Function implementation expected. \ No newline at end of file + +!!! Function implementation is missing. \ No newline at end of file diff --git a/tests/baselines/reference/parserEqualsGreaterThanAfterFunction2.errors.txt b/tests/baselines/reference/parserEqualsGreaterThanAfterFunction2.errors.txt index ef853280dafc7..c6efbe104db03 100644 --- a/tests/baselines/reference/parserEqualsGreaterThanAfterFunction2.errors.txt +++ b/tests/baselines/reference/parserEqualsGreaterThanAfterFunction2.errors.txt @@ -8,5 +8,5 @@ !!! ',' expected. !!! ')' expected. - ~~~~~~~~~~~~~~~~~ -!!! Function implementation expected. \ No newline at end of file + +!!! Function implementation is missing. \ No newline at end of file diff --git a/tests/baselines/reference/parserErrantEqualsGreaterThanAfterFunction1.errors.txt b/tests/baselines/reference/parserErrantEqualsGreaterThanAfterFunction1.errors.txt index b7f3c72f926f7..d2079dfc86725 100644 --- a/tests/baselines/reference/parserErrantEqualsGreaterThanAfterFunction1.errors.txt +++ b/tests/baselines/reference/parserErrantEqualsGreaterThanAfterFunction1.errors.txt @@ -2,5 +2,5 @@ function f() => 4; ~~ !!! Block or ';' expected. - ~~~~~~~~~~~~ -!!! Function implementation expected. \ No newline at end of file + ~ +!!! Function implementation is missing. \ No newline at end of file diff --git a/tests/baselines/reference/parserErrantEqualsGreaterThanAfterFunction2.errors.txt b/tests/baselines/reference/parserErrantEqualsGreaterThanAfterFunction2.errors.txt index 2bcc340e91d04..684fd861eb4c2 100644 --- a/tests/baselines/reference/parserErrantEqualsGreaterThanAfterFunction2.errors.txt +++ b/tests/baselines/reference/parserErrantEqualsGreaterThanAfterFunction2.errors.txt @@ -2,8 +2,8 @@ function f(p: A) => p; ~~ !!! Block or ';' expected. - ~~~~~~~~~~~~~~~~ -!!! Function implementation expected. + ~ +!!! Function implementation is missing. ~ !!! Cannot find name 'A'. ~ diff --git a/tests/baselines/reference/parserErrorRecovery_ParameterList6.errors.txt b/tests/baselines/reference/parserErrorRecovery_ParameterList6.errors.txt index ea1b958e11a28..0ecdaaffb5016 100644 --- a/tests/baselines/reference/parserErrorRecovery_ParameterList6.errors.txt +++ b/tests/baselines/reference/parserErrorRecovery_ParameterList6.errors.txt @@ -5,8 +5,8 @@ !!! Type expected. ~ !!! Identifier expected. - ~~~~~~~~~~~~~~~~~ -!!! Function implementation expected. + ~~~~~~ +!!! Function implementation is missing. } ~ !!! Declaration or statement expected. \ No newline at end of file diff --git a/tests/baselines/reference/parserFunctionDeclaration3.errors.txt b/tests/baselines/reference/parserFunctionDeclaration3.errors.txt index f6274437770c7..2042033edc143 100644 --- a/tests/baselines/reference/parserFunctionDeclaration3.errors.txt +++ b/tests/baselines/reference/parserFunctionDeclaration3.errors.txt @@ -1,4 +1,4 @@ ==== tests/cases/conformance/parser/ecmascript5/FunctionDeclarations/parserFunctionDeclaration3.ts (1 errors) ==== function foo(); - ~~~~~~~~~~~~~~~ -!!! Function implementation expected. \ No newline at end of file + ~~~ +!!! Function implementation is missing. \ No newline at end of file diff --git a/tests/baselines/reference/parserFunctionDeclaration4.errors.txt b/tests/baselines/reference/parserFunctionDeclaration4.errors.txt index 57b1f09d9e40b..f59ae5df9438f 100644 --- a/tests/baselines/reference/parserFunctionDeclaration4.errors.txt +++ b/tests/baselines/reference/parserFunctionDeclaration4.errors.txt @@ -1,5 +1,5 @@ ==== tests/cases/conformance/parser/ecmascript5/FunctionDeclarations/parserFunctionDeclaration4.ts (1 errors) ==== function foo(); - ~~~~~~~~~~~~~~~ -!!! Function implementation expected. - function bar() { } \ No newline at end of file + function bar() { } + ~~~ +!!! Function implementation name must be 'foo'. \ No newline at end of file diff --git a/tests/baselines/reference/parserFunctionDeclaration6.errors.txt b/tests/baselines/reference/parserFunctionDeclaration6.errors.txt index 8a9103e9a2ef9..11758b0a03676 100644 --- a/tests/baselines/reference/parserFunctionDeclaration6.errors.txt +++ b/tests/baselines/reference/parserFunctionDeclaration6.errors.txt @@ -1,7 +1,7 @@ ==== tests/cases/conformance/parser/ecmascript5/FunctionDeclarations/parserFunctionDeclaration6.ts (1 errors) ==== { function foo(); - ~~~~~~~~~~~~~~~ -!!! Function implementation expected. function bar() { } + ~~~ +!!! Function implementation name must be 'foo'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserFunctionDeclaration7.errors.txt b/tests/baselines/reference/parserFunctionDeclaration7.errors.txt index 27f6bdbef6c5f..40ca2414e8e58 100644 --- a/tests/baselines/reference/parserFunctionDeclaration7.errors.txt +++ b/tests/baselines/reference/parserFunctionDeclaration7.errors.txt @@ -1,6 +1,6 @@ ==== tests/cases/conformance/parser/ecmascript5/FunctionDeclarations/parserFunctionDeclaration7.ts (1 errors) ==== module M { function foo(); - ~~~~~~~~~~~~~~~ -!!! Function implementation expected. + ~~~ +!!! Function implementation is missing. } \ No newline at end of file diff --git a/tests/baselines/reference/parserModuleDeclaration10.errors.txt b/tests/baselines/reference/parserModuleDeclaration10.errors.txt index 8aab4b40ddccd..e01868927035a 100644 --- a/tests/baselines/reference/parserModuleDeclaration10.errors.txt +++ b/tests/baselines/reference/parserModuleDeclaration10.errors.txt @@ -1,8 +1,8 @@ ==== tests/cases/conformance/parser/ecmascript5/ModuleDeclarations/parserModuleDeclaration10.ts (2 errors) ==== function data(): string; - ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Function implementation expected. + ~~~~ +!!! Function implementation is missing. function next(): string; - ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! Function implementation expected. + ~~~~ +!!! Function implementation is missing. \ No newline at end of file diff --git a/tests/baselines/reference/parserSkippedTokens16.errors.txt b/tests/baselines/reference/parserSkippedTokens16.errors.txt index 4f391cef055a8..9d696386221d8 100644 --- a/tests/baselines/reference/parserSkippedTokens16.errors.txt +++ b/tests/baselines/reference/parserSkippedTokens16.errors.txt @@ -11,8 +11,8 @@ function Foo () # { } !!! Invalid character. - ~~~~~~~~~~~~~~~~~~~~ -!!! Function implementation expected. + ~~~ +!!! Function implementation is missing. 4+:5 ~ !!! Expression expected. diff --git a/tests/baselines/reference/staticClassMemberError.errors.txt b/tests/baselines/reference/staticClassMemberError.errors.txt index 6f981054bafbb..65b2a0b7aa110 100644 --- a/tests/baselines/reference/staticClassMemberError.errors.txt +++ b/tests/baselines/reference/staticClassMemberError.errors.txt @@ -10,8 +10,8 @@ // just want to make sure this one doesn't crash the compiler function Foo(); - ~~~~~~~~~~~~~~~ -!!! Function implementation expected. + ~~~ +!!! Function implementation is missing. class Foo { ~~~ !!! Duplicate identifier 'Foo'. From a62b47eace853463a8dc7ee73d1851a978675ff2 Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Thu, 31 Jul 2014 11:06:42 -0700 Subject: [PATCH 2/2] addressed CR feedback: changed error message --- src/compiler/checker.ts | 2 +- src/compiler/diagnosticInformationMap.generated.ts | 2 +- src/compiler/diagnosticMessages.json | 2 +- .../baselines/reference/ClassDeclaration10.errors.txt | 2 +- .../baselines/reference/ClassDeclaration14.errors.txt | 2 +- .../baselines/reference/ClassDeclaration15.errors.txt | 2 +- .../baselines/reference/ClassDeclaration25.errors.txt | 4 ++-- tests/baselines/reference/ClassDeclaration9.errors.txt | 2 +- .../reference/FunctionDeclaration3.errors.txt | 2 +- .../reference/FunctionDeclaration7.errors.txt | 2 +- ...ssignmentCompatFunctionsWithOptionalArgs.errors.txt | 2 +- tests/baselines/reference/callOverloads1.errors.txt | 2 +- tests/baselines/reference/callOverloads2.errors.txt | 2 +- tests/baselines/reference/callOverloads3.errors.txt | 2 +- tests/baselines/reference/callOverloads4.errors.txt | 2 +- tests/baselines/reference/callOverloads5.errors.txt | 2 +- .../reference/classOverloadForFunction2.errors.txt | 2 +- ...ssWithOverloadImplementationOfWrongName2.errors.txt | 2 +- .../reference/crashOnMethodSignatures.errors.txt | 2 +- tests/baselines/reference/dottedModuleName.errors.txt | 2 +- tests/baselines/reference/externModule.errors.txt | 10 +++++----- ...nctionOverloadImplementationOfWrongName2.errors.txt | 2 +- .../baselines/reference/functionOverloads1.errors.txt | 2 +- .../baselines/reference/functionOverloads3.errors.txt | 2 +- .../reference/functionOverloadsOutOfOrder.errors.txt | 4 ++-- .../reference/incorrectClassOverloadChain.errors.txt | 2 +- tests/baselines/reference/indexer2A.errors.txt | 2 +- ...rFunctionOverloadMixingStaticAndInstance.errors.txt | 8 ++++---- .../objectTypesWithOptionalProperties2.errors.txt | 4 ++-- .../reference/parserClassDeclaration10.errors.txt | 2 +- .../reference/parserClassDeclaration14.errors.txt | 2 +- .../reference/parserClassDeclaration15.errors.txt | 2 +- .../reference/parserClassDeclaration25.errors.txt | 4 ++-- .../reference/parserClassDeclaration9.errors.txt | 2 +- .../parserEqualsGreaterThanAfterFunction1.errors.txt | 2 +- .../parserEqualsGreaterThanAfterFunction2.errors.txt | 2 +- ...serErrantEqualsGreaterThanAfterFunction1.errors.txt | 2 +- ...serErrantEqualsGreaterThanAfterFunction2.errors.txt | 2 +- .../parserErrorRecovery_ParameterList6.errors.txt | 2 +- .../reference/parserFunctionDeclaration3.errors.txt | 2 +- .../reference/parserFunctionDeclaration7.errors.txt | 2 +- .../reference/parserModuleDeclaration10.errors.txt | 4 ++-- .../reference/parserSkippedTokens16.errors.txt | 2 +- .../reference/staticClassMemberError.errors.txt | 2 +- 44 files changed, 56 insertions(+), 56 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 6bb7635843d26..edfabad5e8e49 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -4909,7 +4909,7 @@ module ts { error(errorNode, Diagnostics.Constructor_implementation_is_missing); } else { - error(errorNode, Diagnostics.Function_implementation_is_missing); + error(errorNode, Diagnostics.Function_implementation_is_missing_or_not_immediately_following_the_declaration); } } diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index 3301cd8da4705..0c1d0ec74abed 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -279,7 +279,7 @@ module ts { Types_of_parameters_0_and_1_are_incompatible_Colon: { code: -9999999, category: DiagnosticCategory.Error, key: "Types of parameters '{0}' and '{1}' are incompatible:" }, Unknown_identifier_0: { code: -9999999, category: DiagnosticCategory.Error, key: "Unknown identifier '{0}'." }, Property_0_is_inaccessible: { code: -9999999, category: DiagnosticCategory.Error, key: "Property '{0}' is inaccessible." }, - Function_implementation_is_missing: { code: -9999999, category: DiagnosticCategory.Error, key: "Function implementation is missing." }, + Function_implementation_is_missing_or_not_immediately_following_the_declaration: { code: -9999999, category: DiagnosticCategory.Error, key: "Function implementation is missing or not immediately following the declaration." }, Property_0_of_type_1_is_not_assignable_to_string_index_type_2: { code: -9999999, category: DiagnosticCategory.Error, key: "Property '{0}' of type '{1}' is not assignable to string index type '{2}'." }, Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2: { code: -9999999, category: DiagnosticCategory.Error, key: "Property '{0}' of type '{1}' is not assignable to numeric index type '{2}'." }, Numeric_index_type_0_is_not_assignable_to_string_index_type_1: { code: -9999999, category: DiagnosticCategory.Error, key: "Numeric index type '{0}' is not assignable to string index type '{1}'." }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index f9fdf66639e6b..35c2734c1d2f5 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1132,7 +1132,7 @@ "category": "Error", "code": -9999999 }, - "Function implementation is missing.": { + "Function implementation is missing or not immediately following the declaration.": { "category": "Error", "code": -9999999 }, diff --git a/tests/baselines/reference/ClassDeclaration10.errors.txt b/tests/baselines/reference/ClassDeclaration10.errors.txt index b14c22d1b63ab..be26c1d5b47ff 100644 --- a/tests/baselines/reference/ClassDeclaration10.errors.txt +++ b/tests/baselines/reference/ClassDeclaration10.errors.txt @@ -5,5 +5,5 @@ !!! Constructor implementation is missing. foo(); ~~~ -!!! Function implementation is missing. +!!! Function implementation is missing or not immediately following the declaration. } \ No newline at end of file diff --git a/tests/baselines/reference/ClassDeclaration14.errors.txt b/tests/baselines/reference/ClassDeclaration14.errors.txt index be56741d65665..cf181a7eb8b53 100644 --- a/tests/baselines/reference/ClassDeclaration14.errors.txt +++ b/tests/baselines/reference/ClassDeclaration14.errors.txt @@ -2,7 +2,7 @@ class C { foo(); ~~~ -!!! Function implementation is missing. +!!! Function implementation is missing or not immediately following the declaration. constructor(); ~~~~~~~~~~~~~~ !!! Constructor implementation is missing. diff --git a/tests/baselines/reference/ClassDeclaration15.errors.txt b/tests/baselines/reference/ClassDeclaration15.errors.txt index de98a14880de5..08c33f1875844 100644 --- a/tests/baselines/reference/ClassDeclaration15.errors.txt +++ b/tests/baselines/reference/ClassDeclaration15.errors.txt @@ -2,6 +2,6 @@ class C { foo(); ~~~ -!!! Function implementation is missing. +!!! Function implementation is missing or not immediately following the declaration. constructor() { } } \ No newline at end of file diff --git a/tests/baselines/reference/ClassDeclaration25.errors.txt b/tests/baselines/reference/ClassDeclaration25.errors.txt index 2d86bd80fa651..3a73349506e61 100644 --- a/tests/baselines/reference/ClassDeclaration25.errors.txt +++ b/tests/baselines/reference/ClassDeclaration25.errors.txt @@ -6,9 +6,9 @@ class List implements IList { data(): U; ~~~~ -!!! Function implementation is missing. +!!! Function implementation is missing or not immediately following the declaration. next(): string; ~~~~ -!!! Function implementation is missing. +!!! Function implementation is missing or not immediately following the declaration. } \ No newline at end of file diff --git a/tests/baselines/reference/ClassDeclaration9.errors.txt b/tests/baselines/reference/ClassDeclaration9.errors.txt index f8d51d26b4b77..03813d146834d 100644 --- a/tests/baselines/reference/ClassDeclaration9.errors.txt +++ b/tests/baselines/reference/ClassDeclaration9.errors.txt @@ -2,5 +2,5 @@ class C { foo(); ~~~ -!!! Function implementation is missing. +!!! Function implementation is missing or not immediately following the declaration. } \ No newline at end of file diff --git a/tests/baselines/reference/FunctionDeclaration3.errors.txt b/tests/baselines/reference/FunctionDeclaration3.errors.txt index c5a553ed9a47b..40a51283449ce 100644 --- a/tests/baselines/reference/FunctionDeclaration3.errors.txt +++ b/tests/baselines/reference/FunctionDeclaration3.errors.txt @@ -1,4 +1,4 @@ ==== tests/cases/compiler/FunctionDeclaration3.ts (1 errors) ==== function foo(); ~~~ -!!! Function implementation is missing. \ No newline at end of file +!!! Function implementation is missing or not immediately following the declaration. \ No newline at end of file diff --git a/tests/baselines/reference/FunctionDeclaration7.errors.txt b/tests/baselines/reference/FunctionDeclaration7.errors.txt index 8c7ae6f8bf323..fcc48feb2d88a 100644 --- a/tests/baselines/reference/FunctionDeclaration7.errors.txt +++ b/tests/baselines/reference/FunctionDeclaration7.errors.txt @@ -2,5 +2,5 @@ module M { function foo(); ~~~ -!!! Function implementation is missing. +!!! Function implementation is missing or not immediately following the declaration. } \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatFunctionsWithOptionalArgs.errors.txt b/tests/baselines/reference/assignmentCompatFunctionsWithOptionalArgs.errors.txt index 1a4eaf303920e..fda1cca3d8ed6 100644 --- a/tests/baselines/reference/assignmentCompatFunctionsWithOptionalArgs.errors.txt +++ b/tests/baselines/reference/assignmentCompatFunctionsWithOptionalArgs.errors.txt @@ -1,7 +1,7 @@ ==== tests/cases/compiler/assignmentCompatFunctionsWithOptionalArgs.ts (3 errors) ==== function foo(x: { id: number; name?: string; }): void; ~~~ -!!! Function implementation is missing. +!!! Function implementation is missing or not immediately following the declaration. foo({ id: 1234 }); // Ok foo({ id: 1234, name: "hello" }); // Ok foo({ id: 1234, name: false }); // Error, name of wrong type diff --git a/tests/baselines/reference/callOverloads1.errors.txt b/tests/baselines/reference/callOverloads1.errors.txt index 06aa8e6eeb7ea..7826219c5131d 100644 --- a/tests/baselines/reference/callOverloads1.errors.txt +++ b/tests/baselines/reference/callOverloads1.errors.txt @@ -9,7 +9,7 @@ function Foo(); // error ~~~ -!!! Function implementation is missing. +!!! Function implementation is missing or not immediately following the declaration. ~~~ !!! Duplicate identifier 'Foo'. function F1(s:string); diff --git a/tests/baselines/reference/callOverloads2.errors.txt b/tests/baselines/reference/callOverloads2.errors.txt index 1649729048cf2..a715c13401eba 100644 --- a/tests/baselines/reference/callOverloads2.errors.txt +++ b/tests/baselines/reference/callOverloads2.errors.txt @@ -22,7 +22,7 @@ function Goo(s:string); // error - no implementation ~~~ -!!! Function implementation is missing. +!!! Function implementation is missing or not immediately following the declaration. declare function Gar(s:String); // expect no error diff --git a/tests/baselines/reference/callOverloads3.errors.txt b/tests/baselines/reference/callOverloads3.errors.txt index eef63a648076f..e6b7fecb59f19 100644 --- a/tests/baselines/reference/callOverloads3.errors.txt +++ b/tests/baselines/reference/callOverloads3.errors.txt @@ -5,7 +5,7 @@ !!! Cannot find name 'Foo'. function Foo(s:string):Foo; ~~~ -!!! Function implementation is missing. +!!! Function implementation is missing or not immediately following the declaration. ~~~ !!! Cannot find name 'Foo'. class Foo { diff --git a/tests/baselines/reference/callOverloads4.errors.txt b/tests/baselines/reference/callOverloads4.errors.txt index 053305c36572c..5fafef84f4ccd 100644 --- a/tests/baselines/reference/callOverloads4.errors.txt +++ b/tests/baselines/reference/callOverloads4.errors.txt @@ -5,7 +5,7 @@ !!! Cannot find name 'Foo'. function Foo(s:string):Foo; ~~~ -!!! Function implementation is missing. +!!! Function implementation is missing or not immediately following the declaration. ~~~ !!! Cannot find name 'Foo'. class Foo { diff --git a/tests/baselines/reference/callOverloads5.errors.txt b/tests/baselines/reference/callOverloads5.errors.txt index e7ccb6c5a08bb..7df261b7e0cca 100644 --- a/tests/baselines/reference/callOverloads5.errors.txt +++ b/tests/baselines/reference/callOverloads5.errors.txt @@ -4,7 +4,7 @@ !!! Cannot find name 'Foo'. function Foo(s:string):Foo; ~~~ -!!! Function implementation is missing. +!!! Function implementation is missing or not immediately following the declaration. ~~~ !!! Cannot find name 'Foo'. class Foo { diff --git a/tests/baselines/reference/classOverloadForFunction2.errors.txt b/tests/baselines/reference/classOverloadForFunction2.errors.txt index be4ce08a9e5fe..3d73a8bb3f3c2 100644 --- a/tests/baselines/reference/classOverloadForFunction2.errors.txt +++ b/tests/baselines/reference/classOverloadForFunction2.errors.txt @@ -1,7 +1,7 @@ ==== tests/cases/compiler/classOverloadForFunction2.ts (2 errors) ==== function bar(): string; ~~~ -!!! Function implementation is missing. +!!! Function implementation is missing or not immediately following the declaration. class bar {} ~~~ !!! Duplicate identifier 'bar'. \ No newline at end of file diff --git a/tests/baselines/reference/classWithOverloadImplementationOfWrongName2.errors.txt b/tests/baselines/reference/classWithOverloadImplementationOfWrongName2.errors.txt index 08aaa1239eb18..9d4c0588e633b 100644 --- a/tests/baselines/reference/classWithOverloadImplementationOfWrongName2.errors.txt +++ b/tests/baselines/reference/classWithOverloadImplementationOfWrongName2.errors.txt @@ -6,5 +6,5 @@ !!! Function implementation name must be 'foo'. foo(x): number; ~~~ -!!! Function implementation is missing. +!!! Function implementation is missing or not immediately following the declaration. } \ No newline at end of file diff --git a/tests/baselines/reference/crashOnMethodSignatures.errors.txt b/tests/baselines/reference/crashOnMethodSignatures.errors.txt index f7b02a2bb4d31..014700b813521 100644 --- a/tests/baselines/reference/crashOnMethodSignatures.errors.txt +++ b/tests/baselines/reference/crashOnMethodSignatures.errors.txt @@ -2,6 +2,6 @@ class A { a(completed: () => any): void; ~ -!!! Function implementation is missing. +!!! Function implementation is missing or not immediately following the declaration. } \ No newline at end of file diff --git a/tests/baselines/reference/dottedModuleName.errors.txt b/tests/baselines/reference/dottedModuleName.errors.txt index 5a2c975325762..7308aa980f76c 100644 --- a/tests/baselines/reference/dottedModuleName.errors.txt +++ b/tests/baselines/reference/dottedModuleName.errors.txt @@ -5,7 +5,7 @@ ~~ !!! Block or ';' expected. ~ -!!! Function implementation is missing. +!!! Function implementation is missing or not immediately following the declaration. ~ !!! Cannot find name 'x'. export module X.Y.Z { diff --git a/tests/baselines/reference/externModule.errors.txt b/tests/baselines/reference/externModule.errors.txt index f7e4795e6b85d..613f6d9f8d7ef 100644 --- a/tests/baselines/reference/externModule.errors.txt +++ b/tests/baselines/reference/externModule.errors.txt @@ -15,10 +15,10 @@ !!! Cannot compile external modules unless the '--module' flag is provided. public getDay():number; ~~~~~~ -!!! Function implementation is missing. +!!! Function implementation is missing or not immediately following the declaration. public getXDate():number; ~~~~~~~~ -!!! Function implementation is missing. +!!! Function implementation is missing or not immediately following the declaration. // etc. // Called as a function @@ -38,7 +38,7 @@ static parse(string: string): number; ~~~~~ -!!! Function implementation is missing. +!!! Function implementation is missing or not immediately following the declaration. static UTC(year: number, month: number): number; static UTC(year: number, month: number, date: number): number; static UTC(year: number, month: number, date: number, hours: number): number; @@ -46,11 +46,11 @@ static UTC(year: number, month: number, date: number, hours: number, minutes: number, seconds: number): number; static UTC(year: number, month: number, date: number, hours: number, minutes: number, seconds: number, ~~~ -!!! Function implementation is missing. +!!! Function implementation is missing or not immediately following the declaration. ms: number): number; static now(): number; ~~~ -!!! Function implementation is missing. +!!! Function implementation is missing or not immediately following the declaration. } } ~ diff --git a/tests/baselines/reference/functionOverloadImplementationOfWrongName2.errors.txt b/tests/baselines/reference/functionOverloadImplementationOfWrongName2.errors.txt index a5216bebb405a..c656065b37518 100644 --- a/tests/baselines/reference/functionOverloadImplementationOfWrongName2.errors.txt +++ b/tests/baselines/reference/functionOverloadImplementationOfWrongName2.errors.txt @@ -5,4 +5,4 @@ !!! Function implementation name must be 'foo'. function foo(x, y); ~~~ -!!! Function implementation is missing. \ No newline at end of file +!!! Function implementation is missing or not immediately following the declaration. \ No newline at end of file diff --git a/tests/baselines/reference/functionOverloads1.errors.txt b/tests/baselines/reference/functionOverloads1.errors.txt index 71532313f44ce..610363c772f0c 100644 --- a/tests/baselines/reference/functionOverloads1.errors.txt +++ b/tests/baselines/reference/functionOverloads1.errors.txt @@ -1,6 +1,6 @@ ==== tests/cases/compiler/functionOverloads1.ts (1 errors) ==== function foo(); ~~~ -!!! Function implementation is missing. +!!! Function implementation is missing or not immediately following the declaration. 1+1; function foo():string { return "a" } \ No newline at end of file diff --git a/tests/baselines/reference/functionOverloads3.errors.txt b/tests/baselines/reference/functionOverloads3.errors.txt index 79fca9f342c8a..b153d81c10916 100644 --- a/tests/baselines/reference/functionOverloads3.errors.txt +++ b/tests/baselines/reference/functionOverloads3.errors.txt @@ -1,4 +1,4 @@ ==== tests/cases/compiler/functionOverloads3.ts (1 errors) ==== function foo():string; ~~~ -!!! Function implementation is missing. \ No newline at end of file +!!! Function implementation is missing or not immediately following the declaration. \ No newline at end of file diff --git a/tests/baselines/reference/functionOverloadsOutOfOrder.errors.txt b/tests/baselines/reference/functionOverloadsOutOfOrder.errors.txt index 977d160a45a80..c5cfcb2ac7389 100644 --- a/tests/baselines/reference/functionOverloadsOutOfOrder.errors.txt +++ b/tests/baselines/reference/functionOverloadsOutOfOrder.errors.txt @@ -6,7 +6,7 @@ } private foo(s: string): string; ~~~ -!!! Function implementation is missing. +!!! Function implementation is missing or not immediately following the declaration. } class e { @@ -16,5 +16,5 @@ private foo(s: string): string; private foo(n: number): string; ~~~ -!!! Function implementation is missing. +!!! Function implementation is missing or not immediately following the declaration. } \ No newline at end of file diff --git a/tests/baselines/reference/incorrectClassOverloadChain.errors.txt b/tests/baselines/reference/incorrectClassOverloadChain.errors.txt index 6c12e650d023e..c6a4361b56ecd 100644 --- a/tests/baselines/reference/incorrectClassOverloadChain.errors.txt +++ b/tests/baselines/reference/incorrectClassOverloadChain.errors.txt @@ -3,6 +3,6 @@ foo(): string; foo(x): number; ~~~ -!!! Function implementation is missing. +!!! Function implementation is missing or not immediately following the declaration. x = 1; } \ No newline at end of file diff --git a/tests/baselines/reference/indexer2A.errors.txt b/tests/baselines/reference/indexer2A.errors.txt index 25d9145a11fe5..59575b3ef5b5e 100644 --- a/tests/baselines/reference/indexer2A.errors.txt +++ b/tests/baselines/reference/indexer2A.errors.txt @@ -4,7 +4,7 @@ // Decided to enforce a semicolon after declarations hasOwnProperty(objectId: number): boolean ~~~~~~~~~~~~~~ -!!! Function implementation is missing. +!!! Function implementation is missing or not immediately following the declaration. [objectId: number]: IHeapObjectProperty[] } var directChildrenMap = {}; \ No newline at end of file diff --git a/tests/baselines/reference/memberFunctionOverloadMixingStaticAndInstance.errors.txt b/tests/baselines/reference/memberFunctionOverloadMixingStaticAndInstance.errors.txt index 6c1c18c32166b..69fc3e3723116 100644 --- a/tests/baselines/reference/memberFunctionOverloadMixingStaticAndInstance.errors.txt +++ b/tests/baselines/reference/memberFunctionOverloadMixingStaticAndInstance.errors.txt @@ -3,7 +3,7 @@ foo(); static foo(); // error ~~~ -!!! Function implementation is missing. +!!! Function implementation is missing or not immediately following the declaration. ~~~ !!! Function overload must not be static. } @@ -12,7 +12,7 @@ static foo(); foo(); // error ~~~ -!!! Function implementation is missing. +!!! Function implementation is missing or not immediately following the declaration. ~~~ !!! Function overload must be static. } @@ -21,7 +21,7 @@ foo(x: T); static foo(x: number); // error ~~~ -!!! Function implementation is missing. +!!! Function implementation is missing or not immediately following the declaration. ~~~ !!! Function overload must not be static. } @@ -30,7 +30,7 @@ static foo(x: number); foo(x: T); // error ~~~ -!!! Function implementation is missing. +!!! Function implementation is missing or not immediately following the declaration. ~~~ !!! Function overload must be static. } \ No newline at end of file diff --git a/tests/baselines/reference/objectTypesWithOptionalProperties2.errors.txt b/tests/baselines/reference/objectTypesWithOptionalProperties2.errors.txt index ee417a928e518..75e3b2efc8edd 100644 --- a/tests/baselines/reference/objectTypesWithOptionalProperties2.errors.txt +++ b/tests/baselines/reference/objectTypesWithOptionalProperties2.errors.txt @@ -24,7 +24,7 @@ ~ !!! Unexpected token. A constructor, method, accessor, or property was expected. ~ -!!! Function implementation is missing. +!!! Function implementation is missing or not immediately following the declaration. } interface I2 { @@ -42,7 +42,7 @@ ~ !!! Unexpected token. A constructor, method, accessor, or property was expected. ~ -!!! Function implementation is missing. +!!! Function implementation is missing or not immediately following the declaration. } diff --git a/tests/baselines/reference/parserClassDeclaration10.errors.txt b/tests/baselines/reference/parserClassDeclaration10.errors.txt index 10ef6a300a553..050ef3d24adbf 100644 --- a/tests/baselines/reference/parserClassDeclaration10.errors.txt +++ b/tests/baselines/reference/parserClassDeclaration10.errors.txt @@ -5,5 +5,5 @@ !!! Constructor implementation is missing. foo(); ~~~ -!!! Function implementation is missing. +!!! Function implementation is missing or not immediately following the declaration. } \ No newline at end of file diff --git a/tests/baselines/reference/parserClassDeclaration14.errors.txt b/tests/baselines/reference/parserClassDeclaration14.errors.txt index dbc94ceb5548c..749e66b8aef53 100644 --- a/tests/baselines/reference/parserClassDeclaration14.errors.txt +++ b/tests/baselines/reference/parserClassDeclaration14.errors.txt @@ -2,7 +2,7 @@ class C { foo(); ~~~ -!!! Function implementation is missing. +!!! Function implementation is missing or not immediately following the declaration. constructor(); ~~~~~~~~~~~~~~ !!! Constructor implementation is missing. diff --git a/tests/baselines/reference/parserClassDeclaration15.errors.txt b/tests/baselines/reference/parserClassDeclaration15.errors.txt index 45bc3398e880e..84a9840a0b4f4 100644 --- a/tests/baselines/reference/parserClassDeclaration15.errors.txt +++ b/tests/baselines/reference/parserClassDeclaration15.errors.txt @@ -2,6 +2,6 @@ class C { foo(); ~~~ -!!! Function implementation is missing. +!!! Function implementation is missing or not immediately following the declaration. constructor() { } } \ No newline at end of file diff --git a/tests/baselines/reference/parserClassDeclaration25.errors.txt b/tests/baselines/reference/parserClassDeclaration25.errors.txt index 3ac19df284c06..14e581aaa2158 100644 --- a/tests/baselines/reference/parserClassDeclaration25.errors.txt +++ b/tests/baselines/reference/parserClassDeclaration25.errors.txt @@ -6,9 +6,9 @@ class List implements IList { data(): U; ~~~~ -!!! Function implementation is missing. +!!! Function implementation is missing or not immediately following the declaration. next(): string; ~~~~ -!!! Function implementation is missing. +!!! Function implementation is missing or not immediately following the declaration. } \ No newline at end of file diff --git a/tests/baselines/reference/parserClassDeclaration9.errors.txt b/tests/baselines/reference/parserClassDeclaration9.errors.txt index f1e6ed44e3ac7..e23f647643336 100644 --- a/tests/baselines/reference/parserClassDeclaration9.errors.txt +++ b/tests/baselines/reference/parserClassDeclaration9.errors.txt @@ -2,5 +2,5 @@ class C { foo(); ~~~ -!!! Function implementation is missing. +!!! Function implementation is missing or not immediately following the declaration. } \ No newline at end of file diff --git a/tests/baselines/reference/parserEqualsGreaterThanAfterFunction1.errors.txt b/tests/baselines/reference/parserEqualsGreaterThanAfterFunction1.errors.txt index 7b9a64333b3cd..e3ff187a00ef8 100644 --- a/tests/baselines/reference/parserEqualsGreaterThanAfterFunction1.errors.txt +++ b/tests/baselines/reference/parserEqualsGreaterThanAfterFunction1.errors.txt @@ -3,4 +3,4 @@ ~~ !!! Identifier expected. -!!! Function implementation is missing. \ No newline at end of file +!!! Function implementation is missing or not immediately following the declaration. \ No newline at end of file diff --git a/tests/baselines/reference/parserEqualsGreaterThanAfterFunction2.errors.txt b/tests/baselines/reference/parserEqualsGreaterThanAfterFunction2.errors.txt index c6efbe104db03..24866e9e4247a 100644 --- a/tests/baselines/reference/parserEqualsGreaterThanAfterFunction2.errors.txt +++ b/tests/baselines/reference/parserEqualsGreaterThanAfterFunction2.errors.txt @@ -9,4 +9,4 @@ !!! ')' expected. -!!! Function implementation is missing. \ No newline at end of file +!!! Function implementation is missing or not immediately following the declaration. \ No newline at end of file diff --git a/tests/baselines/reference/parserErrantEqualsGreaterThanAfterFunction1.errors.txt b/tests/baselines/reference/parserErrantEqualsGreaterThanAfterFunction1.errors.txt index d2079dfc86725..452919e7bc60e 100644 --- a/tests/baselines/reference/parserErrantEqualsGreaterThanAfterFunction1.errors.txt +++ b/tests/baselines/reference/parserErrantEqualsGreaterThanAfterFunction1.errors.txt @@ -3,4 +3,4 @@ ~~ !!! Block or ';' expected. ~ -!!! Function implementation is missing. \ No newline at end of file +!!! Function implementation is missing or not immediately following the declaration. \ No newline at end of file diff --git a/tests/baselines/reference/parserErrantEqualsGreaterThanAfterFunction2.errors.txt b/tests/baselines/reference/parserErrantEqualsGreaterThanAfterFunction2.errors.txt index 684fd861eb4c2..9063aa5f5414b 100644 --- a/tests/baselines/reference/parserErrantEqualsGreaterThanAfterFunction2.errors.txt +++ b/tests/baselines/reference/parserErrantEqualsGreaterThanAfterFunction2.errors.txt @@ -3,7 +3,7 @@ ~~ !!! Block or ';' expected. ~ -!!! Function implementation is missing. +!!! Function implementation is missing or not immediately following the declaration. ~ !!! Cannot find name 'A'. ~ diff --git a/tests/baselines/reference/parserErrorRecovery_ParameterList6.errors.txt b/tests/baselines/reference/parserErrorRecovery_ParameterList6.errors.txt index 0ecdaaffb5016..5ccacf77e4662 100644 --- a/tests/baselines/reference/parserErrorRecovery_ParameterList6.errors.txt +++ b/tests/baselines/reference/parserErrorRecovery_ParameterList6.errors.txt @@ -6,7 +6,7 @@ ~ !!! Identifier expected. ~~~~~~ -!!! Function implementation is missing. +!!! Function implementation is missing or not immediately following the declaration. } ~ !!! Declaration or statement expected. \ No newline at end of file diff --git a/tests/baselines/reference/parserFunctionDeclaration3.errors.txt b/tests/baselines/reference/parserFunctionDeclaration3.errors.txt index 2042033edc143..0ba98e4e480aa 100644 --- a/tests/baselines/reference/parserFunctionDeclaration3.errors.txt +++ b/tests/baselines/reference/parserFunctionDeclaration3.errors.txt @@ -1,4 +1,4 @@ ==== tests/cases/conformance/parser/ecmascript5/FunctionDeclarations/parserFunctionDeclaration3.ts (1 errors) ==== function foo(); ~~~ -!!! Function implementation is missing. \ No newline at end of file +!!! Function implementation is missing or not immediately following the declaration. \ No newline at end of file diff --git a/tests/baselines/reference/parserFunctionDeclaration7.errors.txt b/tests/baselines/reference/parserFunctionDeclaration7.errors.txt index 40ca2414e8e58..661b497608e0a 100644 --- a/tests/baselines/reference/parserFunctionDeclaration7.errors.txt +++ b/tests/baselines/reference/parserFunctionDeclaration7.errors.txt @@ -2,5 +2,5 @@ module M { function foo(); ~~~ -!!! Function implementation is missing. +!!! Function implementation is missing or not immediately following the declaration. } \ No newline at end of file diff --git a/tests/baselines/reference/parserModuleDeclaration10.errors.txt b/tests/baselines/reference/parserModuleDeclaration10.errors.txt index e01868927035a..d84c17e43131d 100644 --- a/tests/baselines/reference/parserModuleDeclaration10.errors.txt +++ b/tests/baselines/reference/parserModuleDeclaration10.errors.txt @@ -1,8 +1,8 @@ ==== tests/cases/conformance/parser/ecmascript5/ModuleDeclarations/parserModuleDeclaration10.ts (2 errors) ==== function data(): string; ~~~~ -!!! Function implementation is missing. +!!! Function implementation is missing or not immediately following the declaration. function next(): string; ~~~~ -!!! Function implementation is missing. +!!! Function implementation is missing or not immediately following the declaration. \ No newline at end of file diff --git a/tests/baselines/reference/parserSkippedTokens16.errors.txt b/tests/baselines/reference/parserSkippedTokens16.errors.txt index 9d696386221d8..6416bc999a936 100644 --- a/tests/baselines/reference/parserSkippedTokens16.errors.txt +++ b/tests/baselines/reference/parserSkippedTokens16.errors.txt @@ -12,7 +12,7 @@ !!! Invalid character. ~~~ -!!! Function implementation is missing. +!!! Function implementation is missing or not immediately following the declaration. 4+:5 ~ !!! Expression expected. diff --git a/tests/baselines/reference/staticClassMemberError.errors.txt b/tests/baselines/reference/staticClassMemberError.errors.txt index 65b2a0b7aa110..8594a29a2d8dc 100644 --- a/tests/baselines/reference/staticClassMemberError.errors.txt +++ b/tests/baselines/reference/staticClassMemberError.errors.txt @@ -11,7 +11,7 @@ // just want to make sure this one doesn't crash the compiler function Foo(); ~~~ -!!! Function implementation is missing. +!!! Function implementation is missing or not immediately following the declaration. class Foo { ~~~ !!! Duplicate identifier 'Foo'.