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
|
=== tests/cases/compiler/overloadsWithComputedNames.ts ===
// https://github.com/microsoft/TypeScript/issues/52329
class Person {
>Person : Symbol(Person, Decl(overloadsWithComputedNames.ts, 0, 0))
["B"](a: number): string;
>["B"] : Symbol(Person["B"], Decl(overloadsWithComputedNames.ts, 1, 14))
>"B" : Symbol(Person["B"], Decl(overloadsWithComputedNames.ts, 1, 14))
>a : Symbol(a, Decl(overloadsWithComputedNames.ts, 2, 10))
["A"](a: string|number): number | string {
>["A"] : Symbol(Person["A"], Decl(overloadsWithComputedNames.ts, 2, 29))
>"A" : Symbol(Person["A"], Decl(overloadsWithComputedNames.ts, 2, 29))
>a : Symbol(a, Decl(overloadsWithComputedNames.ts, 3, 10))
return 0;
}
}
let p = new Person();
>p : Symbol(p, Decl(overloadsWithComputedNames.ts, 7, 3))
>Person : Symbol(Person, Decl(overloadsWithComputedNames.ts, 0, 0))
p.A(0)
>p.A : Symbol(Person["A"], Decl(overloadsWithComputedNames.ts, 2, 29))
>p : Symbol(p, Decl(overloadsWithComputedNames.ts, 7, 3))
>A : Symbol(Person["A"], Decl(overloadsWithComputedNames.ts, 2, 29))
p.B(0)
>p.B : Symbol(Person["B"], Decl(overloadsWithComputedNames.ts, 1, 14))
>p : Symbol(p, Decl(overloadsWithComputedNames.ts, 7, 3))
>B : Symbol(Person["B"], Decl(overloadsWithComputedNames.ts, 1, 14))
// https://github.com/microsoft/TypeScript/issues/17345
class C {
>C : Symbol(C, Decl(overloadsWithComputedNames.ts, 9, 6))
["foo"](): void
>["foo"] : Symbol(C["foo"], Decl(overloadsWithComputedNames.ts, 12, 9), Decl(overloadsWithComputedNames.ts, 14, 20))
>"foo" : Symbol(C["foo"], Decl(overloadsWithComputedNames.ts, 12, 9), Decl(overloadsWithComputedNames.ts, 14, 20))
["bar"](): void;
>["bar"] : Symbol(C["bar"], Decl(overloadsWithComputedNames.ts, 13, 19))
>"bar" : Symbol(C["bar"], Decl(overloadsWithComputedNames.ts, 13, 19))
["foo"]() {
>["foo"] : Symbol(C["foo"], Decl(overloadsWithComputedNames.ts, 12, 9), Decl(overloadsWithComputedNames.ts, 14, 20))
>"foo" : Symbol(C["foo"], Decl(overloadsWithComputedNames.ts, 12, 9), Decl(overloadsWithComputedNames.ts, 14, 20))
return 0;
}
}
declare const uniqueSym: unique symbol;
>uniqueSym : Symbol(uniqueSym, Decl(overloadsWithComputedNames.ts, 20, 13))
declare const uniqueSym2: unique symbol;
>uniqueSym2 : Symbol(uniqueSym2, Decl(overloadsWithComputedNames.ts, 21, 13))
declare const sym: symbol;
>sym : Symbol(sym, Decl(overloadsWithComputedNames.ts, 22, 13))
declare const strUnion: 'foo' | 'bar';
>strUnion : Symbol(strUnion, Decl(overloadsWithComputedNames.ts, 24, 13))
class C1 {
>C1 : Symbol(C1, Decl(overloadsWithComputedNames.ts, 24, 38))
[sym](): void; // should error
>[sym] : Symbol(C1[sym], Decl(overloadsWithComputedNames.ts, 26, 10))
>sym : Symbol(sym, Decl(overloadsWithComputedNames.ts, 22, 13))
[uniqueSym2](): void; // should error
>[uniqueSym2] : Symbol(C1[uniqueSym2], Decl(overloadsWithComputedNames.ts, 27, 18))
>uniqueSym2 : Symbol(uniqueSym2, Decl(overloadsWithComputedNames.ts, 21, 13))
[uniqueSym](): void;
>[uniqueSym] : Symbol(C1[uniqueSym], Decl(overloadsWithComputedNames.ts, 28, 25), Decl(overloadsWithComputedNames.ts, 29, 24))
>uniqueSym : Symbol(uniqueSym, Decl(overloadsWithComputedNames.ts, 20, 13))
[uniqueSym]() { }
>[uniqueSym] : Symbol(C1[uniqueSym], Decl(overloadsWithComputedNames.ts, 28, 25), Decl(overloadsWithComputedNames.ts, 29, 24))
>uniqueSym : Symbol(uniqueSym, Decl(overloadsWithComputedNames.ts, 20, 13))
}
interface I1 {
>I1 : Symbol(I1, Decl(overloadsWithComputedNames.ts, 31, 1))
[sym](): void; // should error
>[sym] : Symbol(I1[sym], Decl(overloadsWithComputedNames.ts, 33, 14))
>sym : Symbol(sym, Decl(overloadsWithComputedNames.ts, 22, 13))
[uniqueSym2](): void;
>[uniqueSym2] : Symbol(I1[uniqueSym2], Decl(overloadsWithComputedNames.ts, 34, 18))
>uniqueSym2 : Symbol(uniqueSym2, Decl(overloadsWithComputedNames.ts, 21, 13))
[uniqueSym](): void;
>[uniqueSym] : Symbol(I1[uniqueSym], Decl(overloadsWithComputedNames.ts, 35, 25), Decl(overloadsWithComputedNames.ts, 36, 24))
>uniqueSym : Symbol(uniqueSym, Decl(overloadsWithComputedNames.ts, 20, 13))
[uniqueSym](): void;
>[uniqueSym] : Symbol(I1[uniqueSym], Decl(overloadsWithComputedNames.ts, 35, 25), Decl(overloadsWithComputedNames.ts, 36, 24))
>uniqueSym : Symbol(uniqueSym, Decl(overloadsWithComputedNames.ts, 20, 13))
}
class C2 {
>C2 : Symbol(C2, Decl(overloadsWithComputedNames.ts, 38, 1))
[strUnion](): void; // should error
>[strUnion] : Symbol(C2[strUnion], Decl(overloadsWithComputedNames.ts, 40, 10))
>strUnion : Symbol(strUnion, Decl(overloadsWithComputedNames.ts, 24, 13))
[strUnion]() { }
>[strUnion] : Symbol(C2[strUnion], Decl(overloadsWithComputedNames.ts, 41, 23))
>strUnion : Symbol(strUnion, Decl(overloadsWithComputedNames.ts, 24, 13))
}
class I2 {
>I2 : Symbol(I2, Decl(overloadsWithComputedNames.ts, 43, 1))
[strUnion](): void; // should error
>[strUnion] : Symbol(I2[strUnion], Decl(overloadsWithComputedNames.ts, 45, 10))
>strUnion : Symbol(strUnion, Decl(overloadsWithComputedNames.ts, 24, 13))
[strUnion]() { }
>[strUnion] : Symbol(I2[strUnion], Decl(overloadsWithComputedNames.ts, 46, 23))
>strUnion : Symbol(strUnion, Decl(overloadsWithComputedNames.ts, 24, 13))
}
class C3 {
>C3 : Symbol(C3, Decl(overloadsWithComputedNames.ts, 48, 1))
[1](): void; // should error
>[1] : Symbol(C3[1], Decl(overloadsWithComputedNames.ts, 50, 10))
>1 : Symbol(C3[1], Decl(overloadsWithComputedNames.ts, 50, 10))
[2](): void;
>[2] : Symbol(C3[2], Decl(overloadsWithComputedNames.ts, 51, 16), Decl(overloadsWithComputedNames.ts, 52, 16))
>2 : Symbol(C3[2], Decl(overloadsWithComputedNames.ts, 51, 16), Decl(overloadsWithComputedNames.ts, 52, 16))
[2]() { }
>[2] : Symbol(C3[2], Decl(overloadsWithComputedNames.ts, 51, 16), Decl(overloadsWithComputedNames.ts, 52, 16))
>2 : Symbol(C3[2], Decl(overloadsWithComputedNames.ts, 51, 16), Decl(overloadsWithComputedNames.ts, 52, 16))
}
interface I3 {
>I3 : Symbol(I3, Decl(overloadsWithComputedNames.ts, 54, 1))
[1](): void;
>[1] : Symbol(I3[1], Decl(overloadsWithComputedNames.ts, 56, 14))
>1 : Symbol(I3[1], Decl(overloadsWithComputedNames.ts, 56, 14))
[2](): void;
>[2] : Symbol(I3[2], Decl(overloadsWithComputedNames.ts, 57, 16), Decl(overloadsWithComputedNames.ts, 58, 16))
>2 : Symbol(I3[2], Decl(overloadsWithComputedNames.ts, 57, 16), Decl(overloadsWithComputedNames.ts, 58, 16))
[2](): void;
>[2] : Symbol(I3[2], Decl(overloadsWithComputedNames.ts, 57, 16), Decl(overloadsWithComputedNames.ts, 58, 16))
>2 : Symbol(I3[2], Decl(overloadsWithComputedNames.ts, 57, 16), Decl(overloadsWithComputedNames.ts, 58, 16))
}
|