Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
d8cb3c6
Allow some dynamic names in types
rbuckton Apr 29, 2017
0c1eef7
Add support for declaration emit
rbuckton Apr 29, 2017
d572a54
Report errors from duplicate member names
rbuckton May 1, 2017
2714295
Add declaration file output to tests
rbuckton May 2, 2017
3181a8d
Merge branch 'master' into dynamicNames
rbuckton May 2, 2017
b5f1169
Accept baselines
rbuckton May 2, 2017
3b684d4
PR feedback
rbuckton May 2, 2017
64fd857
fix symbol display for computed properties
rbuckton May 3, 2017
d8ae9c0
Early support for unique symbol type
rbuckton May 4, 2017
83b5a75
Add freshness to unique symbol types
rbuckton May 4, 2017
57674dd
Emit dynamic names for object literal types
rbuckton May 5, 2017
fc61863
Merge branch 'dynamicNames' into symbolLiterals
rbuckton May 5, 2017
fe414a2
Ensure we get the correct symbol for nodes, clean up
rbuckton May 6, 2017
93ea56b
Improve union type reduction for symbol()
rbuckton May 6, 2017
2a73d08
Merge branch 'master' into dynamicNames
rbuckton May 10, 2017
625b37e
Merge branch 'master' into dynamicNames
rbuckton May 31, 2017
8c3b73f
Merge branch 'master' into dynamicNames
rbuckton May 31, 2017
c4e9ce5
Merge branch 'master' into dynamicNames
rbuckton Jun 7, 2017
5854e87
comment typo
rbuckton Jun 9, 2017
3f83b55
Added comments for fresh/regular unique symbol types
rbuckton Jun 9, 2017
38ee475
Fix escaping and follow symbols for element access
rbuckton Jun 9, 2017
022e81b
Merge branch 'master' into dynamicNames
rbuckton Jun 9, 2017
d7ef995
Merge branch 'master' into dynamicNames
rbuckton Sep 21, 2017
e81c83c
Merge branch 'master' into dynamicNames
rbuckton Sep 22, 2017
891e71d
Remove freshness, more comprehensive grammar checks and diagnostic me…
rbuckton Sep 22, 2017
7eedf2e
Update baselines
rbuckton Oct 1, 2017
fb3168d
Merge branch 'master' into dynamicNames
rbuckton Oct 2, 2017
1b45a05
Update baselines
rbuckton Oct 2, 2017
6f05e43
Merge branch 'master' into dynamicNames
rbuckton Oct 3, 2017
7ab451b
Merge branch 'master' into dynamicNames
rbuckton Oct 3, 2017
1745e17
Merge branch 'master' into dynamicNames
rbuckton Oct 3, 2017
4395f25
PR Feedback and API baselines
rbuckton Oct 3, 2017
43c151a
Merge branch 'master' into dynamicNames
rbuckton Oct 4, 2017
ee23f93
Switch to 'unique symbol'
rbuckton Oct 4, 2017
51ded0b
Additional tests
rbuckton Oct 5, 2017
fea6a87
General tidying up and comments.
rbuckton Oct 5, 2017
36f90b6
General tidying up and comments.
rbuckton Oct 5, 2017
906a79d
Support dynamic names on static members of class.
rbuckton Oct 5, 2017
180ca23
Additional documentation
rbuckton Oct 5, 2017
7fd38c8
Merge branch 'master' into dynamicNames
rbuckton Oct 5, 2017
55e63a8
Simplify getLateBoundSymbol
rbuckton Oct 20, 2017
3341e07
Refactor widening
rbuckton Oct 21, 2017
0b31860
Revert some minor changes to clean up PR
rbuckton Oct 21, 2017
ccd98af
Simplify property symbol logic in checkObjectLiteral
rbuckton Oct 21, 2017
b5a7b03
Address PR feedback
rbuckton Oct 21, 2017
51929ac
Merge branch 'master' into dynamicNames
rbuckton Oct 21, 2017
3febc80
More repetitive but less complex widening logic for literals/symbols
rbuckton Oct 26, 2017
170e6ec
Ensure correct errors when emitting declarations
rbuckton Oct 26, 2017
44117e1
Reduce noise in PR, minor cleanup
rbuckton Oct 27, 2017
ec90dbc
Unify logic for getMembers/Exports of symbol
rbuckton Oct 27, 2017
26ca98c
Merge branch 'master' into dynamicNames
rbuckton Oct 31, 2017
208dfa6
Merge branch 'master' into dynamicNames
rbuckton Nov 4, 2017
211b2f0
Shave off ~100ms by extracting ExpandingFlags
rbuckton Nov 4, 2017
33e09f9
Merge branch 'master' into dynamicNames
rbuckton Nov 6, 2017
8b717d3
PR Feedback
rbuckton Nov 7, 2017
ee36e6a
Merge branch 'master' into dynamicNames
rbuckton Nov 7, 2017
444e282
Update baselines after merge
rbuckton Nov 7, 2017
d0fb7e4
PR Feedback
rbuckton Nov 7, 2017
b9dbf5d
Simplify literal/unique symbol widening
rbuckton Nov 10, 2017
ae11ae5
Fix getReturnTypeFromBody widening
rbuckton Nov 13, 2017
804c7d3
Merge branch 'master' into dynamicNames
rbuckton Nov 13, 2017
a21a129
Merge branch 'master' into dynamicNames
rbuckton Nov 15, 2017
86b0759
PR feedback
rbuckton Nov 16, 2017
0b24f02
Use correct base primitive type
rbuckton Nov 16, 2017
ccba128
Use correct base primitive type
rbuckton Nov 16, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix symbol display for computed properties
  • Loading branch information
