File: narrowingOfDottedNames.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 (131 lines) | stat: -rw-r--r-- 4,455 bytes parent folder | download
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
=== tests/cases/compiler/narrowingOfDottedNames.ts ===
// Repro from #8383

class A {
>A : Symbol(A, Decl(narrowingOfDottedNames.ts, 0, 0))

    prop!: { a: string; };
>prop : Symbol(A.prop, Decl(narrowingOfDottedNames.ts, 2, 9))
>a : Symbol(a, Decl(narrowingOfDottedNames.ts, 3, 12))
}

class B {
>B : Symbol(B, Decl(narrowingOfDottedNames.ts, 4, 1))

    prop!: { b: string; }
>prop : Symbol(B.prop, Decl(narrowingOfDottedNames.ts, 6, 9))
>b : Symbol(b, Decl(narrowingOfDottedNames.ts, 7, 12))
}

function isA(x: any): x is A {
>isA : Symbol(isA, Decl(narrowingOfDottedNames.ts, 8, 1))
>x : Symbol(x, Decl(narrowingOfDottedNames.ts, 10, 13))
>x : Symbol(x, Decl(narrowingOfDottedNames.ts, 10, 13))
>A : Symbol(A, Decl(narrowingOfDottedNames.ts, 0, 0))

    return x instanceof A;
>x : Symbol(x, Decl(narrowingOfDottedNames.ts, 10, 13))
>A : Symbol(A, Decl(narrowingOfDottedNames.ts, 0, 0))
}

function isB(x: any): x is B {
>isB : Symbol(isB, Decl(narrowingOfDottedNames.ts, 12, 1))
>x : Symbol(x, Decl(narrowingOfDottedNames.ts, 14, 13))
>x : Symbol(x, Decl(narrowingOfDottedNames.ts, 14, 13))
>B : Symbol(B, Decl(narrowingOfDottedNames.ts, 4, 1))

    return x instanceof B;
>x : Symbol(x, Decl(narrowingOfDottedNames.ts, 14, 13))
>B : Symbol(B, Decl(narrowingOfDottedNames.ts, 4, 1))
}

function f1(x: A | B) {
>f1 : Symbol(f1, Decl(narrowingOfDottedNames.ts, 16, 1))
>x : Symbol(x, Decl(narrowingOfDottedNames.ts, 18, 12))
>A : Symbol(A, Decl(narrowingOfDottedNames.ts, 0, 0))
>B : Symbol(B, Decl(narrowingOfDottedNames.ts, 4, 1))

    while (true) {
        if (x instanceof A) {
>x : Symbol(x, Decl(narrowingOfDottedNames.ts, 18, 12))
>A : Symbol(A, Decl(narrowingOfDottedNames.ts, 0, 0))

            x.prop.a;
>x.prop.a : Symbol(a, Decl(narrowingOfDottedNames.ts, 3, 12))
>x.prop : Symbol(A.prop, Decl(narrowingOfDottedNames.ts, 2, 9))
>x : Symbol(x, Decl(narrowingOfDottedNames.ts, 18, 12))
>prop : Symbol(A.prop, Decl(narrowingOfDottedNames.ts, 2, 9))
>a : Symbol(a, Decl(narrowingOfDottedNames.ts, 3, 12))
        }
        else if (x instanceof B) {
>x : Symbol(x, Decl(narrowingOfDottedNames.ts, 18, 12))
>B : Symbol(B, Decl(narrowingOfDottedNames.ts, 4, 1))

            x.prop.b;
>x.prop.b : Symbol(b, Decl(narrowingOfDottedNames.ts, 7, 12))
>x.prop : Symbol(B.prop, Decl(narrowingOfDottedNames.ts, 6, 9))
>x : Symbol(x, Decl(narrowingOfDottedNames.ts, 18, 12))
>prop : Symbol(B.prop, Decl(narrowingOfDottedNames.ts, 6, 9))
>b : Symbol(b, Decl(narrowingOfDottedNames.ts, 7, 12))
        }
    }
}

function f2(x: A | B) {
>f2 : Symbol(f2, Decl(narrowingOfDottedNames.ts, 27, 1))
>x : Symbol(x, Decl(narrowingOfDottedNames.ts, 29, 12))
>A : Symbol(A, Decl(narrowingOfDottedNames.ts, 0, 0))
>B : Symbol(B, Decl(narrowingOfDottedNames.ts, 4, 1))

    while (true) {
        if (isA(x)) {
>isA : Symbol(isA, Decl(narrowingOfDottedNames.ts, 8, 1))
>x : Symbol(x, Decl(narrowingOfDottedNames.ts, 29, 12))

            x.prop.a;
>x.prop.a : Symbol(a, Decl(narrowingOfDottedNames.ts, 3, 12))
>x.prop : Symbol(A.prop, Decl(narrowingOfDottedNames.ts, 2, 9))
>x : Symbol(x, Decl(narrowingOfDottedNames.ts, 29, 12))
>prop : Symbol(A.prop, Decl(narrowingOfDottedNames.ts, 2, 9))
>a : Symbol(a, Decl(narrowingOfDottedNames.ts, 3, 12))
        }
        else if (isB(x)) {
>isB : Symbol(isB, Decl(narrowingOfDottedNames.ts, 12, 1))
>x : Symbol(x, Decl(narrowingOfDottedNames.ts, 29, 12))

            x.prop.b;
>x.prop.b : Symbol(b, Decl(narrowingOfDottedNames.ts, 7, 12))
>x.prop : Symbol(B.prop, Decl(narrowingOfDottedNames.ts, 6, 9))
>x : Symbol(x, Decl(narrowingOfDottedNames.ts, 29, 12))
>prop : Symbol(B.prop, Decl(narrowingOfDottedNames.ts, 6, 9))
>b : Symbol(b, Decl(narrowingOfDottedNames.ts, 7, 12))
        }
    }
}

// Repro from #28100

class Foo1
>Foo1 : Symbol(Foo1, Decl(narrowingOfDottedNames.ts, 38, 1))
{
    x: number;  // Error
>x : Symbol(Foo1.x, Decl(narrowingOfDottedNames.ts, 43, 1))

    constructor() {
        if (this instanceof Boolean) {
>this : Symbol(Foo1, Decl(narrowingOfDottedNames.ts, 38, 1))
>Boolean : Symbol(Boolean, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
        }
    }
}

class Foo2
>Foo2 : Symbol(Foo2, Decl(narrowingOfDottedNames.ts, 49, 1))
{
    x: number;  // Error
>x : Symbol(Foo2.x, Decl(narrowingOfDottedNames.ts, 52, 1))

    constructor() {
    }
}