mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-24 11:43:18 -05:00
Add tests for scoping
This commit is contained in:
7
tests/baselines/reference/for-of51.errors.txt
Normal file
7
tests/baselines/reference/for-of51.errors.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
tests/cases/conformance/es6/for-ofStatements/for-of51.ts(1,10): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/for-ofStatements/for-of51.ts (1 errors) ====
|
||||
for (let let of []) {}
|
||||
~~~
|
||||
!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations.
|
||||
5
tests/baselines/reference/for-of51.js
Normal file
5
tests/baselines/reference/for-of51.js
Normal file
@@ -0,0 +1,5 @@
|
||||
//// [for-of51.ts]
|
||||
for (let let of []) {}
|
||||
|
||||
//// [for-of51.js]
|
||||
for (let let of []) { }
|
||||
10
tests/baselines/reference/for-of52.errors.txt
Normal file
10
tests/baselines/reference/for-of52.errors.txt
Normal file
@@ -0,0 +1,10 @@
|
||||
tests/cases/conformance/es6/for-ofStatements/for-of52.ts(1,11): error TS2451: Cannot redeclare block-scoped variable 'v'.
|
||||
tests/cases/conformance/es6/for-ofStatements/for-of52.ts(1,14): error TS2451: Cannot redeclare block-scoped variable 'v'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/for-ofStatements/for-of52.ts (2 errors) ====
|
||||
for (let [v, v] of [[]]) {}
|
||||
~
|
||||
!!! error TS2451: Cannot redeclare block-scoped variable 'v'.
|
||||
~
|
||||
!!! error TS2451: Cannot redeclare block-scoped variable 'v'.
|
||||
5
tests/baselines/reference/for-of52.js
Normal file
5
tests/baselines/reference/for-of52.js
Normal file
@@ -0,0 +1,5 @@
|
||||
//// [for-of52.ts]
|
||||
for (let [v, v] of [[]]) {}
|
||||
|
||||
//// [for-of52.js]
|
||||
for (let [v, v] of [[]]) { }
|
||||
9
tests/baselines/reference/for-of53.js
Normal file
9
tests/baselines/reference/for-of53.js
Normal file
@@ -0,0 +1,9 @@
|
||||
//// [for-of53.ts]
|
||||
for (let v of []) {
|
||||
var v;
|
||||
}
|
||||
|
||||
//// [for-of53.js]
|
||||
for (let v of []) {
|
||||
var v;
|
||||
}
|
||||
8
tests/baselines/reference/for-of53.types
Normal file
8
tests/baselines/reference/for-of53.types
Normal file
@@ -0,0 +1,8 @@
|
||||
=== tests/cases/conformance/es6/for-ofStatements/for-of53.ts ===
|
||||
for (let v of []) {
|
||||
>v : any
|
||||
>[] : undefined[]
|
||||
|
||||
var v;
|
||||
>v : any
|
||||
}
|
||||
9
tests/baselines/reference/for-of54.errors.txt
Normal file
9
tests/baselines/reference/for-of54.errors.txt
Normal file
@@ -0,0 +1,9 @@
|
||||
tests/cases/conformance/es6/for-ofStatements/for-of54.ts(2,9): error TS2481: Cannot initialize outer scoped variable 'v' in the same scope as block scoped declaration 'v'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/for-ofStatements/for-of54.ts (1 errors) ====
|
||||
for (let v of []) {
|
||||
var v = 0;
|
||||
~
|
||||
!!! error TS2481: Cannot initialize outer scoped variable 'v' in the same scope as block scoped declaration 'v'.
|
||||
}
|
||||
9
tests/baselines/reference/for-of54.js
Normal file
9
tests/baselines/reference/for-of54.js
Normal file
@@ -0,0 +1,9 @@
|
||||
//// [for-of54.ts]
|
||||
for (let v of []) {
|
||||
var v = 0;
|
||||
}
|
||||
|
||||
//// [for-of54.js]
|
||||
for (let v of []) {
|
||||
var v = 0;
|
||||
}
|
||||
11
tests/baselines/reference/for-of55.js
Normal file
11
tests/baselines/reference/for-of55.js
Normal file
@@ -0,0 +1,11 @@
|
||||
//// [for-of55.ts]
|
||||
let v = [1];
|
||||
for (let v of v) {
|
||||
v;
|
||||
}
|
||||
|
||||
//// [for-of55.js]
|
||||
let v = [1];
|
||||
for (let v of v) {
|
||||
v;
|
||||
}
|
||||
12
tests/baselines/reference/for-of55.types
Normal file
12
tests/baselines/reference/for-of55.types
Normal file
@@ -0,0 +1,12 @@
|
||||
=== tests/cases/conformance/es6/for-ofStatements/for-of55.ts ===
|
||||
let v = [1];
|
||||
>v : number[]
|
||||
>[1] : number[]
|
||||
|
||||
for (let v of v) {
|
||||
>v : any
|
||||
>v : any
|
||||
|
||||
v;
|
||||
>v : any
|
||||
}
|
||||
2
tests/cases/conformance/es6/for-ofStatements/for-of51.ts
Normal file
2
tests/cases/conformance/es6/for-ofStatements/for-of51.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
//@target: ES6
|
||||
for (let let of []) {}
|
||||
2
tests/cases/conformance/es6/for-ofStatements/for-of52.ts
Normal file
2
tests/cases/conformance/es6/for-ofStatements/for-of52.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
//@target: ES6
|
||||
for (let [v, v] of [[]]) {}
|
||||
4
tests/cases/conformance/es6/for-ofStatements/for-of53.ts
Normal file
4
tests/cases/conformance/es6/for-ofStatements/for-of53.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
//@target: ES6
|
||||
for (let v of []) {
|
||||
var v;
|
||||
}
|
||||
4
tests/cases/conformance/es6/for-ofStatements/for-of54.ts
Normal file
4
tests/cases/conformance/es6/for-ofStatements/for-of54.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
//@target: ES6
|
||||
for (let v of []) {
|
||||
var v = 0;
|
||||
}
|
||||
5
tests/cases/conformance/es6/for-ofStatements/for-of55.ts
Normal file
5
tests/cases/conformance/es6/for-ofStatements/for-of55.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
//@target: ES6
|
||||
let v = [1];
|
||||
for (let v of v) {
|
||||
v;
|
||||
}
|
||||
Reference in New Issue
Block a user