Skip to content

Commit 5915b6d

Browse files
authored
Merge pull request microsoft#21558 from Microsoft/symbolAndTypesOfString
Emit the symbol information for declaration names
2 parents 4150a46 + a0b8be0 commit 5915b6d

793 files changed

Lines changed: 3838 additions & 121 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/harness/typeWriter.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class TypeWriterWalker {
5252
}
5353

5454
private *visitNode(node: ts.Node, isSymbolWalk: boolean): IterableIterator<TypeWriterResult> {
55-
if (ts.isExpressionNode(node) || node.kind === ts.SyntaxKind.Identifier) {
55+
if (ts.isExpressionNode(node) || node.kind === ts.SyntaxKind.Identifier || ts.isDeclarationName(node)) {
5656
const result = this.writeTypeOrSymbol(node, isSymbolWalk);
5757
if (result) {
5858
yield result;
@@ -122,4 +122,4 @@ class TypeWriterWalker {
122122
symbol: symbolString
123123
};
124124
}
125-
}
125+
}

tests/baselines/reference/ClassDeclaration21.symbols

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,8 @@ class C {
33
>C : Symbol(C, Decl(ClassDeclaration21.ts, 0, 0))
44

55
0();
6+
>0 : Symbol(C[0], Decl(ClassDeclaration21.ts, 0, 9))
7+
68
1() { }
9+
>1 : Symbol(C[1], Decl(ClassDeclaration21.ts, 1, 8))
710
}

tests/baselines/reference/ClassDeclaration21.types

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,8 @@ class C {
33
>C : C
44

55
0();
6+
>0 : () => any
7+
68
1() { }
9+
>1 : () => void
710
}

tests/baselines/reference/ClassDeclaration22.symbols

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,8 @@ class C {
33
>C : Symbol(C, Decl(ClassDeclaration22.ts, 0, 0))
44

55
"foo"();
6+
>"foo" : Symbol(C["foo"], Decl(ClassDeclaration22.ts, 0, 9))
7+
68
"bar"() { }
9+
>"bar" : Symbol(C["bar"], Decl(ClassDeclaration22.ts, 1, 12))
710
}

tests/baselines/reference/ClassDeclaration22.types

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,8 @@ class C {
33
>C : C
44

55
"foo"();
6+
>"foo" : () => any
7+
68
"bar"() { }
9+
>"bar" : () => void
710
}

tests/baselines/reference/aliasOnMergedModuleInterface.symbols

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ var x: foo.A = foo.bar("hello"); // foo.A should be ok but foo.bar should be err
1919

2020
=== tests/cases/compiler/aliasOnMergedModuleInterface_0.ts ===
2121
declare module "foo"
22+
>"foo" : Symbol("foo", Decl(aliasOnMergedModuleInterface_0.ts, 0, 0))
2223
{
2324
module B {
2425
>B : Symbol(B, Decl(aliasOnMergedModuleInterface_0.ts, 1, 1), Decl(aliasOnMergedModuleInterface_0.ts, 5, 5))

tests/baselines/reference/aliasOnMergedModuleInterface.types

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ var x: foo.A = foo.bar("hello"); // foo.A should be ok but foo.bar should be err
2626

2727
=== tests/cases/compiler/aliasOnMergedModuleInterface_0.ts ===
2828
declare module "foo"
29+
>"foo" : typeof "foo"
2930
{
3031
module B {
3132
>B : any

tests/baselines/reference/ambientDeclarations.symbols

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,8 @@ var q = M1.fn();
160160
// Ambient external module in the global module
161161
// Ambient external module with a string literal name that is a top level external module name
162162
declare module 'external1' {
163+
>'external1' : Symbol('external1', Decl(ambientDeclarations.ts, 67, 16))
164+
163165
var q;
164166
>q : Symbol(q, Decl(ambientDeclarations.ts, 72, 7))
165167
}

tests/baselines/reference/ambientDeclarations.types

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,8 @@ var q = M1.fn();
163163
// Ambient external module in the global module
164164
// Ambient external module with a string literal name that is a top level external module name
165165
declare module 'external1' {
166+
>'external1' : typeof 'external1'
167+
166168
var q;
167169
>q : any
168170
}

tests/baselines/reference/ambientDeclarationsExternal.symbols

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ var n: number;
2020
=== tests/cases/conformance/ambient/decls.ts ===
2121
// Ambient external module with export assignment
2222
declare module 'equ' {
23+
>'equ' : Symbol('equ', Decl(decls.ts, 0, 0))
24+
2325
var x;
2426
>x : Symbol(x, Decl(decls.ts, 2, 7))
2527

@@ -28,6 +30,8 @@ declare module 'equ' {
2830
}
2931

3032
declare module 'equ2' {
33+
>'equ2' : Symbol('equ2', Decl(decls.ts, 4, 1))
34+
3135
var x: number;
3236
>x : Symbol(x, Decl(decls.ts, 7, 7))
3337
}

0 commit comments

Comments
 (0)