rbuckton committed May 3, 2017
commit 64fd857b0dcca50b2babe4b5404e6eb496e5dbcb
12 changes: 8 additions & 4 deletions src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -5232,7 +5236,7 @@ namespace ts {
const nameType = checkComputedPropertyName(<ComputedPropertyName>member.name);
if (nameType.flags & TypeFlags.StringOrNumberLiteral) {
// TODO(rbuckton): ESSymbolLiteral
const memberName = escapeIdentifier((<LiteralType>nameType).text);
const memberName = (<LiteralType>nameType).text;
let symbol = symbolTable.get(memberName);
if (!symbol) {
symbolTable.set(memberName, symbol = createSymbol(SymbolFlags.Dynamic, memberName));
Expand Down
4 changes: 2 additions & 2 deletions tests/baselines/reference/computedPropertyNames13_ES5.symbols
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
4 changes: 2 additions & 2 deletions tests/baselines/reference/computedPropertyNames13_ES6.symbols
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
4 changes: 2 additions & 2 deletions tests/baselines/reference/computedPropertyNames16_ES5.symbols
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
4 changes: 2 additions & 2 deletions tests/baselines/reference/computedPropertyNames16_ES6.symbols
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
4 changes: 2 additions & 2 deletions tests/baselines/reference/computedPropertyNames37_ES5.symbols
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
4 changes: 2 additions & 2 deletions tests/baselines/reference/computedPropertyNames37_ES6.symbols
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions tests/baselines/reference/decoratorOnClassMethod13.symbols
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
2 changes: 1 addition & 1 deletion tests/baselines/reference/decoratorOnClassMethod4.symbols
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
2 changes: 1 addition & 1 deletion tests/baselines/reference/decoratorOnClassMethod5.symbols
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
2 changes: 1 addition & 1 deletion tests/baselines/reference/decoratorOnClassMethod7.symbols
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
36 changes: 18 additions & 18 deletions tests/baselines/reference/dynamicNames.types
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -329,49 +329,49 @@ 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
>t5 : N.T5
>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;
Expand Down
8 changes: 4 additions & 4 deletions tests/baselines/reference/dynamicNamesErrors.errors.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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'.


Expand Down Expand Up @@ -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'.
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}

Expand All @@ -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))
}
Loading