File: truthinessCallExpressionCoercion.symbols

package info (click to toggle)
node-typescript 4.9.5%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 533,908 kB
  • sloc: javascript: 2,018,330; makefile: 7; sh: 1
file content (229 lines) | stat: -rw-r--r-- 10,019 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
=== tests/cases/compiler/truthinessCallExpressionCoercion.ts ===
function onlyErrorsWhenTestingNonNullableFunctionType(required: () => boolean, optional?: () => boolean) {
>onlyErrorsWhenTestingNonNullableFunctionType : Symbol(onlyErrorsWhenTestingNonNullableFunctionType, Decl(truthinessCallExpressionCoercion.ts, 0, 0))
>required : Symbol(required, Decl(truthinessCallExpressionCoercion.ts, 0, 54))
>optional : Symbol(optional, Decl(truthinessCallExpressionCoercion.ts, 0, 78))

    if (required) { // error
>required : Symbol(required, Decl(truthinessCallExpressionCoercion.ts, 0, 54))
    }

    if (optional) { // ok
>optional : Symbol(optional, Decl(truthinessCallExpressionCoercion.ts, 0, 78))
    }

    if (!!required) { // ok
>required : Symbol(required, Decl(truthinessCallExpressionCoercion.ts, 0, 54))
    }

    if (required()) { // ok
>required : Symbol(required, Decl(truthinessCallExpressionCoercion.ts, 0, 54))
    }
}

function onlyErrorsWhenUnusedInBody() {
>onlyErrorsWhenUnusedInBody : Symbol(onlyErrorsWhenUnusedInBody, Decl(truthinessCallExpressionCoercion.ts, 12, 1))

    function test() { return Math.random() > 0.5; }
>test : Symbol(test, Decl(truthinessCallExpressionCoercion.ts, 14, 39))
>Math.random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --))
>Math : Symbol(Math, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --))

    if (test) { // error
>test : Symbol(test, Decl(truthinessCallExpressionCoercion.ts, 14, 39))

        console.log('test');
>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
>console : Symbol(console, Decl(lib.dom.d.ts, --, --))
>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
    }
    
    if (test) { // ok
>test : Symbol(test, Decl(truthinessCallExpressionCoercion.ts, 14, 39))

        console.log(test);
>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
>console : Symbol(console, Decl(lib.dom.d.ts, --, --))
>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
>test : Symbol(test, Decl(truthinessCallExpressionCoercion.ts, 14, 39))
    }

    if (test) { // ok
>test : Symbol(test, Decl(truthinessCallExpressionCoercion.ts, 14, 39))

        test();
>test : Symbol(test, Decl(truthinessCallExpressionCoercion.ts, 14, 39))
    }
    
    if (test) { // ok
>test : Symbol(test, Decl(truthinessCallExpressionCoercion.ts, 14, 39))

        [() => null].forEach(() => {
>[() => null].forEach : Symbol(Array.forEach, Decl(lib.es5.d.ts, --, --))
>forEach : Symbol(Array.forEach, Decl(lib.es5.d.ts, --, --))

            test();
>test : Symbol(test, Decl(truthinessCallExpressionCoercion.ts, 14, 39))

        });
    }
    
    if (test) { // error
>test : Symbol(test, Decl(truthinessCallExpressionCoercion.ts, 14, 39))

        [() => null].forEach(test => {
>[() => null].forEach : Symbol(Array.forEach, Decl(lib.es5.d.ts, --, --))
>forEach : Symbol(Array.forEach, Decl(lib.es5.d.ts, --, --))
>test : Symbol(test, Decl(truthinessCallExpressionCoercion.ts, 36, 29))

            test();
>test : Symbol(test, Decl(truthinessCallExpressionCoercion.ts, 36, 29))

        });
    }
}

