-
Notifications
You must be signed in to change notification settings - Fork 12.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Error on binding patterns and improve error location
- Loading branch information
Andy Hanson
committed
Mar 1, 2018
1 parent
0a32978
commit f69d5b4
Showing
13 changed files
with
122 additions
and
29 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
21 changes: 21 additions & 0 deletions
21
tests/baselines/reference/trailingCommasInBindingPatterns.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,21 @@ | ||
tests/cases/conformance/es7/trailingCommasInBindingPatterns.ts(1,12): error TS1013: A rest parameter or binding pattern may not have a trailing comma. | ||
tests/cases/conformance/es7/trailingCommasInBindingPatterns.ts(2,12): error TS1013: A rest parameter or binding pattern may not have a trailing comma. | ||
tests/cases/conformance/es7/trailingCommasInBindingPatterns.ts(4,7): error TS1013: A rest parameter or binding pattern may not have a trailing comma. | ||
tests/cases/conformance/es7/trailingCommasInBindingPatterns.ts(5,7): error TS1013: A rest parameter or binding pattern may not have a trailing comma. | ||
|
||
|
||
==== tests/cases/conformance/es7/trailingCommasInBindingPatterns.ts (4 errors) ==== | ||
const [...a,] = []; | ||
~ | ||
!!! error TS1013: A rest parameter or binding pattern may not have a trailing comma. | ||
const {...b,} = {}; | ||
~ | ||
!!! error TS1013: A rest parameter or binding pattern may not have a trailing comma. | ||
let c, d; | ||
([...c,] = []); | ||
~ | ||
!!! error TS1013: A rest parameter or binding pattern may not have a trailing comma. | ||
({...d,} = {}); | ||
~ | ||
!!! error TS1013: A rest parameter or binding pattern may not have a trailing comma. | ||
|
23 changes: 23 additions & 0 deletions
23
tests/baselines/reference/trailingCommasInBindingPatterns.js
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,23 @@ | ||
//// [trailingCommasInBindingPatterns.ts] | ||
const [...a,] = []; | ||
const {...b,} = {}; | ||
let c, d; | ||
([...c,] = []); | ||
({...d,} = {}); | ||
|
||
|
||
//// [trailingCommasInBindingPatterns.js] | ||
var __rest = (this && this.__rest) || function (s, e) { | ||
var t = {}; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) | ||
t[p] = s[p]; | ||
if (s != null && typeof Object.getOwnPropertySymbols === "function") | ||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0) | ||
t[p[i]] = s[p[i]]; | ||
return t; | ||
}; | ||
var a = [].slice(0); | ||
var b = __rest({}, []); | ||
var c, d; | ||
(c = [].slice(0)); | ||
(d = __rest({}, [])); |
17 changes: 17 additions & 0 deletions
17
tests/baselines/reference/trailingCommasInBindingPatterns.symbols
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,17 @@ | ||
=== tests/cases/conformance/es7/trailingCommasInBindingPatterns.ts === | ||
const [...a,] = []; | ||
>a : Symbol(a, Decl(trailingCommasInBindingPatterns.ts, 0, 7)) | ||
|
||
const {...b,} = {}; | ||
>b : Symbol(b, Decl(trailingCommasInBindingPatterns.ts, 1, 7)) | ||
|
||
let c, d; | ||
>c : Symbol(c, Decl(trailingCommasInBindingPatterns.ts, 2, 3)) | ||
>d : Symbol(d, Decl(trailingCommasInBindingPatterns.ts, 2, 6)) | ||
|
||
([...c,] = []); | ||
>c : Symbol(c, Decl(trailingCommasInBindingPatterns.ts, 2, 3)) | ||
|
||
({...d,} = {}); | ||
>d : Symbol(d, Decl(trailingCommasInBindingPatterns.ts, 2, 6)) | ||
|
28 changes: 28 additions & 0 deletions
28
tests/baselines/reference/trailingCommasInBindingPatterns.types
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,28 @@ | ||
=== tests/cases/conformance/es7/trailingCommasInBindingPatterns.ts === | ||
const [...a,] = []; | ||
>a : any[] | ||
>[] : undefined[] | ||
|
||
const {...b,} = {}; | ||
>b : {} | ||
>{} : {} | ||
|
||
let c, d; | ||
>c : any | ||
>d : any | ||
|
||
([...c,] = []); | ||
>([...c,] = []) : undefined[] | ||
>[...c,] = [] : undefined[] | ||
>[...c,] : undefined[] | ||
>...c : any | ||
>c : any | ||
>[] : undefined[] | ||
|
||
({...d,} = {}); | ||
>({...d,} = {}) : {} | ||
>{...d,} = {} : {} | ||
>{...d,} : any | ||
>d : any | ||
>{} : {} | ||
|
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
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
5 changes: 5 additions & 0 deletions
5
tests/cases/conformance/es7/trailingCommasInBindingPatterns.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,5 @@ | ||
const [...a,] = []; | ||
const {...b,} = {}; | ||
let c, d; | ||
([...c,] = []); | ||
({...d,} = {}); |