Skip to content

Commit 1ea4008

Browse files
committed
Accept new baselines
1 parent ec38799 commit 1ea4008

File tree

3 files changed

+103
-0
lines changed

3 files changed

+103
-0
lines changed

tests/baselines/reference/unionAndIntersectionInference3.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,20 @@ declare let g2: <U>(x: Foo2<U> | Bar2<U>) => Promise<U>;
3838

3939
g1 = g2;
4040
g2 = g1;
41+
42+
// Repro from #32572
43+
44+
declare function foo1<T>(obj: string[] & Iterable<T>): T;
45+
declare function foo2<T>(obj: string[] & T): T;
46+
47+
declare let sa: string[];
48+
declare let sx: string[] & { extra: number };
49+
50+
let x1 = foo1(sa); // string
51+
let y1 = foo1(sx); // string
52+
53+
let x2 = foo2(sa); // unknown
54+
let y2 = foo2(sx); // { extra: number }
4155

4256

4357
//// [unionAndIntersectionInference3.js]
@@ -52,3 +66,7 @@ f1 = f2;
5266
f2 = f1;
5367
g1 = g2;
5468
g2 = g1;
69+
let x1 = foo1(sa); // string
70+
let y1 = foo1(sx); // string
71+
let x2 = foo2(sa); // unknown
72+
let y2 = foo2(sx); // { extra: number }

tests/baselines/reference/unionAndIntersectionInference3.symbols

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,3 +161,47 @@ g2 = g1;
161161
>g2 : Symbol(g2, Decl(unionAndIntersectionInference3.ts, 35, 11))
162162
>g1 : Symbol(g1, Decl(unionAndIntersectionInference3.ts, 34, 11))
163163

164+
// Repro from #32572
165+
166+
declare function foo1<T>(obj: string[] & Iterable<T>): T;
167+
>foo1 : Symbol(foo1, Decl(unionAndIntersectionInference3.ts, 38, 8))
168+
>T : Symbol(T, Decl(unionAndIntersectionInference3.ts, 42, 22))
169+
>obj : Symbol(obj, Decl(unionAndIntersectionInference3.ts, 42, 25))
170+
>Iterable : Symbol(Iterable, Decl(lib.es2015.iterable.d.ts, --, --))
171+
>T : Symbol(T, Decl(unionAndIntersectionInference3.ts, 42, 22))
172+
>T : Symbol(T, Decl(unionAndIntersectionInference3.ts, 42, 22))
173+
174+
declare function foo2<T>(obj: string[] & T): T;
175+
>foo2 : Symbol(foo2, Decl(unionAndIntersectionInference3.ts, 42, 57))
176+
>T : Symbol(T, Decl(unionAndIntersectionInference3.ts, 43, 22))
177+
>obj : Symbol(obj, Decl(unionAndIntersectionInference3.ts, 43, 25))
178+
>T : Symbol(T, Decl(unionAndIntersectionInference3.ts, 43, 22))
179+
>T : Symbol(T, Decl(unionAndIntersectionInference3.ts, 43, 22))
180+
181+
declare let sa: string[];
182+
>sa : Symbol(sa, Decl(unionAndIntersectionInference3.ts, 45, 11))
183+
184+
declare let sx: string[] & { extra: number };
185+
>sx : Symbol(sx, Decl(unionAndIntersectionInference3.ts, 46, 11))
186+
>extra : Symbol(extra, Decl(unionAndIntersectionInference3.ts, 46, 28))
187+
188+
let x1 = foo1(sa); // string
189+
>x1 : Symbol(x1, Decl(unionAndIntersectionInference3.ts, 48, 3))
190+
>foo1 : Symbol(foo1, Decl(unionAndIntersectionInference3.ts, 38, 8))
191+
>sa : Symbol(sa, Decl(unionAndIntersectionInference3.ts, 45, 11))
192+
193+
let y1 = foo1(sx); // string
194+
>y1 : Symbol(y1, Decl(unionAndIntersectionInference3.ts, 49, 3))
195+
>foo1 : Symbol(foo1, Decl(unionAndIntersectionInference3.ts, 38, 8))
196+
>sx : Symbol(sx, Decl(unionAndIntersectionInference3.ts, 46, 11))
197+
198+
let x2 = foo2(sa); // unknown
199+
>x2 : Symbol(x2, Decl(unionAndIntersectionInference3.ts, 51, 3))
200+
>foo2 : Symbol(foo2, Decl(unionAndIntersectionInference3.ts, 42, 57))
201+
>sa : Symbol(sa, Decl(unionAndIntersectionInference3.ts, 45, 11))
202+
203+
let y2 = foo2(sx); // { extra: number }
204+
>y2 : Symbol(y2, Decl(unionAndIntersectionInference3.ts, 52, 3))
205+
>foo2 : Symbol(foo2, Decl(unionAndIntersectionInference3.ts, 42, 57))
206+
>sx : Symbol(sx, Decl(unionAndIntersectionInference3.ts, 46, 11))
207+

tests/baselines/reference/unionAndIntersectionInference3.types

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,3 +94,44 @@ g2 = g1;
9494
>g2 : <U>(x: Foo2<U> | Bar2<U>) => Promise<U>
9595
>g1 : <T>(x: Foo2<T> | Bar2<T>) => Promise<T>
9696

97+
// Repro from #32572
98+
99+
declare function foo1<T>(obj: string[] & Iterable<T>): T;
100+
>foo1 : <T>(obj: string[] & Iterable<T>) => T
101+
>obj : string[] & Iterable<T>
102+
103+
declare function foo2<T>(obj: string[] & T): T;
104+
>foo2 : <T>(obj: string[] & T) => T
105+
>obj : string[] & T
106+
107+
declare let sa: string[];
108+
>sa : string[]
109+
110+
declare let sx: string[] & { extra: number };
111+
>sx : string[] & { extra: number; }
112+
>extra : number
113+
114+
let x1 = foo1(sa); // string
115+
>x1 : string
116+
>foo1(sa) : string
117+
>foo1 : <T>(obj: string[] & Iterable<T>) => T
118+
>sa : string[]
119+
120+
let y1 = foo1(sx); // string
121+
>y1 : string
122+
>foo1(sx) : string
123+
>foo1 : <T>(obj: string[] & Iterable<T>) => T
124+
>sx : string[] & { extra: number; }
125+
126+
let x2 = foo2(sa); // unknown
127+
>x2 : unknown
128+
>foo2(sa) : unknown
129+
>foo2 : <T>(obj: string[] & T) => T
130+
>sa : string[]
131+
132+
let y2 = foo2(sx); // { extra: number }
133+
>y2 : { extra: number; }
134+
>foo2(sx) : { extra: number; }
135+
>foo2 : <T>(obj: string[] & T) => T
136+
>sx : string[] & { extra: number; }
137+

0 commit comments

Comments
 (0)