From 64fd857b0dcca50b2babe4b5404e6eb496e5dbcb Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Tue, 2 May 2017 17:34:08 -0700 Subject: [PATCH] fix symbol display for computed properties --- src/compiler/checker.ts | 12 ++++--- .../computedPropertyNames13_ES5.symbols | 4 +-- .../computedPropertyNames13_ES6.symbols | 4 +-- .../computedPropertyNames16_ES5.symbols | 4 +-- .../computedPropertyNames16_ES6.symbols | 4 +-- .../computedPropertyNames37_ES5.symbols | 4 +-- .../computedPropertyNames37_ES6.symbols | 4 +-- .../computedPropertyNames41_ES5.symbols | 2 +- .../computedPropertyNames41_ES6.symbols | 2 +- ...omputedPropertyNamesSourceMap1_ES5.symbols | 4 +-- ...omputedPropertyNamesSourceMap1_ES6.symbols | 4 +-- .../decoratorOnClassMethod13.symbols | 4 +-- .../reference/decoratorOnClassMethod4.symbols | 2 +- .../reference/decoratorOnClassMethod5.symbols | 2 +- .../reference/decoratorOnClassMethod7.symbols | 2 +- tests/baselines/reference/dynamicNames.types | 36 +++++++++---------- .../reference/dynamicNamesErrors.errors.txt | 8 ++--- ...ssDeclarationWithGetterSetterInES6.symbols | 12 +++---- ...mitClassDeclarationWithMethodInES6.symbols | 12 +++---- .../findAllRefsForComputedProperties.ts | 8 ++--- .../findAllRefsForComputedProperties2.ts | 8 ++--- 21 files changed, 73 insertions(+), 69 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 8ca7ba85056..4491804c56d 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -2898,7 +2898,7 @@ namespace ts { function getNameOfSymbol(symbol: Symbol): string { if (symbol.flags & SymbolFlags.Dynamic) { - return unescapeIdentifier(symbol.name); + return `"${escapeString(unescapeIdentifier(symbol.name))}"`; } if (symbol.declarations && symbol.declarations.length) { const declaration = symbol.declarations[0]; @@ -2940,14 +2940,18 @@ namespace ts { const needsElementAccess = !isIdentifierStart(firstChar, languageVersion); if (needsElementAccess) { - writePunctuation(writer, SyntaxKind.OpenBracketToken); + if (firstChar !== CharacterCodes.openBracket) { + writePunctuation(writer, SyntaxKind.OpenBracketToken); + } if (isSingleOrDoubleQuote(firstChar)) { writer.writeStringLiteral(symbolName); } else { writer.writeSymbol(symbolName, symbol); } - writePunctuation(writer, SyntaxKind.CloseBracketToken); + if (firstChar !== CharacterCodes.openBracket) { + writePunctuation(writer, SyntaxKind.CloseBracketToken); + } } else { writePunctuation(writer, SyntaxKind.DotToken); @@ -5232,7 +5236,7 @@ namespace ts { const nameType = checkComputedPropertyName(member.name); if (nameType.flags & TypeFlags.StringOrNumberLiteral) { // TODO(rbuckton): ESSymbolLiteral - const memberName = escapeIdentifier((nameType).text); + const memberName = (nameType).text; let symbol = symbolTable.get(memberName); if (!symbol) { symbolTable.set(memberName, symbol = createSymbol(SymbolFlags.Dynamic, memberName)); diff --git a/tests/baselines/reference/computedPropertyNames13_ES5.symbols b/tests/baselines/reference/computedPropertyNames13_ES5.symbols index 493ea44b339..4fae0886ca2 100644 --- a/tests/baselines/reference/computedPropertyNames13_ES5.symbols +++ b/tests/baselines/reference/computedPropertyNames13_ES5.symbols @@ -29,10 +29,10 @@ class C { >s : Symbol(s, Decl(computedPropertyNames13_ES5.ts, 0, 3)) static [""]() { } ->"" : Symbol(C[[""]], Decl(computedPropertyNames13_ES5.ts, 8, 14)) +>"" : Symbol(C[""], Decl(computedPropertyNames13_ES5.ts, 8, 14)) [0]() { } ->0 : Symbol(C[[0]], Decl(computedPropertyNames13_ES5.ts, 9, 21)) +>0 : Symbol(C[0], Decl(computedPropertyNames13_ES5.ts, 9, 21)) [a]() { } >a : Symbol(a, Decl(computedPropertyNames13_ES5.ts, 2, 3)) diff --git a/tests/baselines/reference/computedPropertyNames13_ES6.symbols b/tests/baselines/reference/computedPropertyNames13_ES6.symbols index 7c421d3f9f7..1f3a1c1460c 100644 --- a/tests/baselines/reference/computedPropertyNames13_ES6.symbols +++ b/tests/baselines/reference/computedPropertyNames13_ES6.symbols @@ -29,10 +29,10 @@ class C { >s : Symbol(s, Decl(computedPropertyNames13_ES6.ts, 0, 3)) static [""]() { } ->"" : Symbol(C[[""]], Decl(computedPropertyNames13_ES6.ts, 8, 14)) +>"" : Symbol(C[""], Decl(computedPropertyNames13_ES6.ts, 8, 14)) [0]() { } ->0 : Symbol(C[[0]], Decl(computedPropertyNames13_ES6.ts, 9, 21)) +>0 : Symbol(C[0], Decl(computedPropertyNames13_ES6.ts, 9, 21)) [a]() { } >a : Symbol(a, Decl(computedPropertyNames13_ES6.ts, 2, 3)) diff --git a/tests/baselines/reference/computedPropertyNames16_ES5.symbols b/tests/baselines/reference/computedPropertyNames16_ES5.symbols index 43f6e208957..dff21e3cd97 100644 --- a/tests/baselines/reference/computedPropertyNames16_ES5.symbols +++ b/tests/baselines/reference/computedPropertyNames16_ES5.symbols @@ -31,11 +31,11 @@ class C { >s : Symbol(s, Decl(computedPropertyNames16_ES5.ts, 0, 3)) static set [""](v) { } ->"" : Symbol(C[[""]], Decl(computedPropertyNames16_ES5.ts, 8, 28)) +>"" : Symbol(C[""], Decl(computedPropertyNames16_ES5.ts, 8, 28)) >v : Symbol(v, Decl(computedPropertyNames16_ES5.ts, 9, 20)) get [0]() { return 0; } ->0 : Symbol(C[[0]], Decl(computedPropertyNames16_ES5.ts, 9, 26)) +>0 : Symbol(C[0], Decl(computedPropertyNames16_ES5.ts, 9, 26)) set [a](v) { } >a : Symbol(a, Decl(computedPropertyNames16_ES5.ts, 2, 3)) diff --git a/tests/baselines/reference/computedPropertyNames16_ES6.symbols b/tests/baselines/reference/computedPropertyNames16_ES6.symbols index 4febdc01b9b..3e1af442b2d 100644 --- a/tests/baselines/reference/computedPropertyNames16_ES6.symbols +++ b/tests/baselines/reference/computedPropertyNames16_ES6.symbols @@ -31,11 +31,11 @@ class C { >s : Symbol(s, Decl(computedPropertyNames16_ES6.ts, 0, 3)) static set [""](v) { } ->"" : Symbol(C[[""]], Decl(computedPropertyNames16_ES6.ts, 8, 28)) +>"" : Symbol(C[""], Decl(computedPropertyNames16_ES6.ts, 8, 28)) >v : Symbol(v, Decl(computedPropertyNames16_ES6.ts, 9, 20)) get [0]() { return 0; } ->0 : Symbol(C[[0]], Decl(computedPropertyNames16_ES6.ts, 9, 26)) +>0 : Symbol(C[0], Decl(computedPropertyNames16_ES6.ts, 9, 26)) set [a](v) { } >a : Symbol(a, Decl(computedPropertyNames16_ES6.ts, 2, 3)) diff --git a/tests/baselines/reference/computedPropertyNames37_ES5.symbols b/tests/baselines/reference/computedPropertyNames37_ES5.symbols index 7763c5970a3..5d9ea090780 100644 --- a/tests/baselines/reference/computedPropertyNames37_ES5.symbols +++ b/tests/baselines/reference/computedPropertyNames37_ES5.symbols @@ -17,11 +17,11 @@ class C { // Computed properties get ["get1"]() { return new Foo } ->"get1" : Symbol(C[["get1"]], Decl(computedPropertyNames37_ES5.ts, 4, 22)) +>"get1" : Symbol(C["get1"], Decl(computedPropertyNames37_ES5.ts, 4, 22)) >Foo : Symbol(Foo, Decl(computedPropertyNames37_ES5.ts, 0, 0)) set ["set1"](p: Foo2) { } ->"set1" : Symbol(C[["set1"]], Decl(computedPropertyNames37_ES5.ts, 7, 37)) +>"set1" : Symbol(C["set1"], Decl(computedPropertyNames37_ES5.ts, 7, 37)) >p : Symbol(p, Decl(computedPropertyNames37_ES5.ts, 8, 17)) >Foo2 : Symbol(Foo2, Decl(computedPropertyNames37_ES5.ts, 0, 15)) } diff --git a/tests/baselines/reference/computedPropertyNames37_ES6.symbols b/tests/baselines/reference/computedPropertyNames37_ES6.symbols index d2e1e2fdc6e..f30cd6cad37 100644 --- a/tests/baselines/reference/computedPropertyNames37_ES6.symbols +++ b/tests/baselines/reference/computedPropertyNames37_ES6.symbols @@ -17,11 +17,11 @@ class C { // Computed properties get ["get1"]() { return new Foo } ->"get1" : Symbol(C[["get1"]], Decl(computedPropertyNames37_ES6.ts, 4, 22)) +>"get1" : Symbol(C["get1"], Decl(computedPropertyNames37_ES6.ts, 4, 22)) >Foo : Symbol(Foo, Decl(computedPropertyNames37_ES6.ts, 0, 0)) set ["set1"](p: Foo2) { } ->"set1" : Symbol(C[["set1"]], Decl(computedPropertyNames37_ES6.ts, 7, 37)) +>"set1" : Symbol(C["set1"], Decl(computedPropertyNames37_ES6.ts, 7, 37)) >p : Symbol(p, Decl(computedPropertyNames37_ES6.ts, 8, 17)) >Foo2 : Symbol(Foo2, Decl(computedPropertyNames37_ES6.ts, 0, 15)) } diff --git a/tests/baselines/reference/computedPropertyNames41_ES5.symbols b/tests/baselines/reference/computedPropertyNames41_ES5.symbols index 821a39c8d59..c0642d6b0a6 100644 --- a/tests/baselines/reference/computedPropertyNames41_ES5.symbols +++ b/tests/baselines/reference/computedPropertyNames41_ES5.symbols @@ -17,6 +17,6 @@ class C { // Computed properties static [""]() { return new Foo } ->"" : Symbol(C[[""]], Decl(computedPropertyNames41_ES5.ts, 4, 28)) +>"" : Symbol(C[""], Decl(computedPropertyNames41_ES5.ts, 4, 28)) >Foo : Symbol(Foo, Decl(computedPropertyNames41_ES5.ts, 0, 0)) } diff --git a/tests/baselines/reference/computedPropertyNames41_ES6.symbols b/tests/baselines/reference/computedPropertyNames41_ES6.symbols index a075603e252..10ef48e4d16 100644 --- a/tests/baselines/reference/computedPropertyNames41_ES6.symbols +++ b/tests/baselines/reference/computedPropertyNames41_ES6.symbols @@ -17,6 +17,6 @@ class C { // Computed properties static [""]() { return new Foo } ->"" : Symbol(C[[""]], Decl(computedPropertyNames41_ES6.ts, 4, 28)) +>"" : Symbol(C[""], Decl(computedPropertyNames41_ES6.ts, 4, 28)) >Foo : Symbol(Foo, Decl(computedPropertyNames41_ES6.ts, 0, 0)) } diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.symbols b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.symbols index 9f4f5110e8f..cdb193e3bd3 100644 --- a/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.symbols +++ b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.symbols @@ -3,12 +3,12 @@ class C { >C : Symbol(C, Decl(computedPropertyNamesSourceMap1_ES5.ts, 0, 0)) ["hello"]() { ->"hello" : Symbol(C[["hello"]], Decl(computedPropertyNamesSourceMap1_ES5.ts, 0, 9)) +>"hello" : Symbol(C["hello"], Decl(computedPropertyNamesSourceMap1_ES5.ts, 0, 9)) debugger; } get ["goodbye"]() { ->"goodbye" : Symbol(C[["goodbye"]], Decl(computedPropertyNamesSourceMap1_ES5.ts, 3, 5)) +>"goodbye" : Symbol(C["goodbye"], Decl(computedPropertyNamesSourceMap1_ES5.ts, 3, 5)) return 0; } diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.symbols b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.symbols index 447bbaebb7c..e8ebdab2fd8 100644 --- a/tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.symbols +++ b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.symbols @@ -3,12 +3,12 @@ class C { >C : Symbol(C, Decl(computedPropertyNamesSourceMap1_ES6.ts, 0, 0)) ["hello"]() { ->"hello" : Symbol(C[["hello"]], Decl(computedPropertyNamesSourceMap1_ES6.ts, 0, 9)) +>"hello" : Symbol(C["hello"], Decl(computedPropertyNamesSourceMap1_ES6.ts, 0, 9)) debugger; } get ["goodbye"]() { ->"goodbye" : Symbol(C[["goodbye"]], Decl(computedPropertyNamesSourceMap1_ES6.ts, 3, 2)) +>"goodbye" : Symbol(C["goodbye"], Decl(computedPropertyNamesSourceMap1_ES6.ts, 3, 2)) return 0; } diff --git a/tests/baselines/reference/decoratorOnClassMethod13.symbols b/tests/baselines/reference/decoratorOnClassMethod13.symbols index 7cd369be144..5700e6a3bf3 100644 --- a/tests/baselines/reference/decoratorOnClassMethod13.symbols +++ b/tests/baselines/reference/decoratorOnClassMethod13.symbols @@ -15,9 +15,9 @@ class C { @dec ["1"]() { } >dec : Symbol(dec, Decl(decoratorOnClassMethod13.ts, 0, 0)) ->"1" : Symbol(C[["1"]], Decl(decoratorOnClassMethod13.ts, 2, 9)) +>"1" : Symbol(C["1"], Decl(decoratorOnClassMethod13.ts, 2, 9)) @dec ["b"]() { } >dec : Symbol(dec, Decl(decoratorOnClassMethod13.ts, 0, 0)) ->"b" : Symbol(C[["b"]], Decl(decoratorOnClassMethod13.ts, 3, 20)) +>"b" : Symbol(C["b"], Decl(decoratorOnClassMethod13.ts, 3, 20)) } diff --git a/tests/baselines/reference/decoratorOnClassMethod4.symbols b/tests/baselines/reference/decoratorOnClassMethod4.symbols index da0e9eafca7..30d300a937a 100644 --- a/tests/baselines/reference/decoratorOnClassMethod4.symbols +++ b/tests/baselines/reference/decoratorOnClassMethod4.symbols @@ -15,5 +15,5 @@ class C { @dec ["method"]() {} >dec : Symbol(dec, Decl(decoratorOnClassMethod4.ts, 0, 0)) ->"method" : Symbol(C[["method"]], Decl(decoratorOnClassMethod4.ts, 2, 9)) +>"method" : Symbol(C["method"], Decl(decoratorOnClassMethod4.ts, 2, 9)) } diff --git a/tests/baselines/reference/decoratorOnClassMethod5.symbols b/tests/baselines/reference/decoratorOnClassMethod5.symbols index bd895deeea8..004af8b9f8e 100644 --- a/tests/baselines/reference/decoratorOnClassMethod5.symbols +++ b/tests/baselines/reference/decoratorOnClassMethod5.symbols @@ -15,5 +15,5 @@ class C { @dec() ["method"]() {} >dec : Symbol(dec, Decl(decoratorOnClassMethod5.ts, 0, 0)) ->"method" : Symbol(C[["method"]], Decl(decoratorOnClassMethod5.ts, 2, 9)) +>"method" : Symbol(C["method"], Decl(decoratorOnClassMethod5.ts, 2, 9)) } diff --git a/tests/baselines/reference/decoratorOnClassMethod7.symbols b/tests/baselines/reference/decoratorOnClassMethod7.symbols index 9ec0de0c205..90e538ebfc4 100644 --- a/tests/baselines/reference/decoratorOnClassMethod7.symbols +++ b/tests/baselines/reference/decoratorOnClassMethod7.symbols @@ -15,5 +15,5 @@ class C { @dec public ["method"]() {} >dec : Symbol(dec, Decl(decoratorOnClassMethod7.ts, 0, 0)) ->"method" : Symbol(C[["method"]], Decl(decoratorOnClassMethod7.ts, 2, 9)) +>"method" : Symbol(C["method"], Decl(decoratorOnClassMethod7.ts, 2, 9)) } diff --git a/tests/baselines/reference/dynamicNames.types b/tests/baselines/reference/dynamicNames.types index 8d46cb8b6f8..f9391d417c4 100644 --- a/tests/baselines/reference/dynamicNames.types +++ b/tests/baselines/reference/dynamicNames.types @@ -100,7 +100,7 @@ namespace N { >T5 : T5 } export declare type T7 = { ->T7 : { a: number; 1: string; } +>T7 : { "a": number; "1": string; } [N.c2]: number; >N.c2 : "a" @@ -147,7 +147,7 @@ declare class T10 extends T9 { >T9 : T9 } declare type T11 = { ->T11 : { a: number; 1: string; } +>T11 : { "a": number; "1": string; } [c4]: number; >c4 : "a" @@ -239,9 +239,9 @@ let t6: N.T6; >T6 : N.T6 let t7: N.T7; ->t7 : { a: number; 1: string; } +>t7 : { "a": number; "1": string; } >N : any ->T7 : { a: number; 1: string; } +>T7 : { "a": number; "1": string; } let t8: T8; >t8 : T8 @@ -256,8 +256,8 @@ let t10: T10; >T10 : T10 let t11: T11; ->t11 : { a: number; 1: string; } ->T11 : { a: number; 1: string; } +>t11 : { "a": number; "1": string; } +>T11 : { "a": number; "1": string; } let t12: T12; >t12 : T12 @@ -329,13 +329,13 @@ t4 = t5, t4 = t6, t4 = t7, t5 = t4, t5 = t6, t5 = t7, t6 = t4, t6 = t5, t6 = t7, >t4 = t5, t4 = t6, t4 = t7, t5 = t4, t5 = t6, t5 = t7, t6 = t4, t6 = t5, t6 = t7, t7 = t4, t7 = t5, t7 = t6 : N.T6 >t4 = t5, t4 = t6, t4 = t7, t5 = t4, t5 = t6, t5 = t7, t6 = t4, t6 = t5, t6 = t7, t7 = t4, t7 = t5 : N.T5 >t4 = t5, t4 = t6, t4 = t7, t5 = t4, t5 = t6, t5 = t7, t6 = t4, t6 = t5, t6 = t7, t7 = t4 : N.T4 ->t4 = t5, t4 = t6, t4 = t7, t5 = t4, t5 = t6, t5 = t7, t6 = t4, t6 = t5, t6 = t7 : { a: number; 1: string; } +>t4 = t5, t4 = t6, t4 = t7, t5 = t4, t5 = t6, t5 = t7, t6 = t4, t6 = t5, t6 = t7 : { "a": number; "1": string; } >t4 = t5, t4 = t6, t4 = t7, t5 = t4, t5 = t6, t5 = t7, t6 = t4, t6 = t5 : N.T5 >t4 = t5, t4 = t6, t4 = t7, t5 = t4, t5 = t6, t5 = t7, t6 = t4 : N.T4 ->t4 = t5, t4 = t6, t4 = t7, t5 = t4, t5 = t6, t5 = t7 : { a: number; 1: string; } +>t4 = t5, t4 = t6, t4 = t7, t5 = t4, t5 = t6, t5 = t7 : { "a": number; "1": string; } >t4 = t5, t4 = t6, t4 = t7, t5 = t4, t5 = t6 : N.T6 >t4 = t5, t4 = t6, t4 = t7, t5 = t4 : N.T4 ->t4 = t5, t4 = t6, t4 = t7 : { a: number; 1: string; } +>t4 = t5, t4 = t6, t4 = t7 : { "a": number; "1": string; } >t4 = t5, t4 = t6 : N.T6 >t4 = t5 : N.T5 >t4 : N.T4 @@ -343,35 +343,35 @@ t4 = t5, t4 = t6, t4 = t7, t5 = t4, t5 = t6, t5 = t7, t6 = t4, t6 = t5, t6 = t7, >t4 = t6 : N.T6 >t4 : N.T4 >t6 : N.T6 ->t4 = t7 : { a: number; 1: string; } +>t4 = t7 : { "a": number; "1": string; } >t4 : N.T4 ->t7 : { a: number; 1: string; } +>t7 : { "a": number; "1": string; } >t5 = t4 : N.T4 >t5 : N.T5 >t4 : N.T4 >t5 = t6 : N.T6 >t5 : N.T5 >t6 : N.T6 ->t5 = t7 : { a: number; 1: string; } +>t5 = t7 : { "a": number; "1": string; } >t5 : N.T5 ->t7 : { a: number; 1: string; } +>t7 : { "a": number; "1": string; } >t6 = t4 : N.T4 >t6 : N.T6 >t4 : N.T4 >t6 = t5 : N.T5 >t6 : N.T6 >t5 : N.T5 ->t6 = t7 : { a: number; 1: string; } +>t6 = t7 : { "a": number; "1": string; } >t6 : N.T6 ->t7 : { a: number; 1: string; } +>t7 : { "a": number; "1": string; } >t7 = t4 : N.T4 ->t7 : { a: number; 1: string; } +>t7 : { "a": number; "1": string; } >t4 : N.T4 >t7 = t5 : N.T5 ->t7 : { a: number; 1: string; } +>t7 : { "a": number; "1": string; } >t5 : N.T5 >t7 = t6 : N.T6 ->t7 : { a: number; 1: string; } +>t7 : { "a": number; "1": string; } >t6 : N.T6 t0 = t12, t0 = t13, t0 = t14, t0 = t15, t12 = t0, t13 = t0, t14 = t0, t15 = t0; diff --git a/tests/baselines/reference/dynamicNamesErrors.errors.txt b/tests/baselines/reference/dynamicNamesErrors.errors.txt index 50af0addb9a..90e33b02736 100644 --- a/tests/baselines/reference/dynamicNamesErrors.errors.txt +++ b/tests/baselines/reference/dynamicNamesErrors.errors.txt @@ -2,10 +2,10 @@ tests/cases/compiler/dynamicNamesErrors.ts(5,5): error TS2300: Duplicate identif tests/cases/compiler/dynamicNamesErrors.ts(6,5): error TS2300: Duplicate identifier '1'. tests/cases/compiler/dynamicNamesErrors.ts(19,5): error TS2711: Subsequent property declarations must have the same type. Property '[c1]' must be of type 'number', but here has type 'string'. tests/cases/compiler/dynamicNamesErrors.ts(25,1): error TS2322: Type 'T2' is not assignable to type 'T1'. - Types of property '1' are incompatible. + Types of property '"1"' are incompatible. Type 'string' is not assignable to type 'number'. tests/cases/compiler/dynamicNamesErrors.ts(26,1): error TS2322: Type 'T1' is not assignable to type 'T2'. - Types of property '1' are incompatible. + Types of property '"1"' are incompatible. Type 'number' is not assignable to type 'string'. @@ -43,10 +43,10 @@ tests/cases/compiler/dynamicNamesErrors.ts(26,1): error TS2322: Type 'T1' is not t1 = t2; ~~ !!! error TS2322: Type 'T2' is not assignable to type 'T1'. -!!! error TS2322: Types of property '1' are incompatible. +!!! error TS2322: Types of property '"1"' are incompatible. !!! error TS2322: Type 'string' is not assignable to type 'number'. t2 = t1; ~~ !!! error TS2322: Type 'T1' is not assignable to type 'T2'. -!!! error TS2322: Types of property '1' are incompatible. +!!! error TS2322: Types of property '"1"' are incompatible. !!! error TS2322: Type 'number' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/emitClassDeclarationWithGetterSetterInES6.symbols b/tests/baselines/reference/emitClassDeclarationWithGetterSetterInES6.symbols index 89c49123e77..b6a267e596f 100644 --- a/tests/baselines/reference/emitClassDeclarationWithGetterSetterInES6.symbols +++ b/tests/baselines/reference/emitClassDeclarationWithGetterSetterInES6.symbols @@ -19,27 +19,27 @@ class C { return "BYE"; } static get ["computedname"]() { ->"computedname" : Symbol(C[["computedname"]], Decl(emitClassDeclarationWithGetterSetterInES6.ts, 7, 5), Decl(emitClassDeclarationWithGetterSetterInES6.ts, 24, 33)) +>"computedname" : Symbol(C["computedname"], Decl(emitClassDeclarationWithGetterSetterInES6.ts, 7, 5), Decl(emitClassDeclarationWithGetterSetterInES6.ts, 24, 33)) return ""; } get ["computedname1"]() { ->"computedname1" : Symbol(C[["computedname1"]], Decl(emitClassDeclarationWithGetterSetterInES6.ts, 10, 5)) +>"computedname1" : Symbol(C["computedname1"], Decl(emitClassDeclarationWithGetterSetterInES6.ts, 10, 5)) return ""; } get ["computedname2"]() { ->"computedname2" : Symbol(C[["computedname2"]], Decl(emitClassDeclarationWithGetterSetterInES6.ts, 13, 5)) +>"computedname2" : Symbol(C["computedname2"], Decl(emitClassDeclarationWithGetterSetterInES6.ts, 13, 5)) return ""; } set ["computedname3"](x: any) { ->"computedname3" : Symbol(C[["computedname3"]], Decl(emitClassDeclarationWithGetterSetterInES6.ts, 16, 5)) +>"computedname3" : Symbol(C["computedname3"], Decl(emitClassDeclarationWithGetterSetterInES6.ts, 16, 5)) >x : Symbol(x, Decl(emitClassDeclarationWithGetterSetterInES6.ts, 18, 26)) } set ["computedname4"](y: string) { ->"computedname4" : Symbol(C[["computedname4"]], Decl(emitClassDeclarationWithGetterSetterInES6.ts, 19, 5)) +>"computedname4" : Symbol(C["computedname4"], Decl(emitClassDeclarationWithGetterSetterInES6.ts, 19, 5)) >y : Symbol(y, Decl(emitClassDeclarationWithGetterSetterInES6.ts, 20, 26)) } @@ -52,6 +52,6 @@ class C { >b : Symbol(b, Decl(emitClassDeclarationWithGetterSetterInES6.ts, 24, 19)) static set ["computedname"](b: string) { } ->"computedname" : Symbol(C[["computedname"]], Decl(emitClassDeclarationWithGetterSetterInES6.ts, 7, 5), Decl(emitClassDeclarationWithGetterSetterInES6.ts, 24, 33)) +>"computedname" : Symbol(C["computedname"], Decl(emitClassDeclarationWithGetterSetterInES6.ts, 7, 5), Decl(emitClassDeclarationWithGetterSetterInES6.ts, 24, 33)) >b : Symbol(b, Decl(emitClassDeclarationWithGetterSetterInES6.ts, 25, 32)) } diff --git a/tests/baselines/reference/emitClassDeclarationWithMethodInES6.symbols b/tests/baselines/reference/emitClassDeclarationWithMethodInES6.symbols index 54522c5834a..5328b892ded 100644 --- a/tests/baselines/reference/emitClassDeclarationWithMethodInES6.symbols +++ b/tests/baselines/reference/emitClassDeclarationWithMethodInES6.symbols @@ -9,14 +9,14 @@ class D { >foo : Symbol(D.foo, Decl(emitClassDeclarationWithMethodInES6.ts, 1, 17)) ["computedName1"]() { } ->"computedName1" : Symbol(D[["computedName1"]], Decl(emitClassDeclarationWithMethodInES6.ts, 2, 13)) +>"computedName1" : Symbol(D["computedName1"], Decl(emitClassDeclarationWithMethodInES6.ts, 2, 13)) ["computedName2"](a: string) { } ->"computedName2" : Symbol(D[["computedName2"]], Decl(emitClassDeclarationWithMethodInES6.ts, 3, 27)) +>"computedName2" : Symbol(D["computedName2"], Decl(emitClassDeclarationWithMethodInES6.ts, 3, 27)) >a : Symbol(a, Decl(emitClassDeclarationWithMethodInES6.ts, 4, 22)) ["computedName3"](a: string): number { return 1; } ->"computedName3" : Symbol(D[["computedName3"]], Decl(emitClassDeclarationWithMethodInES6.ts, 4, 36)) +>"computedName3" : Symbol(D["computedName3"], Decl(emitClassDeclarationWithMethodInES6.ts, 4, 36)) >a : Symbol(a, Decl(emitClassDeclarationWithMethodInES6.ts, 5, 22)) bar(): string { @@ -35,14 +35,14 @@ class D { return "HELLO"; } static ["computedname4"]() { } ->"computedname4" : Symbol(D[["computedname4"]], Decl(emitClassDeclarationWithMethodInES6.ts, 11, 5)) +>"computedname4" : Symbol(D["computedname4"], Decl(emitClassDeclarationWithMethodInES6.ts, 11, 5)) static ["computedname5"](a: string) { } ->"computedname5" : Symbol(D[["computedname5"]], Decl(emitClassDeclarationWithMethodInES6.ts, 12, 34)) +>"computedname5" : Symbol(D["computedname5"], Decl(emitClassDeclarationWithMethodInES6.ts, 12, 34)) >a : Symbol(a, Decl(emitClassDeclarationWithMethodInES6.ts, 13, 29)) static ["computedname6"](a: string): boolean { return true; } ->"computedname6" : Symbol(D[["computedname6"]], Decl(emitClassDeclarationWithMethodInES6.ts, 13, 43)) +>"computedname6" : Symbol(D["computedname6"], Decl(emitClassDeclarationWithMethodInES6.ts, 13, 43)) >a : Symbol(a, Decl(emitClassDeclarationWithMethodInES6.ts, 14, 29)) static staticMethod() { diff --git a/tests/cases/fourslash/findAllRefsForComputedProperties.ts b/tests/cases/fourslash/findAllRefsForComputedProperties.ts index 72c49104ded..6587211b76d 100644 --- a/tests/cases/fourslash/findAllRefsForComputedProperties.ts +++ b/tests/cases/fourslash/findAllRefsForComputedProperties.ts @@ -14,13 +14,13 @@ const ranges = test.ranges(); const [r0, r1, r2] = ranges; -verify.referenceGroups(r0, [{ definition: '(property) I[["prop1"]]: () => void', ranges }]); +verify.referenceGroups(r0, [{ definition: '(property) I["prop1"]: () => void', ranges }]); verify.referenceGroups(r1, [ - { definition: '(property) I[["prop1"]]: () => void', ranges: [r0, r2] }, - { definition: '(property) C[["prop1"]]: any', ranges: [r1] } + { definition: '(property) I["prop1"]: () => void', ranges: [r0, r2] }, + { definition: '(property) C["prop1"]: any', ranges: [r1] } ]); verify.referenceGroups(r2, [ - { definition: '(property) I[["prop1"]]: () => void', ranges: [r0, r1] }, + { definition: '(property) I["prop1"]: () => void', ranges: [r0, r1] }, { definition: '(property) ["prop1"]: () => void', ranges: [r2] } ]); diff --git a/tests/cases/fourslash/findAllRefsForComputedProperties2.ts b/tests/cases/fourslash/findAllRefsForComputedProperties2.ts index 4a7a17047ec..ef28b2f9bd7 100644 --- a/tests/cases/fourslash/findAllRefsForComputedProperties2.ts +++ b/tests/cases/fourslash/findAllRefsForComputedProperties2.ts @@ -14,12 +14,12 @@ const ranges = test.ranges(); const [r0, r1, r2] = ranges; -verify.referenceGroups(r0, [{ definition: "(method) I[[42]](): void", ranges }]); +verify.referenceGroups(r0, [{ definition: "(method) I[42](): void", ranges }]); verify.referenceGroups(r1, [ - { definition: "(method) I[[42]](): void", ranges: [r0, r2] }, - { definition: "(property) C[[42]]: any", ranges: [r1] } + { definition: "(method) I[42](): void", ranges: [r0, r2] }, + { definition: "(property) C[42]: any", ranges: [r1] } ]); verify.referenceGroups(r2, [ - { definition: "(method) I[[42]](): void", ranges: [r0, r1] }, + { definition: "(method) I[42](): void", ranges: [r0, r1] }, { definition: '(property) ["42"]: () => void', ranges: [r2] } ]);