Skip to content

Commit 2f252dd

Browse files
committed
Accept baseline after re-ordering reduce
1 parent 756956b commit 2f252dd

24 files changed

+365
-357
lines changed

tests/baselines/reference/anyInferenceAnonymousFunctions.symbols

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ paired.reduce(function (a1, a2) {
1010
>a2 : Symbol(a2, Decl(anyInferenceAnonymousFunctions.ts, 2, 27))
1111

1212
return a1.concat({});
13+
>a1.concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
1314
>a1 : Symbol(a1, Decl(anyInferenceAnonymousFunctions.ts, 2, 24))
15+
>concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
1416

1517
} , []);
1618

@@ -22,7 +24,9 @@ paired.reduce((b1, b2) => {
2224
>b2 : Symbol(b2, Decl(anyInferenceAnonymousFunctions.ts, 8, 18))
2325

2426
return b1.concat({});
27+
>b1.concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
2528
>b1 : Symbol(b1, Decl(anyInferenceAnonymousFunctions.ts, 8, 15))
29+
>concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
2630

2731
} , []);
2832

@@ -32,7 +36,9 @@ paired.reduce((b3, b4) => b3.concat({}), []);
3236
>reduce : Symbol(Array.reduce, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
3337
>b3 : Symbol(b3, Decl(anyInferenceAnonymousFunctions.ts, 13, 15))
3438
>b4 : Symbol(b4, Decl(anyInferenceAnonymousFunctions.ts, 13, 18))
39+
>b3.concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
3540
>b3 : Symbol(b3, Decl(anyInferenceAnonymousFunctions.ts, 13, 15))
41+
>concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
3642

3743
paired.map((c1) => c1.count);
3844
>paired.map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --))

tests/baselines/reference/anyInferenceAnonymousFunctions.types

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,55 +3,55 @@ var paired: any[];
33
>paired : any[]
44

55
paired.reduce(function (a1, a2) {
6-
>paired.reduce(function (a1, a2) { return a1.concat({});} , []) : any
7-
>paired.reduce : { (callbackfn: (previousValue: any, currentValue: any, currentIndex: number, array: any[]) => any): any; (callbackfn: (previousValue: any, currentValue: any, currentIndex: number, array: any[]) => any, initialValue: any): any; <U>(callbackfn: (previousValue: U, currentValue: any, currentIndex: number, array: any[]) => U, initialValue: U): U; }
6+
>paired.reduce(function (a1, a2) { return a1.concat({});} , []) : any[]
7+
>paired.reduce : { <U>(callbackfn: (previousValue: U, currentValue: any, currentIndex: number, array: any[]) => U, initialValue: U): U; (callbackfn: (previousValue: any, currentValue: any, currentIndex: number, array: any[]) => any): any; (callbackfn: (previousValue: any, currentValue: any, currentIndex: number, array: any[]) => any, initialValue: any): any; }
88
>paired : any[]
9-
>reduce : { (callbackfn: (previousValue: any, currentValue: any, currentIndex: number, array: any[]) => any): any; (callbackfn: (previousValue: any, currentValue: any, currentIndex: number, array: any[]) => any, initialValue: any): any; <U>(callbackfn: (previousValue: U, currentValue: any, currentIndex: number, array: any[]) => U, initialValue: U): U; }
10-
>function (a1, a2) { return a1.concat({});} : (a1: any, a2: any) => any
11-
>a1 : any
9+
>reduce : { <U>(callbackfn: (previousValue: U, currentValue: any, currentIndex: number, array: any[]) => U, initialValue: U): U; (callbackfn: (previousValue: any, currentValue: any, currentIndex: number, array: any[]) => any): any; (callbackfn: (previousValue: any, currentValue: any, currentIndex: number, array: any[]) => any, initialValue: any): any; }
10+
>function (a1, a2) { return a1.concat({});} : (a1: any[], a2: any) => any[]
11+
>a1 : any[]
1212
>a2 : any
1313

1414
return a1.concat({});
15-
>a1.concat({}) : any
16-
>a1.concat : any
17-
>a1 : any
18-
>concat : any
15+
>a1.concat({}) : any[]
16+
>a1.concat : { (...items: ConcatArray<any>[]): any[]; (...items: any[]): any[]; }
17+
>a1 : any[]
18+
>concat : { (...items: ConcatArray<any>[]): any[]; (...items: any[]): any[]; }
1919
>{} : {}
2020

2121
} , []);
2222
>[] : undefined[]
2323

