Change computed property error message to mention Symbols

This commit is contained in:
Jason Freeman 2015-01-28 16:14:46 -08:00
parent f344654460
commit 30892af563
12 changed files with 63 additions and 63 deletions

View File

@ -5517,7 +5517,7 @@ module ts {
// This will allow types number, string, or any. It will also allow enums, the unknown
// type, and any union of these types (like string | number).
if (!isTypeOfKind(links.resolvedType, TypeFlags.Any | TypeFlags.NumberLike | TypeFlags.StringLike)) {
error(node, Diagnostics.A_computed_property_name_must_be_of_type_string_number_or_any);
error(node, Diagnostics.A_computed_property_name_must_be_of_type_string_number_Symbol_or_any);
}
}

View File

@ -300,7 +300,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'." },
A_computed_property_name_must_be_of_type_string_number_Symbol_or_any: { code: 2464, category: DiagnosticCategory.Error, key: "A computed property name must be of type 'string', 'number', 'Symbol', or 'any'." },
this_cannot_be_referenced_in_a_computed_property_name: { code: 2465, category: DiagnosticCategory.Error, key: "'this' cannot be referenced in a computed property name." },
super_cannot_be_referenced_in_a_computed_property_name: { code: 2466, category: DiagnosticCategory.Error, key: "'super' cannot be referenced in a computed property name." },
A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type: { code: 2466, category: DiagnosticCategory.Error, key: "A computed property name cannot reference a type parameter from its containing type." },

View File

@ -1193,7 +1193,7 @@
"category": "Error",
"code": 2463
},
"A computed property name must be of type 'string', 'number', or 'any'.": {
"A computed property name must be of type 'string', 'number', 'Symbol', or 'any'.": {
"category": "Error",
"code": 2464
},

View File

@ -1,9 +1,9 @@
tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(3,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(4,12): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(5,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(6,12): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(8,12): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(3,5): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(4,12): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(5,5): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(6,12): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(8,12): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'.
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts (6 errors) ====
@ -11,20 +11,20 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(8,12):
class C {
[b]() {}
~~~
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'.
static [true]() { }
~~~~~~
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'.
[[]]() { }
~~~~
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'.
static [{}]() { }
~~~~
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'.
[undefined]() { }
~~~~~~~~~~~
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'.
static [null]() { }
~~~~~~
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'.
}

View File

@ -1,5 +1,5 @@
tests/cases/conformance/es6/computedProperties/computedPropertyNames15.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames15.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames15.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames15.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'.
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames15.ts (2 errors) ====
@ -10,8 +10,8 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames15.ts(7,5):
[p1]() { }
[p2]() { }
~~~~
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'.
[p3]() { }
~~~~
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'.
}

View File

@ -1,9 +1,9 @@
tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(3,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(4,16): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(7,16): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(8,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(3,9): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(4,16): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(7,16): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(8,9): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'.
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts (6 errors) ====
@ -11,20 +11,20 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(8,9):
class C {
get [b]() { return 0;}
~~~
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'.
static set [true](v) { }
~~~~~~
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'.
get [[]]() { return 0; }
~~~~
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'.
set [{}](v) { }
~~~~
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'.
static get [undefined]() { return 0; }
~~~~~~~~~~~
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'.
set [null](v) { }
~~~~~~
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'.
}

View File

@ -1,9 +1,9 @@
tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(4,12): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(4,12): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(5,9): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement.
tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(7,16): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement.
tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(7,16): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(7,16): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'.
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts (6 errors) ====
@ -12,19 +12,19 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(7,16):
[0 + 1]() { }
static [() => { }]() { }
~~~~~~~~~~~
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'.
get [delete id]() { }
~~~~~~~~~~~
!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement.
~~~~~~~~~~~
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'.
set [[0, 1]](v) { }
~~~~~~~~
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'.
static get [<String>""]() { }
~~~~~~~~~~~~
!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement.
~~~~~~~~~~~~
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'.
static set [id.toString()](v) { }
}

View File

@ -1,9 +1,9 @@
tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(3,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(4,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(5,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(8,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(3,5): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(4,5): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(5,5): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(8,5): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'.
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts (6 errors) ====
@ -11,20 +11,20 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(8,5): e
var v = {
[b]: 0,
~~~
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'.
[true]: 1,
~~~~~~
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'.
[[]]: 0,
~~~~
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'.
[{}]: 0,
~~~~
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'.
[undefined]: undefined,
~~~~~~~~~~~
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'.
[null]: null
~~~~~~
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'.
}

View File

@ -1,5 +1,5 @@
tests/cases/conformance/es6/computedProperties/computedPropertyNames6.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames6.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames6.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames6.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'.
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames6.ts (2 errors) ====
@ -10,8 +10,8 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames6.ts(7,5): e
[p1]: 0,
[p2]: 1,
~~~~
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'.
[p3]: 2
~~~~
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'.
}

View File

@ -1,5 +1,5 @@
tests/cases/conformance/es6/computedProperties/computedPropertyNames8.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames8.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames8.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames8.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'.
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames8.ts (2 errors) ====
@ -9,9 +9,9 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames8.ts(6,9): e
var v = {
[t]: 0,
~~~
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'.
[u]: 1
~~~
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'.
};
}

View File

@ -1,4 +1,4 @@
tests/cases/conformance/es6/computedProperties/computedPropertyNames9.ts(9,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames9.ts(9,5): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'.
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames9.ts (1 errors) ====
@ -12,5 +12,5 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames9.ts(9,5): e
[f(0)]: 0,
[f(true)]: 0
~~~~~~~~~
!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'.
}

View File

@ -1,9 +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(2,5): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', 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'.
!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'.
}