Skip to content

Commit ee05467

Browse files
committed
Baseline accept
1 parent 17d7cce commit ee05467

7 files changed

+72
-57
lines changed

tests/baselines/reference/functionConstraintSatisfaction3.errors.txt

+11-5
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction3.ts(48,6): error TS2345: Argument of type '(x: string, y: string) => string' is not assignable to parameter of type '(x: string, y: number) => string'.
1+
tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction3.ts(50,6): error TS2345: Argument of type '(x: string, y: string) => string' is not assignable to parameter of type '(x: string, y: number) => string'.
22
Types of parameters 'y' and 'y' are incompatible.
33
Type 'number' is not assignable to type 'string'.
4-
tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction3.ts(49,7): error TS2345: Argument of type '(x: string, y: string) => string' is not assignable to parameter of type '(x: string, y: number) => string'.
4+
tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction3.ts(51,7): error TS2345: Argument of type '(x: string, y: string) => string' is not assignable to parameter of type '(x: string, y: number) => string'.
55
Types of parameters 'y' and 'y' are incompatible.
66
Type 'number' is not assignable to type 'string'.
7-
tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction3.ts(55,12): error TS2345: Argument of type '(x: number) => number' is not assignable to parameter of type '(x: string) => string'.
7+
tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction3.ts(59,12): error TS2345: Argument of type '(x: number) => number' is not assignable to parameter of type '(x: string) => string'.
88
Types of parameters 'x' and 'x' are incompatible.
99
Type 'string' is not assignable to type 'number'.
10-
tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction3.ts(56,11): error TS2345: Argument of type '(x: number) => number' is not assignable to parameter of type '(x: string) => string'.
10+
tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction3.ts(60,11): error TS2345: Argument of type '(x: number) => number' is not assignable to parameter of type '(x: string) => string'.
1111
Types of parameters 'x' and 'x' are incompatible.
1212
Type 'string' is not assignable to type 'number'.
13-
tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction3.ts(64,17): error TS2345: Argument of type '(x: number) => number' is not assignable to parameter of type '(x: string) => string'.
13+
tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction3.ts(70,17): error TS2345: Argument of type '(x: number) => number' is not assignable to parameter of type '(x: string) => string'.
1414
Types of parameters 'x' and 'x' are incompatible.
1515
Type 'string' is not assignable to type 'number'.
1616

@@ -59,9 +59,11 @@ tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstrain
5959
var r15 = foo(c2);
6060

6161
declare function id2<T>(x: T, y: T): T;
62+
declare function id3<T>(x: T, y: T, z: T): T;
6263

6364
declare function boom<R>(f: (x: string, y: number) => R): R;
6465
declare function boom2(f: (x: string, y: number) => string): void;
66+
declare function boom3<R>(f: (x: string, y: number, z: R) => R): R;
6567

6668
boom(id2); // Should be an error T = [string, number]
6769
~~~
@@ -73,6 +75,8 @@ tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstrain
7375
!!! error TS2345: Argument of type '(x: string, y: string) => string' is not assignable to parameter of type '(x: string, y: number) => string'.
7476
!!! error TS2345: Types of parameters 'y' and 'y' are incompatible.
7577
!!! error TS2345: Type 'number' is not assignable to type 'string'.
78+
boom<string|number>(id2); // Should be OK
79+
boom3<string|number>(id3); // Should be OK
7680

7781
declare function withNum<N extends number>(x: N): N;
7882
declare function withString<S extends string>(f: (x: S) => S): void;
@@ -90,9 +94,11 @@ tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstrain
9094
!!! error TS2345: Type 'string' is not assignable to type 'number'.
9195

9296
declare function okay<R>(f: (x: 1, y: number) => R): R;
97+
declare function okay2(f: (x: string, y: number) => string|number);
9398
declare function transitive<T>(x: T, f: (x: T) => T): void;
9499

95100
okay(id2);
101+
okay2(id2);
96102

97103
transitive(1, withNum);
98104
transitive('1', withNum);

