From 98eda2bf5cba36278bfcccf28377ecdd96f751f0 Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Tue, 18 Nov 2014 10:53:22 -0800 Subject: [PATCH] Syntax error for computed properties on method overloads --- src/compiler/diagnosticInformationMap.generated.ts | 1 + src/compiler/diagnosticMessages.json | 4 ++++ .../reference/parserComputedPropertyName11.errors.txt | 5 ++++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index c8156dff138..4fbc864b3c5 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -131,6 +131,7 @@ module ts { Computed_property_names_are_not_allowed_in_an_ambient_context: { code: 1163, 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: 1164, 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: 1165, 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: 1166, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in method overloads." }, 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." }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 5784a427224..ba4fb052094 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -515,6 +515,10 @@ "category": "Error", "code": 1165 }, + "Computed property names are not allowed in method overloads.": { + "category": "Error", + "code": 1166 + }, "Duplicate identifier '{0}'.": { "category": "Error", diff --git a/tests/baselines/reference/parserComputedPropertyName11.errors.txt b/tests/baselines/reference/parserComputedPropertyName11.errors.txt index 2d2edd2b841..fe2e82b54ee 100644 --- a/tests/baselines/reference/parserComputedPropertyName11.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName11.errors.txt @@ -1,9 +1,12 @@ +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName11.ts(2,4): error TS1166: Computed property names are not allowed in method overloads. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName11.ts(2,4): error TS2391: Function implementation is missing or not immediately following the declaration. -==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName11.ts (1 errors) ==== +==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName11.ts (2 errors) ==== class C { [e](); ~~~ +!!! error TS1166: Computed property names are not allowed in method overloads. + ~~~ !!! error TS2391: Function implementation is missing or not immediately following the declaration. } \ No newline at end of file