Skip to content

Commit 6a7d912

Browse files
committed
Print pure namespaces as unknown
1 parent 4e1bb26 commit 6a7d912

File tree

492 files changed

+5472
-5490
lines changed

Some content is hidden

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

492 files changed

+5472
-5490
lines changed

src/compiler/checker.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6916,18 +6916,6 @@ module ts {
69166916
return getDeclaredTypeOfSymbol(symbol);
69176917
}
69186918

6919-
if (node.kind === SyntaxKind.ModuleDeclaration ||
6920-
node.kind === SyntaxKind.ImportDeclaration) {
6921-
return unknownType;
6922-
}
6923-
6924-
if (node.parent.kind === SyntaxKind.ModuleDeclaration ||
6925-
node.parent.kind === SyntaxKind.ImportDeclaration) {
6926-
if ((<Declaration>node.parent).name === node) {
6927-
return unknownType;
6928-
}
6929-
}
6930-
69316919
if (isDeclaration(node)) {
69326920
// In this case, we call getSymbolOfNode instead of getSymbolInfo because it is a declaration
69336921
var symbol = getSymbolOfNode(node);

src/harness/typeWriter.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ class TypeWriterWalker {
2929
// old typeWriter baselines, suppress tokens
3030
case ts.SyntaxKind.ThisKeyword:
3131
case ts.SyntaxKind.SuperKeyword:
32-
// case ts.SyntaxKind.RegularExpressionLiteral:
3332
case ts.SyntaxKind.ArrayLiteral:
3433
case ts.SyntaxKind.ObjectLiteral:
3534
case ts.SyntaxKind.PropertyAccess:
@@ -79,10 +78,7 @@ class TypeWriterWalker {
7978
var lineAndCharacter = this.currentSourceFile.getLineAndCharacterFromPosition(actualPos);
8079
var sourceText = ts.getSourceTextOfNodeFromSourceText(this.currentSourceFile.text, node);
8180
var isUnknownType = (<ts.IntrinsicType>type).intrinsicName === "unknown";
82-
if (isUnknownType) {
83-
var symbol = this.checker.getSymbolInfo(node);
84-
}
85-
else {
81+
if (!isUnknownType) {
8682
var writeArrayAsGenericType = node.kind === ts.SyntaxKind.Identifier && (<ts.Identifier>node).text === "Array" ? ts.TypeFormatFlags.WriteArrayAsGenericType : 0;
8783
}
8884

@@ -94,9 +90,7 @@ class TypeWriterWalker {
9490
column: lineAndCharacter.character,
9591
syntaxKind: ts.SyntaxKind[node.kind],
9692
sourceText: sourceText,
97-
type: isUnknownType
98-
? this.checker.symbolToString(symbol, node.parent, ts.SymbolFlags.Value | ts.SymbolFlags.Type | ts.SymbolFlags.Namespace | ts.SymbolFlags.Import)
99-
: this.checker.typeToString(type, node.parent, ts.TypeFormatFlags.UseTypeOfFunction | writeArrayAsGenericType)
93+
type: this.checker.typeToString(type, node.parent, ts.TypeFormatFlags.UseTypeOfFunction | writeArrayAsGenericType)
10094
});
10195
}
10296

tests/baselines/reference/AmbientModuleAndAmbientFunctionWithTheSameNameAndCommonRoot.types

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
=== tests/cases/conformance/internalModules/DeclarationMerging/module.d.ts ===
22
declare module Point {
3-
>Point : Point
3+
>Point : typeof Point
44

55
export var Origin: { x: number; y: number; }
66
>Origin : { x: number; y: number; }

tests/baselines/reference/AmbientModuleAndAmbientWithSameNameAndCommonRoot.types

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
=== tests/cases/conformance/internalModules/DeclarationMerging/module.d.ts ===
22
declare module A {
3-
>A : A
3+
>A : typeof A
44

55
export module Point {
6-
>Point : Point
6+
>Point : typeof Point
77

88
export var Origin: {
99
>Origin : { x: number; y: number; }
@@ -19,7 +19,7 @@ declare module A {
1919

2020
=== tests/cases/conformance/internalModules/DeclarationMerging/class.d.ts ===
2121
declare module A {
22-
>A : A
22+
>A : typeof A
2323

2424
export class Point {
2525
>Point : Point

tests/baselines/reference/AmbientModuleAndNonAmbientClassWithSameNameAndCommonRoot.types

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
=== tests/cases/conformance/internalModules/DeclarationMerging/module.d.ts ===
22
declare module A {
3-
>A : A
3+
>A : typeof A
44

55
export module Point {
6-
>Point : Point
6+
>Point : typeof Point
77

88
export var Origin: {
99
>Origin : { x: number; y: number; }
@@ -19,7 +19,7 @@ declare module A {
1919

2020
=== tests/cases/conformance/internalModules/DeclarationMerging/classPoint.ts ===
2121
module A {
22-
>A : A
22+
>A : typeof A
2323

2424
export class Point {
2525
>Point : Point

tests/baselines/reference/AmbientModuleAndNonAmbientFunctionWithTheSameNameAndCommonRoot.types

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
=== tests/cases/conformance/internalModules/DeclarationMerging/module.d.ts ===
22
declare module Point {
3-
>Point : Point
3+
>Point : typeof Point
44

55
export var Origin: { x: number; y: number; }
66
>Origin : { x: number; y: number; }

tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.types

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ class Point {
1515
}
1616

1717
module Point {
18-
>Point : Point
18+
>Point : typeof Point
1919

2020
function Origin() { return ""; }// not an error, since not exported
2121
>Origin : typeof Origin
2222
}
2323

2424

2525
module A {
26-
>A : A
26+
>A : typeof A
2727

2828
export class Point {
2929
>Point : Point
@@ -41,7 +41,7 @@ module A {
4141
}
4242

4343
export module Point {
44-
>Point : Point
44+
>Point : typeof Point
4545

4646
function Origin() { return ""; }// not an error since not exported
4747
>Origin : typeof Origin

tests/baselines/reference/ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.types

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ class Point {
1515
}
1616

1717
module Point {
18-
>Point : Point
18+
>Point : typeof Point
1919

2020
var Origin = ""; // not an error, since not exported
2121
>Origin : string
2222
}
2323

2424

2525
module A {
26-
>A : A
26+
>A : typeof A
2727

2828
export class Point {
2929
>Point : Point
@@ -41,7 +41,7 @@ module A {
4141
}
4242

4343
export module Point {
44-
>Point : Point
44+
>Point : typeof Point
4545

4646
var Origin = ""; // not an error since not exported
4747
>Origin : string

tests/baselines/reference/EnumAndModuleWithSameNameAndCommonRoot.types

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ enum enumdule {
88
}
99

1010
module enumdule {
11-
>enumdule : enumdule
11+
>enumdule : typeof enumdule
1212

1313
export class Point {
1414
>Point : Point

tests/baselines/reference/ExportClassWhichExtendsInterfaceWithInaccessibleType.types

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
=== tests/cases/conformance/internalModules/exportDeclarations/ExportClassWhichExtendsInterfaceWithInaccessibleType.ts ===
22
module A {
3-
>A : A
3+
>A : typeof A
44

55
interface Point {
66
>Point : Point

0 commit comments

Comments
 (0)