Skip to content

Commit 5401348

Browse files
committed
Accept new baselines
1 parent b9d27c0 commit 5401348

File tree

3 files changed

+261
-0
lines changed

3 files changed

+261
-0
lines changed

tests/baselines/reference/unionAndIntersectionInference3.js

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,51 @@
44
type Maybe<T> = T | undefined;
55
declare function concatMaybe<T>(...args: (Maybe<T> | Maybe<T>[])[]): T[];
66
concatMaybe([1, 2, 3], 4);
7+
8+
// Repros from #32247
9+
10+
const g: <U, R, S>(com: () => Iterator<S, U, R> | AsyncIterator<S, U, R>) => Promise<U> = async <U, R, S>(com: () => Iterator<S, U, R> | AsyncIterator<S, U, R>): Promise<U> => {
11+
throw com;
12+
};
13+
14+
interface Foo1<T> {
15+
test(value: T): void;
16+
}
17+
18+
interface Bar1<T> {
19+
test(value: T | PromiseLike<T>): void;
20+
}
21+
22+
declare let f1: <T>(x: Foo1<T> | Bar1<T>) => Promise<T>;
23+
declare let f2: <U>(x: Foo1<U> | Bar1<U>) => Promise<U>;
24+
25+
f1 = f2;
26+
f2 = f1;
27+
28+
type Foo2<T> = {
29+
test(value: T): void;
30+
}
31+
32+
type Bar2<T> = {
33+
test(value: T | PromiseLike<T>): void;
34+
}
35+
36+
declare let g1: <T>(x: Foo2<T> | Bar2<T>) => Promise<T>;
37+
declare let g2: <U>(x: Foo2<U> | Bar2<U>) => Promise<U>;
38+
39+
g1 = g2;
40+
g2 = g1;
741

842

943
//// [unionAndIntersectionInference3.js]
1044
"use strict";
1145
// Repro from #30720
1246
concatMaybe([1, 2, 3], 4);
47+
// Repros from #32247
48+
const g = async (com) => {
49+
throw com;
50+
};
51+
f1 = f2;
52+
f2 = f1;
53+
g1 = g2;
54+
g2 = g1;

tests/baselines/reference/unionAndIntersectionInference3.symbols

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,145 @@ declare function concatMaybe<T>(...args: (Maybe<T> | Maybe<T>[])[]): T[];
1919
concatMaybe([1, 2, 3], 4);
2020
>concatMaybe : Symbol(concatMaybe, Decl(unionAndIntersectionInference3.ts, 2, 30))
2121