tests/baselines/reference/functionConstraintSatisfaction3.js

+9
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,16 @@ var r12 = foo(i2);
4242
var r15 = foo(c2);
4343

4444
declare function id2<T>(x: T, y: T): T;
45+
declare function id3<T>(x: T, y: T, z: T): T;
4546

4647
declare function boom<R>(f: (x: string, y: number) => R): R;
4748
declare function boom2(f: (x: string, y: number) => string): void;
49+
declare function boom3<R>(f: (x: string, y: number, z: R) => R): R;
4850

4951
boom(id2); // Should be an error T = [string, number]
5052
boom2(id2); // Should be an error T = [string, number]
53+
boom<string|number>(id2); // Should be OK
54+
boom3<string|number>(id3); // Should be OK
5155

5256
declare function withNum<N extends number>(x: N): N;
5357
declare function withString<S extends string>(f: (x: S) => S): void;
@@ -57,9 +61,11 @@ withString(withNum); // Error
5761
useString(withNum); // Error
5862

5963
declare function okay<R>(f: (x: 1, y: number) => R): R;
64+
declare function okay2(f: (x: string, y: number) => string|number);
6065
declare function transitive<T>(x: T, f: (x: T) => T): void;
6166

6267
okay(id2);
68+
okay2(id2);
6369

6470
transitive(1, withNum);
6571
transitive('1', withNum);
@@ -98,8 +104,11 @@ var r12 = foo(i2);
98104
var r15 = foo(c2);
99105
boom(id2); // Should be an error T = [string, number]
100106
boom2(id2); // Should be an error T = [string, number]
107+
boom(id2); // Should be OK
108+
boom3(id3); // Should be OK
101109
withString(withNum); // Error
102110
useString(withNum); // Error
103111
okay(id2);
112+
okay2(id2);
104113
transitive(1, withNum);
105114
transitive('1', withNum);

tests/baselines/reference/promisePermutations.errors.txt

