Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jablko committed Oct 9, 2019
1 parent d202b21 commit f4e78a6
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/baselines/reference/arrayConcat2.js
Expand Up @@ -6,6 +6,12 @@ a.concat('Hello');

var b = new Array<string>();
b.concat('hello');

// #19535

const c: number[][] = [];
const [x] = c.concat([1]);
x == 1;


//// [arrayConcat2.js]
Expand All @@ -14,3 +20,7 @@ a.concat("hello", 'world');
a.concat('Hello');
var b = new Array();
b.concat('hello');
// #19535
var c = [];
var x = c.concat([1])[0];
x == 1;
14 changes: 14 additions & 0 deletions tests/baselines/reference/arrayConcat2.symbols
Expand Up @@ -21,3 +21,17 @@ b.concat('hello');
>b : Symbol(b, Decl(arrayConcat2.ts, 5, 3))
>concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))

// #19535

const c: number[][] = [];
>c : Symbol(c, Decl(arrayConcat2.ts, 10, 5))

const [x] = c.concat([1]);
>x : Symbol(x, Decl(arrayConcat2.ts, 11, 7))
>c.concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>c : Symbol(c, Decl(arrayConcat2.ts, 10, 5))
>concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))

x == 1;
>x : Symbol(x, Decl(arrayConcat2.ts, 11, 7))

20 changes: 20 additions & 0 deletions tests/baselines/reference/arrayConcat2.types
Expand Up @@ -30,3 +30,23 @@ b.concat('hello');
>concat : { (...items: ConcatArray<string>[]): string[]; <U extends (string | ConcatArray<string>)[]>(...items: U): (string | ConcatFlatten<U[number]>)[]; }
>'hello' : "hello"

// #19535

const c: number[][] = [];
>c : number[][]
>[] : undefined[]

const [x] = c.concat([1]);
>x : number | number[]
>c.concat([1]) : (number | number[])[]
>c.concat : { (...items: ConcatArray<number[]>[]): number[][]; <U extends (number[] | ConcatArray<number[]>)[]>(...items: U): (number[] | ConcatFlatten<U[number]>)[]; }
>c : number[][]
>concat : { (...items: ConcatArray<number[]>[]): number[][]; <U extends (number[] | ConcatArray<number[]>)[]>(...items: U): (number[] | ConcatFlatten<U[number]>)[]; }
>[1] : number[]
>1 : 1

x == 1;
>x == 1 : boolean
>x : number | number[]
>1 : 1

6 changes: 6 additions & 0 deletions tests/cases/compiler/arrayConcat2.ts
Expand Up @@ -5,3 +5,9 @@ a.concat('Hello');

var b = new Array<string>();
b.concat('hello');

// #19535

const c: number[][] = [];
const [x] = c.concat([1]);
x == 1;

0 comments on commit f4e78a6

Please sign in to comment.