File: intersectionReductionStrict.symbols

package info (click to toggle)
node-typescript 5.0.4%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 459,140 kB
  • sloc: javascript: 1,972,754; makefile: 6; sh: 1
file content (336 lines) | stat: -rw-r--r-- 15,401 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
=== tests/cases/conformance/types/intersection/intersectionReductionStrict.ts ===
declare const sym1: unique symbol;
>sym1 : Symbol(sym1, Decl(intersectionReductionStrict.ts, 0, 13))

declare const sym2: unique symbol;
>sym2 : Symbol(sym2, Decl(intersectionReductionStrict.ts, 1, 13))

type T1 = string & 'a';  // 'a'
>T1 : Symbol(T1, Decl(intersectionReductionStrict.ts, 1, 34))

type T2 = 'a' & string & 'b';  // never
>T2 : Symbol(T2, Decl(intersectionReductionStrict.ts, 3, 23))

type T3 = number & 10;  // 10
>T3 : Symbol(T3, Decl(intersectionReductionStrict.ts, 4, 29))

type T4 = 10 & number & 20;  // never
>T4 : Symbol(T4, Decl(intersectionReductionStrict.ts, 5, 22))

type T5 = symbol & typeof sym1;  // typeof sym1
>T5 : Symbol(T5, Decl(intersectionReductionStrict.ts, 6, 27))
>sym1 : Symbol(sym1, Decl(intersectionReductionStrict.ts, 0, 13))

type T6 = typeof sym1 & symbol & typeof sym2;  // never
>T6 : Symbol(T6, Decl(intersectionReductionStrict.ts, 7, 31))
>sym1 : Symbol(sym1, Decl(intersectionReductionStrict.ts, 0, 13))
>sym2 : Symbol(sym2, Decl(intersectionReductionStrict.ts, 1, 13))

type T7 = string & 'a' & number & 10 & symbol & typeof sym1;  // never
>T7 : Symbol(T7, Decl(intersectionReductionStrict.ts, 8, 45))
>sym1 : Symbol(sym1, Decl(intersectionReductionStrict.ts, 0, 13))

type T10 = string & ('a' | 'b');  // 'a' | 'b'
>T10 : Symbol(T10, Decl(intersectionReductionStrict.ts, 9, 60))

type T11 = (string | number) & ('a' | 10);  // 'a' | 10
>T11 : Symbol(T11, Decl(intersectionReductionStrict.ts, 11, 32))

type N1 = 'a' & 'b';
>N1 : Symbol(N1, Decl(intersectionReductionStrict.ts, 12, 42))

type N2 = { a: string } & null;
>N2 : Symbol(N2, Decl(intersectionReductionStrict.ts, 14, 20))
>a : Symbol(a, Decl(intersectionReductionStrict.ts, 15, 11))

type N3 = { a: string } & undefined;
>N3 : Symbol(N3, Decl(intersectionReductionStrict.ts, 15, 31))
>a : Symbol(a, Decl(intersectionReductionStrict.ts, 16, 11))

type N4 = string & number;
>N4 : Symbol(N4, Decl(intersectionReductionStrict.ts, 16, 36))

type N5 = number & object;
>N5 : Symbol(N5, Decl(intersectionReductionStrict.ts, 17, 26))

type N6 = symbol & string;
>N6 : Symbol(N6, Decl(intersectionReductionStrict.ts, 18, 26))

type N7 = void & string;
>N7 : Symbol(N7, Decl(intersectionReductionStrict.ts, 19, 26))

type X = { x: string };
>X : Symbol(X, Decl(intersectionReductionStrict.ts, 20, 24))
>x : Symbol(x, Decl(intersectionReductionStrict.ts, 22, 10))

type X1 = X | 'a' & 'b';
>X1 : Symbol(X1, Decl(intersectionReductionStrict.ts, 22, 23))
>X : Symbol(X, Decl(intersectionReductionStrict.ts, 20, 24))

type X2 = X | { a: string } & null;
>X2 : Symbol(X2, Decl(intersectionReductionStrict.ts, 24, 24))
>X : Symbol(X, Decl(intersectionReductionStrict.ts, 20, 24))
>a : Symbol(a, Decl(intersectionReductionStrict.ts, 25, 15))