22+
// Repros from #32247
23+
24+
const g: <U, R, S>(com: () => Iterator<S, U, R> | AsyncIterator<S, U, R>) => Promise<U> = async <U, R, S>(com: () => Iterator<S, U, R> | AsyncIterator<S, U, R>): Promise<U> => {
25+
>g : Symbol(g, Decl(unionAndIntersectionInference3.ts, 8, 5))
26+
>U : Symbol(U, Decl(unionAndIntersectionInference3.ts, 8, 10))
27+
>R : Symbol(R, Decl(unionAndIntersectionInference3.ts, 8, 12))
28+
>S : Symbol(S, Decl(unionAndIntersectionInference3.ts, 8, 15))
29+
>com : Symbol(com, Decl(unionAndIntersectionInference3.ts, 8, 19))
30+
>Iterator : Symbol(Iterator, Decl(lib.es2015.iterable.d.ts, --, --))
31+
>S : Symbol(S, Decl(unionAndIntersectionInference3.ts, 8, 15))
32+
>U : Symbol(U, Decl(unionAndIntersectionInference3.ts, 8, 10))
33+
>R : Symbol(R, Decl(unionAndIntersectionInference3.ts, 8, 12))
34+
>AsyncIterator : Symbol(AsyncIterator, Decl(lib.es2018.asynciterable.d.ts, --, --))
35+
>S : Symbol(S, Decl(unionAndIntersectionInference3.ts, 8, 15))
36+
>U : Symbol(U, Decl(unionAndIntersectionInference3.ts, 8, 10))
37+
>R : Symbol(R, Decl(unionAndIntersectionInference3.ts, 8, 12))
38+
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --))
39+
>U : Symbol(U, Decl(unionAndIntersectionInference3.ts, 8, 10))
40+
>U : Symbol(U, Decl(unionAndIntersectionInference3.ts, 8, 97))
41+
>R : Symbol(R, Decl(unionAndIntersectionInference3.ts, 8, 99))
42+
>S : Symbol(S, Decl(unionAndIntersectionInference3.ts, 8, 102))
43+
>com : Symbol(com, Decl(unionAndIntersectionInference3.ts, 8, 106))
44+
>Iterator : Symbol(Iterator, Decl(lib.es2015.iterable.d.ts, --, --))
45+
>S : Symbol(S, Decl(unionAndIntersectionInference3.ts, 8, 102))
46+
>U : Symbol(U, Decl(unionAndIntersectionInference3.ts, 8, 97))
47+
>R : Symbol(R, Decl(unionAndIntersectionInference3.ts, 8, 99))
48+
>AsyncIterator : Symbol(AsyncIterator, Decl(lib.es2018.asynciterable.d.ts, --, --))
49+
>S : Symbol(S, Decl(unionAndIntersectionInference3.ts, 8, 102))
50+
>U : Symbol(U, Decl(unionAndIntersectionInference3.ts, 8, 97))
51+
>R : Symbol(R, Decl(unionAndIntersectionInference3.ts, 8, 99))
52+
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --))
53+
>U : Symbol(U, Decl(unionAndIntersectionInference3.ts, 8, 97))
54+
55+
throw com;
56+
>com : Symbol(com, Decl(unionAndIntersectionInference3.ts, 8, 106))
57+
58+
};
59+
60+
interface Foo1<T> {
61+
>Foo1 : Symbol(Foo1, Decl(unionAndIntersectionInference3.ts, 10, 2))
62+
>T : Symbol(T, Decl(unionAndIntersectionInference3.ts, 12, 15))
63+
64+
test(value: T): void;
65+
>test : Symbol(Foo1.test, Decl(unionAndIntersectionInference3.ts, 12, 19))
66+
>value : Symbol(value, Decl(unionAndIntersectionInference3.ts, 13, 9))
67+
>T : Symbol(T, Decl(unionAndIntersectionInference3.ts, 12, 15))
68+
}
69+
70+
interface Bar1<T> {
71+
>Bar1 : Symbol(Bar1, Decl(unionAndIntersectionInference3.ts, 14, 1))
72+
>T : Symbol(T, Decl(unionAndIntersectionInference3.ts, 16, 15))
73+
74+
test(value: T | PromiseLike<T>): void;
75+
>test : Symbol(Bar1.test, Decl(unionAndIntersectionInference3.ts, 16, 19))
76+
>value : Symbol(value, Decl(unionAndIntersectionInference3.ts, 17, 9))
77+
>T : Symbol(T, Decl(unionAndIntersectionInference3.ts, 16, 15))
78+
>PromiseLike : Symbol(PromiseLike, Decl(lib.es5.d.ts, --, --))
79+
>T : Symbol(T, Decl(unionAndIntersectionInference3.ts, 16, 15))
80+
}
81+
82+
declare let f1: <T>(x: Foo1<T> | Bar1<T>) => Promise<T>;
83+
>f1 : Symbol(f1, Decl(unionAndIntersectionInference3.ts, 20, 11))
84+
>T : Symbol(T, Decl(unionAndIntersectionInference3.ts, 20, 17))
85+
>x : Symbol(x, Decl(unionAndIntersectionInference3.ts, 20, 20))
86+
>Foo1 : Symbol(Foo1, Decl(unionAndIntersectionInference3.ts, 10, 2))
87+
>T : Symbol(T, Decl(unionAndIntersectionInference3.ts, 20, 17))
88+
>Bar1 : Symbol(Bar1, Decl(unionAndIntersectionInference3.ts, 14, 1))
89+
>T : Symbol(T, Decl(unionAndIntersectionInference3.ts, 20, 17))
90+
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --))
91+
>T : Symbol(T, Decl(unionAndIntersectionInference3.ts, 20, 17))
92+
93+
declare let f2: <U>(x: Foo1<U> | Bar1<U>) => Promise<U>;
94+
>f2 : Symbol(f2, Decl(unionAndIntersectionInference3.ts, 21, 11))
95+
>U : Symbol(U, Decl(unionAndIntersectionInference3.ts, 21, 17))
96+
>x : Symbol(x, Decl(unionAndIntersectionInference3.ts, 21, 20))
97+
>Foo1 : Symbol(Foo1, Decl(unionAndIntersectionInference3.ts, 10, 2))
98+
>U : Symbol(U, Decl(unionAndIntersectionInference3.ts, 21, 17))
99+
>Bar1 : Symbol(Bar1, Decl(unionAndIntersectionInference3.ts, 14, 1))
100+
>U : Symbol(U, Decl(unionAndIntersectionInference3.ts, 21, 17))
101+
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --))
102+
>U : Symbol(U, Decl(unionAndIntersectionInference3.ts, 21, 17))
103+
104+
f1 = f2;
105+
>f1 : Symbol(f1, Decl(unionAndIntersectionInference3.ts, 20, 11))
106+
>f2 : Symbol(f2, Decl(unionAndIntersectionInference3.ts, 21, 11))
107+
108+
f2 = f1;
109+
>f2 : Symbol(f2, Decl(unionAndIntersectionInference3.ts, 21, 11))
110+
>f1 : Symbol(f1, Decl(unionAndIntersectionInference3.ts, 20, 11))
111+
112+
type Foo2<T> = {
113+
>Foo2 : Symbol(Foo2, Decl(unionAndIntersectionInference3.ts, 24, 8))
114+
>T : Symbol(T, Decl(unionAndIntersectionInference3.ts, 26, 10))
115+
116+
test(value: T): void;
117+
>test : Symbol(test, Decl(unionAndIntersectionInference3.ts, 26, 16))
118+
>value : Symbol(value, Decl(unionAndIntersectionInference3.ts, 27, 9))
119+
>T : Symbol(T, Decl(unionAndIntersectionInference3.ts, 26, 10))
120+
}
121+
122+
type Bar2<T> = {
123+
>Bar2 : Symbol(Bar2, Decl(unionAndIntersectionInference3.ts, 28, 1))
124+
>T : Symbol(T, Decl(unionAndIntersectionInference3.ts, 30, 10))
125+
126+
test(value: T | PromiseLike<T>): void;
127+
>test : Symbol(test, Decl(unionAndIntersectionInference3.ts, 30, 16))
128+
>value : Symbol(value, Decl(unionAndIntersectionInference3.ts, 31, 9))
129+
>T : Symbol(T, Decl(unionAndIntersectionInference3.ts, 30, 10))
130+
>PromiseLike : Symbol(PromiseLike, Decl(lib.es5.d.ts, --, --))
131+
>T : Symbol(T, Decl(unionAndIntersectionInference3.ts, 30, 10))
132+
}
133+
134+
declare let g1: <T>(x: Foo2<T> | Bar2<T>) => Promise<T>;
135+
>g1 : Symbol(g1, Decl(unionAndIntersectionInference3.ts, 34, 11))
136+
>T : Symbol(T, Decl(unionAndIntersectionInference3.ts, 34, 17))
137+
>x : Symbol(x, Decl(unionAndIntersectionInference3.ts, 34, 20))
138+
>Foo2 : Symbol(Foo2, Decl(unionAndIntersectionInference3.ts, 24, 8))
139+
>T : Symbol(T, Decl(unionAndIntersectionInference3.ts, 34, 17))
140+
>Bar2 : Symbol(Bar2, Decl(unionAndIntersectionInference3.ts, 28, 1))
141+
>T : Symbol(T, Decl(unionAndIntersectionInference3.ts, 34, 17))
142+
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --))
143+
>T : Symbol(T, Decl(unionAndIntersectionInference3.ts, 34, 17))
144+
145+
declare let g2: <U>(x: Foo2<U> | Bar2<U>) => Promise<U>;
146+
>g2 : Symbol(g2, Decl(unionAndIntersectionInference3.ts, 35, 11))
147+
>U : Symbol(U, Decl(unionAndIntersectionInference3.ts, 35, 17))
148+
>x : Symbol(x, Decl(unionAndIntersectionInference3.ts, 35, 20))
149+
>Foo2 : Symbol(Foo2, Decl(unionAndIntersectionInference3.ts, 24, 8))
150+
>U : Symbol(U, Decl(unionAndIntersectionInference3.ts, 35, 17))
151+
>Bar2 : Symbol(Bar2, Decl(unionAndIntersectionInference3.ts, 28, 1))
152+
>U : Symbol(U, Decl(unionAndIntersectionInference3.ts, 35, 17))
153+
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --))
154+
>U : Symbol(U, Decl(unionAndIntersectionInference3.ts, 35, 17))
155+
156+
g1 = g2;
157+
>g1 : Symbol(g1, Decl(unionAndIntersectionInference3.ts, 34, 11))
158+
>g2 : Symbol(g2, Decl(unionAndIntersectionInference3.ts, 35, 11))
159+
160+
g2 = g1;
161+
>g2 : Symbol(g2, Decl(unionAndIntersectionInference3.ts, 35, 11))
162+
>g1 : Symbol(g1, Decl(unionAndIntersectionInference3.ts, 34, 11))
163+

