Add parser tests for computed properties
This commit is contained in:
parent
9d5c86a11d
commit
cf4f34c224
|
@ -4528,14 +4528,12 @@ module ts {
|
|||
var inStrictMode = (node.parserContextFlags & ParserContextFlags.StrictMode) !== 0;
|
||||
|
||||
for (var i = 0, n = node.properties.length; i < n; i++) {
|
||||
var prop = node.properties[i];
|
||||
if (prop.kind === SyntaxKind.OmittedExpression || p.name.kind === SyntaxKind.ComputedPropertyName) {
|
||||
var prop = <Declaration>node.properties[i];
|
||||
var name = <Identifier>prop.name;
|
||||
if (prop.kind === SyntaxKind.OmittedExpression || name.kind === SyntaxKind.ComputedPropertyName) {
|
||||
continue;
|
||||
}
|
||||
|
||||
var p = <Declaration>prop;
|
||||
var name = <Identifier>p.name;
|
||||
|
||||
// ECMA-262 11.1.5 Object Initialiser
|
||||
// If previous is not undefined then throw a SyntaxError exception if any of the following conditions are true
|
||||
// a.This production is contained in strict code and IsDataDescriptor(previous) is true and
|
||||
|
@ -4545,20 +4543,20 @@ module ts {
|
|||
// d.IsAccessorDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true
|
||||
// and either both previous and propId.descriptor have[[Get]] fields or both previous and propId.descriptor have[[Set]] fields
|
||||
var currentKind: number;
|
||||
if (p.kind === SyntaxKind.PropertyAssignment) {
|
||||
if (prop.kind === SyntaxKind.PropertyAssignment) {
|
||||
currentKind = Property;
|
||||
}
|
||||
else if (p.kind === SyntaxKind.ShorthandPropertyAssignment) {
|
||||
else if (prop.kind === SyntaxKind.ShorthandPropertyAssignment) {
|
||||
currentKind = Property;
|
||||
}
|
||||
else if (p.kind === SyntaxKind.GetAccessor) {
|
||||
else if (prop.kind === SyntaxKind.GetAccessor) {
|
||||
currentKind = GetAccessor;
|
||||
}
|
||||
else if (p.kind === SyntaxKind.SetAccessor) {
|
||||
else if (prop.kind === SyntaxKind.SetAccessor) {
|
||||
currentKind = SetAccesor;
|
||||
}
|
||||
else {
|
||||
Debug.fail("Unexpected syntax kind:" + p.kind);
|
||||
Debug.fail("Unexpected syntax kind:" + prop.kind);
|
||||
}
|
||||
|
||||
if (!hasProperty(seen, name.text)) {
|
||||
|
|
|
@ -4,7 +4,7 @@ tests/cases/compiler/giant.ts(28,17): error TS1056: Accessors are only available
|
|||
tests/cases/compiler/giant.ts(30,17): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/giant.ts(34,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/giant.ts(36,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/giant.ts(61,6): error TS1022: An index signature parameter must have a type annotation.
|
||||
tests/cases/compiler/giant.ts(61,5): error TS1161: Computed property names are not allowed in interfaces or type literals.
|
||||
tests/cases/compiler/giant.ts(62,5): error TS1021: An index signature must have a type annotation.
|
||||
tests/cases/compiler/giant.ts(63,6): error TS1096: An index signature must have exactly one parameter.
|
||||
tests/cases/compiler/giant.ts(88,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
|
@ -13,7 +13,7 @@ tests/cases/compiler/giant.ts(92,21): error TS1056: Accessors are only available
|
|||
tests/cases/compiler/giant.ts(94,21): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/giant.ts(98,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/giant.ts(100,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/giant.ts(125,10): error TS1022: An index signature parameter must have a type annotation.
|
||||
tests/cases/compiler/giant.ts(125,9): error TS1161: Computed property names are not allowed in interfaces or type literals.
|
||||
tests/cases/compiler/giant.ts(126,9): error TS1021: An index signature must have a type annotation.
|
||||
tests/cases/compiler/giant.ts(127,10): error TS1096: An index signature must have exactly one parameter.
|
||||
tests/cases/compiler/giant.ts(154,39): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
|
@ -23,7 +23,7 @@ tests/cases/compiler/giant.ts(171,21): error TS1056: Accessors are only availabl
|
|||
tests/cases/compiler/giant.ts(173,21): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/giant.ts(177,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/giant.ts(179,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/giant.ts(204,10): error TS1022: An index signature parameter must have a type annotation.
|
||||
tests/cases/compiler/giant.ts(204,9): error TS1161: Computed property names are not allowed in interfaces or type literals.
|
||||
tests/cases/compiler/giant.ts(205,9): error TS1021: An index signature must have a type annotation.
|
||||
tests/cases/compiler/giant.ts(206,10): error TS1096: An index signature must have exactly one parameter.
|
||||
tests/cases/compiler/giant.ts(233,39): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
|
@ -54,7 +54,7 @@ tests/cases/compiler/giant.ts(286,17): error TS1056: Accessors are only availabl
|
|||
tests/cases/compiler/giant.ts(288,17): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/giant.ts(292,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/giant.ts(294,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/giant.ts(319,6): error TS1022: An index signature parameter must have a type annotation.
|
||||
tests/cases/compiler/giant.ts(319,5): error TS1161: Computed property names are not allowed in interfaces or type literals.
|
||||
tests/cases/compiler/giant.ts(320,5): error TS1021: An index signature must have a type annotation.
|
||||
tests/cases/compiler/giant.ts(321,6): error TS1096: An index signature must have exactly one parameter.
|
||||
tests/cases/compiler/giant.ts(346,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
|
@ -63,7 +63,7 @@ tests/cases/compiler/giant.ts(350,21): error TS1056: Accessors are only availabl
|
|||
tests/cases/compiler/giant.ts(352,21): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/giant.ts(356,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/giant.ts(358,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/giant.ts(383,10): error TS1022: An index signature parameter must have a type annotation.
|
||||
tests/cases/compiler/giant.ts(383,9): error TS1161: Computed property names are not allowed in interfaces or type literals.
|
||||
tests/cases/compiler/giant.ts(384,9): error TS1021: An index signature must have a type annotation.
|
||||
tests/cases/compiler/giant.ts(385,10): error TS1096: An index signature must have exactly one parameter.
|
||||
tests/cases/compiler/giant.ts(412,39): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
|
@ -73,7 +73,7 @@ tests/cases/compiler/giant.ts(429,21): error TS1056: Accessors are only availabl
|
|||
tests/cases/compiler/giant.ts(431,21): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/giant.ts(435,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/giant.ts(437,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/giant.ts(462,10): error TS1022: An index signature parameter must have a type annotation.
|
||||
tests/cases/compiler/giant.ts(462,9): error TS1161: Computed property names are not allowed in interfaces or type literals.
|
||||
tests/cases/compiler/giant.ts(463,9): error TS1021: An index signature must have a type annotation.
|
||||
tests/cases/compiler/giant.ts(464,10): error TS1096: An index signature must have exactly one parameter.
|
||||
tests/cases/compiler/giant.ts(491,39): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
|
@ -120,7 +120,7 @@ tests/cases/compiler/giant.ts(556,21): error TS1036: Statements are not allowed
|
|||
tests/cases/compiler/giant.ts(558,24): error TS1111: A constructor implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(561,21): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(563,21): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(587,10): error TS1022: An index signature parameter must have a type annotation.
|
||||
tests/cases/compiler/giant.ts(587,9): error TS1161: Computed property names are not allowed in interfaces or type literals.
|
||||
tests/cases/compiler/giant.ts(588,9): error TS1021: An index signature must have a type annotation.
|
||||
tests/cases/compiler/giant.ts(589,10): error TS1096: An index signature must have exactly one parameter.
|
||||
tests/cases/compiler/giant.ts(606,22): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
|
@ -137,7 +137,7 @@ tests/cases/compiler/giant.ts(621,29): error TS1036: Statements are not allowed
|
|||
tests/cases/compiler/giant.ts(623,24): error TS1111: A constructor implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(626,21): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(628,21): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(653,10): error TS1022: An index signature parameter must have a type annotation.
|
||||
tests/cases/compiler/giant.ts(653,9): error TS1161: Computed property names are not allowed in interfaces or type literals.
|
||||
tests/cases/compiler/giant.ts(654,9): error TS1021: An index signature must have a type annotation.
|
||||
tests/cases/compiler/giant.ts(655,10): error TS1096: An index signature must have exactly one parameter.
|
||||
tests/cases/compiler/giant.ts(672,22): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
|
@ -360,8 +360,8 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
|
|||
|
||||
//Index Signature
|
||||
[p];
|
||||
~
|
||||
!!! error TS1022: An index signature parameter must have a type annotation.
|
||||
~~~
|
||||
!!! error TS1161: Computed property names are not allowed in interfaces or type literals.
|
||||
[p1: string];
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1021: An index signature must have a type annotation.
|
||||
|
@ -468,8 +468,8 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
|
|||
|
||||
//Index Signature
|
||||
[p];
|
||||
~
|
||||
!!! error TS1022: An index signature parameter must have a type annotation.
|
||||
~~~
|
||||
!!! error TS1161: Computed property names are not allowed in interfaces or type literals.
|
||||
[p1: string];
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1021: An index signature must have a type annotation.
|
||||
|
@ -593,8 +593,8 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
|
|||
|
||||
//Index Signature
|
||||
[p];
|
||||
~
|
||||
!!! error TS1022: An index signature parameter must have a type annotation.
|
||||
~~~
|
||||
!!! error TS1161: Computed property names are not allowed in interfaces or type literals.
|
||||
[p1: string];
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1021: An index signature must have a type annotation.
|
||||
|
@ -820,8 +820,8 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
|
|||
|
||||
//Index Signature
|
||||
[p];
|
||||
~
|
||||
!!! error TS1022: An index signature parameter must have a type annotation.
|
||||
~~~
|
||||
!!! error TS1161: Computed property names are not allowed in interfaces or type literals.
|
||||
[p1: string];
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1021: An index signature must have a type annotation.
|
||||
|
@ -928,8 +928,8 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
|
|||
|
||||
//Index Signature
|
||||
[p];
|
||||
~
|
||||
!!! error TS1022: An index signature parameter must have a type annotation.
|
||||
~~~
|
||||
!!! error TS1161: Computed property names are not allowed in interfaces or type literals.
|
||||
[p1: string];
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1021: An index signature must have a type annotation.
|
||||
|
@ -1053,8 +1053,8 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
|
|||
|
||||
//Index Signature
|
||||
[p];
|
||||
~
|
||||
!!! error TS1022: An index signature parameter must have a type annotation.
|
||||
~~~
|
||||
!!! error TS1161: Computed property names are not allowed in interfaces or type literals.
|
||||
[p1: string];
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1021: An index signature must have a type annotation.
|
||||
|
@ -1322,8 +1322,8 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
|
|||
|
||||
//Index Signature
|
||||
[p];
|
||||
~
|
||||
!!! error TS1022: An index signature parameter must have a type annotation.
|
||||
~~~
|
||||
!!! error TS1161: Computed property names are not allowed in interfaces or type literals.
|
||||
[p1: string];
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1021: An index signature must have a type annotation.
|
||||
|
@ -1424,8 +1424,8 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
|
|||
|
||||
//Index Signature
|
||||
[p];
|
||||
~
|
||||
!!! error TS1022: An index signature parameter must have a type annotation.
|
||||
~~~
|
||||
!!! error TS1161: Computed property names are not allowed in interfaces or type literals.
|
||||
[p1: string];
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1021: An index signature must have a type annotation.
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(2,6): error TS1022: An index signature parameter must have a type annotation.
|
||||
tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(2,5): error TS1161: Computed property names are not allowed in interfaces or type literals.
|
||||
tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(3,5): error TS1021: An index signature must have a type annotation.
|
||||
tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(7,6): error TS1022: An index signature parameter must have a type annotation.
|
||||
tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(7,5): error TS1164: Computed property names are not allowed in class property declarations.
|
||||
tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(12,5): error TS1021: An index signature must have a type annotation.
|
||||
|
||||
|
||||
==== tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts (4 errors) ====
|
||||
interface I {
|
||||
[x]: string;
|
||||
~
|
||||
!!! error TS1022: An index signature parameter must have a type annotation.
|
||||
~~~
|
||||
!!! error TS1161: Computed property names are not allowed in interfaces or type literals.
|
||||
[x: string];
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS1021: An index signature must have a type annotation.
|
||||
|
@ -16,8 +16,8 @@ tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(12,5): error TS1021
|
|||
|
||||
class C {
|
||||
[x]: string
|
||||
~
|
||||
!!! error TS1022: An index signature parameter must have a type annotation.
|
||||
~~~
|
||||
!!! error TS1164: Computed property names are not allowed in class property declarations.
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,22 +1,16 @@
|
|||
tests/cases/compiler/indexSignatureWithInitializer.ts(2,6): error TS1020: An index signature parameter cannot have an initializer.
|
||||
tests/cases/compiler/indexSignatureWithInitializer.ts(6,6): error TS1020: An index signature parameter cannot have an initializer.
|
||||
tests/cases/compiler/indexSignatureWithInitializer.ts(2,6): error TS2371: A parameter initializer is only allowed in a function or constructor implementation.
|
||||
tests/cases/compiler/indexSignatureWithInitializer.ts(6,6): error TS2371: A parameter initializer is only allowed in a function or constructor implementation.
|
||||
tests/cases/compiler/indexSignatureWithInitializer.ts(2,5): error TS1161: Computed property names are not allowed in interfaces or type literals.
|
||||
tests/cases/compiler/indexSignatureWithInitializer.ts(6,5): error TS1164: Computed property names are not allowed in class property declarations.
|
||||
|
||||
|
||||
==== tests/cases/compiler/indexSignatureWithInitializer.ts (4 errors) ====
|
||||
==== tests/cases/compiler/indexSignatureWithInitializer.ts (2 errors) ====
|
||||
interface I {
|
||||
[x = '']: string;
|
||||
~
|
||||
!!! error TS1020: An index signature parameter cannot have an initializer.
|
||||
~~~~~~
|
||||
!!! error TS2371: A parameter initializer is only allowed in a function or constructor implementation.
|
||||
~~~~~~~~
|
||||
!!! error TS1161: Computed property names are not allowed in interfaces or type literals.
|
||||
}
|
||||
|
||||
class C {
|
||||
[x = 0]: string
|
||||
~
|
||||
!!! error TS1020: An index signature parameter cannot have an initializer.
|
||||
~~~~~
|
||||
!!! error TS2371: A parameter initializer is only allowed in a function or constructor implementation.
|
||||
~~~~~~~
|
||||
!!! error TS1164: Computed property names are not allowed in class property declarations.
|
||||
}
|
|
@ -1,9 +1,9 @@
|
|||
tests/cases/compiler/indexWithoutParamType2.ts(2,6): error TS1022: An index signature parameter must have a type annotation.
|
||||
tests/cases/compiler/indexWithoutParamType2.ts(2,5): error TS1164: Computed property names are not allowed in class property declarations.
|
||||
|
||||
|
||||
==== tests/cases/compiler/indexWithoutParamType2.ts (1 errors) ====
|
||||
class C {
|
||||
[x]: string
|
||||
~
|
||||
!!! error TS1022: An index signature parameter must have a type annotation.
|
||||
~~~
|
||||
!!! error TS1164: Computed property names are not allowed in class property declarations.
|
||||
}
|
|
@ -1,9 +1,9 @@
|
|||
tests/cases/compiler/objectTypeWithOptionalProperty1.ts(2,10): error TS1162: An object member cannot be declared optional.
|
||||
tests/cases/compiler/objectTypeWithOptionalProperty1.ts(2,10): error TS1160: An object member cannot be declared optional.
|
||||
|
||||
|
||||
==== tests/cases/compiler/objectTypeWithOptionalProperty1.ts (1 errors) ====
|
||||
var b = {
|
||||
x?: 1 // error
|
||||
~
|
||||
!!! error TS1162: An object member cannot be declared optional.
|
||||
!!! error TS1160: An object member cannot be declared optional.
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties.ts(12,6): error TS1112: A class member cannot be declared optional.
|
||||
tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties.ts(20,6): error TS1112: A class member cannot be declared optional.
|
||||
tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties.ts(24,6): error TS1162: An object member cannot be declared optional.
|
||||
tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties.ts(24,6): error TS1160: An object member cannot be declared optional.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWithOptionalProperties.ts (3 errors) ====
|
||||
|
@ -33,5 +33,5 @@ tests/cases/conformance/types/objectTypeLiteral/methodSignatures/objectTypesWith
|
|||
var b = {
|
||||
x?: 1 // error
|
||||
~
|
||||
!!! error TS1162: An object member cannot be declared optional.
|
||||
!!! error TS1160: An object member cannot be declared optional.
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName1.ts(1,15): error TS1005: ':' expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName1.ts (1 errors) ====
|
||||
var v = { [e] };
|
||||
~
|
||||
!!! error TS1005: ':' expected.
|
|
@ -0,0 +1,9 @@
|
|||
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName10.ts(2,4): error TS1164: Computed property names are not allowed in class property declarations.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName10.ts (1 errors) ====
|
||||
class C {
|
||||
[e] = 1
|
||||
~~~
|
||||
!!! error TS1164: Computed property names are not allowed in class property declarations.
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
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) ====
|
||||
class C {
|
||||
[e]();
|
||||
~~~
|
||||
!!! error TS2391: Function implementation is missing or not immediately following the declaration.
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName13.ts(1,10): error TS1161: Computed property names are not allowed in interfaces or type literals.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName13.ts (1 errors) ====
|
||||
var v: { [e]: number };
|
||||
~~~
|
||||
!!! error TS1161: Computed property names are not allowed in interfaces or type literals.
|
|
@ -0,0 +1,7 @@
|
|||
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName14.ts(1,10): error TS1161: Computed property names are not allowed in interfaces or type literals.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName14.ts (1 errors) ====
|
||||
var v: { [e](): number };
|
||||
~~~
|
||||
!!! error TS1161: Computed property names are not allowed in interfaces or type literals.
|
|
@ -0,0 +1,7 @@
|
|||
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName15.ts(1,31): error TS1161: Computed property names are not allowed in interfaces or type literals.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName15.ts (1 errors) ====
|
||||
var v: { [e: number]: string; [e]: number };
|
||||
~~~
|
||||
!!! error TS1161: Computed property names are not allowed in interfaces or type literals.
|
|
@ -0,0 +1,9 @@
|
|||
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName16.ts(2,3): error TS1162: Computed property names are not allowed in enums.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName16.ts (1 errors) ====
|
||||
enum E {
|
||||
[e] = 1
|
||||
~~~
|
||||
!!! error TS1162: Computed property names are not allowed in enums.
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName18.ts(1,10): error TS1161: Computed property names are not allowed in interfaces or type literals.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName18.ts (1 errors) ====
|
||||
var v: { [e]?(): number };
|
||||
~~~
|
||||
!!! error TS1161: Computed property names are not allowed in interfaces or type literals.
|
|
@ -0,0 +1,7 @@
|
|||
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName19.ts(1,10): error TS1161: Computed property names are not allowed in interfaces or type literals.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName19.ts (1 errors) ====
|
||||
var v: { [e]? };
|
||||
~~~
|
||||
!!! error TS1161: Computed property names are not allowed in interfaces or type literals.
|
|
@ -0,0 +1,9 @@
|
|||
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName20.ts(2,5): error TS1161: Computed property names are not allowed in interfaces or type literals.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName20.ts (1 errors) ====
|
||||
interface I {
|
||||
[e](): number
|
||||
~~~
|
||||
!!! error TS1161: Computed property names are not allowed in interfaces or type literals.
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName21.ts(2,5): error TS1161: Computed property names are not allowed in interfaces or type literals.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName21.ts (1 errors) ====
|
||||
interface I {
|
||||
[e]: number
|
||||
~~~
|
||||
!!! error TS1161: Computed property names are not allowed in interfaces or type literals.
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName22.ts(2,5): error TS1164: Computed property names are not allowed in class property declarations.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName22.ts (1 errors) ====
|
||||
declare class C {
|
||||
[e]: number
|
||||
~~~
|
||||
!!! error TS1164: Computed property names are not allowed in class property declarations.
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName23.ts(2,9): error TS1086: An accessor cannot be declared in an ambient context.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName23.ts (1 errors) ====
|
||||
declare class C {
|
||||
get [e](): number
|
||||
~~~
|
||||
!!! error TS1086: An accessor cannot be declared in an ambient context.
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName25.ts(3,5): error TS1164: Computed property names are not allowed in class property declarations.
|
||||
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName25.ts(4,6): error TS2304: Cannot find name 'e2'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName25.ts (2 errors) ====
|
||||
class C {
|
||||
// No ASI
|
||||
[e] = 0
|
||||
~~~
|
||||
!!! error TS1164: Computed property names are not allowed in class property declarations.
|
||||
[e2] = 1
|
||||
~~
|
||||
!!! error TS2304: Cannot find name 'e2'.
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName26.ts(3,5): error TS1162: Computed property names are not allowed in enums.
|
||||
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName26.ts(4,6): error TS2304: Cannot find name 'e2'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName26.ts (2 errors) ====
|
||||
enum E {
|
||||
// No ASI
|
||||
[e] = 0
|
||||
~~~
|
||||
!!! error TS1162: Computed property names are not allowed in enums.
|
||||
[e2] = 1
|
||||
~~
|
||||
!!! error TS2304: Cannot find name 'e2'.
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName27.ts(4,9): error TS1005: ';' expected.
|
||||
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName27.ts(4,6): error TS2304: Cannot find name 'e2'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName27.ts (2 errors) ====
|
||||
class C {
|
||||
// No ASI
|
||||
[e]: number = 0
|
||||
[e2]: number
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
~~
|
||||
!!! error TS2304: Cannot find name 'e2'.
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName28.ts(2,5): error TS1164: Computed property names are not allowed in class property declarations.
|
||||
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName28.ts(3,5): error TS1164: Computed property names are not allowed in class property declarations.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName28.ts (2 errors) ====
|
||||
class C {
|
||||
[e]: number = 0;
|
||||
~~~
|
||||
!!! error TS1164: Computed property names are not allowed in class property declarations.
|
||||
[e2]: number
|
||||
~~~~
|
||||
!!! error TS1164: Computed property names are not allowed in class property declarations.
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName29.ts(3,5): error TS1164: Computed property names are not allowed in class property declarations.
|
||||
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName29.ts(4,5): error TS1164: Computed property names are not allowed in class property declarations.
|
||||
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName29.ts(3,11): error TS2304: Cannot find name 'id'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName29.ts (3 errors) ====
|
||||
class C {
|
||||
// yes ASI
|
||||
[e] = id++
|
||||
~~~
|
||||
!!! error TS1164: Computed property names are not allowed in class property declarations.
|
||||
~~
|
||||
!!! error TS2304: Cannot find name 'id'.
|
||||
[e2]: number
|
||||
~~~~
|
||||
!!! error TS1164: Computed property names are not allowed in class property declarations.
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName30.ts(4,5): error TS1005: ',' expected.
|
||||
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName30.ts(3,11): error TS2304: Cannot find name 'id'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName30.ts (2 errors) ====
|
||||
enum E {
|
||||
// no ASI, comma expected
|
||||
[e] = id++
|
||||
~~
|
||||
!!! error TS2304: Cannot find name 'id'.
|
||||
[e2] = 1
|
||||
~
|
||||
!!! error TS1005: ',' expected.
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName31.ts(3,5): error TS1164: Computed property names are not allowed in class property declarations.
|
||||
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName31.ts(4,5): error TS1164: Computed property names are not allowed in class property declarations.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName31.ts (2 errors) ====
|
||||
class C {
|
||||
// yes ASI
|
||||
[e]: number
|
||||
~~~
|
||||
!!! error TS1164: Computed property names are not allowed in class property declarations.
|
||||
[e2]: number
|
||||
~~~~
|
||||
!!! error TS1164: Computed property names are not allowed in class property declarations.
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName32.ts(2,5): error TS1163: Computed property names are not allowed in an ambient context.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName32.ts (1 errors) ====
|
||||
declare class C {
|
||||
[e](): number
|
||||
~~~
|
||||
!!! error TS1163: Computed property names are not allowed in an ambient context.
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName33.ts(4,12): error TS1005: ';' expected.
|
||||
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName33.ts(5,1): error TS1128: Declaration or statement expected.
|
||||
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName33.ts(4,6): error TS2304: Cannot find name 'e2'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName33.ts (3 errors) ====
|
||||
class C {
|
||||
// No ASI
|
||||
[e] = 0
|
||||
[e2]() { }
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
~~
|
||||
!!! error TS2304: Cannot find name 'e2'.
|
||||
}
|
||||
~
|
||||
!!! error TS1128: Declaration or statement expected.
|
|
@ -0,0 +1,17 @@
|
|||
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName34.ts(3,5): error TS1162: Computed property names are not allowed in enums.
|
||||
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName34.ts(4,5): error TS1162: Computed property names are not allowed in enums.
|
||||
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName34.ts(3,11): error TS2304: Cannot find name 'id'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName34.ts (3 errors) ====
|
||||
enum E {
|
||||
// no ASI, comma expected
|
||||
[e] = id++,
|
||||
~~~
|
||||
!!! error TS1162: Computed property names are not allowed in enums.
|
||||
~~
|
||||
!!! error TS2304: Cannot find name 'id'.
|
||||
[e2] = 1
|
||||
~~~~
|
||||
!!! error TS1162: Computed property names are not allowed in enums.
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName5.ts(1,18): error TS1005: ':' expected.
|
||||
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName5.ts(1,28): error TS1005: ',' expected.
|
||||
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName5.ts(1,32): error TS1128: Declaration or statement expected.
|
||||
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName5.ts(1,18): error TS2304: Cannot find name 'get'.
|
||||
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName5.ts(1,23): error TS2304: Cannot find name 'e'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName5.ts (5 errors) ====
|
||||
var v = { public get [e]() { } };
|
||||
~~~
|
||||
!!! error TS1005: ':' expected.
|
||||
~
|
||||
!!! error TS1005: ',' expected.
|
||||
~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
~~~
|
||||
!!! error TS2304: Cannot find name 'get'.
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'e'.
|
|
@ -0,0 +1,9 @@
|
|||
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName7.ts(2,4): error TS1164: Computed property names are not allowed in class property declarations.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName7.ts (1 errors) ====
|
||||
class C {
|
||||
[e]
|
||||
~~~
|
||||
!!! error TS1164: Computed property names are not allowed in class property declarations.
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName8.ts(2,11): error TS1164: Computed property names are not allowed in class property declarations.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName8.ts (1 errors) ====
|
||||
class C {
|
||||
public [e]
|
||||
~~~
|
||||
!!! error TS1164: Computed property names are not allowed in class property declarations.
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName9.ts(2,4): error TS1164: Computed property names are not allowed in class property declarations.
|
||||
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName9.ts(2,9): error TS2304: Cannot find name 'Type'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName9.ts (2 errors) ====
|
||||
class C {
|
||||
[e]: Type
|
||||
~~~
|
||||
!!! error TS1164: Computed property names are not allowed in class property declarations.
|
||||
~~~~
|
||||
!!! error TS2304: Cannot find name 'Type'.
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName1.ts(2,5): error TS1164: Computed property names are not allowed in class property declarations.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName1.ts (1 errors) ====
|
||||
declare class C {
|
||||
[e]: number
|
||||
~~~
|
||||
!!! error TS1164: Computed property names are not allowed in class property declarations.
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName10.ts(2,4): error TS1164: Computed property names are not allowed in class property declarations.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName10.ts (1 errors) ====
|
||||
class C {
|
||||
[e] = 1
|
||||
~~~
|
||||
!!! error TS1164: Computed property names are not allowed in class property declarations.
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName11.ts(2,4): error TS1165: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName11.ts(2,4): error TS2391: Function implementation is missing or not immediately following the declaration.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName11.ts (2 errors) ====
|
||||
class C {
|
||||
[e]();
|
||||
~~~
|
||||
!!! error TS1165: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
~~~
|
||||
!!! error TS2391: Function implementation is missing or not immediately following the declaration.
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName2.ts(1,11): error TS1165: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName2.ts (1 errors) ====
|
||||
var v = { [e]: 1 };
|
||||
~~~
|
||||
!!! error TS1165: Computed property names are only available when targeting ECMAScript 6 and higher.
|
|
@ -0,0 +1,7 @@
|
|||
tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName3.ts(1,11): error TS1165: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName3.ts (1 errors) ====
|
||||
var v = { [e]() { } };
|
||||
~~~
|
||||
!!! error TS1165: Computed property names are only available when targeting ECMAScript 6 and higher.
|
|
@ -0,0 +1,7 @@
|
|||
tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName4.ts(1,15): error TS1165: Computed property names are only available when targeting ECMAScript 6 and higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName4.ts (1 errors) ====
|
||||
var v = { get [e]() { } };
|
||||
~~~
|
||||
!!! error TS1165: Computed property names are only available when targeting ECMAScript 6 and higher.
|
|
@ -0,0 +1,9 @@
|
|||
tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName5.ts(2,5): error TS1161: Computed property names are not allowed in interfaces or type literals.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName5.ts (1 errors) ====
|
||||
interface I {
|
||||
[e]: number
|
||||
~~~
|
||||
!!! error TS1161: Computed property names are not allowed in interfaces or type literals.
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName6.ts(2,3): error TS1162: Computed property names are not allowed in enums.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName6.ts (1 errors) ====
|
||||
enum E {
|
||||
[e] = 1
|
||||
~~~
|
||||
!!! error TS1162: Computed property names are not allowed in enums.
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName7.ts(2,4): error TS1164: Computed property names are not allowed in class property declarations.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName7.ts (1 errors) ====
|
||||
class C {
|
||||
[e]
|
||||
~~~
|
||||
!!! error TS1164: Computed property names are not allowed in class property declarations.
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName8.ts(1,10): error TS1161: Computed property names are not allowed in interfaces or type literals.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName8.ts (1 errors) ====
|
||||
var v: { [e]: number };
|
||||
~~~
|
||||
!!! error TS1161: Computed property names are not allowed in interfaces or type literals.
|
|
@ -0,0 +1,12 @@
|
|||
tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName9.ts(2,4): error TS1164: Computed property names are not allowed in class property declarations.
|
||||
tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName9.ts(2,9): error TS2304: Cannot find name 'Type'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName9.ts (2 errors) ====
|
||||
class C {
|
||||
[e]: Type
|
||||
~~~
|
||||
!!! error TS1164: Computed property names are not allowed in class property declarations.
|
||||
~~~~
|
||||
!!! error TS2304: Cannot find name 'Type'.
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature11.ts(2,10): error TS1022: An index signature parameter must have a type annotation.
|
||||
tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature11.ts(2,9): error TS1161: Computed property names are not allowed in interfaces or type literals.
|
||||
tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature11.ts(3,9): error TS1021: An index signature must have a type annotation.
|
||||
tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature11.ts(4,10): error TS1096: An index signature must have exactly one parameter.
|
||||
|
||||
|
@ -6,8 +6,8 @@ tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature1
|
|||
==== tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature11.ts (3 errors) ====
|
||||
interface I {
|
||||
[p];
|
||||
~
|
||||
!!! error TS1022: An index signature parameter must have a type annotation.
|
||||
~~~
|
||||
!!! error TS1161: Computed property names are not allowed in interfaces or type literals.
|
||||
[p1: string];
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1021: An index signature must have a type annotation.
|
||||
|
|
|
@ -1,12 +1,9 @@
|
|||
tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature4.ts(2,4): error TS1020: An index signature parameter cannot have an initializer.
|
||||
tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature4.ts(2,4): error TS2371: A parameter initializer is only allowed in a function or constructor implementation.
|
||||
tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature4.ts(2,3): error TS1161: Computed property names are not allowed in interfaces or type literals.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature4.ts (2 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature4.ts (1 errors) ====
|
||||
interface I {
|
||||
[a = 0]
|
||||
~
|
||||
!!! error TS1020: An index signature parameter cannot have an initializer.
|
||||
~~~~~
|
||||
!!! error TS2371: A parameter initializer is only allowed in a function or constructor implementation.
|
||||
~~~~~~~
|
||||
!!! error TS1161: Computed property names are not allowed in interfaces or type literals.
|
||||
}
|
|
@ -1,9 +1,9 @@
|
|||
tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature5.ts(2,4): error TS1022: An index signature parameter must have a type annotation.
|
||||
tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature5.ts(2,3): error TS1161: Computed property names are not allowed in interfaces or type literals.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature5.ts (1 errors) ====
|
||||
interface I {
|
||||
[a]
|
||||
~
|
||||
!!! error TS1022: An index signature parameter must have a type annotation.
|
||||
~~~
|
||||
!!! error TS1161: Computed property names are not allowed in interfaces or type literals.
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
tests/cases/compiler/propertyAssignment.ts(6,14): error TS1022: An index signature parameter must have a type annotation.
|
||||
tests/cases/compiler/propertyAssignment.ts(6,13): error TS1161: Computed property names are not allowed in interfaces or type literals.
|
||||
tests/cases/compiler/propertyAssignment.ts(14,1): error TS2322: Type '{ x: number; }' is not assignable to type 'new () => any'.
|
||||
tests/cases/compiler/propertyAssignment.ts(16,1): error TS2322: Type '{ x: number; }' is not assignable to type '() => void'.
|
||||
|
||||
|
@ -10,8 +10,8 @@ tests/cases/compiler/propertyAssignment.ts(16,1): error TS2322: Type '{ x: numbe
|
|||
var bar1: { x : number; }
|
||||
|
||||
var foo2: { [index]; } // should be an error
|
||||
~~~~~
|
||||
!!! error TS1022: An index signature parameter must have a type annotation.
|
||||
~~~~~~~
|
||||
!!! error TS1161: Computed property names are not allowed in interfaces or type literals.
|
||||
var bar2: { x : number; }
|
||||
|
||||
var foo3: { ():void; }
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
tests/cases/compiler/spaceBeforeQuestionMarkInPropertyAssignment.ts(1,12): error TS1162: An object member cannot be declared optional.
|
||||
tests/cases/compiler/spaceBeforeQuestionMarkInPropertyAssignment.ts(1,12): error TS1160: An object member cannot be declared optional.
|
||||
|
||||
|
||||
==== tests/cases/compiler/spaceBeforeQuestionMarkInPropertyAssignment.ts (1 errors) ====
|
||||
var x = {x ?: 1} // should not crash
|
||||
~
|
||||
!!! error TS1162: An object member cannot be declared optional.
|
||||
!!! error TS1160: An object member cannot be declared optional.
|
|
@ -0,0 +1,4 @@
|
|||
//@target: ES5
|
||||
declare class C {
|
||||
[e]: number
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
//@target: ES5
|
||||
class C {
|
||||
[e] = 1
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
//@target: ES5
|
||||
class C {
|
||||
[e]();
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
//@target: ES5
|
||||
var v = { [e]: 1 };
|
|
@ -0,0 +1,2 @@
|
|||
//@target: ES5
|
||||
var v = { [e]() { } };
|
|
@ -0,0 +1,2 @@
|
|||
//@target: ES5
|
||||
var v = { get [e]() { } };
|
|
@ -0,0 +1,4 @@
|
|||
//@target: ES5
|
||||
interface I {
|
||||
[e]: number
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
//@target: ES5
|
||||
enum E {
|
||||
[e] = 1
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
//@target: ES5
|
||||
class C {
|
||||
[e]
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
//@target: ES5
|
||||
var v: { [e]: number };
|
|
@ -0,0 +1,4 @@
|
|||
//@target: ES5
|
||||
class C {
|
||||
[e]: Type
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
//@target: ES6
|
||||
var v = { [e] };
|
|
@ -0,0 +1,4 @@
|
|||
//@target: ES6
|
||||
class C {
|
||||
[e] = 1
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
//@target: ES6
|
||||
class C {
|
||||
[e]();
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
//@target: ES6
|
||||
class C {
|
||||
[e]() { }
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
//@target: ES6
|
||||
var v: { [e]: number };
|
|
@ -0,0 +1,2 @@
|
|||
//@target: ES6
|
||||
var v: { [e](): number };
|
|
@ -0,0 +1,2 @@
|
|||
//@target: ES6
|
||||
var v: { [e: number]: string; [e]: number };
|
|
@ -0,0 +1,4 @@
|
|||
//@target: ES6
|
||||
enum E {
|
||||
[e] = 1
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
//@target: ES6
|
||||
var v = { set [e](v) { } }
|
|
@ -0,0 +1,2 @@
|
|||
//@target: ES6
|
||||
var v: { [e]?(): number };
|
|
@ -0,0 +1,2 @@
|
|||
//@target: ES6
|
||||
var v: { [e]? };
|
|
@ -0,0 +1,2 @@
|
|||
//@target: ES6
|
||||
var v = { [e]: 1 };
|
|
@ -0,0 +1,4 @@
|
|||
//@target: ES6
|
||||
interface I {
|
||||
[e](): number
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
//@target: ES6
|
||||
interface I {
|
||||
[e]: number
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
//@target: ES6
|
||||
declare class C {
|
||||
[e]: number
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
//@target: ES6
|
||||
declare class C {
|
||||
get [e](): number
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
//@target: ES6
|
||||
class C {
|
||||
set [e](v) { }
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
//@target: ES6
|
||||
class C {
|
||||
// No ASI
|
||||
[e] = 0
|
||||
[e2] = 1
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
//@target: ES6
|
||||
enum E {
|
||||
// No ASI
|
||||
[e] = 0
|
||||
[e2] = 1
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
//@target: ES6
|
||||
class C {
|
||||
// No ASI
|
||||
[e]: number = 0
|
||||
[e2]: number
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
//@target: ES6
|
||||
class C {
|
||||
[e]: number = 0;
|
||||
[e2]: number
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
//@target: ES6
|
||||
class C {
|
||||
// yes ASI
|
||||
[e] = id++
|
||||
[e2]: number
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
//@target: ES6
|
||||
var v = { [e]() { } };
|
|
@ -0,0 +1,6 @@
|
|||
//@target: ES6
|
||||
enum E {
|
||||
// no ASI, comma expected
|
||||
[e] = id++
|
||||
[e2] = 1
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
//@target: ES6
|
||||
class C {
|
||||
// yes ASI
|
||||
[e]: number
|
||||
[e2]: number
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
//@target: ES6
|
||||
declare class C {
|
||||
[e](): number
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
//@target: ES6
|
||||
class C {
|
||||
// No ASI
|
||||
[e] = 0
|
||||
[e2]() { }
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
//@target: ES6
|
||||
enum E {
|
||||
// no ASI, comma expected
|
||||
[e] = id++,
|
||||
[e2] = 1
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
//@target: ES6
|
||||
var v = { get [e]() { } };
|
|
@ -0,0 +1,2 @@
|
|||
//@target: ES6
|
||||
var v = { public get [e]() { } };
|
|
@ -0,0 +1,2 @@
|
|||
//@target: ES6
|
||||
var v = { [e]: 1, [e + e]: 2 };
|
|
@ -0,0 +1,4 @@
|
|||
//@target: ES6
|
||||
class C {
|
||||
[e]
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
//@target: ES6
|
||||
class C {
|
||||
public [e]
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
//@target: ES6
|
||||
class C {
|
||||
[e]: Type
|
||||
}
|
Loading…
Reference in a new issue