File: privateNamesUnique-3.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 (30 lines) | stat: -rw-r--r-- 1,044 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
=== tests/cases/conformance/classes/members/privateNames/privateNamesUnique-3.ts ===
class A {
>A : Symbol(A, Decl(privateNamesUnique-3.ts, 0, 0))

    #foo = 1;
>#foo : Symbol(A.#foo, Decl(privateNamesUnique-3.ts, 0, 9))

    static #foo = true; // error (duplicate)
>#foo : Symbol(A.#foo, Decl(privateNamesUnique-3.ts, 1, 13))

                        // because static and instance private names
                        // share the same lexical scope
                        // https://tc39.es/proposal-class-fields/#prod-ClassBody
}
class B {
>B : Symbol(B, Decl(privateNamesUnique-3.ts, 6, 1))

    static #foo = true;
>#foo : Symbol(B.#foo, Decl(privateNamesUnique-3.ts, 7, 9))

    test(x: B) {
>test : Symbol(B.test, Decl(privateNamesUnique-3.ts, 8, 23))
>x : Symbol(x, Decl(privateNamesUnique-3.ts, 9, 9))
>B : Symbol(B, Decl(privateNamesUnique-3.ts, 6, 1))

        x.#foo; // error (#foo is a static property on B, not an instance property)
>x : Symbol(x, Decl(privateNamesUnique-3.ts, 9, 9))
    }
}