mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-12-16 01:41:17 -06:00
Remove error for using 'for...of' in ES3/ES5
This commit is contained in:
parent
b38743c793
commit
5b46f5f9ae
@ -8777,11 +8777,6 @@ module ts {
|
||||
}
|
||||
|
||||
function checkForOfStatement(node: ForOfStatement): void {
|
||||
if (languageVersion < ScriptTarget.ES6) {
|
||||
grammarErrorOnFirstToken(node, Diagnostics.for_of_statements_are_only_available_when_targeting_ECMAScript_6_or_higher);
|
||||
return;
|
||||
}
|
||||
|
||||
checkGrammarForInOrForOfStatement(node)
|
||||
|
||||
// Check the LHS and RHS
|
||||
|
||||
@ -327,7 +327,6 @@ module ts {
|
||||
Property_0_does_not_exist_on_const_enum_1: { code: 2479, category: DiagnosticCategory.Error, key: "Property '{0}' does not exist on 'const' enum '{1}'." },
|
||||
let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations: { code: 2480, category: DiagnosticCategory.Error, key: "'let' is not allowed to be used as a name in 'let' or 'const' declarations." },
|
||||
Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1: { code: 2481, category: DiagnosticCategory.Error, key: "Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'." },
|
||||
for_of_statements_are_only_available_when_targeting_ECMAScript_6_or_higher: { code: 2482, category: DiagnosticCategory.Error, key: "'for...of' statements are only available when targeting ECMAScript 6 or higher." },
|
||||
The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation: { code: 2483, category: DiagnosticCategory.Error, key: "The left-hand side of a 'for...of' statement cannot use a type annotation." },
|
||||
Export_declaration_conflicts_with_exported_declaration_of_0: { code: 2484, category: DiagnosticCategory.Error, key: "Export declaration conflicts with exported declaration of '{0}'" },
|
||||
The_left_hand_side_of_a_for_of_statement_cannot_be_a_previously_defined_constant: { code: 2485, category: DiagnosticCategory.Error, key: "The left-hand side of a 'for...of' statement cannot be a previously defined constant." },
|
||||
|
||||
@ -1299,10 +1299,6 @@
|
||||
"category": "Error",
|
||||
"code": 2481
|
||||
},
|
||||
"'for...of' statements are only available when targeting ECMAScript 6 or higher.": {
|
||||
"category": "Error",
|
||||
"code": 2482
|
||||
},
|
||||
"The left-hand side of a 'for...of' statement cannot use a type annotation.": {
|
||||
"category": "Error",
|
||||
"code": 2483
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
tests/cases/conformance/statements/for-ofStatements/ES5For-of1.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
tests/cases/conformance/statements/for-ofStatements/ES5For-of1.ts(2,5): error TS2304: Cannot find name 'console'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/statements/for-ofStatements/ES5For-of1.ts (1 errors) ====
|
||||
for (var v of ['a', 'b', 'c']) {
|
||||
~~~
|
||||
!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
console.log(v);
|
||||
~~~~~~~
|
||||
!!! error TS2304: Cannot find name 'console'.
|
||||
}
|
||||
@ -1,13 +0,0 @@
|
||||
tests/cases/conformance/statements/for-ofStatements/ES5For-of10.ts(4,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/statements/for-ofStatements/ES5For-of10.ts (1 errors) ====
|
||||
function foo() {
|
||||
return { x: 0 };
|
||||
}
|
||||
for (foo().x of []) {
|
||||
~~~
|
||||
!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
for (foo().x of [])
|
||||
var p = foo().x;
|
||||
}
|
||||
@ -1,8 +0,0 @@
|
||||
tests/cases/conformance/statements/for-ofStatements/ES5For-of11.ts(2,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/statements/for-ofStatements/ES5For-of11.ts (1 errors) ====
|
||||
var v;
|
||||
for (v of []) { }
|
||||
~~~
|
||||
!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
@ -1,9 +0,0 @@
|
||||
tests/cases/conformance/statements/for-ofStatements/ES5For-of13.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/statements/for-ofStatements/ES5For-of13.ts (1 errors) ====
|
||||
for (let v of ['a', 'b', 'c']) {
|
||||
~~~
|
||||
!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
var x = v;
|
||||
}
|
||||
@ -1,9 +0,0 @@
|
||||
tests/cases/conformance/statements/for-ofStatements/ES5For-of14.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/statements/for-ofStatements/ES5For-of14.ts (1 errors) ====
|
||||
for (const v of []) {
|
||||
~~~
|
||||
!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
var x = v;
|
||||
}
|
||||
9
tests/baselines/reference/ES5For-of14.types
Normal file
9
tests/baselines/reference/ES5For-of14.types
Normal file
@ -0,0 +1,9 @@
|
||||
=== tests/cases/conformance/statements/for-ofStatements/ES5For-of14.ts ===
|
||||
for (const v of []) {
|
||||
>v : any
|
||||
>[] : undefined[]
|
||||
|
||||
var x = v;
|
||||
>x : any
|
||||
>v : any
|
||||
}
|
||||
@ -1,12 +0,0 @@
|
||||
tests/cases/conformance/statements/for-ofStatements/ES5For-of15.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/statements/for-ofStatements/ES5For-of15.ts (1 errors) ====
|
||||
for (let v of []) {
|
||||
~~~
|
||||
!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
v;
|
||||
for (const v of []) {
|
||||
var x = v;
|
||||
}
|
||||
}
|
||||
17
tests/baselines/reference/ES5For-of15.types
Normal file
17
tests/baselines/reference/ES5For-of15.types
Normal file
@ -0,0 +1,17 @@
|
||||
=== tests/cases/conformance/statements/for-ofStatements/ES5For-of15.ts ===
|
||||
for (let v of []) {
|
||||
>v : any
|
||||
>[] : undefined[]
|
||||
|
||||
v;
|
||||
>v : any
|
||||
|
||||
for (const v of []) {
|
||||
>v : any
|
||||
>[] : undefined[]
|
||||
|
||||
var x = v;
|
||||
>x : any
|
||||
>v : any
|
||||
}
|
||||
}
|
||||
@ -1,13 +0,0 @@
|
||||
tests/cases/conformance/statements/for-ofStatements/ES5For-of16.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/statements/for-ofStatements/ES5For-of16.ts (1 errors) ====
|
||||
for (let v of []) {
|
||||
~~~
|
||||
!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
v;
|
||||
for (let v of []) {
|
||||
var x = v;
|
||||
v++;
|
||||
}
|
||||
}
|
||||
21
tests/baselines/reference/ES5For-of16.types
Normal file
21
tests/baselines/reference/ES5For-of16.types
Normal file
@ -0,0 +1,21 @@
|
||||
=== tests/cases/conformance/statements/for-ofStatements/ES5For-of16.ts ===
|
||||
for (let v of []) {
|
||||
>v : any
|
||||
>[] : undefined[]
|
||||
|
||||
v;
|
||||
>v : any
|
||||
|
||||
for (let v of []) {
|
||||
>v : any
|
||||
>[] : undefined[]
|
||||
|
||||
var x = v;
|
||||
>x : any
|
||||
>v : any
|
||||
|
||||
v++;
|
||||
>v++ : number
|
||||
>v : any
|
||||
}
|
||||
}
|
||||
@ -1,16 +0,0 @@
|
||||
tests/cases/conformance/statements/for-ofStatements/ES5For-of18.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
tests/cases/conformance/statements/for-ofStatements/ES5For-of18.ts(4,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/statements/for-ofStatements/ES5For-of18.ts (2 errors) ====
|
||||
for (let v of []) {
|
||||
~~~
|
||||
!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
v;
|
||||
}
|
||||
for (let v of []) {
|
||||
~~~
|
||||
!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
v;
|
||||
}
|
||||
|
||||
16
tests/baselines/reference/ES5For-of18.types
Normal file
16
tests/baselines/reference/ES5For-of18.types
Normal file
@ -0,0 +1,16 @@
|
||||
=== tests/cases/conformance/statements/for-ofStatements/ES5For-of18.ts ===
|
||||
for (let v of []) {
|
||||
>v : any
|
||||
>[] : undefined[]
|
||||
|
||||
v;
|
||||
>v : any
|
||||
}
|
||||
for (let v of []) {
|
||||
>v : any
|
||||
>[] : undefined[]
|
||||
|
||||
v;
|
||||
>v : any
|
||||
}
|
||||
|
||||
@ -1,15 +0,0 @@
|
||||
tests/cases/conformance/statements/for-ofStatements/ES5For-of19.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/statements/for-ofStatements/ES5For-of19.ts (1 errors) ====
|
||||
for (let v of []) {
|
||||
~~~
|
||||
!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
v;
|
||||
function foo() {
|
||||
for (const v of []) {
|
||||
v;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
21
tests/baselines/reference/ES5For-of19.types
Normal file
21
tests/baselines/reference/ES5For-of19.types
Normal file
@ -0,0 +1,21 @@
|
||||
=== tests/cases/conformance/statements/for-ofStatements/ES5For-of19.ts ===
|
||||
for (let v of []) {
|
||||
>v : any
|
||||
>[] : undefined[]
|
||||
|
||||
v;
|
||||
>v : any
|
||||
|
||||
function foo() {
|
||||
>foo : () => void
|
||||
|
||||
for (const v of []) {
|
||||
>v : any
|
||||
>[] : undefined[]
|
||||
|
||||
v;
|
||||
>v : any
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,9 +0,0 @@
|
||||
tests/cases/conformance/statements/for-ofStatements/ES5For-of2.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/statements/for-ofStatements/ES5For-of2.ts (1 errors) ====
|
||||
for (var v of []) {
|
||||
~~~
|
||||
!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
var x = v;
|
||||
}
|
||||
9
tests/baselines/reference/ES5For-of2.types
Normal file
9
tests/baselines/reference/ES5For-of2.types
Normal file
@ -0,0 +1,9 @@
|
||||
=== tests/cases/conformance/statements/for-ofStatements/ES5For-of2.ts ===
|
||||
for (var v of []) {
|
||||
>v : any
|
||||
>[] : undefined[]
|
||||
|
||||
var x = v;
|
||||
>x : any
|
||||
>v : any
|
||||
}
|
||||
@ -1,12 +1,12 @@
|
||||
tests/cases/conformance/statements/for-ofStatements/ES5For-of20.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
tests/cases/conformance/statements/for-ofStatements/ES5For-of20.ts(4,15): error TS1155: 'const' declarations must be initialized
|
||||
|
||||
|
||||
==== tests/cases/conformance/statements/for-ofStatements/ES5For-of20.ts (1 errors) ====
|
||||
for (let v of []) {
|
||||
~~~
|
||||
!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
let v;
|
||||
for (let v of [v]) {
|
||||
const v;
|
||||
~
|
||||
!!! error TS1155: 'const' declarations must be initialized
|
||||
}
|
||||
}
|
||||
@ -1,9 +0,0 @@
|
||||
tests/cases/conformance/statements/for-ofStatements/ES5For-of21.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/statements/for-ofStatements/ES5For-of21.ts (1 errors) ====
|
||||
for (let v of []) {
|
||||
~~~
|
||||
!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
for (let _i of []) { }
|
||||
}
|
||||
9
tests/baselines/reference/ES5For-of21.types
Normal file
9
tests/baselines/reference/ES5For-of21.types
Normal file
@ -0,0 +1,9 @@
|
||||
=== tests/cases/conformance/statements/for-ofStatements/ES5For-of21.ts ===
|
||||
for (let v of []) {
|
||||
>v : any
|
||||
>[] : undefined[]
|
||||
|
||||
for (let _i of []) { }
|
||||
>_i : any
|
||||
>[] : undefined[]
|
||||
}
|
||||
@ -1,10 +1,10 @@
|
||||
tests/cases/conformance/statements/for-ofStatements/ES5For-of22.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
tests/cases/conformance/statements/for-ofStatements/ES5For-of22.ts(3,5): error TS2304: Cannot find name 'console'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/statements/for-ofStatements/ES5For-of22.ts (1 errors) ====
|
||||
for (var x of [1, 2, 3]) {
|
||||
~~~
|
||||
!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
let _a = 0;
|
||||
console.log(x);
|
||||
~~~~~~~
|
||||
!!! error TS2304: Cannot find name 'console'.
|
||||
}
|
||||
@ -1,10 +1,10 @@
|
||||
tests/cases/conformance/statements/for-ofStatements/ES5For-of23.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
tests/cases/conformance/statements/for-ofStatements/ES5For-of23.ts(3,5): error TS2304: Cannot find name 'console'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/statements/for-ofStatements/ES5For-of23.ts (1 errors) ====
|
||||
for (var x of [1, 2, 3]) {
|
||||
~~~
|
||||
!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
var _a = 0;
|
||||
console.log(x);
|
||||
~~~~~~~
|
||||
!!! error TS2304: Cannot find name 'console'.
|
||||
}
|
||||
@ -1,10 +0,0 @@
|
||||
tests/cases/conformance/statements/for-ofStatements/ES5For-of24.ts(2,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/statements/for-ofStatements/ES5For-of24.ts (1 errors) ====
|
||||
var a = [1, 2, 3];
|
||||
for (var v of a) {
|
||||
~~~
|
||||
!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
let a = 0;
|
||||
}
|
||||
@ -1,11 +0,0 @@
|
||||
tests/cases/conformance/statements/for-ofStatements/ES5For-of25.ts(2,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/statements/for-ofStatements/ES5For-of25.ts (1 errors) ====
|
||||
var a = [1, 2, 3];
|
||||
for (var v of a) {
|
||||
~~~
|
||||
!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
v;
|
||||
a;
|
||||
}
|
||||
@ -1,10 +0,0 @@
|
||||
tests/cases/conformance/statements/for-ofStatements/ES5For-of26.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/statements/for-ofStatements/ES5For-of26.ts (1 errors) ====
|
||||
for (var [a = 0, b = 1] of [2, 3]) {
|
||||
~~~
|
||||
!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
a;
|
||||
b;
|
||||
}
|
||||
12
tests/baselines/reference/ES5For-of26.types
Normal file
12
tests/baselines/reference/ES5For-of26.types
Normal file
@ -0,0 +1,12 @@
|
||||
=== tests/cases/conformance/statements/for-ofStatements/ES5For-of26.ts ===
|
||||
for (var [a = 0, b = 1] of [2, 3]) {
|
||||
>a : number
|
||||
>b : number
|
||||
>[2, 3] : number[]
|
||||
|
||||
a;
|
||||
>a : number
|
||||
|
||||
b;
|
||||
>b : number
|
||||
}
|
||||
@ -1,10 +0,0 @@
|
||||
tests/cases/conformance/statements/for-ofStatements/ES5For-of28.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/statements/for-ofStatements/ES5For-of28.ts (1 errors) ====
|
||||
for (let [a = 0, b = 1] of [2, 3]) {
|
||||
~~~
|
||||
!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
a;
|
||||
b;
|
||||
}
|
||||
12
tests/baselines/reference/ES5For-of28.types
Normal file
12
tests/baselines/reference/ES5For-of28.types
Normal file
@ -0,0 +1,12 @@
|
||||
=== tests/cases/conformance/statements/for-ofStatements/ES5For-of28.ts ===
|
||||
for (let [a = 0, b = 1] of [2, 3]) {
|
||||
>a : number
|
||||
>b : number
|
||||
>[2, 3] : number[]
|
||||
|
||||
a;
|
||||
>a : number
|
||||
|
||||
b;
|
||||
>b : number
|
||||
}
|
||||
@ -1,8 +0,0 @@
|
||||
tests/cases/conformance/statements/for-ofStatements/ES5For-of3.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/statements/for-ofStatements/ES5For-of3.ts (1 errors) ====
|
||||
for (var v of ['a', 'b', 'c'])
|
||||
~~~
|
||||
!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
var x = v;
|
||||
@ -1,9 +0,0 @@
|
||||
tests/cases/conformance/statements/for-ofStatements/ES5For-of4.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/statements/for-ofStatements/ES5For-of4.ts (1 errors) ====
|
||||
for (var v of [])
|
||||
~~~
|
||||
!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
var x = v;
|
||||
var y = v;
|
||||
13
tests/baselines/reference/ES5For-of4.types
Normal file
13
tests/baselines/reference/ES5For-of4.types
Normal file
@ -0,0 +1,13 @@
|
||||
=== tests/cases/conformance/statements/for-ofStatements/ES5For-of4.ts ===
|
||||
for (var v of [])
|
||||
>v : any
|
||||
>[] : undefined[]
|
||||
|
||||
var x = v;
|
||||
>x : any
|
||||
>v : any
|
||||
|
||||
var y = v;
|
||||
>y : any
|
||||
>v : any
|
||||
|
||||
@ -1,9 +0,0 @@
|
||||
tests/cases/conformance/statements/for-ofStatements/ES5For-of5.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/statements/for-ofStatements/ES5For-of5.ts (1 errors) ====
|
||||
for (var _a of []) {
|
||||
~~~
|
||||
!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
var x = _a;
|
||||
}
|
||||
9
tests/baselines/reference/ES5For-of5.types
Normal file
9
tests/baselines/reference/ES5For-of5.types
Normal file
@ -0,0 +1,9 @@
|
||||
=== tests/cases/conformance/statements/for-ofStatements/ES5For-of5.ts ===
|
||||
for (var _a of []) {
|
||||
>_a : any
|
||||
>[] : undefined[]
|
||||
|
||||
var x = _a;
|
||||
>x : any
|
||||
>_a : any
|
||||
}
|
||||
@ -1,11 +0,0 @@
|
||||
tests/cases/conformance/statements/for-ofStatements/ES5For-of6.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/statements/for-ofStatements/ES5For-of6.ts (1 errors) ====
|
||||
for (var w of []) {
|
||||
~~~
|
||||
!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
for (var v of []) {
|
||||
var x = [w, v];
|
||||
}
|
||||
}
|
||||
16
tests/baselines/reference/ES5For-of6.types
Normal file
16
tests/baselines/reference/ES5For-of6.types
Normal file
@ -0,0 +1,16 @@
|
||||
=== tests/cases/conformance/statements/for-ofStatements/ES5For-of6.ts ===
|
||||
for (var w of []) {
|
||||
>w : any
|
||||
>[] : undefined[]
|
||||
|
||||
for (var v of []) {
|
||||
>v : any
|
||||
>[] : undefined[]
|
||||
|
||||
var x = [w, v];
|
||||
>x : any[]
|
||||
>[w, v] : any[]
|
||||
>w : any
|
||||
>v : any
|
||||
}
|
||||
}
|
||||
@ -1,16 +1,13 @@
|
||||
tests/cases/conformance/statements/for-ofStatements/ES5For-of7.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
tests/cases/conformance/statements/for-ofStatements/ES5For-of7.ts(5,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
tests/cases/conformance/statements/for-ofStatements/ES5For-of7.ts(6,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'any', but here has type 'any[]'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/statements/for-ofStatements/ES5For-of7.ts (2 errors) ====
|
||||
==== tests/cases/conformance/statements/for-ofStatements/ES5For-of7.ts (1 errors) ====
|
||||
for (var w of []) {
|
||||
~~~
|
||||
!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
var x = w;
|
||||
}
|
||||
|
||||
for (var v of []) {
|
||||
~~~
|
||||
!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
var x = [w, v];
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'any', but here has type 'any[]'.
|
||||
}
|
||||
@ -1,14 +0,0 @@
|
||||
tests/cases/conformance/statements/for-ofStatements/ES5For-of9.ts(4,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/statements/for-ofStatements/ES5For-of9.ts (1 errors) ====
|
||||
function foo() {
|
||||
return { x: 0 };
|
||||
}
|
||||
for (foo().x of []) {
|
||||
~~~
|
||||
!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
for (foo().x of []) {
|
||||
var p = foo().x;
|
||||
}
|
||||
}
|
||||
@ -1,248 +0,0 @@
|
||||
tests/cases/compiler/downlevelLetConst16.ts(188,5): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
tests/cases/compiler/downlevelLetConst16.ts(195,5): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
tests/cases/compiler/downlevelLetConst16.ts(202,5): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
tests/cases/compiler/downlevelLetConst16.ts(209,5): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
tests/cases/compiler/downlevelLetConst16.ts(216,5): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
tests/cases/compiler/downlevelLetConst16.ts(223,5): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
|
||||
|
||||
==== tests/cases/compiler/downlevelLetConst16.ts (6 errors) ====
|
||||
'use strict'
|
||||
|
||||
declare function use(a: any);
|
||||
|
||||
var x = 10;
|
||||
var y;
|
||||
var z;
|
||||
use(x);
|
||||
use(y);
|
||||
use(z);
|
||||
function foo1() {
|
||||
let x = 1;
|
||||
use(x);
|
||||
let [y] = [1];
|
||||
use(y);
|
||||
let {a: z} = {a: 1};
|
||||
use(z);
|
||||
}
|
||||
|
||||
function foo2() {
|
||||
{
|
||||
let x = 1;
|
||||
use(x);
|
||||
let [y] = [1];
|
||||
use(y);
|
||||
let {a: z} = { a: 1 };
|
||||
use(z);
|
||||
}
|
||||
use(x);
|
||||
}
|
||||
|
||||
class A {
|
||||
m1() {
|
||||
let x = 1;
|
||||
use(x);
|
||||
let [y] = [1];
|
||||
use(y);
|
||||
let {a: z} = { a: 1 };
|
||||
use(z);
|
||||
}
|
||||
m2() {
|
||||
{
|
||||
let x = 1;
|
||||
use(x);
|
||||
let [y] = [1];
|
||||
use(y);
|
||||
let {a: z} = { a: 1 };
|
||||
use(z);
|
||||
}
|
||||
use(x);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class B {
|
||||
m1() {
|
||||
const x = 1;
|
||||
use(x);
|
||||
const [y] = [1];
|
||||
use(y);
|
||||
const {a: z} = { a: 1 };
|
||||
use(z);
|
||||
|
||||
}
|
||||
m2() {
|
||||
{
|
||||
const x = 1;
|
||||
use(x);
|
||||
const [y] = [1];
|
||||
use(y);
|
||||
const {a: z} = { a: 1 };
|
||||
use(z);
|
||||
|
||||
}
|
||||
use(x);
|
||||
}
|
||||
}
|
||||
|
||||
function bar1() {
|
||||
const x = 1;
|
||||
use(x);
|
||||
const [y] = [1];
|
||||
use(y);
|
||||
const {a: z} = { a: 1 };
|
||||
use(z);
|
||||
}
|
||||
|
||||
function bar2() {
|
||||
{
|
||||
const x = 1;
|
||||
use(x);
|
||||
const [y] = [1];
|
||||
use(y);
|
||||
const {a: z} = { a: 1 };
|
||||
use(z);
|
||||
|
||||
}
|
||||
use(x);
|
||||
}
|
||||
|
||||
module M1 {
|
||||
let x = 1;
|
||||
use(x);
|
||||
let [y] = [1];
|
||||
use(y);
|
||||
let {a: z} = { a: 1 };
|
||||
use(z);
|
||||
}
|
||||
|
||||
module M2 {
|
||||
{
|
||||
let x = 1;
|
||||
use(x);
|
||||
let [y] = [1];
|
||||
use(y);
|
||||
let {a: z} = { a: 1 };
|
||||
use(z);
|
||||
}
|
||||
use(x);
|
||||
}
|
||||
|
||||
module M3 {
|
||||
const x = 1;
|
||||
use(x);
|
||||
const [y] = [1];
|
||||
use(y);
|
||||
const {a: z} = { a: 1 };
|
||||
use(z);
|
||||
|
||||
}
|
||||
|
||||
module M4 {
|
||||
{
|
||||
const x = 1;
|
||||
use(x);
|
||||
const [y] = [1];
|
||||
use(y);
|
||||
const {a: z} = { a: 1 };
|
||||
use(z);
|
||||
|
||||
}
|
||||
use(x);
|
||||
use(y);
|
||||
use(z);
|
||||
}
|
||||
|
||||
function foo3() {
|
||||
for (let x; ;) {
|
||||
use(x);
|
||||
}
|
||||
for (let [y] = []; ;) {
|
||||
use(y);
|
||||
}
|
||||
for (let {a: z} = {a: 1}; ;) {
|
||||
use(z);
|
||||
}
|
||||
use(x);
|
||||
}
|
||||
|
||||
function foo4() {
|
||||
for (const x = 1; ;) {
|
||||
use(x);
|
||||
}
|
||||
for (const [y] = []; ;) {
|
||||
use(y);
|
||||
}
|
||||
for (const {a: z} = { a: 1 }; ;) {
|
||||
use(z);
|
||||
}
|
||||
use(x);
|
||||
}
|
||||
|
||||
function foo5() {
|
||||
for (let x in []) {
|
||||
use(x);
|
||||
}
|
||||
use(x);
|
||||
}
|
||||
|
||||
function foo6() {
|
||||
for (const x in []) {
|
||||
use(x);
|
||||
}
|
||||
use(x);
|
||||
}
|
||||
|
||||
function foo7() {
|
||||
for (let x of []) {
|
||||
~~~
|
||||
!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
use(x);
|
||||
}
|
||||
use(x);
|
||||
}
|
||||
|
||||
function foo8() {
|
||||
for (let [x] of []) {
|
||||
~~~
|
||||
!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
use(x);
|
||||
}
|
||||
use(x);
|
||||
}
|
||||
|
||||
function foo9() {
|
||||
for (let {a: x} of []) {
|
||||
~~~
|
||||
!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
use(x);
|
||||
}
|
||||
use(x);
|
||||
}
|
||||
|
||||
function foo10() {
|
||||
for (const x of []) {
|
||||
~~~
|
||||
!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
use(x);
|
||||
}
|
||||
use(x);
|
||||
}
|
||||
|
||||
function foo11() {
|
||||
for (const [x] of []) {
|
||||
~~~
|
||||
!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
use(x);
|
||||
}
|
||||
use(x);
|
||||
}
|
||||
|
||||
function foo12() {
|
||||
for (const {a: x} of []) {
|
||||
~~~
|
||||
!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
use(x);
|
||||
}
|
||||
use(x);
|
||||
}
|
||||
686
tests/baselines/reference/downlevelLetConst16.types
Normal file
686
tests/baselines/reference/downlevelLetConst16.types
Normal file
@ -0,0 +1,686 @@
|
||||
=== tests/cases/compiler/downlevelLetConst16.ts ===
|
||||
'use strict'
|
||||
|
||||
declare function use(a: any);
|
||||
>use : (a: any) => any
|
||||
>a : any
|
||||
|
||||
var x = 10;
|
||||
>x : number
|
||||
|
||||
var y;
|
||||
>y : any
|
||||
|
||||
var z;
|
||||
>z : any
|
||||
|
||||
use(x);
|
||||
>use(x) : any
|
||||
>use : (a: any) => any
|
||||
>x : number
|
||||
|
||||
use(y);
|
||||
>use(y) : any
|
||||
>use : (a: any) => any
|
||||
>y : any
|
||||
|
||||
use(z);
|
||||
>use(z) : any
|
||||
>use : (a: any) => any
|
||||
>z : any
|
||||
|
||||
function foo1() {
|
||||
>foo1 : () => void
|
||||
|
||||
let x = 1;
|
||||
>x : number
|
||||
|
||||
use(x);
|
||||
>use(x) : any
|
||||
>use : (a: any) => any
|
||||
>x : number
|
||||
|
||||
let [y] = [1];
|
||||
>y : number
|
||||
>[1] : [number]
|
||||
|
||||
use(y);
|
||||
>use(y) : any
|
||||
>use : (a: any) => any
|
||||
>y : number
|
||||
|
||||
let {a: z} = {a: 1};
|
||||
>a : unknown
|
||||
>z : number
|
||||
>{a: 1} : { a: number; }
|
||||
>a : number
|
||||
|
||||
use(z);
|
||||
>use(z) : any
|
||||
>use : (a: any) => any
|
||||
>z : number
|
||||
}
|
||||
|
||||
function foo2() {
|
||||
>foo2 : () => void
|
||||
{
|
||||
let x = 1;
|
||||
>x : number
|
||||
|
||||
use(x);
|
||||
>use(x) : any
|
||||
>use : (a: any) => any
|
||||
>x : number
|
||||
|
||||
let [y] = [1];
|
||||
>y : number
|
||||
>[1] : [number]
|
||||
|
||||
use(y);
|
||||
>use(y) : any
|
||||
>use : (a: any) => any
|
||||
>y : number
|
||||
|
||||
let {a: z} = { a: 1 };
|
||||
>a : unknown
|
||||
>z : number
|
||||
>{ a: 1 } : { a: number; }
|
||||
>a : number
|
||||
|
||||
use(z);
|
||||
>use(z) : any
|
||||
>use : (a: any) => any
|
||||
>z : number
|
||||
}
|
||||
use(x);
|
||||
>use(x) : any
|
||||
>use : (a: any) => any
|
||||
>x : number
|
||||
}
|
||||
|
||||
class A {
|
||||
>A : A
|
||||
|
||||
m1() {
|
||||
>m1 : () => void
|
||||
|
||||
let x = 1;
|
||||
>x : number
|
||||
|
||||
use(x);
|
||||
>use(x) : any
|
||||
>use : (a: any) => any
|
||||
>x : number
|
||||
|
||||
let [y] = [1];
|
||||
>y : number
|
||||
>[1] : [number]
|
||||
|
||||
use(y);
|
||||
>use(y) : any
|
||||
>use : (a: any) => any
|
||||
>y : number
|
||||
|
||||
let {a: z} = { a: 1 };
|
||||
>a : unknown
|
||||
>z : number
|
||||
>{ a: 1 } : { a: number; }
|
||||
>a : number
|
||||
|
||||
use(z);
|
||||
>use(z) : any
|
||||
>use : (a: any) => any
|
||||
>z : number
|
||||
}
|
||||
m2() {
|
||||
>m2 : () => void
|
||||
{
|
||||
let x = 1;
|
||||
>x : number
|
||||
|
||||
use(x);
|
||||
>use(x) : any
|
||||
>use : (a: any) => any
|
||||
>x : number
|
||||
|
||||
let [y] = [1];
|
||||
>y : number
|
||||
>[1] : [number]
|
||||
|
||||
use(y);
|
||||
>use(y) : any
|
||||
>use : (a: any) => any
|
||||
>y : number
|
||||
|
||||
let {a: z} = { a: 1 };
|
||||
>a : unknown
|
||||
>z : number
|
||||
>{ a: 1 } : { a: number; }
|
||||
>a : number
|
||||
|
||||
use(z);
|
||||
>use(z) : any
|
||||
>use : (a: any) => any
|
||||
>z : number
|
||||
}
|
||||
use(x);
|
||||
>use(x) : any
|
||||
>use : (a: any) => any
|
||||
>x : number
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class B {
|
||||
>B : B
|
||||
|
||||
m1() {
|
||||
>m1 : () => void
|
||||
|
||||
const x = 1;
|
||||
>x : number
|
||||
|
||||
use(x);
|
||||
>use(x) : any
|
||||
>use : (a: any) => any
|
||||
>x : number
|
||||
|
||||
const [y] = [1];
|
||||
>y : number
|
||||
>[1] : [number]
|
||||
|
||||
use(y);
|
||||
>use(y) : any
|
||||
>use : (a: any) => any
|
||||
>y : number
|
||||
|
||||
const {a: z} = { a: 1 };
|
||||
>a : unknown
|
||||
>z : number
|
||||
>{ a: 1 } : { a: number; }
|
||||
>a : number
|
||||
|
||||
use(z);
|
||||
>use(z) : any
|
||||
>use : (a: any) => any
|
||||
>z : number
|
||||
|
||||
}
|
||||
m2() {
|
||||
>m2 : () => void
|
||||
{
|
||||
const x = 1;
|
||||
>x : number
|
||||
|
||||
use(x);
|
||||
>use(x) : any
|
||||
>use : (a: any) => any
|
||||
>x : number
|
||||
|
||||
const [y] = [1];
|
||||
>y : number
|
||||
>[1] : [number]
|
||||
|
||||
use(y);
|
||||
>use(y) : any
|
||||
>use : (a: any) => any
|
||||
>y : number
|
||||
|
||||
const {a: z} = { a: 1 };
|
||||
>a : unknown
|
||||
>z : number
|
||||
>{ a: 1 } : { a: number; }
|
||||
>a : number
|
||||
|
||||
use(z);
|
||||
>use(z) : any
|
||||
>use : (a: any) => any
|
||||
>z : number
|
||||
|
||||
}
|
||||
use(x);
|
||||
>use(x) : any
|
||||
>use : (a: any) => any
|
||||
>x : number
|
||||
}
|
||||
}
|
||||
|
||||
function bar1() {
|
||||
>bar1 : () => void
|
||||
|
||||
const x = 1;
|
||||
>x : number
|
||||
|
||||
use(x);
|
||||
>use(x) : any
|
||||
>use : (a: any) => any
|
||||
>x : number
|
||||
|
||||
const [y] = [1];
|
||||
>y : number
|
||||
>[1] : [number]
|
||||
|
||||
use(y);
|
||||
>use(y) : any
|
||||
>use : (a: any) => any
|
||||
>y : number
|
||||
|
||||
const {a: z} = { a: 1 };
|
||||
>a : unknown
|
||||
>z : number
|
||||
>{ a: 1 } : { a: number; }
|
||||
>a : number
|
||||
|
||||
use(z);
|
||||
>use(z) : any
|
||||
>use : (a: any) => any
|
||||
>z : number
|
||||
}
|
||||
|
||||
function bar2() {
|
||||
>bar2 : () => void
|
||||
{
|
||||
const x = 1;
|
||||
>x : number
|
||||
|
||||
use(x);
|
||||
>use(x) : any
|
||||
>use : (a: any) => any
|
||||
>x : number
|
||||
|
||||
const [y] = [1];
|
||||
>y : number
|
||||
>[1] : [number]
|
||||
|
||||
use(y);
|
||||
>use(y) : any
|
||||
>use : (a: any) => any
|
||||
>y : number
|
||||
|
||||
const {a: z} = { a: 1 };
|
||||
>a : unknown
|
||||
>z : number
|
||||
>{ a: 1 } : { a: number; }
|
||||
>a : number
|
||||
|
||||
use(z);
|
||||
>use(z) : any
|
||||
>use : (a: any) => any
|
||||
>z : number
|
||||
|
||||
}
|
||||
use(x);
|
||||
>use(x) : any
|
||||
>use : (a: any) => any
|
||||
>x : number
|
||||
}
|
||||
|
||||
module M1 {
|
||||
>M1 : typeof M1
|
||||
|
||||
let x = 1;
|
||||
>x : number
|
||||
|
||||
use(x);
|
||||
>use(x) : any
|
||||
>use : (a: any) => any
|
||||
>x : number
|
||||
|
||||
let [y] = [1];
|
||||
>y : number
|
||||
>[1] : [number]
|
||||
|
||||
use(y);
|
||||
>use(y) : any
|
||||
>use : (a: any) => any
|
||||
>y : number
|
||||
|
||||
let {a: z} = { a: 1 };
|
||||
>a : unknown
|
||||
>z : number
|
||||
>{ a: 1 } : { a: number; }
|
||||
>a : number
|
||||
|
||||
use(z);
|
||||
>use(z) : any
|
||||
>use : (a: any) => any
|
||||
>z : number
|
||||
}
|
||||
|
||||
module M2 {
|
||||
>M2 : typeof M2
|
||||
{
|
||||
let x = 1;
|
||||
>x : number
|
||||
|
||||
use(x);
|
||||
>use(x) : any
|
||||
>use : (a: any) => any
|
||||
>x : number
|
||||
|
||||
let [y] = [1];
|
||||
>y : number
|
||||
>[1] : [number]
|
||||
|
||||
use(y);
|
||||
>use(y) : any
|
||||
>use : (a: any) => any
|
||||
>y : number
|
||||
|
||||
let {a: z} = { a: 1 };
|
||||
>a : unknown
|
||||
>z : number
|
||||
>{ a: 1 } : { a: number; }
|
||||
>a : number
|
||||
|
||||
use(z);
|
||||
>use(z) : any
|
||||
>use : (a: any) => any
|
||||
>z : number
|
||||
}
|
||||
use(x);
|
||||
>use(x) : any
|
||||
>use : (a: any) => any
|
||||
>x : number
|
||||
}
|
||||
|
||||
module M3 {
|
||||
>M3 : typeof M3
|
||||
|
||||
const x = 1;
|
||||
>x : number
|
||||
|
||||
use(x);
|
||||
>use(x) : any
|
||||
>use : (a: any) => any
|
||||
>x : number
|
||||
|
||||
const [y] = [1];
|
||||
>y : number
|
||||
>[1] : [number]
|
||||
|
||||
use(y);
|
||||
>use(y) : any
|
||||
>use : (a: any) => any
|
||||
>y : number
|
||||
|
||||
const {a: z} = { a: 1 };
|
||||
>a : unknown
|
||||
>z : number
|
||||
>{ a: 1 } : { a: number; }
|
||||
>a : number
|
||||
|
||||
use(z);
|
||||
>use(z) : any
|
||||
>use : (a: any) => any
|
||||
>z : number
|
||||
|
||||
}
|
||||
|
||||
module M4 {
|
||||
>M4 : typeof M4
|
||||
{
|
||||
const x = 1;
|
||||
>x : number
|
||||
|
||||
use(x);
|
||||
>use(x) : any
|
||||
>use : (a: any) => any
|
||||
>x : number
|
||||
|
||||
const [y] = [1];
|
||||
>y : number
|
||||
>[1] : [number]
|
||||
|
||||
use(y);
|
||||
>use(y) : any
|
||||
>use : (a: any) => any
|
||||
>y : number
|
||||
|
||||
const {a: z} = { a: 1 };
|
||||
>a : unknown
|
||||
>z : number
|
||||
>{ a: 1 } : { a: number; }
|
||||
>a : number
|
||||
|
||||
use(z);
|
||||
>use(z) : any
|
||||
>use : (a: any) => any
|
||||
>z : number
|
||||
|
||||
}
|
||||
use(x);
|
||||
>use(x) : any
|
||||
>use : (a: any) => any
|
||||
>x : number
|
||||
|
||||
use(y);
|
||||
>use(y) : any
|
||||
>use : (a: any) => any
|
||||
>y : any
|
||||
|
||||
use(z);
|
||||
>use(z) : any
|
||||
>use : (a: any) => any
|
||||
>z : any
|
||||
}
|
||||
|
||||
function foo3() {
|
||||
>foo3 : () => void
|
||||
|
||||
for (let x; ;) {
|
||||
>x : any
|
||||
|
||||
use(x);
|
||||
>use(x) : any
|
||||
>use : (a: any) => any
|
||||
>x : any
|
||||
}
|
||||
for (let [y] = []; ;) {
|
||||
>y : any
|
||||
>[] : undefined[]
|
||||
|
||||
use(y);
|
||||
>use(y) : any
|
||||
>use : (a: any) => any
|
||||
>y : any
|
||||
}
|
||||
for (let {a: z} = {a: 1}; ;) {
|
||||
>a : unknown
|
||||
>z : number
|
||||
>{a: 1} : { a: number; }
|
||||
>a : number
|
||||
|
||||
use(z);
|
||||
>use(z) : any
|
||||
>use : (a: any) => any
|
||||
>z : number
|
||||
}
|
||||
use(x);
|
||||
>use(x) : any
|
||||
>use : (a: any) => any
|
||||
>x : number
|
||||
}
|
||||
|
||||
function foo4() {
|
||||
>foo4 : () => void
|
||||
|
||||
for (const x = 1; ;) {
|
||||
>x : number
|
||||
|
||||
use(x);
|
||||
>use(x) : any
|
||||
>use : (a: any) => any
|
||||
>x : number
|
||||
}
|
||||
for (const [y] = []; ;) {
|
||||
>y : any
|
||||
>[] : undefined[]
|
||||
|
||||
use(y);
|
||||
>use(y) : any
|
||||
>use : (a: any) => any
|
||||
>y : any
|
||||
}
|
||||
for (const {a: z} = { a: 1 }; ;) {
|
||||
>a : unknown
|
||||
>z : number
|
||||
>{ a: 1 } : { a: number; }
|
||||
>a : number
|
||||
|
||||
use(z);
|
||||
>use(z) : any
|
||||
>use : (a: any) => any
|
||||
>z : number
|
||||
}
|
||||
use(x);
|
||||
>use(x) : any
|
||||
>use : (a: any) => any
|
||||
>x : number
|
||||
}
|
||||
|
||||
function foo5() {
|
||||
>foo5 : () => void
|
||||
|
||||
for (let x in []) {
|
||||
>x : any
|
||||
>[] : undefined[]
|
||||
|
||||
use(x);
|
||||
>use(x) : any
|
||||
>use : (a: any) => any
|
||||
>x : any
|
||||
}
|
||||
use(x);
|
||||
>use(x) : any
|
||||
>use : (a: any) => any
|
||||
>x : number
|
||||
}
|
||||
|
||||
function foo6() {
|
||||
>foo6 : () => void
|
||||
|
||||
for (const x in []) {
|
||||
>x : any
|
||||
>[] : undefined[]
|
||||
|
||||
use(x);
|
||||
>use(x) : any
|
||||
>use : (a: any) => any
|
||||
>x : any
|
||||
}
|
||||
use(x);
|
||||
>use(x) : any
|
||||
>use : (a: any) => any
|
||||
>x : number
|
||||
}
|
||||
|
||||
function foo7() {
|
||||
>foo7 : () => void
|
||||
|
||||
for (let x of []) {
|
||||
>x : any
|
||||
>[] : undefined[]
|
||||
|
||||
use(x);
|
||||
>use(x) : any
|
||||
>use : (a: any) => any
|
||||
>x : any
|
||||
}
|
||||
use(x);
|
||||
>use(x) : any
|
||||
>use : (a: any) => any
|
||||
>x : number
|
||||
}
|
||||
|
||||
function foo8() {
|
||||
>foo8 : () => void
|
||||
|
||||
for (let [x] of []) {
|
||||
>x : any
|
||||
>[] : undefined[]
|
||||
|
||||
use(x);
|
||||
>use(x) : any
|
||||
>use : (a: any) => any
|
||||
>x : any
|
||||
}
|
||||
use(x);
|
||||
>use(x) : any
|
||||
>use : (a: any) => any
|
||||
>x : number
|
||||
}
|
||||
|
||||
function foo9() {
|
||||
>foo9 : () => void
|
||||
|
||||
for (let {a: x} of []) {
|
||||
>a : unknown
|
||||
>x : any
|
||||
>[] : undefined[]
|
||||
|
||||
use(x);
|
||||
>use(x) : any
|
||||
>use : (a: any) => any
|
||||
>x : any
|
||||
}
|
||||
use(x);
|
||||
>use(x) : any
|
||||
>use : (a: any) => any
|
||||
>x : number
|
||||
}
|
||||
|
||||
function foo10() {
|
||||
>foo10 : () => void
|
||||
|
||||
for (const x of []) {
|
||||
>x : any
|
||||
>[] : undefined[]
|
||||
|
||||
use(x);
|
||||
>use(x) : any
|
||||
>use : (a: any) => any
|
||||
>x : any
|
||||
}
|
||||
use(x);
|
||||
>use(x) : any
|
||||
>use : (a: any) => any
|
||||
>x : number
|
||||
}
|
||||
|
||||
function foo11() {
|
||||
>foo11 : () => void
|
||||
|
||||
for (const [x] of []) {
|
||||
>x : any
|
||||
>[] : undefined[]
|
||||
|
||||
use(x);
|
||||
>use(x) : any
|
||||
>use : (a: any) => any
|
||||
>x : any
|
||||
}
|
||||
use(x);
|
||||
>use(x) : any
|
||||
>use : (a: any) => any
|
||||
>x : number
|
||||
}
|
||||
|
||||
function foo12() {
|
||||
>foo12 : () => void
|
||||
|
||||
for (const {a: x} of []) {
|
||||
>a : unknown
|
||||
>x : any
|
||||
>[] : undefined[]
|
||||
|
||||
use(x);
|
||||
>use(x) : any
|
||||
>use : (a: any) => any
|
||||
>x : any
|
||||
}
|
||||
use(x);
|
||||
>use(x) : any
|
||||
>use : (a: any) => any
|
||||
>x : number
|
||||
}
|
||||
@ -1,73 +0,0 @@
|
||||
tests/cases/compiler/downlevelLetConst17.ts(65,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
|
||||
|
||||
==== tests/cases/compiler/downlevelLetConst17.ts (1 errors) ====
|
||||
'use strict'
|
||||
|
||||
declare function use(a: any);
|
||||
|
||||
var x;
|
||||
for (let x = 10; ;) {
|
||||
use(x);
|
||||
}
|
||||
use(x);
|
||||
|
||||
for (const x = 10; ;) {
|
||||
use(x);
|
||||
}
|
||||
|
||||
for (; ;) {
|
||||
let x = 10;
|
||||
use(x);
|
||||
x = 1;
|
||||
}
|
||||
|
||||
for (; ;) {
|
||||
const x = 10;
|
||||
use(x);
|
||||
}
|
||||
|
||||
for (let x; ;) {
|
||||
use(x);
|
||||
x = 1;
|
||||
}
|
||||
|
||||
for (; ;) {
|
||||
let x;
|
||||
use(x);
|
||||
x = 1;
|
||||
}
|
||||
|
||||
while (true) {
|
||||
let x;
|
||||
use(x);
|
||||
}
|
||||
|
||||
while (true) {
|
||||
const x = true;
|
||||
use(x);
|
||||
}
|
||||
|
||||
do {
|
||||
let x;
|
||||
use(x);
|
||||
} while (true);
|
||||
|
||||
do {
|
||||
let x;
|
||||
use(x);
|
||||
} while (true);
|
||||
|
||||
for (let x in []) {
|
||||
use(x);
|
||||
}
|
||||
|
||||
for (const x in []) {
|
||||
use(x);
|
||||
}
|
||||
|
||||
for (const x of []) {
|
||||
~~~
|
||||
!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
use(x);
|
||||
}
|
||||
154
tests/baselines/reference/downlevelLetConst17.types
Normal file
154
tests/baselines/reference/downlevelLetConst17.types
Normal file
@ -0,0 +1,154 @@
|
||||
=== tests/cases/compiler/downlevelLetConst17.ts ===
|
||||
'use strict'
|
||||
|
||||
declare function use(a: any);
|
||||
>use : (a: any) => any
|
||||
>a : any
|
||||
|
||||
var x;
|
||||
>x : any
|
||||
|
||||
for (let x = 10; ;) {
|
||||
>x : number
|
||||
|
||||
use(x);
|
||||
>use(x) : any
|
||||
>use : (a: any) => any
|
||||
>x : number
|
||||
}
|
||||
use(x);
|
||||
>use(x) : any
|
||||
>use : (a: any) => any
|
||||
>x : any
|
||||
|
||||
for (const x = 10; ;) {
|
||||
>x : number
|
||||
|
||||
use(x);
|
||||
>use(x) : any
|
||||
>use : (a: any) => any
|
||||
>x : number
|
||||
}
|
||||
|
||||
for (; ;) {
|
||||
let x = 10;
|
||||
>x : number
|
||||
|
||||
use(x);
|
||||
>use(x) : any
|
||||
>use : (a: any) => any
|
||||
>x : number
|
||||
|
||||
x = 1;
|
||||
>x = 1 : number
|
||||
>x : number
|
||||
}
|
||||
|
||||
for (; ;) {
|
||||
const x = 10;
|
||||
>x : number
|
||||
|
||||
use(x);
|
||||
>use(x) : any
|
||||
>use : (a: any) => any
|
||||
>x : number
|
||||
}
|
||||
|
||||
for (let x; ;) {
|
||||
>x : any
|
||||
|
||||
use(x);
|
||||
>use(x) : any
|
||||
>use : (a: any) => any
|
||||
>x : any
|
||||
|
||||
x = 1;
|
||||
>x = 1 : number
|
||||
>x : any
|
||||
}
|
||||
|
||||
for (; ;) {
|
||||
let x;
|
||||
>x : any
|
||||
|
||||
use(x);
|
||||
>use(x) : any
|
||||
>use : (a: any) => any
|
||||
>x : any
|
||||
|
||||
x = 1;
|
||||
>x = 1 : number
|
||||
>x : any
|
||||
}
|
||||
|
||||
while (true) {
|
||||
let x;
|
||||
>x : any
|
||||
|
||||
use(x);
|
||||
>use(x) : any
|
||||
>use : (a: any) => any
|
||||
>x : any
|
||||
}
|
||||
|
||||
while (true) {
|
||||
const x = true;
|
||||
>x : boolean
|
||||
|
||||
use(x);
|
||||
>use(x) : any
|
||||
>use : (a: any) => any
|
||||
>x : boolean
|
||||
}
|
||||
|
||||
do {
|
||||
let x;
|
||||
>x : any
|
||||
|
||||
use(x);
|
||||
>use(x) : any
|
||||
>use : (a: any) => any
|
||||
>x : any
|
||||
|
||||
} while (true);
|
||||
|
||||
do {
|
||||
let x;
|
||||
>x : any
|
||||
|
||||
use(x);
|
||||
>use(x) : any
|
||||
>use : (a: any) => any
|
||||
>x : any
|
||||
|
||||
} while (true);
|
||||
|
||||
for (let x in []) {
|
||||
>x : any
|
||||
>[] : undefined[]
|
||||
|
||||
use(x);
|
||||
>use(x) : any
|
||||
>use : (a: any) => any
|
||||
>x : any
|
||||
}
|
||||
|
||||
for (const x in []) {
|
||||
>x : any
|
||||
>[] : undefined[]
|
||||
|
||||
use(x);
|
||||
>use(x) : any
|
||||
>use : (a: any) => any
|
||||
>x : any
|
||||
}
|
||||
|
||||
for (const x of []) {
|
||||
>x : any
|
||||
>[] : undefined[]
|
||||
|
||||
use(x);
|
||||
>use(x) : any
|
||||
>use : (a: any) => any
|
||||
>x : any
|
||||
}
|
||||
@ -1,8 +1,8 @@
|
||||
tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement1.d.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement1.d.ts(1,1): error TS1036: Statements are not allowed in ambient contexts.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement1.d.ts (1 errors) ====
|
||||
for (var i of e) {
|
||||
~~~
|
||||
!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
!!! error TS1036: Statements are not allowed in ambient contexts.
|
||||
}
|
||||
@ -1,8 +1,8 @@
|
||||
tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement2.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement2.ts(1,9): error TS1123: Variable declaration list cannot be empty.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement2.ts (1 errors) ====
|
||||
for (var of X) {
|
||||
~~~
|
||||
!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
|
||||
!!! error TS1123: Variable declaration list cannot be empty.
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement21.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement21.ts(1,9): error TS1123: Variable declaration list cannot be empty.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement21.ts (1 errors) ====
|
||||
for (var of of) { }
|
||||
~~~
|
||||
!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
|
||||
!!! error TS1123: Variable declaration list cannot be empty.
|
||||
@ -1,8 +1,8 @@
|
||||
tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement3.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement3.ts(1,13): error TS1188: Only a single variable declaration is allowed in a 'for...of' statement.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement3.ts (1 errors) ====
|
||||
for (var a, b of X) {
|
||||
~~~
|
||||
!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
~
|
||||
!!! error TS1188: Only a single variable declaration is allowed in a 'for...of' statement.
|
||||
}
|
||||
@ -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,8 @@
|
||||
tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement5.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement5.ts(1,10): error TS2483: The left-hand side of a 'for...of' statement cannot use a type annotation.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement5.ts (1 errors) ====
|
||||
for (var a: number of X) {
|
||||
~~~
|
||||
!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
~
|
||||
!!! error TS2483: The left-hand side of a 'for...of' statement cannot use a type annotation.
|
||||
}
|
||||
@ -1,8 +1,8 @@
|
||||
tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement6.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement6.ts(1,17): error TS1188: Only a single variable declaration is allowed in a 'for...of' statement.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement6.ts (1 errors) ====
|
||||
for (var a = 1, b = 2 of X) {
|
||||
~~~
|
||||
!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
~
|
||||
!!! error TS1188: Only a single variable declaration is allowed in a 'for...of' statement.
|
||||
}
|
||||
@ -1,8 +1,8 @@
|
||||
tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement7.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement7.ts(1,25): error TS1188: Only a single variable declaration is allowed in a 'for...of' statement.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement7.ts (1 errors) ====
|
||||
for (var a: number = 1, b: string = "" of X) {
|
||||
~~~
|
||||
!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher.
|
||||
~
|
||||
!!! error TS1188: Only a single variable declaration is allowed in a 'for...of' statement.
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user