Skip to content

Commit 77b6482

Browse files
committed
Add baselines for new tests
1 parent 4efa61c commit 77b6482

4 files changed

+91
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment3.ts(2,22): error TS2448: Block-scoped variable 'e' used before its declaration.
2+
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment3.ts(3,22): error TS2448: Block-scoped variable 'i' used before its declaration.
3+
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment3.ts(7,27): error TS2372: Parameter 'e' cannot be referenced in its initializer.
4+
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment3.ts(9,27): error TS2373: Initializer of parameter 'h' cannot reference identifier 'i' declared after it.
5+
6+
7+
==== tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment3.ts (4 errors) ====
8+
const [a, b = a] = [1]; // ok
9+
const [c, d = c, e = e] = [1]; // error for e = e
10+
~
11+
!!! error TS2448: Block-scoped variable 'e' used before its declaration.
12+
const [f, g = f, h = i, i = f] = [1]; // error for h = i
13+
~
14+
!!! error TS2448: Block-scoped variable 'i' used before its declaration.
15+
16+
(function ([a, b = a]) { // ok
17+
})([1]);
18+
(function ([c, d = c, e = e]) { // error for e = e
19+
~
20+
!!! error TS2372: Parameter 'e' cannot be referenced in its initializer.
21+
})([1]);
22+
(function ([f, g = f, h = i, i = f]) { // error for h = i
23+
~
24+
!!! error TS2373: Initializer of parameter 'h' cannot reference identifier 'i' declared after it.
25+
})([1])
26+
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
//// [destructuringArrayBindingPatternAndAssignment3.ts]
2+
const [a, b = a] = [1]; // ok
3+
const [c, d = c, e = e] = [1]; // error for e = e
4+
const [f, g = f, h = i, i = f] = [1]; // error for h = i
5+
6+
(function ([a, b = a]) { // ok
7+
})([1]);
8+
(function ([c, d = c, e = e]) { // error for e = e
9+
})([1]);
10+
(function ([f, g = f, h = i, i = f]) { // error for h = i
11+
})([1])
12+
13+
14+
//// [destructuringArrayBindingPatternAndAssignment3.js]
15+
var _a = [1], a = _a[0], _b = _a[1], b = _b === void 0 ? a : _b; // ok
16+
var _c = [1], c = _c[0], _d = _c[1], d = _d === void 0 ? c : _d, _e = _c[2], e = _e === void 0 ? e : _e; // error for e = e
17+
var _f = [1], f = _f[0], _g = _f[1], g = _g === void 0 ? f : _g, _h = _f[2], h = _h === void 0 ? i : _h, _j = _f[3], i = _j === void 0 ? f : _j; // error for h = i
18+
(function (_a) {
19+
var a = _a[0], _b = _a[1], b = _b === void 0 ? a : _b;
20+
})([1]);
21+
(function (_a) {
22+
var c = _a[0], _b = _a[1], d = _b === void 0 ? c : _b, _c = _a[2], e = _c === void 0 ? e : _c;
23+
})([1]);
24+
(function (_a) {
25+
var f = _a[0], _b = _a[1], g = _b === void 0 ? f : _b, _c = _a[2], h = _c === void 0 ? i : _c, _d = _a[3], i = _d === void 0 ? f : _d;
26+
})([1]);
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAssignment4.ts(6,9): error TS2448: Block-scoped variable 'f' used before its declaration.
2+
tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAssignment4.ts(7,9): error TS2448: Block-scoped variable 'f' used before its declaration.
3+
4+
5+
==== tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAssignment4.ts (2 errors) ====
6+
const {
7+
a = 1,
8+
b = 2,
9+
c = b, // ok
10+
d = a, // ok
11+
e = f, // error
12+
~
13+
!!! error TS2448: Block-scoped variable 'f' used before its declaration.
14+
f = f // error
15+
~
16+
!!! error TS2448: Block-scoped variable 'f' used before its declaration.
17+
} = { } as any;
18+
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//// [destructuringObjectBindingPatternAndAssignment4.ts]
2+
const {
3+
a = 1,
4+
b = 2,
5+
c = b, // ok
6+
d = a, // ok
7+
e = f, // error
8+
f = f // error
9+
} = { } as any;
10+
11+
12+
//// [destructuringObjectBindingPatternAndAssignment4.js]
13+
var _a = {}, _b = _a.a, a = _b === void 0 ? 1 : _b, _c = _a.b, b = _c === void 0 ? 2 : _c, _d = _a.c, c = _d === void 0 ? b : _d, // ok
14+
_e = _a.d, // ok
15+
d = _e === void 0 ? a : _e, // ok
16+
_f = _a.e, // ok
17+
e = _f === void 0 ? f : _f, // error
18+
_g = _a.f // error
19+
, // error
20+
f = _g === void 0 ? f : _g // error
21+
;

0 commit comments

Comments
 (0)