@@ -107,34 +107,83 @@ const d3 = f4(42); // Error
107
107
>d3 : Symbol(d3, Decl(unionTypeInference.ts, 30, 5))
108
108
>f4 : Symbol(f4, Decl(unionTypeInference.ts, 24, 21))
109
109
110
+ export interface Foo<T> {
111
+ >Foo : Symbol(Foo, Decl(unionTypeInference.ts, 30, 18))
112
+ >T : Symbol(T, Decl(unionTypeInference.ts, 32, 21))
113
+
114
+ then<U>(f: (x: T) => U | Foo<U>, g: U): Foo<U>;
115
+ >then : Symbol(Foo.then, Decl(unionTypeInference.ts, 32, 25))
116
+ >U : Symbol(U, Decl(unionTypeInference.ts, 33, 9))
117
+ >f : Symbol(f, Decl(unionTypeInference.ts, 33, 12))
118
+ >x : Symbol(x, Decl(unionTypeInference.ts, 33, 16))
119
+ >T : Symbol(T, Decl(unionTypeInference.ts, 32, 21))
120
+ >U : Symbol(U, Decl(unionTypeInference.ts, 33, 9))
121
+ >Foo : Symbol(Foo, Decl(unionTypeInference.ts, 30, 18))
122
+ >U : Symbol(U, Decl(unionTypeInference.ts, 33, 9))
123
+ >g : Symbol(g, Decl(unionTypeInference.ts, 33, 36))
124
+ >U : Symbol(U, Decl(unionTypeInference.ts, 33, 9))
125
+ >Foo : Symbol(Foo, Decl(unionTypeInference.ts, 30, 18))
126
+ >U : Symbol(U, Decl(unionTypeInference.ts, 33, 9))
127
+ }
128
+ export interface Bar<T> {
129
+ >Bar : Symbol(Bar, Decl(unionTypeInference.ts, 34, 1))
130
+ >T : Symbol(T, Decl(unionTypeInference.ts, 35, 21))
131
+
132
+ then<S>(f: (x: T) => S | Bar<S>, g: S): Bar<S>;
133
+ >then : Symbol(Bar.then, Decl(unionTypeInference.ts, 35, 25))
134
+ >S : Symbol(S, Decl(unionTypeInference.ts, 36, 9))
135
+ >f : Symbol(f, Decl(unionTypeInference.ts, 36, 12))
136
+ >x : Symbol(x, Decl(unionTypeInference.ts, 36, 16))
137
+ >T : Symbol(T, Decl(unionTypeInference.ts, 35, 21))
138
+ >S : Symbol(S, Decl(unionTypeInference.ts, 36, 9))
139
+ >Bar : Symbol(Bar, Decl(unionTypeInference.ts, 34, 1))
140
+ >S : Symbol(S, Decl(unionTypeInference.ts, 36, 9))
141
+ >g : Symbol(g, Decl(unionTypeInference.ts, 36, 36))
142
+ >S : Symbol(S, Decl(unionTypeInference.ts, 36, 9))
143
+ >Bar : Symbol(Bar, Decl(unionTypeInference.ts, 34, 1))
144
+ >S : Symbol(S, Decl(unionTypeInference.ts, 36, 9))
145
+ }
146
+
147
+ function qux(p1: Foo<void>, p2: Bar<void>) {
148
+ >qux : Symbol(qux, Decl(unionTypeInference.ts, 37, 1))
149
+ >p1 : Symbol(p1, Decl(unionTypeInference.ts, 39, 13))
150
+ >Foo : Symbol(Foo, Decl(unionTypeInference.ts, 30, 18))
151
+ >p2 : Symbol(p2, Decl(unionTypeInference.ts, 39, 27))
152
+ >Bar : Symbol(Bar, Decl(unionTypeInference.ts, 34, 1))
153
+
154
+ p1 = p2;
155
+ >p1 : Symbol(p1, Decl(unionTypeInference.ts, 39, 13))
156
+ >p2 : Symbol(p2, Decl(unionTypeInference.ts, 39, 27))
157
+ }
158
+
110
159
// Repros from #32434
111
160
112
161
declare function foo<T>(x: T | Promise<T>): void;
113
- >foo : Symbol(foo, Decl(unionTypeInference.ts, 30, 18 ))
114
- >T : Symbol(T, Decl(unionTypeInference.ts, 34 , 21))
115
- >x : Symbol(x, Decl(unionTypeInference.ts, 34 , 24))
116
- >T : Symbol(T, Decl(unionTypeInference.ts, 34 , 21))
162
+ >foo : Symbol(foo, Decl(unionTypeInference.ts, 41, 1 ))
163
+ >T : Symbol(T, Decl(unionTypeInference.ts, 45 , 21))
164
+ >x : Symbol(x, Decl(unionTypeInference.ts, 45 , 24))
165
+ >T : Symbol(T, Decl(unionTypeInference.ts, 45 , 21))
117
166
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --))
118
- >T : Symbol(T, Decl(unionTypeInference.ts, 34 , 21))
167
+ >T : Symbol(T, Decl(unionTypeInference.ts, 45 , 21))
119
168
120
169
declare let x: false | Promise<true>;
121
- >x : Symbol(x, Decl(unionTypeInference.ts, 35 , 11))
170
+ >x : Symbol(x, Decl(unionTypeInference.ts, 46 , 11))
122
171
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --))
123
172
124
173
foo(x);
125
- >foo : Symbol(foo, Decl(unionTypeInference.ts, 30, 18 ))
126
- >x : Symbol(x, Decl(unionTypeInference.ts, 35 , 11))
174
+ >foo : Symbol(foo, Decl(unionTypeInference.ts, 41, 1 ))
175
+ >x : Symbol(x, Decl(unionTypeInference.ts, 46 , 11))
127
176
128
177
declare function bar<T>(x: T, y: string | T): T;
129
- >bar : Symbol(bar, Decl(unionTypeInference.ts, 36 , 7))
130
- >T : Symbol(T, Decl(unionTypeInference.ts, 38 , 21))
131
- >x : Symbol(x, Decl(unionTypeInference.ts, 38 , 24))
132
- >T : Symbol(T, Decl(unionTypeInference.ts, 38 , 21))
133
- >y : Symbol(y, Decl(unionTypeInference.ts, 38 , 29))
134
- >T : Symbol(T, Decl(unionTypeInference.ts, 38 , 21))
135
- >T : Symbol(T, Decl(unionTypeInference.ts, 38 , 21))
178
+ >bar : Symbol(bar, Decl(unionTypeInference.ts, 47 , 7))
179
+ >T : Symbol(T, Decl(unionTypeInference.ts, 49 , 21))
180
+ >x : Symbol(x, Decl(unionTypeInference.ts, 49 , 24))
181
+ >T : Symbol(T, Decl(unionTypeInference.ts, 49 , 21))
182
+ >y : Symbol(y, Decl(unionTypeInference.ts, 49 , 29))
183
+ >T : Symbol(T, Decl(unionTypeInference.ts, 49 , 21))
184
+ >T : Symbol(T, Decl(unionTypeInference.ts, 49 , 21))
136
185
137
186
const y = bar(1, 2);
138
- >y : Symbol(y, Decl(unionTypeInference.ts, 39 , 5))
139
- >bar : Symbol(bar, Decl(unionTypeInference.ts, 36 , 7))
187
+ >y : Symbol(y, Decl(unionTypeInference.ts, 50 , 5))
188
+ >bar : Symbol(bar, Decl(unionTypeInference.ts, 47 , 7))
140
189
0 commit comments