function checksPropertyAccess() {
>checksPropertyAccess : Symbol(checksPropertyAccess, Decl(truthinessCallExpressionCoercion.ts, 40, 1))

    const x = {
>x : Symbol(x, Decl(truthinessCallExpressionCoercion.ts, 43, 9))

        foo: {
>foo : Symbol(foo, Decl(truthinessCallExpressionCoercion.ts, 43, 15))

            bar() { return true; }
>bar : Symbol(bar, Decl(truthinessCallExpressionCoercion.ts, 44, 14))
        }
    }

    if (x.foo.bar) { // error
>x.foo.bar : Symbol(bar, Decl(truthinessCallExpressionCoercion.ts, 44, 14))
>x.foo : Symbol(foo, Decl(truthinessCallExpressionCoercion.ts, 43, 15))
>x : Symbol(x, Decl(truthinessCallExpressionCoercion.ts, 43, 9))
>foo : Symbol(foo, Decl(truthinessCallExpressionCoercion.ts, 43, 15))
>bar : Symbol(bar, Decl(truthinessCallExpressionCoercion.ts, 44, 14))
    }

    if (x.foo.bar) { // ok
>x.foo.bar : Symbol(bar, Decl(truthinessCallExpressionCoercion.ts, 44, 14))
>x.foo : Symbol(foo, Decl(truthinessCallExpressionCoercion.ts, 43, 15))
>x : Symbol(x, Decl(truthinessCallExpressionCoercion.ts, 43, 9))
>foo : Symbol(foo, Decl(truthinessCallExpressionCoercion.ts, 43, 15))
>bar : Symbol(bar, Decl(truthinessCallExpressionCoercion.ts, 44, 14))

        x.foo.bar;
>x.foo.bar : Symbol(bar, Decl(truthinessCallExpressionCoercion.ts, 44, 14))
>x.foo : Symbol(foo, Decl(truthinessCallExpressionCoercion.ts, 43, 15))
>x : Symbol(x, Decl(truthinessCallExpressionCoercion.ts, 43, 9))
>foo : Symbol(foo, Decl(truthinessCallExpressionCoercion.ts, 43, 15))
>bar : Symbol(bar, Decl(truthinessCallExpressionCoercion.ts, 44, 14))
    }
}

class Foo {
>Foo : Symbol(Foo, Decl(truthinessCallExpressionCoercion.ts, 55, 1))

    maybeIsUser?: () => boolean;
>maybeIsUser : Symbol(Foo.maybeIsUser, Decl(truthinessCallExpressionCoercion.ts, 57, 11))

    isUser() {
>isUser : Symbol(Foo.isUser, Decl(truthinessCallExpressionCoercion.ts, 58, 32))

        return true;
    }

    test() {
>test : Symbol(Foo.test, Decl(truthinessCallExpressionCoercion.ts, 62, 5))

        if (this.isUser) { // error
>this.isUser : Symbol(Foo.isUser, Decl(truthinessCallExpressionCoercion.ts, 58, 32))
>this : Symbol(Foo, Decl(truthinessCallExpressionCoercion.ts, 55, 1))
>isUser : Symbol(Foo.isUser, Decl(truthinessCallExpressionCoercion.ts, 58, 32))
        }

        if (this.maybeIsUser) { // ok
>this.maybeIsUser : Symbol(Foo.maybeIsUser, Decl(truthinessCallExpressionCoercion.ts, 57, 11))
>this : Symbol(Foo, Decl(truthinessCallExpressionCoercion.ts, 55, 1))
>maybeIsUser : Symbol(Foo.maybeIsUser, Decl(truthinessCallExpressionCoercion.ts, 57, 11))
        }
    }
}

// Test for GH-35557 where ids were not assigned for a symbol.
function A(stats: StatsBase<any>) {
>A : Symbol(A, Decl(truthinessCallExpressionCoercion.ts, 71, 1))
>stats : Symbol(stats, Decl(truthinessCallExpressionCoercion.ts, 74, 11))
>StatsBase : Symbol(StatsBase, Decl(truthinessCallExpressionCoercion.ts, 87, 1))

    if (stats.isDirectory) { // err
>stats.isDirectory : Symbol(StatsBase.isDirectory, Decl(truthinessCallExpressionCoercion.ts, 89, 24))
>stats : Symbol(stats, Decl(truthinessCallExpressionCoercion.ts, 74, 11))
>isDirectory : Symbol(StatsBase.isDirectory, Decl(truthinessCallExpressionCoercion.ts, 89, 24))

        console.log(`[Directory] ${stats.ctime}`)
>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
>console : Symbol(console, Decl(lib.dom.d.ts, --, --))
>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
>stats.ctime : Symbol(StatsBase.ctime, Decl(truthinessCallExpressionCoercion.ts, 90, 27))
>stats : Symbol(stats, Decl(truthinessCallExpressionCoercion.ts, 74, 11))
>ctime : Symbol(StatsBase.ctime, Decl(truthinessCallExpressionCoercion.ts, 90, 27))
    }
}

