-
Notifications
You must be signed in to change notification settings - Fork 12.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Disallow binding patterns in binding rest elements (fixes #2519)
- Loading branch information
1 parent
6637f49
commit 2d3b22c
Showing
9 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
tests/baselines/reference/restElementWithBindingPattern.errors.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
tests/cases/conformance/es6/destructuring/restElementWithBindingPattern.ts(1,9): error TS2501: A rest element cannot contain a binding pattern. | ||
|
||
|
||
==== tests/cases/conformance/es6/destructuring/restElementWithBindingPattern.ts (1 errors) ==== | ||
var [...[a, b]] = [0, 1]; | ||
~~~~~~ | ||
!!! error TS2501: A rest element cannot contain a binding pattern. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
//// [restElementWithBindingPattern.ts] | ||
var [...[a, b]] = [0, 1]; | ||
|
||
//// [restElementWithBindingPattern.js] | ||
var _a = [0, 1], [a, b] = _a.slice(0); |
10 changes: 10 additions & 0 deletions
10
tests/baselines/reference/restElementWithBindingPattern2.errors.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
tests/cases/conformance/es6/destructuring/restElementWithBindingPattern2.ts(1,9): error TS2501: A rest element cannot contain a binding pattern. | ||
tests/cases/conformance/es6/destructuring/restElementWithBindingPattern2.ts(1,16): error TS2459: Type 'number[]' has no property 'b' and no string index signature. | ||
|
||
|
||
==== tests/cases/conformance/es6/destructuring/restElementWithBindingPattern2.ts (2 errors) ==== | ||
var [...{0: a, b }] = [0, 1]; | ||
~~~~~~~~~~ | ||
!!! error TS2501: A rest element cannot contain a binding pattern. | ||
~ | ||
!!! error TS2459: Type 'number[]' has no property 'b' and no string index signature. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
//// [restElementWithBindingPattern2.ts] | ||
var [...{0: a, b }] = [0, 1]; | ||
|
||
//// [restElementWithBindingPattern2.js] | ||
var _a = [0, 1], { 0: a, b } = _a.slice(0); |
1 change: 1 addition & 0 deletions
1
tests/cases/conformance/es6/destructuring/restElementWithBindingPattern.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
var [...[a, b]] = [0, 1]; |
1 change: 1 addition & 0 deletions
1
tests/cases/conformance/es6/destructuring/restElementWithBindingPattern2.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
var [...{0: a, b }] = [0, 1]; |