type X3 = X | { a: string } & undefined;
>X3 : Symbol(X3, Decl(intersectionReductionStrict.ts, 25, 35))
>X : Symbol(X, Decl(intersectionReductionStrict.ts, 20, 24))
>a : Symbol(a, Decl(intersectionReductionStrict.ts, 26, 15))

type X4 = X | string & number;
>X4 : Symbol(X4, Decl(intersectionReductionStrict.ts, 26, 40))
>X : Symbol(X, Decl(intersectionReductionStrict.ts, 20, 24))

type X5 = X | number & object;
>X5 : Symbol(X5, Decl(intersectionReductionStrict.ts, 27, 30))
>X : Symbol(X, Decl(intersectionReductionStrict.ts, 20, 24))

type X6 = X | symbol & string;
>X6 : Symbol(X6, Decl(intersectionReductionStrict.ts, 28, 30))
>X : Symbol(X, Decl(intersectionReductionStrict.ts, 20, 24))

type X7 = X | void & string;
>X7 : Symbol(X7, Decl(intersectionReductionStrict.ts, 29, 30))
>X : Symbol(X, Decl(intersectionReductionStrict.ts, 20, 24))

type A = { kind: 'a', foo: string };
>A : Symbol(A, Decl(intersectionReductionStrict.ts, 30, 28))
>kind : Symbol(kind, Decl(intersectionReductionStrict.ts, 32, 10))
>foo : Symbol(foo, Decl(intersectionReductionStrict.ts, 32, 21))

type B = { kind: 'b', foo: number };
>B : Symbol(B, Decl(intersectionReductionStrict.ts, 32, 36))
>kind : Symbol(kind, Decl(intersectionReductionStrict.ts, 33, 10))
>foo : Symbol(foo, Decl(intersectionReductionStrict.ts, 33, 21))

type C = { kind: 'c', foo: number };
>C : Symbol(C, Decl(intersectionReductionStrict.ts, 33, 36))
>kind : Symbol(kind, Decl(intersectionReductionStrict.ts, 34, 10))
>foo : Symbol(foo, Decl(intersectionReductionStrict.ts, 34, 21))

declare let ab: A & B;
>ab : Symbol(ab, Decl(intersectionReductionStrict.ts, 36, 11))
>A : Symbol(A, Decl(intersectionReductionStrict.ts, 30, 28))
>B : Symbol(B, Decl(intersectionReductionStrict.ts, 32, 36))

ab.kind;  // Error
>ab : Symbol(ab, Decl(intersectionReductionStrict.ts, 36, 11))

declare let x: A | (B & C);  // A
>x : Symbol(x, Decl(intersectionReductionStrict.ts, 39, 11))
>A : Symbol(A, Decl(intersectionReductionStrict.ts, 30, 28))
>B : Symbol(B, Decl(intersectionReductionStrict.ts, 32, 36))
>C : Symbol(C, Decl(intersectionReductionStrict.ts, 33, 36))

let a: A = x;
>a : Symbol(a, Decl(intersectionReductionStrict.ts, 40, 3))
>A : Symbol(A, Decl(intersectionReductionStrict.ts, 30, 28))
>x : Symbol(x, Decl(intersectionReductionStrict.ts, 39, 11))

type AB = A & B;  // never
>AB : Symbol(AB, Decl(intersectionReductionStrict.ts, 40, 13))
>A : Symbol(A, Decl(intersectionReductionStrict.ts, 30, 28))
>B : Symbol(B, Decl(intersectionReductionStrict.ts, 32, 36))

type BC = B & C;  // never
>BC : Symbol(BC, Decl(intersectionReductionStrict.ts, 42, 16))
>B : Symbol(B, Decl(intersectionReductionStrict.ts, 32, 36))
>C : Symbol(C, Decl(intersectionReductionStrict.ts, 33, 36))

type U1 = Partial<A & B>;  // never
>U1 : Symbol(U1, Decl(intersectionReductionStrict.ts, 43, 16))
>Partial : Symbol(Partial, Decl(lib.es5.d.ts, --, --))
>A : Symbol(A, Decl(intersectionReductionStrict.ts, 30, 28))
>B : Symbol(B, Decl(intersectionReductionStrict.ts, 32, 36))