tests/baselines/reference/unionAndIntersectionInference3.types

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,80 @@ concatMaybe([1, 2, 3], 4);
1717
>3 : 3
1818
>4 : 4
1919

20+
// Repros from #32247
21+
22+
const g: <U, R, S>(com: () => Iterator<S, U, R> | AsyncIterator<S, U, R>) => Promise<U> = async <U, R, S>(com: () => Iterator<S, U, R> | AsyncIterator<S, U, R>): Promise<U> => {
23+
>g : <U, R, S>(com: () => Iterator<S, U, R> | AsyncIterator<S, U, R>) => Promise<U>
24+
>com : () => Iterator<S, U, R> | AsyncIterator<S, U, R>
25+
>async <U, R, S>(com: () => Iterator<S, U, R> | AsyncIterator<S, U, R>): Promise<U> => { throw com;} : <U, R, S>(com: () => Iterator<S, U, R> | AsyncIterator<S, U, R>) => Promise<U>
26+
>com : () => Iterator<S, U, R> | AsyncIterator<S, U, R>
27+
28+
throw com;
29+
>com : () => Iterator<S, U, R> | AsyncIterator<S, U, R>
30+
31+
};
32+
33+
interface Foo1<T> {
34+
test(value: T): void;
35+
>test : (value: T) => void
36+
>value : T
37+
}
38+
39+
interface Bar1<T> {
40+
test(value: T | PromiseLike<T>): void;
41+
>test : (value: T | PromiseLike<T>) => void
42+
>value : T | PromiseLike<T>
43+
}
44+
45+
declare let f1: <T>(x: Foo1<T> | Bar1<T>) => Promise<T>;
46+
>f1 : <T>(x: Foo1<T> | Bar1<T>) => Promise<T>
47+
>x : Foo1<T> | Bar1<T>
48+
49+
declare let f2: <U>(x: Foo1<U> | Bar1<U>) => Promise<U>;
50+
>f2 : <U>(x: Foo1<U> | Bar1<U>) => Promise<U>
51+
>x : Foo1<U> | Bar1<U>
52+
53+
f1 = f2;
54+
>f1 = f2 : <U>(x: Foo1<U> | Bar1<U>) => Promise<U>
55+
>f1 : <T>(x: Foo1<T> | Bar1<T>) => Promise<T>
56+
>f2 : <U>(x: Foo1<U> | Bar1<U>) => Promise<U>
57+
58+
f2 = f1;
59+
>f2 = f1 : <T>(x: Foo1<T> | Bar1<T>) => Promise<T>
60+
>f2 : <U>(x: Foo1<U> | Bar1<U>) => Promise<U>
61+
>f1 : <T>(x: Foo1<T> | Bar1<T>) => Promise<T>
62+
63+
type Foo2<T> = {
64+
>Foo2 : Foo2<T>
65+
66+
test(value: T): void;
67+
>test : (value: T) => void
68+
>value : T
69+
}
70+
71+
type Bar2<T> = {
72+
>Bar2 : Bar2<T>
73+
74+
test(value: T | PromiseLike<T>): void;
75+
>test : (value: T | PromiseLike<T>) => void
76+
>value : T | PromiseLike<T>
77+
}
78+
79+
declare let g1: <T>(x: Foo2<T> | Bar2<T>) => Promise<T>;
80+
>g1 : <T>(x: Foo2<T> | Bar2<T>) => Promise<T>
81+
>x : Foo2<T> | Bar2<T>
82+
83+
declare let g2: <U>(x: Foo2<U> | Bar2<U>) => Promise<U>;
84+
>g2 : <U>(x: Foo2<U> | Bar2<U>) => Promise<U>
85+
>x : Foo2<U> | Bar2<U>
86+
87+
g1 = g2;
88+
>g1 = g2 : <U>(x: Foo2<U> | Bar2<U>) => Promise<U>
89+
>g1 : <T>(x: Foo2<T> | Bar2<T>) => Promise<T>
90+
>g2 : <U>(x: Foo2<U> | Bar2<U>) => Promise<U>
91+
92+
g2 = g1;
93+
>g2 = g1 : <T>(x: Foo2<T> | Bar2<T>) => Promise<T>
94+
>g2 : <U>(x: Foo2<U> | Bar2<U>) => Promise<U>
95+
>g1 : <T>(x: Foo2<T> | Bar2<T>) => Promise<T>
96+

0 commit comments

Comments
 (0)