mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 12:51:30 -05:00
Disallow initializers in for-in and for-of loops
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement20.ts(1,10): error TS1189: The variable declaration of a 'for...in' statement cannot have an initializer.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement20.ts (1 errors) ====
|
||||
for (var of = 0 in of) { }
|
||||
~~
|
||||
!!! error TS1189: The variable declaration of a 'for...in' statement cannot have an initializer.
|
||||
@@ -1,5 +0,0 @@
|
||||
=== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement20.ts ===
|
||||
for (var of = 0 in of) { }
|
||||
>of : any
|
||||
>of : any
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement4.ts(1,1): error TS2482: For-of statements are only available when targeting ECMAScript 6 or higher
|
||||
tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement4.ts(1,10): error TS1190: The variable declaration of a 'for...of' statement cannot have an initializer.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement4.ts (1 errors) ====
|
||||
for (var a = 1 of X) {
|
||||
~~~
|
||||
!!! error TS2482: For-of statements are only available when targeting ECMAScript 6 or higher
|
||||
~
|
||||
!!! error TS1190: The variable declaration of a 'for...of' statement cannot have an initializer.
|
||||
}
|
||||
@@ -1,8 +1,11 @@
|
||||
tests/cases/conformance/parser/ecmascript5/Statements/parserForInStatement4.ts(1,10): error TS1189: The variable declaration of a 'for...in' statement cannot have an initializer.
|
||||
tests/cases/conformance/parser/ecmascript5/Statements/parserForInStatement4.ts(1,19): error TS2304: Cannot find name 'X'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript5/Statements/parserForInStatement4.ts (1 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascript5/Statements/parserForInStatement4.ts (2 errors) ====
|
||||
for (var a = 1 in X) {
|
||||
~
|
||||
!!! error TS1189: The variable declaration of a 'for...in' statement cannot have an initializer.
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'X'.
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement20.ts(1,10): error TS1189: The variable declaration of a 'for...in' statement cannot have an initializer.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement20.ts (1 errors) ====
|
||||
for (var of = 0 in of) { }
|
||||
~~
|
||||
!!! error TS1189: The variable declaration of a 'for...in' statement cannot have an initializer.
|
||||
@@ -1,5 +0,0 @@
|
||||
=== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement20.ts ===
|
||||
for (var of = 0 in of) { }
|
||||
>of : any
|
||||
>of : any
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement4.ts(1,10): error TS1190: The variable declaration of a 'for...of' statement cannot have an initializer.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement4.ts (1 errors) ====
|
||||
for (var a = 1 of X) {
|
||||
~
|
||||
!!! error TS1190: The variable declaration of a 'for...of' statement cannot have an initializer.
|
||||
}
|
||||
Reference in New Issue
Block a user