diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index a93400b970319..15df97de4c9ad 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -5395,6 +5395,17 @@ module ts { return (+name).toString() === name; } + function checkComputedPropertyName(node: ComputedPropertyName): void { + var computedNameType = checkExpression(node.expression); + + // This will only allow types number, string, or any. Any types more complex will + // be disallowed, even union types like string | number. In the future, we might consider + // allowing types like that. + if ((computedNameType.flags & (TypeFlags.Number | TypeFlags.String | TypeFlags.Any)) === 0) { + error(node, Diagnostics.A_computed_property_name_must_be_of_type_string_number_or_any); + } + } + function checkObjectLiteral(node: ObjectLiteralExpression, contextualMapper?: TypeMapper): Type { // Grammar checking checkGrammarObjectLiteralExpression(node); @@ -5443,7 +5454,12 @@ module ts { checkAccessorDeclaration(memberDecl); } - properties[member.name] = member; + if (hasComputedNameButNotSymbol(memberDecl)) { + checkComputedPropertyName(memberDecl.name); + } + else { + properties[member.name] = member; + } } var stringIndexType = getIndexType(IndexKind.String); diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index 03df069a9abea..6354633fe6012 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -299,6 +299,7 @@ module ts { Type_0_is_not_an_array_type: { code: 2461, category: DiagnosticCategory.Error, key: "Type '{0}' is not an array type." }, A_rest_element_must_be_last_in_an_array_destructuring_pattern: { code: 2462, category: DiagnosticCategory.Error, key: "A rest element must be last in an array destructuring pattern" }, A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature: { code: 2463, category: DiagnosticCategory.Error, key: "A binding pattern parameter cannot be optional in an implementation signature." }, + A_computed_property_name_must_be_of_type_string_number_or_any: { code: 2464, category: DiagnosticCategory.Error, key: "A computed property name must be of type 'string', 'number', or 'any'." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 6be3bb65c7756..8268af730ec56 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -675,7 +675,7 @@ }, "A parameter property may not be a binding pattern.": { "category": "Error", - "code": 1187 + "code": 1187 }, "Duplicate identifier '{0}'.": { @@ -1288,7 +1288,11 @@ }, "A binding pattern parameter cannot be optional in an implementation signature.": { "category": "Error", - "code": 2463 + "code": 2463 + }, + "A computed property name must be of type 'string', 'number', or 'any'.": { + "category": "Error", + "code": 2464 }, "Import declaration '{0}' is using private name '{1}'.": { diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 7494ec9f6cb12..f1fab4137e264 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -527,6 +527,8 @@ module ts { return node === (parent).expression; case SyntaxKind.TemplateSpan: return node === (parent).expression; + case SyntaxKind.ComputedPropertyName: + return node === (parent).expression; default: if (isExpression(parent)) { return true; diff --git a/tests/baselines/reference/FunctionDeclaration8_es6.errors.txt b/tests/baselines/reference/FunctionDeclaration8_es6.errors.txt index 386e1e8f63cd6..2c8d034649e01 100644 --- a/tests/baselines/reference/FunctionDeclaration8_es6.errors.txt +++ b/tests/baselines/reference/FunctionDeclaration8_es6.errors.txt @@ -1,10 +1,13 @@ 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,12): error TS2304: Cannot find name 'yield'. tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8_es6.ts(1,20): error TS2304: Cannot find name 'foo'. -==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8_es6.ts (2 errors) ==== +==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8_es6.ts (3 errors) ==== var v = { [yield]: foo } ~~~~~~~ !!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~ +!!! error TS2304: Cannot find name 'yield'. ~~~ !!! error TS2304: Cannot find name 'foo'. \ No newline at end of file diff --git a/tests/baselines/reference/FunctionDeclaration9_es6.errors.txt b/tests/baselines/reference/FunctionDeclaration9_es6.errors.txt index 902a195e8fc8f..ef744681fa194 100644 --- a/tests/baselines/reference/FunctionDeclaration9_es6.errors.txt +++ b/tests/baselines/reference/FunctionDeclaration9_es6.errors.txt @@ -1,12 +1,15 @@ 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(2,13): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts(2,14): error TS9000: 'yield' expressions are not currently supported. -==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts (2 errors) ==== +==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts (3 errors) ==== function * foo() { ~ !!! error TS9001: Generators are not currently supported. var v = { [yield]: foo } ~~~~~~~ !!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~ +!!! error TS9000: 'yield' expressions 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 0999186ec0974..c8c356a57ada8 100644 --- a/tests/baselines/reference/FunctionPropertyAssignments5_es6.errors.txt +++ b/tests/baselines/reference/FunctionPropertyAssignments5_es6.errors.txt @@ -1,10 +1,13 @@ 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,12): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts(1,13): error TS2304: Cannot find name 'foo'. -==== tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts (2 errors) ==== +==== tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts (3 errors) ==== var v = { *[foo()]() { } } ~ !!! error TS9001: Generators are not currently supported. ~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. \ No newline at end of file +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~ +!!! error TS2304: Cannot find name 'foo'. \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName1.errors.txt b/tests/baselines/reference/parserComputedPropertyName1.errors.txt index 508d06a915c5a..2258051a46eb6 100644 --- a/tests/baselines/reference/parserComputedPropertyName1.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName1.errors.txt @@ -1,7 +1,10 @@ +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName1.ts(1,12): error TS2304: Cannot find name 'e'. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName1.ts(1,15): error TS1005: ':' expected. -==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName1.ts (1 errors) ==== +==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName1.ts (2 errors) ==== var v = { [e] }; + ~ +!!! error TS2304: Cannot find name 'e'. ~ !!! error TS1005: ':' expected. \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName17.errors.txt b/tests/baselines/reference/parserComputedPropertyName17.errors.txt new file mode 100644 index 0000000000000..d8b43ada5275e --- /dev/null +++ b/tests/baselines/reference/parserComputedPropertyName17.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName17.ts(1,16): error TS2304: Cannot find name 'e'. + + +==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName17.ts (1 errors) ==== + var v = { set [e](v) { } } + ~ +!!! error TS2304: Cannot find name 'e'. \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName17.types b/tests/baselines/reference/parserComputedPropertyName17.types deleted file mode 100644 index 8ae109dda373a..0000000000000 --- 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 0000000000000..864c7adf1b5c4 --- /dev/null +++ b/tests/baselines/reference/parserComputedPropertyName2.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName2.ts(1,12): error TS2304: Cannot find name 'e'. + + +==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName2.ts (1 errors) ==== + var v = { [e]: 1 }; + ~ +!!! error TS2304: Cannot find name 'e'. \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName2.types b/tests/baselines/reference/parserComputedPropertyName2.types deleted file mode 100644 index 8e533282e28f3..0000000000000 --- 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/parserComputedPropertyName3.errors.txt b/tests/baselines/reference/parserComputedPropertyName3.errors.txt new file mode 100644 index 0000000000000..4b20c55f4990f --- /dev/null +++ b/tests/baselines/reference/parserComputedPropertyName3.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName3.ts(1,12): error TS2304: Cannot find name 'e'. + + +==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName3.ts (1 errors) ==== + var v = { [e]() { } }; + ~ +!!! error TS2304: Cannot find name 'e'. \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName3.types b/tests/baselines/reference/parserComputedPropertyName3.types deleted file mode 100644 index 8a5cfafbd40e4..0000000000000 --- 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/parserComputedPropertyName37.errors.txt b/tests/baselines/reference/parserComputedPropertyName37.errors.txt new file mode 100644 index 0000000000000..64a9e7e99dc62 --- /dev/null +++ b/tests/baselines/reference/parserComputedPropertyName37.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName37.ts(2,6): error TS2304: Cannot find name 'public'. + + +==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName37.ts (1 errors) ==== + var v = { + [public]: 0 + ~~~~~~ +!!! error TS2304: Cannot find name 'public'. + }; \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName37.types b/tests/baselines/reference/parserComputedPropertyName37.types deleted file mode 100644 index ebcd0ca276ca4..0000000000000 --- 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/parserComputedPropertyName4.errors.txt b/tests/baselines/reference/parserComputedPropertyName4.errors.txt index ec90ebf8df11f..bfc78b162fd5a 100644 --- a/tests/baselines/reference/parserComputedPropertyName4.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName4.errors.txt @@ -1,7 +1,10 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName4.ts(1,15): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName4.ts(1,16): error TS2304: Cannot find name 'e'. -==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName4.ts (1 errors) ==== +==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName4.ts (2 errors) ==== var v = { get [e]() { } }; ~~~ -!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. \ No newline at end of file +!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. + ~ +!!! error TS2304: Cannot find name 'e'. \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName41.errors.txt b/tests/baselines/reference/parserComputedPropertyName41.errors.txt new file mode 100644 index 0000000000000..65d4ec8627f6a --- /dev/null +++ b/tests/baselines/reference/parserComputedPropertyName41.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName41.ts(2,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + + +==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName41.ts (1 errors) ==== + var v = { + [0 in []]: true + ~~~~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName41.types b/tests/baselines/reference/parserComputedPropertyName41.types deleted file mode 100644 index 468a44e6b9e8a..0000000000000 --- 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/parserComputedPropertyName5.errors.txt b/tests/baselines/reference/parserComputedPropertyName5.errors.txt index 1d321dc156ea8..07cc6f3a9f000 100644 --- a/tests/baselines/reference/parserComputedPropertyName5.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName5.errors.txt @@ -1,7 +1,10 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName5.ts(1,22): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName5.ts(1,23): error TS2304: Cannot find name 'e'. -==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName5.ts (1 errors) ==== +==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName5.ts (2 errors) ==== var v = { public get [e]() { } }; ~~~ -!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. \ No newline at end of file +!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. + ~ +!!! error TS2304: Cannot find name 'e'. \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName6.errors.txt b/tests/baselines/reference/parserComputedPropertyName6.errors.txt new file mode 100644 index 0000000000000..90f1b688408ba --- /dev/null +++ b/tests/baselines/reference/parserComputedPropertyName6.errors.txt @@ -0,0 +1,13 @@ +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName6.ts(1,12): error TS2304: Cannot find name 'e'. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName6.ts(1,20): error TS2304: Cannot find name 'e'. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName6.ts(1,24): error TS2304: Cannot find name 'e'. + + +==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName6.ts (3 errors) ==== + var v = { [e]: 1, [e + e]: 2 }; + ~ +!!! error TS2304: Cannot find name 'e'. + ~ +!!! error TS2304: Cannot find name 'e'. + ~ +!!! error TS2304: Cannot find name 'e'. \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName6.types b/tests/baselines/reference/parserComputedPropertyName6.types deleted file mode 100644 index 5fa7e79c32c8b..0000000000000 --- 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 dc7d7e7ba304a..5918387942d80 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName2.errors.txt +++ b/tests/baselines/reference/parserES5ComputedPropertyName2.errors.txt @@ -1,7 +1,10 @@ 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,12): error TS2304: Cannot find name 'e'. -==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName2.ts (1 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName2.ts (2 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 TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~ +!!! error TS2304: Cannot find name 'e'. \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ComputedPropertyName3.errors.txt b/tests/baselines/reference/parserES5ComputedPropertyName3.errors.txt index 376c1a29ae449..097ab1ea9cb24 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName3.errors.txt +++ b/tests/baselines/reference/parserES5ComputedPropertyName3.errors.txt @@ -1,7 +1,10 @@ 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,12): error TS2304: Cannot find name 'e'. -==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName3.ts (1 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName3.ts (2 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 TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~ +!!! error TS2304: Cannot find name 'e'. \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ComputedPropertyName4.errors.txt b/tests/baselines/reference/parserES5ComputedPropertyName4.errors.txt index df2626033318e..ca69791c93c85 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName4.errors.txt +++ b/tests/baselines/reference/parserES5ComputedPropertyName4.errors.txt @@ -1,10 +1,13 @@ 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 TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName4.ts(1,16): error TS2304: Cannot find name 'e'. -==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName4.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName4.ts (3 errors) ==== var v = { get [e]() { } }; ~~~ !!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. ~~~ -!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. \ No newline at end of file +!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. + ~ +!!! error TS2304: Cannot find name 'e'. \ No newline at end of file