2424
paired.reduce((b1, b2) => {
25-
>paired.reduce((b1, b2) => { return b1.concat({});} , []) : any
26-
>paired.reduce : { (callbackfn: (previousValue: any, currentValue: any, currentIndex: number, array: any[]) => any): any; (callbackfn: (previousValue: any, currentValue: any, currentIndex: number, array: any[]) => any, initialValue: any): any; <U>(callbackfn: (previousValue: U, currentValue: any, currentIndex: number, array: any[]) => U, initialValue: U): U; }
25+
>paired.reduce((b1, b2) => { return b1.concat({});} , []) : any[]
26+
>paired.reduce : { <U>(callbackfn: (previousValue: U, currentValue: any, currentIndex: number, array: any[]) => U, initialValue: U): U; (callbackfn: (previousValue: any, currentValue: any, currentIndex: number, array: any[]) => any): any; (callbackfn: (previousValue: any, currentValue: any, currentIndex: number, array: any[]) => any, initialValue: any): any; }
2727
>paired : any[]
28-
>reduce : { (callbackfn: (previousValue: any, currentValue: any, currentIndex: number, array: any[]) => any): any; (callbackfn: (previousValue: any, currentValue: any, currentIndex: number, array: any[]) => any, initialValue: any): any; <U>(callbackfn: (previousValue: U, currentValue: any, currentIndex: number, array: any[]) => U, initialValue: U): U; }
29-
>(b1, b2) => { return b1.concat({});} : (b1: any, b2: any) => any
30-
>b1 : any
28+
>reduce : { <U>(callbackfn: (previousValue: U, currentValue: any, currentIndex: number, array: any[]) => U, initialValue: U): U; (callbackfn: (previousValue: any, currentValue: any, currentIndex: number, array: any[]) => any): any; (callbackfn: (previousValue: any, currentValue: any, currentIndex: number, array: any[]) => any, initialValue: any): any; }
29+
>(b1, b2) => { return b1.concat({});} : (b1: any[], b2: any) => any[]
30+
>b1 : any[]
3131
>b2 : any
3232

3333
return b1.concat({});
34-
>b1.concat({}) : any
35-
>b1.concat : any
36-
>b1 : any
37-
>concat : any
34+
>b1.concat({}) : any[]
35+
>b1.concat : { (...items: ConcatArray<any>[]): any[]; (...items: any[]): any[]; }
36+
>b1 : any[]
37+
>concat : { (...items: ConcatArray<any>[]): any[]; (...items: any[]): any[]; }
3838
>{} : {}
3939

4040
} , []);
4141
>[] : undefined[]
4242

4343
paired.reduce((b3, b4) => b3.concat({}), []);
44-
>paired.reduce((b3, b4) => b3.concat({}), []) : any
45-
>paired.reduce : { (callbackfn: (previousValue: any, currentValue: any, currentIndex: number, array: any[]) => any): any; (callbackfn: (previousValue: any, currentValue: any, currentIndex: number, array: any[]) => any, initialValue: any): any; <U>(callbackfn: (previousValue: U, currentValue: any, currentIndex: number, array: any[]) => U, initialValue: U): U; }
44+
>paired.reduce((b3, b4) => b3.concat({}), []) : any[]
45+
>paired.reduce : { <U>(callbackfn: (previousValue: U, currentValue: any, currentIndex: number, array: any[]) => U, initialValue: U): U; (callbackfn: (previousValue: any, currentValue: any, currentIndex: number, array: any[]) => any): any; (callbackfn: (previousValue: any, currentValue: any, currentIndex: number, array: any[]) => any, initialValue: any): any; }
4646
>paired : any[]
47-
>reduce : { (callbackfn: (previousValue: any, currentValue: any, currentIndex: number, array: any[]) => any): any; (callbackfn: (previousValue: any, currentValue: any, currentIndex: number, array: any[]) => any, initialValue: any): any; <U>(callbackfn: (previousValue: U, currentValue: any, currentIndex: number, array: any[]) => U, initialValue: U): U; }
48-
>(b3, b4) => b3.concat({}) : (b3: any, b4: any) => any
49-
>b3 : any
47+
>reduce : { <U>(callbackfn: (previousValue: U, currentValue: any, currentIndex: number, array: any[]) => U, initialValue: U): U; (callbackfn: (previousValue: any, currentValue: any, currentIndex: number, array: any[]) => any): any; (callbackfn: (previousValue: any, currentValue: any, currentIndex: number, array: any[]) => any, initialValue: any): any; }
48+
>(b3, b4) => b3.concat({}) : (b3: any[], b4: any) => any[]
49+
>b3 : any[]
5050
>b4 : any
51-
>b3.concat({}) : any
52-
>b3.concat : any
53-
>b3 : any
54-
>concat : any
51+
>b3.concat({}) : any[]
52+
>b3.concat : { (...items: ConcatArray<any>[]): any[]; (...items: any[]): any[]; }
53+
>b3 : any[]
54+
>concat : { (...items: ConcatArray<any>[]): any[]; (...items: any[]): any[]; }
5555
>{} : {}
5656
>[] : undefined[]
5757