+16-16
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,17 @@ tests/cases/compiler/promisePermutations.ts(110,19): error TS2345: Argument of t
3131
tests/cases/compiler/promisePermutations.ts(111,19): error TS2345: Argument of type '(cb: <T>(a: T) => T) => Promise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
3232
Types of parameters 'cb' and 'value' are incompatible.
3333
Type 'string' is not assignable to type '<T>(a: T) => T'.
34-
tests/cases/compiler/promisePermutations.ts(117,19): error TS2345: Argument of type '(x: number, cb: (a: number) => number) => IPromise<number>' is not assignable to parameter of type '(value: number) => IPromise<any>'.
35-
tests/cases/compiler/promisePermutations.ts(120,19): error TS2345: Argument of type '(x: number, cb: (a: number) => number) => IPromise<number>' is not assignable to parameter of type '(value: number) => IPromise<any>'.
36-
tests/cases/compiler/promisePermutations.ts(121,19): error TS2345: Argument of type '(x: number, cb: (a: number) => number) => Promise<number>' is not assignable to parameter of type '(value: number) => Promise<any>'.
37-
tests/cases/compiler/promisePermutations.ts(122,19): error TS2345: Argument of type '(x: number, cb: (a: number) => number) => Promise<number>' is not assignable to parameter of type '(value: number) => IPromise<any>'.
38-
tests/cases/compiler/promisePermutations.ts(126,19): error TS2345: Argument of type '(x: number, cb: <U>(a: U) => U) => IPromise<number>' is not assignable to parameter of type '(value: number) => IPromise<any>'.
34+
tests/cases/compiler/promisePermutations.ts(117,19): error TS2345: Argument of type '(x: any, cb: (a: any) => any) => IPromise<any>' is not assignable to parameter of type '(value: number) => IPromise<any>'.
35+
tests/cases/compiler/promisePermutations.ts(120,19): error TS2345: Argument of type '(x: any, cb: (a: any) => any) => IPromise<any>' is not assignable to parameter of type '(value: number) => IPromise<any>'.
36+
tests/cases/compiler/promisePermutations.ts(121,19): error TS2345: Argument of type '(x: any, cb: (a: any) => any) => Promise<any>' is not assignable to parameter of type '(value: number) => Promise<any>'.
37+
tests/cases/compiler/promisePermutations.ts(122,19): error TS2345: Argument of type '(x: any, cb: (a: any) => any) => Promise<any>' is not assignable to parameter of type '(value: number) => IPromise<any>'.
38+
tests/cases/compiler/promisePermutations.ts(126,19): error TS2345: Argument of type '(x: any, cb: <U>(a: U) => U) => IPromise<any>' is not assignable to parameter of type '(value: number) => IPromise<any>'.
3939
tests/cases/compiler/promisePermutations.ts(129,11): error TS2453: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
4040
Type argument candidate 'IPromise<number>' is not a valid type argument because it is not a supertype of candidate 'IPromise<string>'.
4141
Type 'string' is not assignable to type 'number'.
42-
tests/cases/compiler/promisePermutations.ts(132,19): error TS2345: Argument of type '(x: number, cb: <U>(a: U) => U) => IPromise<number>' is not assignable to parameter of type '(value: number) => IPromise<any>'.
43-
tests/cases/compiler/promisePermutations.ts(133,19): error TS2345: Argument of type '(x: number, cb: <U>(a: U) => U) => Promise<number>' is not assignable to parameter of type '(value: number) => Promise<any>'.
44-
tests/cases/compiler/promisePermutations.ts(134,19): error TS2345: Argument of type '(x: number, cb: <U>(a: U) => U) => Promise<number>' is not assignable to parameter of type '(value: number) => IPromise<any>'.
42+
tests/cases/compiler/promisePermutations.ts(132,19): error TS2345: Argument of type '(x: any, cb: <U>(a: U) => U) => IPromise<any>' is not assignable to parameter of type '(value: number) => IPromise<any>'.
43+
tests/cases/compiler/promisePermutations.ts(133,19): error TS2345: Argument of type '(x: any, cb: <U>(a: U) => U) => Promise<any>' is not assignable to parameter of type '(value: number) => Promise<any>'.
44+
tests/cases/compiler/promisePermutations.ts(134,19): error TS2345: Argument of type '(x: any, cb: <U>(a: U) => U) => Promise<any>' is not assignable to parameter of type '(value: number) => IPromise<any>'.
4545
tests/cases/compiler/promisePermutations.ts(137,11): error TS2453: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
4646
Type argument candidate 'IPromise<number>' is not a valid type argument because it is not a supertype of candidate 'IPromise<string>'.
4747
tests/cases/compiler/promisePermutations.ts(144,12): error TS2453: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
@@ -239,24 +239,24 @@ tests/cases/compiler/promisePermutations.ts(160,21): error TS2345: Argument of t
239239
var nPromise: (x: any) => Promise<number>;
240240
var r8a = r8.then(testFunction8, testFunction8, testFunction8); // error
241241
~~~~~~~~~~~~~
242-
!!! error TS2345: Argument of type '(x: number, cb: (a: number) => number) => IPromise<number>' is not assignable to parameter of type '(value: number) => IPromise<any>'.
242+
!!! error TS2345: Argument of type '(x: any, cb: (a: any) => any) => IPromise<any>' is not assignable to parameter of type '(value: number) => IPromise<any>'.
243243
var r8b = r8.then(nIPromise, nIPromise, nIPromise).then(nIPromise, nIPromise, nIPromise); // ok
244244
var s8: Promise<number>;
245245
var s8a = s8.then(testFunction8, testFunction8, testFunction8); // error
246246
~~~~~~~~~~~~~
247-
!!! error TS2345: Argument of type '(x: number, cb: (a: number) => number) => IPromise<number>' is not assignable to parameter of type '(value: number) => IPromise<any>'.
247+
!!! error TS2345: Argument of type '(x: any, cb: (a: any) => any) => IPromise<any>' is not assignable to parameter of type '(value: number) => IPromise<any>'.
248248
var s8b = s8.then(testFunction8P, testFunction8P, testFunction8P); // error
249249
~~~~~~~~~~~~~~
250-
!!! error TS2345: Argument of type '(x: number, cb: (a: number) => number) => Promise<number>' is not assignable to parameter of type '(value: number) => Promise<any>'.
250+
!!! error TS2345: Argument of type '(x: any, cb: (a: any) => any) => Promise<any>' is not assignable to parameter of type '(value: number) => Promise<any>'.
251251
var s8c = s8.then(testFunction8P, testFunction8, testFunction8); // error
252252
~~~~~~~~~~~~~~
253-
!!! error TS2345: Argument of type '(x: number, cb: (a: number) => number) => Promise<number>' is not assignable to parameter of type '(value: number) => IPromise<any>'.
253+
!!! error TS2345: Argument of type '(x: any, cb: (a: any) => any) => Promise<any>' is not assignable to parameter of type '(value: number) => IPromise<any>'.
254254
var s8d = s8.then(nIPromise, nIPromise, nIPromise).then(nIPromise, nIPromise, nIPromise); // ok
255255