function B(a: Nested, b: Nested) {
>B : Symbol(B, Decl(truthinessCallExpressionCoercion.ts, 78, 1))
>a : Symbol(a, Decl(truthinessCallExpressionCoercion.ts, 80, 11))
>Nested : Symbol(Nested, Decl(truthinessCallExpressionCoercion.ts, 92, 1))
>b : Symbol(b, Decl(truthinessCallExpressionCoercion.ts, 80, 21))
>Nested : Symbol(Nested, Decl(truthinessCallExpressionCoercion.ts, 92, 1))

    if (a.stats.isDirectory) { // err
>a.stats.isDirectory : Symbol(StatsBase.isDirectory, Decl(truthinessCallExpressionCoercion.ts, 89, 24))
>a.stats : Symbol(Nested.stats, Decl(truthinessCallExpressionCoercion.ts, 94, 18))
>a : Symbol(a, Decl(truthinessCallExpressionCoercion.ts, 80, 11))
>stats : Symbol(Nested.stats, Decl(truthinessCallExpressionCoercion.ts, 94, 18))
>isDirectory : Symbol(StatsBase.isDirectory, Decl(truthinessCallExpressionCoercion.ts, 89, 24))

        b.stats.isDirectory(); 
>b.stats.isDirectory : Symbol(StatsBase.isDirectory, Decl(truthinessCallExpressionCoercion.ts, 89, 24))
>b.stats : Symbol(Nested.stats, Decl(truthinessCallExpressionCoercion.ts, 94, 18))
>b : Symbol(b, Decl(truthinessCallExpressionCoercion.ts, 80, 21))
>stats : Symbol(Nested.stats, Decl(truthinessCallExpressionCoercion.ts, 94, 18))
>isDirectory : Symbol(StatsBase.isDirectory, Decl(truthinessCallExpressionCoercion.ts, 89, 24))
    }
    if (a.stats.isDirectory) { // ok
>a.stats.isDirectory : Symbol(StatsBase.isDirectory, Decl(truthinessCallExpressionCoercion.ts, 89, 24))
>a.stats : Symbol(Nested.stats, Decl(truthinessCallExpressionCoercion.ts, 94, 18))
>a : Symbol(a, Decl(truthinessCallExpressionCoercion.ts, 80, 11))
>stats : Symbol(Nested.stats, Decl(truthinessCallExpressionCoercion.ts, 94, 18))
>isDirectory : Symbol(StatsBase.isDirectory, Decl(truthinessCallExpressionCoercion.ts, 89, 24))

        a.stats.isDirectory();
>a.stats.isDirectory : Symbol(StatsBase.isDirectory, Decl(truthinessCallExpressionCoercion.ts, 89, 24))
>a.stats : Symbol(Nested.stats, Decl(truthinessCallExpressionCoercion.ts, 94, 18))
>a : Symbol(a, Decl(truthinessCallExpressionCoercion.ts, 80, 11))
>stats : Symbol(Nested.stats, Decl(truthinessCallExpressionCoercion.ts, 94, 18))
>isDirectory : Symbol(StatsBase.isDirectory, Decl(truthinessCallExpressionCoercion.ts, 89, 24))
    }
} 

interface StatsBase<T> {
>StatsBase : Symbol(StatsBase, Decl(truthinessCallExpressionCoercion.ts, 87, 1))
>T : Symbol(T, Decl(truthinessCallExpressionCoercion.ts, 89, 20))

    isDirectory(): boolean;
>isDirectory : Symbol(StatsBase.isDirectory, Decl(truthinessCallExpressionCoercion.ts, 89, 24))

    ctime: number;
>ctime : Symbol(StatsBase.ctime, Decl(truthinessCallExpressionCoercion.ts, 90, 27))
}

interface Nested {
>Nested : Symbol(Nested, Decl(truthinessCallExpressionCoercion.ts, 92, 1))

    stats: StatsBase<any>;
>stats : Symbol(Nested.stats, Decl(truthinessCallExpressionCoercion.ts, 94, 18))
>StatsBase : Symbol(StatsBase, Decl(truthinessCallExpressionCoercion.ts, 87, 1))
}