/
consistentUnionSubtypeReduction.symbols
130 lines (106 loc) · 5.21 KB
/
consistentUnionSubtypeReduction.symbols
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
=== tests/cases/compiler/consistentUnionSubtypeReduction.ts ===
// https://github.com/microsoft/TypeScript/issues/31155
declare const MyArray: {
>MyArray : Symbol(MyArray, Decl(consistentUnionSubtypeReduction.ts, 2, 13))
isArray<T>(arg: T | {}): arg is T extends readonly any[] ? (unknown extends T ? never : readonly any[]) : any[];
>isArray : Symbol(isArray, Decl(consistentUnionSubtypeReduction.ts, 2, 24))
>T : Symbol(T, Decl(consistentUnionSubtypeReduction.ts, 3, 12))
>arg : Symbol(arg, Decl(consistentUnionSubtypeReduction.ts, 3, 15))
>T : Symbol(T, Decl(consistentUnionSubtypeReduction.ts, 3, 12))
>arg : Symbol(arg, Decl(consistentUnionSubtypeReduction.ts, 3, 15))
>T : Symbol(T, Decl(consistentUnionSubtypeReduction.ts, 3, 12))
>T : Symbol(T, Decl(consistentUnionSubtypeReduction.ts, 3, 12))
};
declare const a: readonly string[] | string;
>a : Symbol(a, Decl(consistentUnionSubtypeReduction.ts, 6, 13))
declare const b: string[] | string;
>b : Symbol(b, Decl(consistentUnionSubtypeReduction.ts, 7, 13))
declare const c: unknown;
>c : Symbol(c, Decl(consistentUnionSubtypeReduction.ts, 8, 13))
if (MyArray.isArray(a)) {
>MyArray.isArray : Symbol(isArray, Decl(consistentUnionSubtypeReduction.ts, 2, 24))
>MyArray : Symbol(MyArray, Decl(consistentUnionSubtypeReduction.ts, 2, 13))
>isArray : Symbol(isArray, Decl(consistentUnionSubtypeReduction.ts, 2, 24))
>a : Symbol(a, Decl(consistentUnionSubtypeReduction.ts, 6, 13))
a; // readonly string[]
>a : Symbol(a, Decl(consistentUnionSubtypeReduction.ts, 6, 13))
}
else {
a; // string
>a : Symbol(a, Decl(consistentUnionSubtypeReduction.ts, 6, 13))
}
a; // readonly string[] | string;
>a : Symbol(a, Decl(consistentUnionSubtypeReduction.ts, 6, 13))
if (MyArray.isArray(b)) {
>MyArray.isArray : Symbol(isArray, Decl(consistentUnionSubtypeReduction.ts, 2, 24))
>MyArray : Symbol(MyArray, Decl(consistentUnionSubtypeReduction.ts, 2, 13))
>isArray : Symbol(isArray, Decl(consistentUnionSubtypeReduction.ts, 2, 24))
>b : Symbol(b, Decl(consistentUnionSubtypeReduction.ts, 7, 13))
b; // string[] | string;
>b : Symbol(b, Decl(consistentUnionSubtypeReduction.ts, 7, 13))
}
else {
b; // string
>b : Symbol(b, Decl(consistentUnionSubtypeReduction.ts, 7, 13))
}
b; // string[] | string;
>b : Symbol(b, Decl(consistentUnionSubtypeReduction.ts, 7, 13))
if (MyArray.isArray(c)) {
>MyArray.isArray : Symbol(isArray, Decl(consistentUnionSubtypeReduction.ts, 2, 24))
>MyArray : Symbol(MyArray, Decl(consistentUnionSubtypeReduction.ts, 2, 13))
>isArray : Symbol(isArray, Decl(consistentUnionSubtypeReduction.ts, 2, 24))
>c : Symbol(c, Decl(consistentUnionSubtypeReduction.ts, 8, 13))
c; // any[]
>c : Symbol(c, Decl(consistentUnionSubtypeReduction.ts, 8, 13))
}
function f<T>(x: T) {
>f : Symbol(f, Decl(consistentUnionSubtypeReduction.ts, 28, 1))
>T : Symbol(T, Decl(consistentUnionSubtypeReduction.ts, 31, 11))
>x : Symbol(x, Decl(consistentUnionSubtypeReduction.ts, 31, 14))
>T : Symbol(T, Decl(consistentUnionSubtypeReduction.ts, 31, 11))
const a: readonly T[] | string = null!;
>a : Symbol(a, Decl(consistentUnionSubtypeReduction.ts, 32, 9))
>T : Symbol(T, Decl(consistentUnionSubtypeReduction.ts, 31, 11))
const b: T[] | string = null!;
>b : Symbol(b, Decl(consistentUnionSubtypeReduction.ts, 33, 9))
>T : Symbol(T, Decl(consistentUnionSubtypeReduction.ts, 31, 11))
const c: T = null!;
>c : Symbol(c, Decl(consistentUnionSubtypeReduction.ts, 34, 9))
>T : Symbol(T, Decl(consistentUnionSubtypeReduction.ts, 31, 11))
if (MyArray.isArray(a)) {
>MyArray.isArray : Symbol(isArray, Decl(consistentUnionSubtypeReduction.ts, 2, 24))
>MyArray : Symbol(MyArray, Decl(consistentUnionSubtypeReduction.ts, 2, 13))
>isArray : Symbol(isArray, Decl(consistentUnionSubtypeReduction.ts, 2, 24))
>a : Symbol(a, Decl(consistentUnionSubtypeReduction.ts, 32, 9))
a; // readonly T[]
>a : Symbol(a, Decl(consistentUnionSubtypeReduction.ts, 32, 9))
}
else {
a; // string
>a : Symbol(a, Decl(consistentUnionSubtypeReduction.ts, 32, 9))
}
a; // readonly T[] | string;
>a : Symbol(a, Decl(consistentUnionSubtypeReduction.ts, 32, 9))
if (MyArray.isArray(b)) {
>MyArray.isArray : Symbol(isArray, Decl(consistentUnionSubtypeReduction.ts, 2, 24))
>MyArray : Symbol(MyArray, Decl(consistentUnionSubtypeReduction.ts, 2, 13))
>isArray : Symbol(isArray, Decl(consistentUnionSubtypeReduction.ts, 2, 24))
>b : Symbol(b, Decl(consistentUnionSubtypeReduction.ts, 33, 9))
b; // T[]
>b : Symbol(b, Decl(consistentUnionSubtypeReduction.ts, 33, 9))
}
else {
b; // string
>b : Symbol(b, Decl(consistentUnionSubtypeReduction.ts, 33, 9))
}
b;
>b : Symbol(b, Decl(consistentUnionSubtypeReduction.ts, 33, 9))
if (MyArray.isArray(c)) {
>MyArray.isArray : Symbol(isArray, Decl(consistentUnionSubtypeReduction.ts, 2, 24))
>MyArray : Symbol(MyArray, Decl(consistentUnionSubtypeReduction.ts, 2, 13))
>isArray : Symbol(isArray, Decl(consistentUnionSubtypeReduction.ts, 2, 24))
>c : Symbol(c, Decl(consistentUnionSubtypeReduction.ts, 34, 9))
c; // T & (T extends readonly any[] ? readonly any[] : any[])
>c : Symbol(c, Decl(consistentUnionSubtypeReduction.ts, 34, 9))
}
}