Accept new baselines

This commit is contained in:
Anders Hejlsberg
2016-10-31 15:29:02 -07:00
parent f9e208533a
commit 03f8403e85
22 changed files with 180 additions and 143 deletions

View File

@@ -15,7 +15,7 @@ tests/cases/compiler/constDeclarations-access3.ts(22,3): error TS2540: Cannot as
tests/cases/compiler/constDeclarations-access3.ts(23,5): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations-access3.ts(24,5): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations-access3.ts(26,7): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations-access3.ts(28,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property.
tests/cases/compiler/constDeclarations-access3.ts(28,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
==== tests/cases/compiler/constDeclarations-access3.ts (18 errors) ====
@@ -81,8 +81,8 @@ tests/cases/compiler/constDeclarations-access3.ts(28,1): error TS2450: Left-hand
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
M["x"] = 0;
~~~~~~
!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property.
~~~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
// OK
var a = M.x + 1;

View File

@@ -15,7 +15,7 @@ tests/cases/compiler/constDeclarations-access4.ts(22,3): error TS2540: Cannot as
tests/cases/compiler/constDeclarations-access4.ts(23,5): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations-access4.ts(24,5): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations-access4.ts(26,7): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations-access4.ts(28,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property.
tests/cases/compiler/constDeclarations-access4.ts(28,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
==== tests/cases/compiler/constDeclarations-access4.ts (18 errors) ====
@@ -81,8 +81,8 @@ tests/cases/compiler/constDeclarations-access4.ts(28,1): error TS2450: Left-hand
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
M["x"] = 0;
~~~~~~
!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property.
~~~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
// OK
var a = M.x + 1;

View File

@@ -15,7 +15,7 @@ tests/cases/compiler/constDeclarations_access_2.ts(18,3): error TS2540: Cannot a
tests/cases/compiler/constDeclarations_access_2.ts(19,5): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations_access_2.ts(20,5): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations_access_2.ts(22,7): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/constDeclarations_access_2.ts(24,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property.
tests/cases/compiler/constDeclarations_access_2.ts(24,3): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
==== tests/cases/compiler/constDeclarations_access_2.ts (18 errors) ====
@@ -77,8 +77,8 @@ tests/cases/compiler/constDeclarations_access_2.ts(24,1): error TS2450: Left-han
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
m["x"] = 0;
~~~~~~
!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property.
~~~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
// OK
var a = m.x + 1;

View File

@@ -1,8 +1,8 @@
tests/cases/compiler/constEnumBadPropertyNames.ts(2,11): error TS2479: Property 'B' does not exist on 'const' enum 'E'.
tests/cases/compiler/constEnumBadPropertyNames.ts(2,11): error TS2339: Property 'B' does not exist on type 'typeof E'.
==== tests/cases/compiler/constEnumBadPropertyNames.ts (1 errors) ====
const enum E { A }
var x = E["B"]
~~~
!!! error TS2479: Property 'B' does not exist on 'const' enum 'E'.
!!! error TS2339: Property 'B' does not exist on type 'typeof E'.

View File

@@ -76,16 +76,16 @@ enum numbersNotConst {
}
let s3 = test[numbersNotConst.zero];
>s3 : any
>test[numbersNotConst.zero] : any
>s3 : string
>test[numbersNotConst.zero] : string
>test : indexAccess
>numbersNotConst.zero : numbersNotConst.zero
>numbersNotConst : typeof numbersNotConst
>zero : numbersNotConst.zero
let n3 = test[numbersNotConst.one];
>n3 : any
>test[numbersNotConst.one] : any
>n3 : number
>test[numbersNotConst.one] : number
>test : indexAccess
>numbersNotConst.one : numbersNotConst.one
>numbersNotConst : typeof numbersNotConst

View File

@@ -1,7 +1,7 @@
tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumType.ts(6,25): error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property.
tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumType.ts(6,31): error TS2540: Cannot assign to 'A' because it is a constant or a read-only property.
tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumType.ts(7,29): error TS2540: Cannot assign to 'A' because it is a constant or a read-only property.
tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumType.ts(10,3): error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property.
tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumType.ts(12,1): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumType.ts(10,9): error TS2540: Cannot assign to 'A' because it is a constant or a read-only property.
tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumType.ts(12,1): error TS2542: Index signature in type 'typeof ENUM1' only permits reading.
tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithEnumType.ts(12,7): error TS2304: Cannot find name 'A'.
@@ -12,19 +12,19 @@ tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOp
// expression
var ResultIsNumber1 = --ENUM1["A"];
~~~~~~~~~~
!!! error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property.
~~~
!!! error TS2540: Cannot assign to 'A' because it is a constant or a read-only property.
var ResultIsNumber2 = ENUM1.A--;
~
!!! error TS2540: Cannot assign to 'A' because it is a constant or a read-only property.
// miss assignment operator
--ENUM1["A"];
~~~~~~~~~~
!!! error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property.
~~~
!!! error TS2540: Cannot assign to 'A' because it is a constant or a read-only property.
ENUM1[A]--;
~~~~~~~~
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
!!! error TS2542: Index signature in type 'typeof ENUM1' only permits reading.
~
!!! error TS2304: Cannot find name 'A'.

View File

@@ -1,23 +1,23 @@
tests/cases/compiler/f2.ts(7,7): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/f2.ts(8,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property.
tests/cases/compiler/f2.ts(8,7): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/f2.ts(9,7): error TS2339: Property 'blah' does not exist on type 'typeof "tests/cases/compiler/f1"'.
tests/cases/compiler/f2.ts(12,7): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/f2.ts(13,1): error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property.
tests/cases/compiler/f2.ts(13,7): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/f2.ts(17,8): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/f2.ts(18,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property.
tests/cases/compiler/f2.ts(18,8): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/f2.ts(19,8): error TS2339: Property 'blah' does not exist on type 'typeof "tests/cases/compiler/f1"'.
tests/cases/compiler/f2.ts(22,8): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/f2.ts(23,1): error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property.
tests/cases/compiler/f2.ts(23,8): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/f2.ts(27,12): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/f2.ts(28,12): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/f2.ts(29,6): error TS2405: The left-hand side of a 'for...in' statement must be of type 'string' or 'any'.
tests/cases/compiler/f2.ts(30,6): error TS2485: The left-hand side of a 'for...of' statement cannot be a constant or a read-only property.
tests/cases/compiler/f2.ts(29,12): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/f2.ts(30,12): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/f2.ts(31,12): error TS2339: Property 'blah' does not exist on type 'typeof "tests/cases/compiler/f1"'.
tests/cases/compiler/f2.ts(32,12): error TS2339: Property 'blah' does not exist on type 'typeof "tests/cases/compiler/f1"'.
tests/cases/compiler/f2.ts(36,13): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/f2.ts(37,13): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/f2.ts(38,6): error TS2405: The left-hand side of a 'for...in' statement must be of type 'string' or 'any'.
tests/cases/compiler/f2.ts(39,6): error TS2485: The left-hand side of a 'for...of' statement cannot be a constant or a read-only property.
tests/cases/compiler/f2.ts(38,13): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/f2.ts(39,13): error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
tests/cases/compiler/f2.ts(40,13): error TS2339: Property 'blah' does not exist on type 'typeof "tests/cases/compiler/f1"'.
tests/cases/compiler/f2.ts(41,13): error TS2339: Property 'blah' does not exist on type 'typeof "tests/cases/compiler/f1"'.
@@ -36,8 +36,8 @@ tests/cases/compiler/f2.ts(41,13): error TS2339: Property 'blah' does not exist
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
stuff['x'] = 1;
~~~~~~~~~~
!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property.
~~~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
stuff.blah = 2;
~~~~
!!! error TS2339: Property 'blah' does not exist on type 'typeof "tests/cases/compiler/f1"'.
@@ -47,8 +47,8 @@ tests/cases/compiler/f2.ts(41,13): error TS2339: Property 'blah' does not exist
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
stuff['x']++;
~~~~~~~~~~
!!! error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property.
~~~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
stuff['blah']++;
stuff[n]++;
@@ -56,8 +56,8 @@ tests/cases/compiler/f2.ts(41,13): error TS2339: Property 'blah' does not exist
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
(stuff['x']) = 1;
~~~~~~~~~~~~
!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property.
~~~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
(stuff.blah) = 2;
~~~~
!!! error TS2339: Property 'blah' does not exist on type 'typeof "tests/cases/compiler/f1"'.
@@ -67,8 +67,8 @@ tests/cases/compiler/f2.ts(41,13): error TS2339: Property 'blah' does not exist
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
(stuff['x'])++;
~~~~~~~~~~~~
!!! error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property.
~~~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
(stuff['blah'])++;
(stuff[n])++;
@@ -79,11 +79,11 @@ tests/cases/compiler/f2.ts(41,13): error TS2339: Property 'blah' does not exist
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
for (stuff['x'] in []) {}
~~~~~~~~~~
!!! error TS2405: The left-hand side of a 'for...in' statement must be of type 'string' or 'any'.
~~~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
for (stuff['x'] of []) {}
~~~~~~~~~~
!!! error TS2485: The left-hand side of a 'for...of' statement cannot be a constant or a read-only property.
~~~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
for (stuff.blah in []) {}
~~~~
!!! error TS2339: Property 'blah' does not exist on type 'typeof "tests/cases/compiler/f1"'.
@@ -100,11 +100,11 @@ tests/cases/compiler/f2.ts(41,13): error TS2339: Property 'blah' does not exist
~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
for ((stuff['x']) in []) {}
~~~~~~~~~~~~
!!! error TS2405: The left-hand side of a 'for...in' statement must be of type 'string' or 'any'.
~~~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
for ((stuff['x']) of []) {}
~~~~~~~~~~~~
!!! error TS2485: The left-hand side of a 'for...of' statement cannot be a constant or a read-only property.
~~~
!!! error TS2540: Cannot assign to 'x' because it is a constant or a read-only property.
for ((stuff.blah) in []) {}
~~~~
!!! error TS2339: Property 'blah' does not exist on type 'typeof "tests/cases/compiler/f1"'.

View File

@@ -1,4 +1,4 @@
tests/cases/conformance/statements/for-inStatements/for-inStatementsArrayErrors.ts(5,14): error TS7015: Element implicitly has an 'any' type because index expression is not of type 'number'.
tests/cases/conformance/statements/for-inStatements/for-inStatementsArrayErrors.ts(5,16): error TS7015: Element implicitly has an 'any' type because index expression is not of type 'number'.
tests/cases/conformance/statements/for-inStatements/for-inStatementsArrayErrors.ts(6,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
tests/cases/conformance/statements/for-inStatements/for-inStatementsArrayErrors.ts(7,9): error TS2365: Operator '===' cannot be applied to types 'string' and 'number'.
tests/cases/conformance/statements/for-inStatements/for-inStatementsArrayErrors.ts(9,16): error TS2339: Property 'unknownProperty' does not exist on type 'string'.
@@ -12,7 +12,7 @@ tests/cases/conformance/statements/for-inStatements/for-inStatementsArrayErrors.
for (let x in a) {
let a1 = a[x + 1];
~~~~~~~~
~~~~~
!!! error TS7015: Element implicitly has an 'any' type because index expression is not of type 'number'.
let a2 = a[x - 1];
~

View File

@@ -1,6 +1,6 @@
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumType.ts(6,25): error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property.
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumType.ts(6,31): error TS2540: Cannot assign to 'B' because it is a constant or a read-only property.
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumType.ts(7,29): error TS2540: Cannot assign to 'B' because it is a constant or a read-only property.
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumType.ts(10,3): error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property.
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumType.ts(10,9): error TS2540: Cannot assign to 'B' because it is a constant or a read-only property.
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithEnumType.ts(12,7): error TS2540: Cannot assign to 'B' because it is a constant or a read-only property.
@@ -11,16 +11,16 @@ tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOp
// expression
var ResultIsNumber1 = ++ENUM1["B"];
~~~~~~~~~~
!!! error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property.
~~~
!!! error TS2540: Cannot assign to 'B' because it is a constant or a read-only property.
var ResultIsNumber2 = ENUM1.B++;
~
!!! error TS2540: Cannot assign to 'B' because it is a constant or a read-only property.
// miss assignment operator
++ENUM1["B"];
~~~~~~~~~~
!!! error TS2449: The operand of an increment or decrement operator cannot be a constant or a read-only property.
~~~
!!! error TS2540: Cannot assign to 'B' because it is a constant or a read-only property.
ENUM1.B++;
~

View File

@@ -5,7 +5,7 @@ tests/cases/compiler/indexTypeCheck.ts(22,2): error TS2413: Numeric index type '
tests/cases/compiler/indexTypeCheck.ts(27,2): error TS2413: Numeric index type 'number' is not assignable to string index type 'string'.
tests/cases/compiler/indexTypeCheck.ts(32,3): error TS1096: An index signature must have exactly one parameter.
tests/cases/compiler/indexTypeCheck.ts(36,3): error TS1023: An index signature parameter type must be 'string' or 'number'.
tests/cases/compiler/indexTypeCheck.ts(51,1): error TS2342: An index expression argument must be of type 'string', 'number', 'symbol', or 'any'.
tests/cases/compiler/indexTypeCheck.ts(51,8): error TS2538: Type 'Blue' cannot be used as an index type.
==== tests/cases/compiler/indexTypeCheck.ts (8 errors) ====
@@ -74,8 +74,8 @@ tests/cases/compiler/indexTypeCheck.ts(51,1): error TS2342: An index expression
s[<any>{}]; // ok
yellow[blue]; // error
~~~~~~~~~~~~
!!! error TS2342: An index expression argument must be of type 'string', 'number', 'symbol', or 'any'.
~~~~
!!! error TS2538: Type 'Blue' cannot be used as an index type.
var x:number[];
x[0];

View File

@@ -0,0 +1,28 @@
tests/cases/compiler/indexWithUndefinedAndNull.ts(9,21): error TS2538: Type 'undefined' cannot be used as an index type.
tests/cases/compiler/indexWithUndefinedAndNull.ts(10,9): error TS2538: Type 'null' cannot be used as an index type.
tests/cases/compiler/indexWithUndefinedAndNull.ts(11,21): error TS2538: Type 'undefined' cannot be used as an index type.
tests/cases/compiler/indexWithUndefinedAndNull.ts(12,9): error TS2538: Type 'null' cannot be used as an index type.
==== tests/cases/compiler/indexWithUndefinedAndNull.ts (4 errors) ====
interface N {
[n: number]: string;
}
interface S {
[s: string]: number;
}
let n: N;
let s: S;
let str: string = n[undefined];
~~~~~~~~~
!!! error TS2538: Type 'undefined' cannot be used as an index type.
str = n[null];
~~~~
!!! error TS2538: Type 'null' cannot be used as an index type.
let num: number = s[undefined];
~~~~~~~~~
!!! error TS2538: Type 'undefined' cannot be used as an index type.
num = s[null];
~~~~
!!! error TS2538: Type 'null' cannot be used as an index type.

View File

@@ -1,11 +1,11 @@
tests/cases/compiler/indexWithUndefinedAndNullStrictNullChecks.ts(9,19): error TS2454: Variable 'n' is used before being assigned.
tests/cases/compiler/indexWithUndefinedAndNullStrictNullChecks.ts(9,19): error TS2342: An index expression argument must be of type 'string', 'number', 'symbol', or 'any'.
tests/cases/compiler/indexWithUndefinedAndNullStrictNullChecks.ts(9,21): error TS2538: Type 'undefined' cannot be used as an index type.
tests/cases/compiler/indexWithUndefinedAndNullStrictNullChecks.ts(10,7): error TS2454: Variable 'n' is used before being assigned.
tests/cases/compiler/indexWithUndefinedAndNullStrictNullChecks.ts(10,7): error TS2342: An index expression argument must be of type 'string', 'number', 'symbol', or 'any'.
tests/cases/compiler/indexWithUndefinedAndNullStrictNullChecks.ts(10,9): error TS2538: Type 'null' cannot be used as an index type.
tests/cases/compiler/indexWithUndefinedAndNullStrictNullChecks.ts(11,19): error TS2454: Variable 's' is used before being assigned.
tests/cases/compiler/indexWithUndefinedAndNullStrictNullChecks.ts(11,19): error TS2342: An index expression argument must be of type 'string', 'number', 'symbol', or 'any'.
tests/cases/compiler/indexWithUndefinedAndNullStrictNullChecks.ts(11,21): error TS2538: Type 'undefined' cannot be used as an index type.
tests/cases/compiler/indexWithUndefinedAndNullStrictNullChecks.ts(12,7): error TS2454: Variable 's' is used before being assigned.
tests/cases/compiler/indexWithUndefinedAndNullStrictNullChecks.ts(12,7): error TS2342: An index expression argument must be of type 'string', 'number', 'symbol', or 'any'.
tests/cases/compiler/indexWithUndefinedAndNullStrictNullChecks.ts(12,9): error TS2538: Type 'null' cannot be used as an index type.
==== tests/cases/compiler/indexWithUndefinedAndNullStrictNullChecks.ts (8 errors) ====
@@ -20,21 +20,21 @@ tests/cases/compiler/indexWithUndefinedAndNullStrictNullChecks.ts(12,7): error T
let str: string = n[undefined];
~
!!! error TS2454: Variable 'n' is used before being assigned.
~~~~~~~~~~~~
!!! error TS2342: An index expression argument must be of type 'string', 'number', 'symbol', or 'any'.
~~~~~~~~~
!!! error TS2538: Type 'undefined' cannot be used as an index type.
str = n[null];
~
!!! error TS2454: Variable 'n' is used before being assigned.
~~~~~~~
!!! error TS2342: An index expression argument must be of type 'string', 'number', 'symbol', or 'any'.
~~~~
!!! error TS2538: Type 'null' cannot be used as an index type.
let num: number = s[undefined];
~
!!! error TS2454: Variable 's' is used before being assigned.
~~~~~~~~~~~~
!!! error TS2342: An index expression argument must be of type 'string', 'number', 'symbol', or 'any'.
~~~~~~~~~
!!! error TS2538: Type 'undefined' cannot be used as an index type.
num = s[null];
~
!!! error TS2454: Variable 's' is used before being assigned.
~~~~~~~
!!! error TS2342: An index expression argument must be of type 'string', 'number', 'symbol', or 'any'.
~~~~
!!! error TS2538: Type 'null' cannot be used as an index type.

View File

@@ -1,5 +1,5 @@
tests/cases/compiler/noImplicitAnyForIn.ts(8,18): error TS7017: Index signature of object type implicitly has an 'any' type.
tests/cases/compiler/noImplicitAnyForIn.ts(15,18): error TS7017: Index signature of object type implicitly has an 'any' type.
tests/cases/compiler/noImplicitAnyForIn.ts(8,18): error TS7017: Element implicitly has an 'any' type because type '{}' has no index signature.
tests/cases/compiler/noImplicitAnyForIn.ts(15,18): error TS7017: Element implicitly has an 'any' type because type '{}' has no index signature.
tests/cases/compiler/noImplicitAnyForIn.ts(29,5): error TS7005: Variable 'n' implicitly has an 'any[][]' type.
tests/cases/compiler/noImplicitAnyForIn.ts(31,6): error TS2405: The left-hand side of a 'for...in' statement must be of type 'string' or 'any'.
@@ -14,7 +14,7 @@ tests/cases/compiler/noImplicitAnyForIn.ts(31,6): error TS2405: The left-hand si
//Should yield an implicit 'any' error
var _j = x[i][j];
~~~~~~~
!!! error TS7017: Index signature of object type implicitly has an 'any' type.
!!! error TS7017: Element implicitly has an 'any' type because type '{}' has no index signature.
}
for (var k in x[0]) {
@@ -23,7 +23,7 @@ tests/cases/compiler/noImplicitAnyForIn.ts(31,6): error TS2405: The left-hand si
//Should yield an implicit 'any' error
var k2 = k1[k];
~~~~~
!!! error TS7017: Index signature of object type implicitly has an 'any' type.
!!! error TS7017: Element implicitly has an 'any' type because type '{}' has no index signature.
}
}

View File

@@ -1,7 +1,7 @@
tests/cases/compiler/noImplicitAnyIndexing.ts(13,26): error TS7015: Element implicitly has an 'any' type because index expression is not of type 'number'.
tests/cases/compiler/noImplicitAnyIndexing.ts(20,9): error TS7017: Index signature of object type implicitly has an 'any' type.
tests/cases/compiler/noImplicitAnyIndexing.ts(23,9): error TS7017: Index signature of object type implicitly has an 'any' type.
tests/cases/compiler/noImplicitAnyIndexing.ts(31,10): error TS7017: Index signature of object type implicitly has an 'any' type.
tests/cases/compiler/noImplicitAnyIndexing.ts(13,37): error TS7015: Element implicitly has an 'any' type because index expression is not of type 'number'.
tests/cases/compiler/noImplicitAnyIndexing.ts(20,9): error TS7017: Element implicitly has an 'any' type because type '{}' has no index signature.
tests/cases/compiler/noImplicitAnyIndexing.ts(23,9): error TS7017: Element implicitly has an 'any' type because type '{}' has no index signature.
tests/cases/compiler/noImplicitAnyIndexing.ts(31,10): error TS7017: Element implicitly has an 'any' type because type '{}' has no index signature.
==== tests/cases/compiler/noImplicitAnyIndexing.ts (4 errors) ====
@@ -18,7 +18,7 @@ tests/cases/compiler/noImplicitAnyIndexing.ts(31,10): error TS7017: Index signat
// Should be implicit 'any' ; property access fails, no string indexer.
var strRepresentation3 = MyEmusEnum["monehh"];
~~~~~~~~~~~~~~~~~~~~
~~~~~~~~
!!! error TS7015: Element implicitly has an 'any' type because index expression is not of type 'number'.
// Should be okay; should be a MyEmusEnum
@@ -28,12 +28,12 @@ tests/cases/compiler/noImplicitAnyIndexing.ts(31,10): error TS7017: Index signat
// Should report an implicit 'any'.
var x = {}["hi"];
~~~~~~~~
!!! error TS7017: Index signature of object type implicitly has an 'any' type.
!!! error TS7017: Element implicitly has an 'any' type because type '{}' has no index signature.
// Should report an implicit 'any'.
var y = {}[10];
~~~~~~
!!! error TS7017: Index signature of object type implicitly has an 'any' type.
!!! error TS7017: Element implicitly has an 'any' type because type '{}' has no index signature.
var hi: any = "hi";
@@ -43,7 +43,7 @@ tests/cases/compiler/noImplicitAnyIndexing.ts(31,10): error TS7017: Index signat
// Should report an implicit 'any'.
var z1 = emptyObj[hi];
~~~~~~~~~~~~
!!! error TS7017: Index signature of object type implicitly has an 'any' type.
!!! error TS7017: Element implicitly has an 'any' type because type '{}' has no index signature.
var z2 = (<any>emptyObj)[hi];
interface MyMap<T> {

View File

@@ -1,8 +1,8 @@
tests/cases/compiler/noImplicitAnyStringIndexerOnObject.ts(2,9): error TS7017: Index signature of object type implicitly has an 'any' type.
tests/cases/compiler/noImplicitAnyStringIndexerOnObject.ts(2,9): error TS7017: Element implicitly has an 'any' type because type '{}' has no index signature.
==== tests/cases/compiler/noImplicitAnyStringIndexerOnObject.ts (1 errors) ====
var x = {}["hello"];
~~~~~~~~~~~
!!! error TS7017: Index signature of object type implicitly has an 'any' type.
!!! error TS7017: Element implicitly has an 'any' type because type '{}' has no index signature.

View File

@@ -1,6 +1,6 @@
tests/cases/compiler/objectCreationOfElementAccessExpression.ts(53,17): error TS2342: An index expression argument must be of type 'string', 'number', 'symbol', or 'any'.
tests/cases/compiler/objectCreationOfElementAccessExpression.ts(53,25): error TS2538: Type 'Cookie' cannot be used as an index type.
tests/cases/compiler/objectCreationOfElementAccessExpression.ts(53,63): error TS2348: Value of type 'typeof Cookie' is not callable. Did you mean to include 'new'?
tests/cases/compiler/objectCreationOfElementAccessExpression.ts(54,33): error TS2342: An index expression argument must be of type 'string', 'number', 'symbol', or 'any'.
tests/cases/compiler/objectCreationOfElementAccessExpression.ts(54,41): error TS2538: Type 'Cookie' cannot be used as an index type.
tests/cases/compiler/objectCreationOfElementAccessExpression.ts(54,79): error TS2348: Value of type 'typeof Cookie' is not callable. Did you mean to include 'new'?
@@ -58,13 +58,13 @@ tests/cases/compiler/objectCreationOfElementAccessExpression.ts(54,79): error TS
// ElementAccessExpressions can only contain one expression. There should be a parse error here.
var foods = new PetFood[new IceCream('Mint chocolate chip') , Cookie('Chocolate chip', false) , new Cookie('Peanut butter', true)];
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2342: An index expression argument must be of type 'string', 'number', 'symbol', or 'any'.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2538: Type 'Cookie' cannot be used as an index type.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2348: Value of type 'typeof Cookie' is not callable. Did you mean to include 'new'?
var foods2: MonsterFood[] = new PetFood[new IceCream('Mint chocolate chip') , Cookie('Chocolate chip', false) , new Cookie('Peanut butter', true)];
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2342: An index expression argument must be of type 'string', 'number', 'symbol', or 'any'.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2538: Type 'Cookie' cannot be used as an index type.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2348: Value of type 'typeof Cookie' is not callable. Did you mean to include 'new'?

View File

@@ -84,15 +84,15 @@ var r3 = c[1.0]; // same as indexing by 1 when done numerically
// BUG 823822
var r7 = i[-1];
>r7 : any
>i[-1] : any
>r7 : Date
>i[-1] : Date
>i : I
>-1 : -1
>1 : 1
var r7 = i[-1.0];
>r7 : any
>i[-1.0] : any
>r7 : Date
>i[-1.0] : Date
>i : I
>-1.0 : -1
>1.0 : 1
@@ -116,8 +116,8 @@ var r10 = i[0x1]
>0x1 : 1
var r11 = i[-0x1]
>r11 : any
>i[-0x1] : any
>r11 : Date
>i[-0x1] : Date
>i : I
>-0x1 : -1
>0x1 : 1
@@ -129,8 +129,8 @@ var r12 = i[01]
>01 : 1
var r13 = i[-01]
>r13 : any
>i[-01] : any
>r13 : Date
>i[-01] : Date
>i : I
>-01 : -1
>01 : 1
@@ -215,15 +215,15 @@ var r3 = c[1.0]; // same as indexing by 1 when done numerically
// BUG 823822
var r7 = i[-1];
>r7 : any
>i[-1] : any
>r7 : Date
>i[-1] : Date
>i : I
>-1 : -1
>1 : 1
var r7 = i[-1.0];
>r7 : any
>i[-1.0] : any
>r7 : Date
>i[-1.0] : Date
>i : I
>-1.0 : -1
>1.0 : 1
@@ -247,8 +247,8 @@ var r10 = i[0x1]
>0x1 : 1
var r11 = i[-0x1]
>r11 : any
>i[-0x1] : any
>r11 : Date
>i[-0x1] : Date
>i : I
>-0x1 : -1
>0x1 : 1
@@ -260,8 +260,8 @@ var r12 = i[01]
>01 : 1
var r13 = i[-01]
>r13 : any
>i[-01] : any
>r13 : Date
>i[-01] : Date
>i : I
>-01 : -1
>01 : 1
@@ -342,15 +342,15 @@ var r3 = c[1.0]; // same as indexing by 1 when done numerically
// BUG 823822
var r7 = i[-1];
>r7 : any
>i[-1] : any
>r7 : Date
>i[-1] : Date
>i : I
>-1 : -1
>1 : 1
var r7 = i[-1.0];
>r7 : any
>i[-1.0] : any
>r7 : Date
>i[-1.0] : Date
>i : I
>-1.0 : -1
>1.0 : 1
@@ -374,8 +374,8 @@ var r10 = i[0x1]
>0x1 : 1
var r11 = i[-0x1]
>r11 : any
>i[-0x1] : any
>r11 : Date
>i[-0x1] : Date
>i : I
>-0x1 : -1
>0x1 : 1
@@ -387,8 +387,8 @@ var r12 = i[01]
>01 : 1
var r13 = i[-01]
>r13 : any
>i[-01] : any
>r13 : Date
>i[-01] : Date
>i : I
>-01 : -1
>01 : 1
@@ -482,15 +482,15 @@ var r3 = c[1.0]; // same as indexing by 1 when done numerically
// BUG 823822
var r7 = i[-1];
>r7 : any
>i[-1] : any
>r7 : Date
>i[-1] : Date
>i : I
>-1 : -1
>1 : 1
var r7 = i[-1.0];
>r7 : any
>i[-1.0] : any
>r7 : Date
>i[-1.0] : Date
>i : I
>-1.0 : -1
>1.0 : 1
@@ -514,8 +514,8 @@ var r10 = i[0x1]
>0x1 : 1
var r11 = i[-0x1]
>r11 : any
>i[-0x1] : any
>r11 : Date
>i[-0x1] : Date
>i : I
>-0x1 : -1
>0x1 : 1
@@ -527,8 +527,8 @@ var r12 = i[01]
>01 : 1
var r13 = i[-01]
>r13 : any
>i[-01] : any
>r13 : Date
>i[-01] : Date
>i : I
>-01 : -1
>01 : 1

View File

@@ -1,11 +1,17 @@
tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement2.ts(4,13): error TS2538: Type 'undefined' cannot be used as an index type.
tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement2.ts(4,20): error TS2538: Type 'undefined' cannot be used as an index type.
tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement2.ts(4,30): error TS2304: Cannot find name 'd'.
==== tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement2.ts (1 errors) ====
==== tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement2.ts (3 errors) ====
var a;
var b = [];
var c;
for (a in b[c] = b[c] || [], d) {
~
!!! error TS2538: Type 'undefined' cannot be used as an index type.
~
!!! error TS2538: Type 'undefined' cannot be used as an index type.
~
!!! error TS2304: Cannot find name 'd'.

View File

@@ -1,12 +1,13 @@
tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(11,55): error TS2322: Type '{ 3: string; 'three': string; }' is not assignable to type '{ [n: number]: string; }'.
Object literal may only specify known properties, and ''three'' does not exist in type '{ [n: number]: string; }'.
tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(45,14): error TS2339: Property 'qqq' does not exist on type '{ 10: string; x: string; y: number; z: { n: string; m: number; o: () => boolean; }; 'literal property': number; }'.
tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(80,10): error TS2342: An index expression argument must be of type 'string', 'number', 'symbol', or 'any'.
tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(117,10): error TS2342: An index expression argument must be of type 'string', 'number', 'symbol', or 'any'.
tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(140,12): error TS2342: An index expression argument must be of type 'string', 'number', 'symbol', or 'any'.
tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(80,19): error TS2538: Type '{ name: string; }' cannot be used as an index type.
tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(117,18): error TS2538: Type '{ name: string; }' cannot be used as an index type.
tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(140,22): error TS2538: Type '{ name: string; }' cannot be used as an index type.
tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(149,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'x3' must be of type 'A | B', but here has type 'A'.
==== tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts (5 errors) ====
==== tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts (6 errors) ====
class A {
a: number;
}
@@ -92,8 +93,8 @@ tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(140,12): er
// Bracket notation property access using value of other type on type with numeric index signature and no string index signature
var ll = numIndex[someObject]; // Error
~~~~~~~~~~~~~~~~~~~~
!!! error TS2342: An index expression argument must be of type 'string', 'number', 'symbol', or 'any'.
~~~~~~~~~~
!!! error TS2538: Type '{ name: string; }' cannot be used as an index type.
// Bracket notation property access using string value on type with string index signature and no numeric index signature
var mm = strIndex['N'];
@@ -131,8 +132,8 @@ tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(140,12): er
// Bracket notation property access using values of other types on type with no index signatures
var uu = noIndex[someObject]; // Error
~~~~~~~~~~~~~~~~~~~
!!! error TS2342: An index expression argument must be of type 'string', 'number', 'symbol', or 'any'.
~~~~~~~~~~
!!! error TS2538: Type '{ name: string; }' cannot be used as an index type.
// Bracket notation property access using numeric value on type with numeric index signature and string index signature
var vv = noIndex[32];
@@ -156,8 +157,8 @@ tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(140,12): er
// Bracket notation property access using value of other type on type with numeric index signature and no string index signature and string index signature
var zzzz = bothIndex[someObject]; // Error
~~~~~~~~~~~~~~~~~~~~~
!!! error TS2342: An index expression argument must be of type 'string', 'number', 'symbol', or 'any'.
~~~~~~~~~~
!!! error TS2538: Type '{ name: string; }' cannot be used as an index type.
var x1 = numIndex[stringOrNumber];
var x1: any;
@@ -167,4 +168,6 @@ tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(140,12): er
var x3 = bothIndex[stringOrNumber];
var x3: A;
~~
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x3' must be of type 'A | B', but here has type 'A'.

View File

@@ -11,8 +11,8 @@ tests/cases/compiler/readonlyMembers.ts(36,3): error TS2540: Cannot assign to 'a
tests/cases/compiler/readonlyMembers.ts(40,3): error TS2540: Cannot assign to 'a' because it is a constant or a read-only property.
tests/cases/compiler/readonlyMembers.ts(49,3): error TS2540: Cannot assign to 'A' because it is a constant or a read-only property.
tests/cases/compiler/readonlyMembers.ts(56,3): error TS2540: Cannot assign to 'a' because it is a constant or a read-only property.
tests/cases/compiler/readonlyMembers.ts(62,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property.
tests/cases/compiler/readonlyMembers.ts(65,1): error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property.
tests/cases/compiler/readonlyMembers.ts(62,1): error TS2542: Index signature in type '{ readonly [x: string]: string; }' only permits reading.
tests/cases/compiler/readonlyMembers.ts(65,1): error TS2542: Index signature in type '{ [x: string]: string; readonly [x: number]: string; }' only permits reading.
==== tests/cases/compiler/readonlyMembers.ts (15 errors) ====
@@ -105,10 +105,10 @@ tests/cases/compiler/readonlyMembers.ts(65,1): error TS2450: Left-hand side of a
let s = xx["foo"];
xx["foo"] = "abc"; // Error
~~~~~~~~~
!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property.
!!! error TS2542: Index signature in type '{ readonly [x: string]: string; }' only permits reading.
let yy: { readonly [x: number]: string, [x: string]: string };
yy[1] = "abc"; // Error
~~~~~
!!! error TS2450: Left-hand side of assignment expression cannot be a constant or a read-only property.
!!! error TS2542: Index signature in type '{ [x: string]: string; readonly [x: number]: string; }' only permits reading.
yy["foo"] = "abc";

View File

@@ -1,4 +1,4 @@
tests/cases/conformance/expressions/superPropertyAccess/superSymbolIndexedAccess3.ts(11,16): error TS2342: An index expression argument must be of type 'string', 'number', 'symbol', or 'any'.
tests/cases/conformance/expressions/superPropertyAccess/superSymbolIndexedAccess3.ts(11,22): error TS2538: Type 'typeof Bar' cannot be used as an index type.
==== tests/cases/conformance/expressions/superPropertyAccess/superSymbolIndexedAccess3.ts (1 errors) ====
@@ -13,7 +13,7 @@ tests/cases/conformance/expressions/superPropertyAccess/superSymbolIndexedAccess
class Bar extends Foo {
[symbol]() {
return super[Bar]();
~~~~~~~~~~
!!! error TS2342: An index expression argument must be of type 'string', 'number', 'symbol', or 'any'.
~~~
!!! error TS2538: Type 'typeof Bar' cannot be used as an index type.
}
}

View File

@@ -1,5 +1,5 @@
tests/cases/conformance/es6/Symbols/symbolProperty53.ts(2,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
tests/cases/conformance/es6/Symbols/symbolProperty53.ts(5,1): error TS2342: An index expression argument must be of type 'string', 'number', 'symbol', or 'any'.
tests/cases/conformance/es6/Symbols/symbolProperty53.ts(5,5): error TS2538: Type '(key: string) => symbol' cannot be used as an index type.
==== tests/cases/conformance/es6/Symbols/symbolProperty53.ts (2 errors) ====
@@ -10,5 +10,5 @@ tests/cases/conformance/es6/Symbols/symbolProperty53.ts(5,1): error TS2342: An i
};
obj[Symbol.for];
~~~~~~~~~~~~~~~
!!! error TS2342: An index expression argument must be of type 'string', 'number', 'symbol', or 'any'.
~~~~~~~~~~
!!! error TS2538: Type '(key: string) => symbol' cannot be used as an index type.