type U2 = Readonly<A & B>;  // never
>U2 : Symbol(U2, Decl(intersectionReductionStrict.ts, 45, 25))
>Readonly : Symbol(Readonly, Decl(lib.es5.d.ts, --, --))
>A : Symbol(A, Decl(intersectionReductionStrict.ts, 30, 28))
>B : Symbol(B, Decl(intersectionReductionStrict.ts, 32, 36))

type U3 = (A & B)['kind'];  // never
>U3 : Symbol(U3, Decl(intersectionReductionStrict.ts, 46, 26))
>A : Symbol(A, Decl(intersectionReductionStrict.ts, 30, 28))
>B : Symbol(B, Decl(intersectionReductionStrict.ts, 32, 36))

type U4 = A & B | B & C;  // never
>U4 : Symbol(U4, Decl(intersectionReductionStrict.ts, 47, 26))
>A : Symbol(A, Decl(intersectionReductionStrict.ts, 30, 28))
>B : Symbol(B, Decl(intersectionReductionStrict.ts, 32, 36))
>B : Symbol(B, Decl(intersectionReductionStrict.ts, 32, 36))
>C : Symbol(C, Decl(intersectionReductionStrict.ts, 33, 36))

type U5 = A | B & C;  // A
>U5 : Symbol(U5, Decl(intersectionReductionStrict.ts, 48, 24))
>A : Symbol(A, Decl(intersectionReductionStrict.ts, 30, 28))
>B : Symbol(B, Decl(intersectionReductionStrict.ts, 32, 36))
>C : Symbol(C, Decl(intersectionReductionStrict.ts, 33, 36))

type K1 = keyof (A & B);  // string | number | symbol
>K1 : Symbol(K1, Decl(intersectionReductionStrict.ts, 49, 20))
>A : Symbol(A, Decl(intersectionReductionStrict.ts, 30, 28))
>B : Symbol(B, Decl(intersectionReductionStrict.ts, 32, 36))

type K2 = keyof A | keyof B;  // 'kind' | 'foo'
>K2 : Symbol(K2, Decl(intersectionReductionStrict.ts, 51, 24))
>A : Symbol(A, Decl(intersectionReductionStrict.ts, 30, 28))
>B : Symbol(B, Decl(intersectionReductionStrict.ts, 32, 36))

type Merge1<T, U> = { [P in keyof (T & U)]: P extends keyof T ? T[P] : U[P & keyof U] }
>Merge1 : Symbol(Merge1, Decl(intersectionReductionStrict.ts, 52, 28))
>T : Symbol(T, Decl(intersectionReductionStrict.ts, 54, 12))
>U : Symbol(U, Decl(intersectionReductionStrict.ts, 54, 14))
>P : Symbol(P, Decl(intersectionReductionStrict.ts, 54, 23))
>T : Symbol(T, Decl(intersectionReductionStrict.ts, 54, 12))
>U : Symbol(U, Decl(intersectionReductionStrict.ts, 54, 14))
>P : Symbol(P, Decl(intersectionReductionStrict.ts, 54, 23))
>T : Symbol(T, Decl(intersectionReductionStrict.ts, 54, 12))
>T : Symbol(T, Decl(intersectionReductionStrict.ts, 54, 12))
>P : Symbol(P, Decl(intersectionReductionStrict.ts, 54, 23))
>U : Symbol(U, Decl(intersectionReductionStrict.ts, 54, 14))
>P : Symbol(P, Decl(intersectionReductionStrict.ts, 54, 23))
>U : Symbol(U, Decl(intersectionReductionStrict.ts, 54, 14))

type Merge2<T, U> = { [P in keyof T | keyof U]: P extends keyof T ? T[P] : U[P & keyof U] }
>Merge2 : Symbol(Merge2, Decl(intersectionReductionStrict.ts, 54, 87))
>T : Symbol(T, Decl(intersectionReductionStrict.ts, 55, 12))
>U : Symbol(U, Decl(intersectionReductionStrict.ts, 55, 14))
>P : Symbol(P, Decl(intersectionReductionStrict.ts, 55, 23))
>T : Symbol(T, Decl(intersectionReductionStrict.ts, 55, 12))
>U : Symbol(U, Decl(intersectionReductionStrict.ts, 55, 14))
>P : Symbol(P, Decl(intersectionReductionStrict.ts, 55, 23))
>T : Symbol(T, Decl(intersectionReductionStrict.ts, 55, 12))
>T : Symbol(T, Decl(intersectionReductionStrict.ts, 55, 12))
>P : Symbol(P, Decl(intersectionReductionStrict.ts, 55, 23))
>U : Symbol(U, Decl(intersectionReductionStrict.ts, 55, 14))
>P : Symbol(P, Decl(intersectionReductionStrict.ts, 55, 23))
>U : Symbol(U, Decl(intersectionReductionStrict.ts, 55, 14))