256256
var r9: IPromise<number>;
257257
var r9a = r9.then(testFunction9, testFunction9, testFunction9); // error
258258
~~~~~~~~~~~~~
259-
!!! error TS2345: Argument of type '(x: number, cb: <U>(a: U) => U) => IPromise<number>' is not assignable to parameter of type '(value: number) => IPromise<any>'.
259+
!!! error TS2345: Argument of type '(x: any, cb: <U>(a: U) => U) => IPromise<any>' is not assignable to parameter of type '(value: number) => IPromise<any>'.
260260
var r9b = r9.then(sIPromise, sIPromise, sIPromise); // ok
261261
var r9c = r9.then(nIPromise, nIPromise, nIPromise); // ok
262262
var r9d = r9.then(testFunction, sIPromise, nIPromise); // ok
@@ -268,13 +268,13 @@ tests/cases/compiler/promisePermutations.ts(160,21): error TS2345: Argument of t
268268
var s9: Promise<number>;
269269
var s9a = s9.then(testFunction9, testFunction9, testFunction9); // error
270270
~~~~~~~~~~~~~
271-
!!! error TS2345: Argument of type '(x: number, cb: <U>(a: U) => U) => IPromise<number>' is not assignable to parameter of type '(value: number) => IPromise<any>'.
271+
!!! error TS2345: Argument of type '(x: any, cb: <U>(a: U) => U) => IPromise<any>' is not assignable to parameter of type '(value: number) => IPromise<any>'.
272272
var s9b = s9.then(testFunction9P, testFunction9P, testFunction9P); // error
273273
~~~~~~~~~~~~~~
274-
!!! error TS2345: Argument of type '(x: number, cb: <U>(a: U) => U) => Promise<number>' is not assignable to parameter of type '(value: number) => Promise<any>'.
274+
!!! error TS2345: Argument of type '(x: any, cb: <U>(a: U) => U) => Promise<any>' is not assignable to parameter of type '(value: number) => Promise<any>'.
275275
var s9c = s9.then(testFunction9P, testFunction9, testFunction9); // error
276276
~~~~~~~~~~~~~~
277-
!!! error TS2345: Argument of type '(x: number, cb: <U>(a: U) => U) => Promise<number>' is not assignable to parameter of type '(value: number) => IPromise<any>'.
277+
!!! error TS2345: Argument of type '(x: any, cb: <U>(a: U) => U) => Promise<any>' is not assignable to parameter of type '(value: number) => IPromise<any>'.
278278
var s9d = s9.then(sPromise, sPromise, sPromise); // ok
279279
var s9e = s9.then(nPromise, nPromise, nPromise); // ok
280280
var s9f = s9.then(testFunction, sIPromise, nIPromise); // error

0 commit comments

Comments
 (0)