tests/baselines/reference/destructuringTuple.errors.txt

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
tests/cases/compiler/destructuringTuple.ts(11,7): error TS2461: Type 'number' is not an array type.
1+
tests/cases/compiler/destructuringTuple.ts(11,8): error TS2493: Tuple type '[]' of length '0' has no element at index '0'.
22
tests/cases/compiler/destructuringTuple.ts(11,48): error TS2769: No overload matches this call.
3-
Overload 1 of 3, '(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number', gave the following error.
4-
Type 'never[]' is not assignable to type 'number'.
5-
Overload 2 of 3, '(callbackfn: (previousValue: [], currentValue: number, currentIndex: number, array: number[]) => [], initialValue: []): []', gave the following error.
3+
Overload 1 of 3, '(callbackfn: (previousValue: [], currentValue: number, currentIndex: number, array: number[]) => [], initialValue: []): []', gave the following error.
64
Type 'never[]' is not assignable to type '[]'.
75
Types of property 'length' are incompatible.
86
Type 'number' is not assignable to type '0'.
7+
Overload 2 of 3, '(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number', gave the following error.
8+
Type 'never[]' is not assignable to type 'number'.
99
tests/cases/compiler/destructuringTuple.ts(11,60): error TS2769: No overload matches this call.
1010
Overload 1 of 2, '(...items: ConcatArray<never>[]): never[]', gave the following error.
1111
Argument of type 'number' is not assignable to parameter of type 'ConcatArray<never>'.
@@ -25,18 +25,18 @@ tests/cases/compiler/destructuringTuple.ts(11,60): error TS2769: No overload mat
2525
// Repros from #32140
2626

2727
const [oops1] = [1, 2, 3].reduce((accu, el) => accu.concat(el), []);
28-
~~~~~~~
29-
!!! error TS2461: Type 'number' is not an array type.
28+
~~~~~
29+
!!! error TS2493: Tuple type '[]' of length '0' has no element at index '0'.
3030
~~~~~~~~~~~~~~~
3131
!!! error TS2769: No overload matches this call.
32-
!!! error TS2769: Overload 1 of 3, '(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number', gave the following error.
33-
!!! error TS2769: Type 'never[]' is not assignable to type 'number'.
34-
!!! error TS2769: Overload 2 of 3, '(callbackfn: (previousValue: [], currentValue: number, currentIndex: number, array: number[]) => [], initialValue: []): []', gave the following error.
32+
!!! error TS2769: Overload 1 of 3, '(callbackfn: (previousValue: [], currentValue: number, currentIndex: number, array: number[]) => [], initialValue: []): []', gave the following error.
3533
!!! error TS2769: Type 'never[]' is not assignable to type '[]'.
3634
!!! error TS2769: Types of property 'length' are incompatible.
3735
!!! error TS2769: Type 'number' is not assignable to type '0'.
38-
!!! related TS6502 /.ts/lib.es5.d.ts:1350:24: The expected type comes from the return type of this signature.
39-
!!! related TS6502 /.ts/lib.es5.d.ts:1356:27: The expected type comes from the return type of this signature.
36+
!!! error TS2769: Overload 2 of 3, '(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number', gave the following error.
37+
!!! error TS2769: Type 'never[]' is not assignable to type 'number'.
38+
!!! related TS6502 /.ts/lib.es5.d.ts:1349:27: The expected type comes from the return type of this signature.
39+
!!! related TS6502 /.ts/lib.es5.d.ts:1356:24: The expected type comes from the return type of this signature.
4040
~~
4141
!!! error TS2769: No overload matches this call.
4242
!!! error TS2769: Overload 1 of 2, '(...items: ConcatArray<never>[]): never[]', gave the following error.

tests/baselines/reference/destructuringTuple.types

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ declare var receiver: typeof tuple;
2323
// Repros from #32140
2424

2525
const [oops1] = [1, 2, 3].reduce((accu, el) => accu.concat(el), []);
26-
>oops1 : any
27-
>[1, 2, 3].reduce((accu, el) => accu.concat(el), []) : number
28-
>[1, 2, 3].reduce : { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; <U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }
26+
>oops1 : undefined
27+
>[1, 2, 3].reduce((accu, el) => accu.concat(el), []) : []
28+
>[1, 2, 3].reduce : { <U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; }
2929
>[1, 2, 3] : number[]
3030
>1 : 1
3131
>2 : 2
3232
>3 : 3
33-
>reduce : { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; <U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }
33+
>reduce : { <U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; }
3434
>(accu, el) => accu.concat(el) : (accu: [], el: number) => never[]
3535
>accu : []
3636
>el : number
@@ -39,17 +39,17 @@ const [oops1] = [1, 2, 3].reduce((accu, el) => accu.concat(el), []);
3939
>accu : []
4040
>concat : { (...items: ConcatArray<never>[]): never[]; (...items: ConcatArray<never>[]): never[]; }
4141
>el : number
42-
>[] : never[]
42+
>[] : []
4343

4444
const [oops2] = [1, 2, 3].reduce((acc: number[], e) => acc.concat(e), []);
4545
>oops2 : number
4646
>[1, 2, 3].reduce((acc: number[], e) => acc.concat(e), []) : number[]
47-
>[1, 2, 3].reduce : { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; <U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }
47+
>[1, 2, 3].reduce : { <U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; }
4848
>[1, 2, 3] : number[]
4949
>1 : 1
5050
>2 : 2
5151
>3 : 3
52-
>reduce : { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; <U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }
52+
>reduce : { <U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; }
5353
>(acc: number[], e) => acc.concat(e) : (acc: number[], e: number) => number[]
5454
>acc : number[]
5555
>e : number

0 commit comments

Comments
 (0)