type M1 = { a: 1, b: 2 } & { a: 2, c: 3 };  // never
>M1 : Symbol(M1, Decl(intersectionReductionStrict.ts, 55, 91))
>a : Symbol(a, Decl(intersectionReductionStrict.ts, 57, 11))
>b : Symbol(b, Decl(intersectionReductionStrict.ts, 57, 17))
>a : Symbol(a, Decl(intersectionReductionStrict.ts, 57, 28))
>c : Symbol(c, Decl(intersectionReductionStrict.ts, 57, 34))

type M2 = Merge1<{ a: 1, b: 2 }, { a: 2, c: 3 }>;  // {}
>M2 : Symbol(M2, Decl(intersectionReductionStrict.ts, 57, 42))
>Merge1 : Symbol(Merge1, Decl(intersectionReductionStrict.ts, 52, 28))
>a : Symbol(a, Decl(intersectionReductionStrict.ts, 58, 18))
>b : Symbol(b, Decl(intersectionReductionStrict.ts, 58, 24))
>a : Symbol(a, Decl(intersectionReductionStrict.ts, 58, 34))
>c : Symbol(c, Decl(intersectionReductionStrict.ts, 58, 40))

type M3 = Merge2<{ a: 1, b: 2 }, { a: 2, c: 3 }>;  // { a: 1, b: 2, c: 3 }
>M3 : Symbol(M3, Decl(intersectionReductionStrict.ts, 58, 49))
>Merge2 : Symbol(Merge2, Decl(intersectionReductionStrict.ts, 54, 87))
>a : Symbol(a, Decl(intersectionReductionStrict.ts, 59, 18))
>b : Symbol(b, Decl(intersectionReductionStrict.ts, 59, 24))
>a : Symbol(a, Decl(intersectionReductionStrict.ts, 59, 34))
>c : Symbol(c, Decl(intersectionReductionStrict.ts, 59, 40))

// Repro from #31663

const x1 = { a: 'foo', b: 42 };
>x1 : Symbol(x1, Decl(intersectionReductionStrict.ts, 63, 5))
>a : Symbol(a, Decl(intersectionReductionStrict.ts, 63, 12))
>b : Symbol(b, Decl(intersectionReductionStrict.ts, 63, 22))

const x2 = { a: 'foo', b: true };
>x2 : Symbol(x2, Decl(intersectionReductionStrict.ts, 64, 5))
>a : Symbol(a, Decl(intersectionReductionStrict.ts, 64, 12))
>b : Symbol(b, Decl(intersectionReductionStrict.ts, 64, 22))

declare let k: 'a' | 'b';
>k : Symbol(k, Decl(intersectionReductionStrict.ts, 66, 11))

x1[k] = 'bar' as any;  // Error
>x1 : Symbol(x1, Decl(intersectionReductionStrict.ts, 63, 5))
>k : Symbol(k, Decl(intersectionReductionStrict.ts, 66, 11))

x2[k] = 'bar' as any;  // Error
>x2 : Symbol(x2, Decl(intersectionReductionStrict.ts, 64, 5))
>k : Symbol(k, Decl(intersectionReductionStrict.ts, 66, 11))

const enum Tag1 {}
>Tag1 : Symbol(Tag1, Decl(intersectionReductionStrict.ts, 69, 21))

const enum Tag2 {}
>Tag2 : Symbol(Tag2, Decl(intersectionReductionStrict.ts, 71, 18))

declare let s1: string & Tag1;
>s1 : Symbol(s1, Decl(intersectionReductionStrict.ts, 74, 11))
>Tag1 : Symbol(Tag1, Decl(intersectionReductionStrict.ts, 69, 21))

declare let s2: string & Tag2;
>s2 : Symbol(s2, Decl(intersectionReductionStrict.ts, 75, 11))
>Tag2 : Symbol(Tag2, Decl(intersectionReductionStrict.ts, 71, 18))

