-
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.
- Loading branch information
1 parent
d65d9b2
commit 9b6de0c
Showing
21 changed files
with
537 additions
and
77 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
5 changes: 4 additions & 1 deletion
5
tests/baselines/reference/FunctionDeclaration10_es6.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
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 was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,43 @@ | ||
=== tests/cases/compiler/destructureGenerics.ts === | ||
// declare function f<T extends any[]>(...args: T): T; | ||
// var x = f(1,2); | ||
// var x: number[]; | ||
declare function f<T extends any[]>(...args: T): T; | ||
>f : Symbol(f, Decl(destructureGenerics.ts, 0, 0)) | ||
>T : Symbol(T, Decl(destructureGenerics.ts, 0, 19)) | ||
>args : Symbol(args, Decl(destructureGenerics.ts, 0, 36)) | ||
>T : Symbol(T, Decl(destructureGenerics.ts, 0, 19)) | ||
>T : Symbol(T, Decl(destructureGenerics.ts, 0, 19)) | ||
|
||
var x = f(1,2); | ||
>x : Symbol(x, Decl(destructureGenerics.ts, 1, 3), Decl(destructureGenerics.ts, 2, 3)) | ||
>f : Symbol(f, Decl(destructureGenerics.ts, 0, 0)) | ||
|
||
var x: [1, 2]; | ||
>x : Symbol(x, Decl(destructureGenerics.ts, 1, 3), Decl(destructureGenerics.ts, 2, 3)) | ||
|
||
declare function g<T extends [number, number]>(...args: T): T; | ||
>g : Symbol(g, Decl(destructureGenerics.ts, 0, 0)) | ||
>g : Symbol(g, Decl(destructureGenerics.ts, 2, 14)) | ||
>T : Symbol(T, Decl(destructureGenerics.ts, 3, 19)) | ||
>args : Symbol(args, Decl(destructureGenerics.ts, 3, 47)) | ||
>T : Symbol(T, Decl(destructureGenerics.ts, 3, 19)) | ||
>T : Symbol(T, Decl(destructureGenerics.ts, 3, 19)) | ||
|
||
// var y = g(1); // error | ||
// var y: [1]; | ||
var z = g(1,2); | ||
>z : Symbol(z, Decl(destructureGenerics.ts, 6, 3)) | ||
>g : Symbol(g, Decl(destructureGenerics.ts, 0, 0)) | ||
>z : Symbol(z, Decl(destructureGenerics.ts, 4, 3), Decl(destructureGenerics.ts, 5, 3)) | ||
>g : Symbol(g, Decl(destructureGenerics.ts, 2, 14)) | ||
|
||
var z: [1,2]; | ||
>z : Symbol(z, Decl(destructureGenerics.ts, 4, 3), Decl(destructureGenerics.ts, 5, 3)) | ||
|
||
// var z: [1,2]; | ||
// var a = g(1,2,3); // error | ||
// var a: [1,2,3]; | ||
declare function h<T>(...args: T[]): T; | ||
>h : Symbol(h, Decl(destructureGenerics.ts, 6, 15)) | ||
>T : Symbol(T, Decl(destructureGenerics.ts, 10, 19)) | ||
>args : Symbol(args, Decl(destructureGenerics.ts, 10, 22)) | ||
>T : Symbol(T, Decl(destructureGenerics.ts, 10, 19)) | ||
>T : Symbol(T, Decl(destructureGenerics.ts, 10, 19)) | ||
>h : Symbol(h, Decl(destructureGenerics.ts, 5, 13)) | ||
>T : Symbol(T, Decl(destructureGenerics.ts, 6, 19)) | ||
>args : Symbol(args, Decl(destructureGenerics.ts, 6, 22)) | ||
>T : Symbol(T, Decl(destructureGenerics.ts, 6, 19)) | ||
>T : Symbol(T, Decl(destructureGenerics.ts, 6, 19)) | ||
|
||
var b = h(1,2,3); | ||
>b : Symbol(b, Decl(destructureGenerics.ts, 11, 3)) | ||
>h : Symbol(h, Decl(destructureGenerics.ts, 6, 15)) | ||
>b : Symbol(b, Decl(destructureGenerics.ts, 7, 3), Decl(destructureGenerics.ts, 8, 3)) | ||
>h : Symbol(h, Decl(destructureGenerics.ts, 5, 13)) | ||
|
||
// var b: 1|2|3; | ||
var b: number; | ||
>b : Symbol(b, Decl(destructureGenerics.ts, 7, 3), Decl(destructureGenerics.ts, 8, 3)) | ||
|
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
15 changes: 15 additions & 0 deletions
15
tests/baselines/reference/destructureGenericsErrors.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,15 @@ | ||
tests/cases/compiler/destructureGenericsErrors.ts(2,9): error TS2554: Expected 2 arguments, but got 1. | ||
tests/cases/compiler/destructureGenericsErrors.ts(4,15): error TS2345: Argument of type '3' is not assignable to parameter of type 'never'. | ||
|
||
|
||
==== tests/cases/compiler/destructureGenericsErrors.ts (2 errors) ==== | ||
declare function g<T extends [number, number]>(...args: T): T; | ||
var y = g(1); // error | ||
~~~~ | ||
!!! error TS2554: Expected 2 arguments, but got 1. | ||
var y: [1]; | ||
var a = g(1,2,3); // error | ||
~ | ||
!!! error TS2345: Argument of type '3' is not assignable to parameter of type 'never'. | ||
var a: [1,2,3]; | ||
|
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,13 @@ | ||
//// [destructureGenericsErrors.ts] | ||
declare function g<T extends [number, number]>(...args: T): T; | ||
var y = g(1); // error | ||
var y: [1]; | ||
var a = g(1,2,3); // error | ||
var a: [1,2,3]; | ||
|
||
|
||
//// [destructureGenericsErrors.js] | ||
var y = g(1); // error | ||
var y; | ||
var a = g(1, 2, 3); // error | ||
var a; |
17 changes: 17 additions & 0 deletions
17
tests/baselines/reference/destructureGenericsErrors.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/compiler/destructureGenericsErrors.ts === | ||
declare function g<T extends [number, number]>(...args: T): T; | ||
>g : Symbol(g, Decl(destructureGenericsErrors.ts, 0, 0)) | ||
>T : Symbol(T, Decl(destructureGenericsErrors.ts, 0, 19)) | ||
>args : Symbol(args, Decl(destructureGenericsErrors.ts, 0, 47)) | ||
>T : Symbol(T, Decl(destructureGenericsErrors.ts, 0, 19)) | ||
>T : Symbol(T, Decl(destructureGenericsErrors.ts, 0, 19)) | ||
|
||
// var y = g(1); // error | ||
// var y: [1]; | ||
var a = g(1,2,3); // error | ||
>a : Symbol(a, Decl(destructureGenericsErrors.ts, 3, 3), Decl(destructureGenericsErrors.ts, 4, 3)) | ||
>g : Symbol(g, Decl(destructureGenericsErrors.ts, 0, 0)) | ||
|
||
var a: [1,2,3]; | ||
>a : Symbol(a, Decl(destructureGenericsErrors.ts, 3, 3), Decl(destructureGenericsErrors.ts, 4, 3)) | ||
|
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/compiler/destructureGenericsErrors.ts === | ||
declare function g<T extends [number, number]>(...args: T): T; | ||
>g : <T extends [number, number]>(...args: T) => T | ||
>T : T | ||
>args : T | ||
>T : T | ||
>T : T | ||
|
||
// var y = g(1); // error | ||
// var y: [1]; | ||
var a = g(1,2,3); // error | ||
>a : [1, 2, 3] | ||
>g(1,2,3) : [1, 2, 3] | ||
>g : <T extends [number, number]>(...args: T) => T | ||
>1 : 1 | ||
>2 : 2 | ||
>3 : 3 | ||
|
||
var a: [1,2,3]; | ||
>a : [1, 2, 3] | ||
|
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
Oops, something went wrong.