File: subtypesOfUnion.symbols

package info (click to toggle)
node-typescript 3.3.3333-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 324,548 kB
  • sloc: makefile: 6; sh: 3
file content (191 lines) | stat: -rw-r--r-- 7,230 bytes parent folder | download | duplicates (5)
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
=== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion.ts ===
enum E { e1, e2 }
>E : Symbol(E, Decl(subtypesOfUnion.ts, 0, 0))
>e1 : Symbol(E.e1, Decl(subtypesOfUnion.ts, 0, 8))
>e2 : Symbol(E.e2, Decl(subtypesOfUnion.ts, 0, 12))

interface I8 { [x: string]: number[]; }
>I8 : Symbol(I8, Decl(subtypesOfUnion.ts, 0, 17))
>x : Symbol(x, Decl(subtypesOfUnion.ts, 1, 16))

class A { foo: number; }
>A : Symbol(A, Decl(subtypesOfUnion.ts, 1, 39))
>foo : Symbol(A.foo, Decl(subtypesOfUnion.ts, 2, 9))

class A2<T> { foo: T; }
>A2 : Symbol(A2, Decl(subtypesOfUnion.ts, 2, 24))
>T : Symbol(T, Decl(subtypesOfUnion.ts, 3, 9))
>foo : Symbol(A2.foo, Decl(subtypesOfUnion.ts, 3, 13))
>T : Symbol(T, Decl(subtypesOfUnion.ts, 3, 9))

function f() { }
>f : Symbol(f, Decl(subtypesOfUnion.ts, 3, 23), Decl(subtypesOfUnion.ts, 4, 16))

module f { export var bar = 1; }
>f : Symbol(f, Decl(subtypesOfUnion.ts, 3, 23), Decl(subtypesOfUnion.ts, 4, 16))
>bar : Symbol(bar, Decl(subtypesOfUnion.ts, 5, 21))

class c { baz: string }
>c : Symbol(c, Decl(subtypesOfUnion.ts, 5, 32), Decl(subtypesOfUnion.ts, 6, 23))
>baz : Symbol(c.baz, Decl(subtypesOfUnion.ts, 6, 9))

module c { export var bar = 1; }
>c : Symbol(c, Decl(subtypesOfUnion.ts, 5, 32), Decl(subtypesOfUnion.ts, 6, 23))
>bar : Symbol(bar, Decl(subtypesOfUnion.ts, 7, 21))

// A type T is a subtype of a union type U if T is a subtype of any type in U.
interface I1<T> {
>I1 : Symbol(I1, Decl(subtypesOfUnion.ts, 7, 32))
>T : Symbol(T, Decl(subtypesOfUnion.ts, 10, 13))

    [x: string]: string | number;
>x : Symbol(x, Decl(subtypesOfUnion.ts, 11, 5))

    foo: any; // ok
>foo : Symbol(I1.foo, Decl(subtypesOfUnion.ts, 11, 33))

    foo2: string; // ok
>foo2 : Symbol(I1.foo2, Decl(subtypesOfUnion.ts, 12, 13))

    foo3: number; // ok
>foo3 : Symbol(I1.foo3, Decl(subtypesOfUnion.ts, 13, 17))

    foo4: boolean; // error 
>foo4 : Symbol(I1.foo4, Decl(subtypesOfUnion.ts, 14, 17))

    foo5: E; // ok - subtype of number 
>foo5 : Symbol(I1.foo5, Decl(subtypesOfUnion.ts, 15, 18))
>E : Symbol(E, Decl(subtypesOfUnion.ts, 0, 0))

    foo6: Date; // error
>foo6 : Symbol(I1.foo6, Decl(subtypesOfUnion.ts, 16, 12))
>Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --))

    foo7: RegExp; // error
>foo7 : Symbol(I1.foo7, Decl(subtypesOfUnion.ts, 17, 15))
>RegExp : Symbol(RegExp, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))

    foo8: { bar: number }; // error
>foo8 : Symbol(I1.foo8, Decl(subtypesOfUnion.ts, 18, 17))
>bar : Symbol(bar, Decl(subtypesOfUnion.ts, 19, 11))

    foo9: I8; // error
>foo9 : Symbol(I1.foo9, Decl(subtypesOfUnion.ts, 19, 26))
>I8 : Symbol(I8, Decl(subtypesOfUnion.ts, 0, 17))

    foo10: A; // error
>foo10 : Symbol(I1.foo10, Decl(subtypesOfUnion.ts, 20, 13))
>A : Symbol(A, Decl(subtypesOfUnion.ts, 1, 39))

    foo11: A2<number>; // error
>foo11 : Symbol(I1.foo11, Decl(subtypesOfUnion.ts, 21, 13))
>A2 : Symbol(A2, Decl(subtypesOfUnion.ts, 2, 24))

    foo12: (x) => number; //error
>foo12 : Symbol(I1.foo12, Decl(subtypesOfUnion.ts, 22, 22))
>x : Symbol(x, Decl(subtypesOfUnion.ts, 23, 12))

    foo13: <T>(x: T) => T; // error
>foo13 : Symbol(I1.foo13, Decl(subtypesOfUnion.ts, 23, 25))
>T : Symbol(T, Decl(subtypesOfUnion.ts, 24, 12))
>x : Symbol(x, Decl(subtypesOfUnion.ts, 24, 15))
>T : Symbol(T, Decl(subtypesOfUnion.ts, 24, 12))
>T : Symbol(T, Decl(subtypesOfUnion.ts, 24, 12))

    foo14: typeof f; // error