declare let t1: string & Tag1 | undefined;
>t1 : Symbol(t1, Decl(intersectionReductionStrict.ts, 77, 11))
>Tag1 : Symbol(Tag1, Decl(intersectionReductionStrict.ts, 69, 21))

declare let t2: string & Tag2 | undefined;
>t2 : Symbol(t2, Decl(intersectionReductionStrict.ts, 78, 11))
>Tag2 : Symbol(Tag2, Decl(intersectionReductionStrict.ts, 71, 18))

s1 = s2;
>s1 : Symbol(s1, Decl(intersectionReductionStrict.ts, 74, 11))
>s2 : Symbol(s2, Decl(intersectionReductionStrict.ts, 75, 11))

s2 = s1;
>s2 : Symbol(s2, Decl(intersectionReductionStrict.ts, 75, 11))
>s1 : Symbol(s1, Decl(intersectionReductionStrict.ts, 74, 11))

t1 = t2;
>t1 : Symbol(t1, Decl(intersectionReductionStrict.ts, 77, 11))
>t2 : Symbol(t2, Decl(intersectionReductionStrict.ts, 78, 11))

t2 = t1;
>t2 : Symbol(t2, Decl(intersectionReductionStrict.ts, 78, 11))
>t1 : Symbol(t1, Decl(intersectionReductionStrict.ts, 77, 11))

// Repro from #36736

const f1 = (t: "a" | ("b" & "c")): "a" => t;
>f1 : Symbol(f1, Decl(intersectionReductionStrict.ts, 88, 5))
>t : Symbol(t, Decl(intersectionReductionStrict.ts, 88, 12))
>t : Symbol(t, Decl(intersectionReductionStrict.ts, 88, 12))

type Container<Type extends string> = {
>Container : Symbol(Container, Decl(intersectionReductionStrict.ts, 88, 44))
>Type : Symbol(Type, Decl(intersectionReductionStrict.ts, 90, 15))

    type: Type;
>type : Symbol(type, Decl(intersectionReductionStrict.ts, 90, 39))
>Type : Symbol(Type, Decl(intersectionReductionStrict.ts, 90, 15))
}

const f2 = (t: Container<"a"> | (Container<"b"> & Container<"c">)): Container<"a"> => t;
>f2 : Symbol(f2, Decl(intersectionReductionStrict.ts, 94, 5))
>t : Symbol(t, Decl(intersectionReductionStrict.ts, 94, 12))
>Container : Symbol(Container, Decl(intersectionReductionStrict.ts, 88, 44))
>Container : Symbol(Container, Decl(intersectionReductionStrict.ts, 88, 44))
>Container : Symbol(Container, Decl(intersectionReductionStrict.ts, 88, 44))
>Container : Symbol(Container, Decl(intersectionReductionStrict.ts, 88, 44))
>t : Symbol(t, Decl(intersectionReductionStrict.ts, 94, 12))

const f3 = (t: Container<"a"> | (Container<"b"> & { dataB: boolean } & Container<"a">)): Container<"a"> => t;
>f3 : Symbol(f3, Decl(intersectionReductionStrict.ts, 95, 5))
>t : Symbol(t, Decl(intersectionReductionStrict.ts, 95, 12))
>Container : Symbol(Container, Decl(intersectionReductionStrict.ts, 88, 44))
>Container : Symbol(Container, Decl(intersectionReductionStrict.ts, 88, 44))
>dataB : Symbol(dataB, Decl(intersectionReductionStrict.ts, 95, 51))
>Container : Symbol(Container, Decl(intersectionReductionStrict.ts, 88, 44))
>Container : Symbol(Container, Decl(intersectionReductionStrict.ts, 88, 44))
>t : Symbol(t, Decl(intersectionReductionStrict.ts, 95, 12))

const f4 = (t: number | (Container<"b"> & { dataB: boolean } & Container<"a">)): number => t;
>f4 : Symbol(f4, Decl(intersectionReductionStrict.ts, 96, 5))
>t : Symbol(t, Decl(intersectionReductionStrict.ts, 96, 12))
>Container : Symbol(Container, Decl(intersectionReductionStrict.ts, 88, 44))
>dataB : Symbol(dataB, Decl(intersectionReductionStrict.ts, 96, 43))
>Container : Symbol(Container, Decl(intersectionReductionStrict.ts, 88, 44))
>t : Symbol(t, Decl(intersectionReductionStrict.ts, 96, 12))