>foo14 : Symbol(I1.foo14, Decl(subtypesOfUnion.ts, 24, 26))
>f : Symbol(f, Decl(subtypesOfUnion.ts, 3, 23), Decl(subtypesOfUnion.ts, 4, 16))

    foo15: typeof c; // error
>foo15 : Symbol(I1.foo15, Decl(subtypesOfUnion.ts, 25, 20))
>c : Symbol(c, Decl(subtypesOfUnion.ts, 5, 32), Decl(subtypesOfUnion.ts, 6, 23))

    foo16: T; // error
>foo16 : Symbol(I1.foo16, Decl(subtypesOfUnion.ts, 26, 20))
>T : Symbol(T, Decl(subtypesOfUnion.ts, 10, 13))

    foo17: Object; // error
>foo17 : Symbol(I1.foo17, Decl(subtypesOfUnion.ts, 27, 13))
>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))

    foo18: {}; // error
>foo18 : Symbol(I1.foo18, Decl(subtypesOfUnion.ts, 28, 18))
}
interface I2<T> {
>I2 : Symbol(I2, Decl(subtypesOfUnion.ts, 30, 1))
>T : Symbol(T, Decl(subtypesOfUnion.ts, 31, 13))

    [x: string]: E | number;
>x : Symbol(x, Decl(subtypesOfUnion.ts, 32, 5))
>E : Symbol(E, Decl(subtypesOfUnion.ts, 0, 0))

    foo: any; // ok
>foo : Symbol(I2.foo, Decl(subtypesOfUnion.ts, 32, 28))

    foo2: string; // error
>foo2 : Symbol(I2.foo2, Decl(subtypesOfUnion.ts, 33, 13))

    foo3: number; // ok
>foo3 : Symbol(I2.foo3, Decl(subtypesOfUnion.ts, 34, 17))

    foo4: boolean; // error 
>foo4 : Symbol(I2.foo4, Decl(subtypesOfUnion.ts, 35, 17))

    foo5: E; // ok
>foo5 : Symbol(I2.foo5, Decl(subtypesOfUnion.ts, 36, 18))
>E : Symbol(E, Decl(subtypesOfUnion.ts, 0, 0))

    foo6: Date; // error
>foo6 : Symbol(I2.foo6, Decl(subtypesOfUnion.ts, 37, 12))
>Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --))

    foo7: RegExp; // error
>foo7 : Symbol(I2.foo7, Decl(subtypesOfUnion.ts, 38, 15))
>RegExp : Symbol(RegExp, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))

    foo8: { bar: number }; // error
>foo8 : Symbol(I2.foo8, Decl(subtypesOfUnion.ts, 39, 17))
>bar : Symbol(bar, Decl(subtypesOfUnion.ts, 40, 11))

    foo9: I8; // error
>foo9 : Symbol(I2.foo9, Decl(subtypesOfUnion.ts, 40, 26))
>I8 : Symbol(I8, Decl(subtypesOfUnion.ts, 0, 17))

    foo10: A; // error
>foo10 : Symbol(I2.foo10, Decl(subtypesOfUnion.ts, 41, 13))
>A : Symbol(A, Decl(subtypesOfUnion.ts, 1, 39))

    foo11: A2<number>; // error
>foo11 : Symbol(I2.foo11, Decl(subtypesOfUnion.ts, 42, 13))
>A2 : Symbol(A2, Decl(subtypesOfUnion.ts, 2, 24))

    foo12: (x) => number; //error
>foo12 : Symbol(I2.foo12, Decl(subtypesOfUnion.ts, 43, 22))
>x : Symbol(x, Decl(subtypesOfUnion.ts, 44, 12))

    foo13: <T>(x: T) => T; // error
>foo13 : Symbol(I2.foo13, Decl(subtypesOfUnion.ts, 44, 25))
>T : Symbol(T, Decl(subtypesOfUnion.ts, 45, 12))
>x : Symbol(x, Decl(subtypesOfUnion.ts, 45, 15))
>T : Symbol(T, Decl(subtypesOfUnion.ts, 45, 12))
>T : Symbol(T, Decl(subtypesOfUnion.ts, 45, 12))

    foo14: typeof f; // error
>foo14 : Symbol(I2.foo14, Decl(subtypesOfUnion.ts, 45, 26))
>f : Symbol(f, Decl(subtypesOfUnion.ts, 3, 23), Decl(subtypesOfUnion.ts, 4, 16))

    foo15: typeof c; // error
>foo15 : Symbol(I2.foo15, Decl(subtypesOfUnion.ts, 46, 20))
>c : Symbol(c, Decl(subtypesOfUnion.ts, 5, 32), Decl(subtypesOfUnion.ts, 6, 23))

    foo16: T; // error
>foo16 : Symbol(I2.foo16, Decl(subtypesOfUnion.ts, 47, 20))
>T : Symbol(T, Decl(subtypesOfUnion.ts, 31, 13))

    foo17: Object; // error
>foo17 : Symbol(I2.foo17, Decl(subtypesOfUnion.ts, 48, 13))
>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))

    foo18: {}; // error
>foo18 : Symbol(I2.foo18, Decl(subtypesOfUnion.ts, 49, 18))
}