From 715f9ff5ad9842dbb4d3709753fe856a7de43e73 Mon Sep 17 00:00:00 2001
From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
Date: Tue, 15 Jul 2025 08:56:46 -0700
Subject: [PATCH 01/10] Nearly done, maybe.
- No crashes
- this types aren't working
- type checking of `p` in `module.exports.p` isn't working
- symbol baselining of `module.exports.p` no longer includes `p` either
That last is probably fine.
---
internal/ast/ast.go | 3 -
internal/ast/deepclone.go | 25 ++-
internal/ast/utilities.go | 11 --
internal/binder/binder.go | 4 +-
internal/binder/nameresolver.go | 5 +-
internal/checker/checker.go | 20 +--
internal/checker/grammarchecks.go | 2 +-
internal/checker/utilities.go | 3 -
internal/parser/reparser.go | 260 ++++++++++++++++--------------
9 files changed, 171 insertions(+), 162 deletions(-)
diff --git a/internal/ast/ast.go b/internal/ast/ast.go
index 4b558549ba..2b3a79da65 100644
--- a/internal/ast/ast.go
+++ b/internal/ast/ast.go
@@ -9059,7 +9059,6 @@ func (node *JSDocLinkCode) Name() *DeclarationName {
type JSDocTypeExpression struct {
TypeNodeBase
- Host *Node
Type *TypeNode
}
@@ -9317,7 +9316,6 @@ type JSDocTemplateTag struct {
JSDocTagBase
Constraint *Node
TypeParameters *TypeParameterList
- Host *Node
}
func (f *NodeFactory) NewJSDocTemplateTag(tagName *IdentifierNode, constraint *Node, typeParameters *TypeParameterList, comment *NodeList) *Node {
@@ -9812,7 +9810,6 @@ func (node *JSDocThisTag) Clone(f NodeFactoryCoercible) *Node {
// JSDocImportTag
type JSDocImportTag struct {
JSDocTagBase
- JSImportDeclaration *ImportDeclaration
ImportClause *Declaration
ModuleSpecifier *Expression
Attributes *Node
diff --git a/internal/ast/deepclone.go b/internal/ast/deepclone.go
index 23460b7de6..9ffb853e33 100644
--- a/internal/ast/deepclone.go
+++ b/internal/ast/deepclone.go
@@ -3,19 +3,26 @@ package ast
import "github.com/microsoft/typescript-go/internal/core"
// Ideally, this would get cached on the node factory so there's only ever one set of closures made per factory
-func getDeepCloneVisitor(f *NodeFactory) *NodeVisitor {
+func getDeepCloneVisitor(f *NodeFactory, reparse bool) *NodeVisitor {
var visitor *NodeVisitor
visitor = NewNodeVisitor(
func(node *Node) *Node {
visited := visitor.VisitEachChild(node)
if visited != node {
+ if reparse {
+ // visited.Flags |= NodeFlagsReparsed
+ }
return visited
}
c := node.Clone(f) // forcibly clone leaf nodes, which will then cascade new nodes/arrays upwards via `update` calls
// In strada, `factory.cloneNode` was dynamic and did _not_ clone positions for any "special cases", meanwhile
// Node.Clone in corsa reliably uses `Update` calls for all nodes and so copies locations by default.
// Deep clones are done to copy a node across files, so here, we explicitly make the location range synthetic on all cloned nodes
- c.Loc = core.NewTextRange(-1, -1)
+ if reparse {
+ // c.Flags |= NodeFlagsReparsed
+ } else {
+ c.Loc = core.NewTextRange(-1, -1)
+ }
return c
},
f,
@@ -46,5 +53,17 @@ func getDeepCloneVisitor(f *NodeFactory) *NodeVisitor {
}
func (f *NodeFactory) DeepCloneNode(node *Node) *Node {
- return getDeepCloneVisitor(f).VisitNode(node)
+ return getDeepCloneVisitor(f, false /*reparse*/).VisitNode(node)
+}
+
+func (f *NodeFactory) DeepCloneReparse(node *Node) *Node {
+ if node != nil {
+ node = getDeepCloneVisitor(f, true /*reparse*/).VisitNode(node)
+ node.Flags |= NodeFlagsReparsed
+ }
+ return node
+}
+
+func (f *NodeFactory) DeepCloneReparseModifiers(modifiers *ModifierList) *ModifierList {
+ return getDeepCloneVisitor(f, true /*reparse*/).VisitModifiers(modifiers)
}
diff --git a/internal/ast/utilities.go b/internal/ast/utilities.go
index 5c5fd2314d..1d64978c3f 100644
--- a/internal/ast/utilities.go
+++ b/internal/ast/utilities.go
@@ -867,17 +867,6 @@ func WalkUpParenthesizedTypes(node *TypeNode) *Node {
return node
}
-func GetEffectiveTypeParent(parent *Node) *Node {
- if parent != nil && IsInJSFile(parent) {
- if parent.Kind == KindJSDocTypeExpression && parent.AsJSDocTypeExpression().Host != nil {
- parent = parent.AsJSDocTypeExpression().Host
- } else if parent.Kind == KindJSDocTemplateTag && parent.AsJSDocTemplateTag().Host != nil {
- parent = parent.AsJSDocTemplateTag().Host
- }
- }
- return parent
-}
-
// Walks up the parents of a node to find the containing SourceFile
func GetSourceFileOfNode(node *Node) *SourceFile {
for node != nil {
diff --git a/internal/binder/binder.go b/internal/binder/binder.go
index 05f8bc6382..d6b363eedf 100644
--- a/internal/binder/binder.go
+++ b/internal/binder/binder.go
@@ -1652,7 +1652,9 @@ func (b *Binder) bindChildren(node *ast.Node) {
b.inAssignmentPattern = saveInAssignmentPattern
b.bindEachChild(node)
case ast.KindJSExportAssignment, ast.KindCommonJSExport:
- // Reparsed nodes do not double-bind children, which are not reparsed
+ // TODO: Probably need some shenanigans in the checker to connect the original syntax's object literal symbols with the cloned, exported object's symbols
+ // or maybe the checker will be OK and it will be the services that have to worry about it.
+ b.bindEachChild(node)
default:
b.bindEachChild(node)
}
diff --git a/internal/binder/nameresolver.go b/internal/binder/nameresolver.go
index 2a74997e42..dbac222247 100644
--- a/internal/binder/nameresolver.go
+++ b/internal/binder/nameresolver.go
@@ -289,7 +289,7 @@ loop:
lastSelfReferenceLocation = location
}
lastLocation = location
- location = ast.GetEffectiveTypeParent(location.Parent)
+ location = location.Parent
}
// We just climbed up parents looking for the name, meaning that we started in a descendant node of `lastLocation`.
// If `result === lastSelfReferenceLocation.symbol`, that means that we are somewhere inside `lastSelfReferenceLocation` looking up a name, and resolving to `lastLocation` itself.
@@ -483,9 +483,6 @@ func isTypeParameterSymbolDeclaredInContainer(symbol *ast.Symbol, container *ast
for _, decl := range symbol.Declarations {
if decl.Kind == ast.KindTypeParameter {
parent := decl.Parent
- if parent.Kind == ast.KindJSDocTemplateTag {
- parent = parent.AsJSDocTemplateTag().Host
- }
if parent == container {
return true
}
diff --git a/internal/checker/checker.go b/internal/checker/checker.go
index 61bde64b91..55ae419422 100644
--- a/internal/checker/checker.go
+++ b/internal/checker/checker.go
@@ -2903,7 +2903,7 @@ func (c *Checker) checkTypePredicate(node *ast.Node) {
}
func (c *Checker) getTypePredicateParent(node *ast.Node) *ast.SignatureDeclaration {
- parent := ast.GetEffectiveTypeParent(node.Parent)
+ parent := node.Parent
switch parent.Kind {
case ast.KindArrowFunction, ast.KindCallSignature, ast.KindFunctionDeclaration, ast.KindFunctionExpression, ast.KindFunctionType,
ast.KindMethodDeclaration, ast.KindMethodSignature:
@@ -13971,9 +13971,6 @@ func (c *Checker) getTargetOfImportSpecifier(node *ast.Node, dontResolveAlias bo
}
}
root := node.Parent.Parent.Parent // ImportDeclaration
- if root.Kind == ast.KindJSDocImportTag {
- root = root.AsJSDocImportTag().JSImportDeclaration.AsNode()
- }
if ast.IsBindingElement(node) {
root = ast.GetRootDeclaration(node)
}
@@ -14344,8 +14341,6 @@ func (c *Checker) getModuleSpecifierForImportOrExport(node *ast.Node) *ast.Node
func getModuleSpecifierFromNode(node *ast.Node) *ast.Node {
switch node.Kind {
- case ast.KindJSDocImportTag:
- return node.AsJSDocImportTag().JSImportDeclaration.ModuleSpecifier
case ast.KindImportDeclaration, ast.KindJSImportDeclaration:
return node.AsImportDeclaration().ModuleSpecifier
case ast.KindExportDeclaration:
@@ -14449,12 +14444,6 @@ func (c *Checker) resolveExternalModule(location *ast.Node, moduleReference stri
contextSpecifier = location.AsVariableDeclaration().Initializer.AsCallExpression().Arguments.Nodes[0]
} else {
var ancestor *ast.Node
- if location.Flags&ast.NodeFlagsJSDoc != 0 {
- ancestor = ast.FindAncestor(location, ast.IsJSDocImportTag)
- if ancestor != nil {
- contextSpecifier = ancestor.AsJSDocImportTag().JSImportDeclaration.ModuleSpecifier
- }
- }
if ancestor == nil {
ancestor = ast.FindAncestor(location, ast.IsImportCall)
if ancestor != nil {
@@ -22039,7 +22028,6 @@ func (c *Checker) getTypeFromTypeOperatorNode(node *ast.Node) *Type {
}
func (c *Checker) getESSymbolLikeTypeForNode(node *ast.Node) *Type {
- node = ast.GetEffectiveTypeParent(node)
if isValidESSymbolDeclaration(node) {
symbol := c.getSymbolOfNode(node)
if symbol != nil {
@@ -22710,9 +22698,9 @@ func (c *Checker) getAliasForTypeNode(node *ast.Node) *TypeAlias {
}
func (c *Checker) getAliasSymbolForTypeNode(node *ast.Node) *ast.Symbol {
- host := ast.GetEffectiveTypeParent(node.Parent)
+ host := node.Parent
for ast.IsParenthesizedTypeNode(host) || ast.IsTypeOperatorNode(host) && host.AsTypeOperatorNode().Operator == ast.KindReadonlyKeyword {
- host = ast.GetEffectiveTypeParent(host.Parent)
+ host = host.Parent
}
if isTypeAlias(host) {
return c.getSymbolOfDeclaration(host)
@@ -22748,7 +22736,7 @@ func (c *Checker) getOuterTypeParametersOfClassOrInterface(symbol *ast.Symbol) [
// Return the outer type parameters of a node or undefined if the node has no outer type parameters.
func (c *Checker) getOuterTypeParameters(node *ast.Node, includeThisTypes bool) []*Type {
for {
- node = ast.GetEffectiveTypeParent(node.Parent)
+ node = node.Parent
if node == nil {
return nil
}
diff --git a/internal/checker/grammarchecks.go b/internal/checker/grammarchecks.go
index cd3cca23f3..b491f1e405 100644
--- a/internal/checker/grammarchecks.go
+++ b/internal/checker/grammarchecks.go
@@ -1394,7 +1394,7 @@ func (c *Checker) checkGrammarTypeOperatorNode(node *ast.TypeOperatorNode) bool
if innerType.Kind != ast.KindSymbolKeyword {
return c.grammarErrorOnNode(innerType, diagnostics.X_0_expected, scanner.TokenToString(ast.KindSymbolKeyword))
}
- parent := ast.GetEffectiveTypeParent(ast.WalkUpParenthesizedTypes(node.Parent))
+ parent := ast.WalkUpParenthesizedTypes(node.Parent)
switch parent.Kind {
case ast.KindVariableDeclaration:
decl := parent.AsVariableDeclaration()
diff --git a/internal/checker/utilities.go b/internal/checker/utilities.go
index 321d069819..9f248ae6c2 100644
--- a/internal/checker/utilities.go
+++ b/internal/checker/utilities.go
@@ -1842,9 +1842,6 @@ func getAnyImportSyntax(node *ast.Node) *ast.Node {
default:
return nil
}
- if importNode.Kind == ast.KindJSDocImportTag {
- return importNode.AsJSDocImportTag().JSImportDeclaration.AsNode()
- }
return importNode
}
diff --git a/internal/parser/reparser.go b/internal/parser/reparser.go
index 6dd6cc5c02..3b71f1e1e9 100644
--- a/internal/parser/reparser.go
+++ b/internal/parser/reparser.go
@@ -5,8 +5,15 @@ import (
"github.com/microsoft/typescript-go/internal/core"
)
-func (p *Parser) finishReparsedNode(node *ast.Node) {
- p.overrideParentInImmediateChildren(node)
+func (p *Parser) finishReparsedNode(node *ast.Node, recursive bool) {
+ // TODO: Maybe every single call to this should be ast.SetParentInChildren--seems likely
+ // TODO: try setting pos and flags here too
+ // TODO: make a purpose-built one-child + recursive setter and call that for the non-fresh case
+ if recursive {
+ ast.SetParentInChildren(node)
+ } else {
+ p.overrideParentInImmediateChildren(node)
+ }
}
func (p *Parser) reparseCommonJS(node *ast.Node, jsdoc []*ast.Node) {
@@ -21,13 +28,13 @@ func (p *Parser) reparseCommonJS(node *ast.Node, jsdoc []*ast.Node) {
var export *ast.Node
switch kind {
case ast.JSDeclarationKindModuleExports:
- export = p.factory.NewJSExportAssignment(nil, bin.Right)
+ export = p.factory.NewJSExportAssignment(nil, p.factory.DeepCloneReparse(bin.Right))
case ast.JSDeclarationKindExportsProperty:
mod := p.factory.NewModifier(ast.KindExportKeyword)
mod.Flags = p.contextFlags | ast.NodeFlagsReparsed
mod.Loc = bin.Loc
// TODO: Name can sometimes be a string literal, so downstream code needs to handle this
- export = p.factory.NewCommonJSExport(p.newModifierList(bin.Loc, p.nodeSlicePool.NewSlice1(mod)), ast.GetElementOrPropertyAccessName(bin.Left), nil /*typeNode*/, bin.Right)
+ export = p.factory.NewCommonJSExport(p.newModifierList(bin.Loc, p.nodeSlicePool.NewSlice1(mod)), p.factory.DeepCloneReparse(ast.GetElementOrPropertyAccessName(bin.Left)), nil /*typeNode*/, p.factory.DeepCloneReparse(bin.Right))
}
if export != nil {
export.Flags = ast.NodeFlagsReparsed
@@ -35,8 +42,9 @@ func (p *Parser) reparseCommonJS(node *ast.Node, jsdoc []*ast.Node) {
p.reparseList = append(p.reparseList, export)
p.commonJSModuleIndicator = export
p.reparseTags(export, jsdoc)
- p.finishReparsedNode(export)
- p.finishReparsedNode(bin.AsNode()) // TODO: the same node appears in both the new export declaration and the original binary expression - both locations cannot have correct `.Parent` pointers. For now, the binary expression being correctly parented is baselined behavior, since it appears first in the AST.
+ p.finishReparsedNode(export, true)
+ // TODO: This will probably be the first place that Original pointer is needed.
+ // p.finishReparsedNode(bin.AsNode()) // TODO: the same node appears in both the new export declaration and the original binary expression - both locations cannot have correct `.Parent` pointers. For now, the binary expression being correctly parented is baselined behavior, since it appears first in the AST.
}
}
@@ -73,12 +81,12 @@ func (p *Parser) reparseUnhosted(tag *ast.Node, parent *ast.Node, jsDoc *ast.Nod
export.Flags = p.contextFlags | ast.NodeFlagsReparsed
modifiers := p.newModifierList(export.Loc, p.nodeSlicePool.NewSlice1(export))
- typeAlias := p.factory.NewJSTypeAliasDeclaration(modifiers, tag.AsJSDocTypedefTag().Name(), nil, nil)
- typeAlias.AsTypeAliasDeclaration().TypeParameters = p.gatherTypeParameters(jsDoc, tag, typeAlias)
+ typeAlias := p.factory.NewJSTypeAliasDeclaration(modifiers, p.factory.DeepCloneReparse(tag.AsJSDocTypedefTag().Name()), nil, nil)
+ typeAlias.AsTypeAliasDeclaration().TypeParameters = p.gatherTypeParameters(jsDoc, tag)
var t *ast.Node
switch typeExpression.Kind {
case ast.KindJSDocTypeExpression:
- t = setHost(typeExpression, typeAlias)
+ t = p.factory.DeepCloneReparse(typeExpression.Type())
case ast.KindJSDocTypeLiteral:
t = p.reparseJSDocTypeLiteral(typeExpression)
default:
@@ -87,7 +95,7 @@ func (p *Parser) reparseUnhosted(tag *ast.Node, parent *ast.Node, jsDoc *ast.Nod
typeAlias.AsTypeAliasDeclaration().Type = t
typeAlias.Loc = tag.Loc
typeAlias.Flags = p.contextFlags | ast.NodeFlagsReparsed
- p.finishReparsedNode(typeAlias)
+ p.finishReparsedNode(typeAlias, true)
p.reparseList = append(p.reparseList, typeAlias)
case ast.KindJSDocCallbackTag:
callbackTag := tag.AsJSDocCallbackTag()
@@ -101,31 +109,33 @@ func (p *Parser) reparseUnhosted(tag *ast.Node, parent *ast.Node, jsDoc *ast.Nod
modifiers := p.newModifierList(export.Loc, p.nodeSlicePool.NewSlice1(export))
functionType := p.reparseJSDocSignature(callbackTag.TypeExpression, tag, jsDoc, tag)
- typeAlias := p.factory.NewJSTypeAliasDeclaration(modifiers, callbackTag.FullName, nil, functionType)
- typeAlias.AsTypeAliasDeclaration().TypeParameters = p.gatherTypeParameters(jsDoc, tag, typeAlias)
+ typeAlias := p.factory.NewJSTypeAliasDeclaration(modifiers, p.factory.DeepCloneReparse(callbackTag.FullName), nil, functionType)
+ typeAlias.AsTypeAliasDeclaration().TypeParameters = p.gatherTypeParameters(jsDoc, tag)
typeAlias.Loc = tag.Loc
typeAlias.Flags = p.contextFlags | ast.NodeFlagsReparsed
- p.finishReparsedNode(typeAlias)
+ p.finishReparsedNode(typeAlias, true)
p.reparseList = append(p.reparseList, typeAlias)
case ast.KindJSDocImportTag:
importTag := tag.AsJSDocImportTag()
- importClause := importTag.ImportClause
- if importClause == nil {
+ if importTag.ImportClause == nil {
break
}
- importClause.Flags |= ast.NodeFlagsReparsed
+ importClause := p.factory.DeepCloneReparse(importTag.ImportClause)
importClause.AsImportClause().IsTypeOnly = true
- p.finishReparsedNode(importClause)
- importDeclaration := p.factory.NewJSImportDeclaration(importTag.Modifiers(), importClause, importTag.ModuleSpecifier, importTag.Attributes)
+ importDeclaration := p.factory.NewJSImportDeclaration(
+ p.factory.DeepCloneReparseModifiers(importTag.Modifiers()),
+ importClause,
+ p.factory.DeepCloneReparse(importTag.ModuleSpecifier),
+ p.factory.DeepCloneReparse(importTag.Attributes),
+ )
importDeclaration.Loc = tag.Loc
importDeclaration.Flags = p.contextFlags | ast.NodeFlagsReparsed
- importTag.JSImportDeclaration = importDeclaration.AsImportDeclaration()
- p.finishReparsedNode(importDeclaration)
+ p.finishReparsedNode(importDeclaration, true)
p.reparseList = append(p.reparseList, importDeclaration)
case ast.KindJSDocOverloadTag:
if fun, ok := getFunctionLikeHost(parent); ok {
p.reparseList = append(p.reparseList, p.reparseJSDocSignature(tag.AsJSDocOverloadTag().TypeExpression, fun, jsDoc, tag))
- p.finishReparsedNode(fun)
+ // p.finishReparsedNode(fun)
}
}
}
@@ -134,9 +144,9 @@ func (p *Parser) reparseJSDocSignature(jsSignature *ast.Node, fun *ast.Node, jsD
var signature *ast.Node
switch fun.Kind {
case ast.KindFunctionDeclaration, ast.KindFunctionExpression, ast.KindArrowFunction:
- signature = p.factory.NewFunctionDeclaration(nil, nil, fun.Name(), nil, nil, nil, nil)
+ signature = p.factory.NewFunctionDeclaration(nil, nil, p.factory.DeepCloneReparse(fun.Name()), nil, nil, nil, nil)
case ast.KindMethodDeclaration, ast.KindMethodSignature:
- signature = p.factory.NewMethodDeclaration(nil, nil, fun.Name(), nil, nil, nil, nil, nil)
+ signature = p.factory.NewMethodDeclaration(nil, nil, p.factory.DeepCloneReparse(fun.Name()), nil, nil, nil, nil, nil)
case ast.KindConstructor:
signature = p.factory.NewConstructorDeclaration(nil, nil, nil, nil, nil)
case ast.KindJSDocCallbackTag:
@@ -146,7 +156,7 @@ func (p *Parser) reparseJSDocSignature(jsSignature *ast.Node, fun *ast.Node, jsD
}
if tag.Kind != ast.KindJSDocCallbackTag {
- signature.FunctionLikeData().TypeParameters = p.gatherTypeParameters(jsDoc, tag, signature)
+ signature.FunctionLikeData().TypeParameters = p.gatherTypeParameters(jsDoc, tag)
}
parameters := p.nodeSlicePool.NewSlice(0)
for _, param := range jsSignature.Parameters() {
@@ -157,30 +167,32 @@ func (p *Parser) reparseJSDocSignature(jsSignature *ast.Node, fun *ast.Node, jsD
thisIdent.Loc = thisTag.Loc
thisIdent.Flags = p.contextFlags | ast.NodeFlagsReparsed
parameter = p.factory.NewParameterDeclaration(nil, nil, thisIdent, nil, nil, nil)
- parameter.AsParameterDeclaration().Type = setHost(thisTag.TypeExpression, parameter)
+ if thisTag.TypeExpression != nil {
+ parameter.AsParameterDeclaration().Type = p.factory.DeepCloneReparse(thisTag.TypeExpression.Type())
+ }
} else {
jsparam := param.AsJSDocParameterOrPropertyTag()
- parameter = p.factory.NewParameterDeclaration(nil, nil, jsparam.Name(), p.makeQuestionIfOptional(jsparam), nil, nil)
+ parameter = p.factory.NewParameterDeclaration(nil, nil, p.factory.DeepCloneReparse(jsparam.Name()), p.makeQuestionIfOptional(jsparam), nil, nil)
if jsparam.TypeExpression != nil {
- parameter.AsParameterDeclaration().Type = p.reparseJSDocTypeLiteral(setHost(jsparam.TypeExpression, parameter))
+ parameter.AsParameterDeclaration().Type = p.reparseJSDocTypeLiteral(jsparam.TypeExpression.Type())
}
}
parameter.Loc = param.Loc
parameter.Flags = p.contextFlags | ast.NodeFlagsReparsed
- p.finishReparsedNode(parameter)
+ p.finishReparsedNode(parameter, false)
parameters = append(parameters, parameter)
}
signature.FunctionLikeData().Parameters = p.newNodeList(jsSignature.AsJSDocSignature().Parameters.Loc, parameters)
- if jsSignature.Type() != nil {
- signature.FunctionLikeData().Type = setHost(jsSignature.Type().AsJSDocReturnTag().TypeExpression, signature)
+ if jsSignature.Type() != nil && jsSignature.Type().AsJSDocReturnTag().TypeExpression != nil {
+ signature.FunctionLikeData().Type = p.factory.DeepCloneReparse(jsSignature.Type().AsJSDocReturnTag().TypeExpression.Type())
}
signature.Loc = tag.Loc
if tag.Kind == ast.KindJSDocOverloadTag {
signature.Loc = tag.AsJSDocOverloadTag().TagName.Loc
}
signature.Flags = p.contextFlags | ast.NodeFlagsReparsed
- p.finishReparsedNode(signature)
+ p.finishReparsedNode(signature, true)
return signature
}
@@ -203,7 +215,7 @@ func (p *Parser) reparseJSDocTypeLiteral(t *ast.TypeNode) *ast.Node {
}
property.Loc = prop.Loc
property.Flags = p.contextFlags | ast.NodeFlagsReparsed
- p.finishReparsedNode(property)
+ p.finishReparsedNode(property, false)
properties = append(properties, property)
}
loc := t.Loc
@@ -211,17 +223,17 @@ func (p *Parser) reparseJSDocTypeLiteral(t *ast.TypeNode) *ast.Node {
t.Loc = loc
t.Flags = p.contextFlags | ast.NodeFlagsReparsed
if isArrayType {
- p.finishReparsedNode(t)
+ p.finishReparsedNode(t, true)
t = p.factory.NewArrayTypeNode(t)
t.Flags = p.contextFlags | ast.NodeFlagsReparsed
t.Loc = loc
}
- p.finishReparsedNode(t)
+ p.finishReparsedNode(t, true)
}
- return t
+ return p.factory.DeepCloneReparse(t)
}
-func (p *Parser) gatherTypeParameters(j *ast.Node, tagWithTypeParameters *ast.Node, host *ast.Node) *ast.NodeList {
+func (p *Parser) gatherTypeParameters(j *ast.Node, tagWithTypeParameters *ast.Node) *ast.NodeList {
typeParameters := p.nodeSlicePool.NewSlice(0)
pos := -1
endPos := -1
@@ -252,20 +264,21 @@ func (p *Parser) gatherTypeParameters(j *ast.Node, tagWithTypeParameters *ast.No
constraint := tag.AsJSDocTemplateTag().Constraint
firstTypeParameter := true
for _, tp := range tag.TypeParameters() {
- reparse := tp
+ var reparse *ast.Node
if constraint != nil && firstTypeParameter {
- reparse = p.factory.NewTypeParameterDeclaration(tp.Modifiers(), tp.Name(), nil, tp.AsTypeParameter().DefaultType)
- reparse.AsTypeParameter().Constraint = setHost(constraint, reparse)
+ reparse = p.factory.NewTypeParameterDeclaration(
+ p.factory.DeepCloneReparseModifiers(tp.Modifiers()),
+ p.factory.DeepCloneReparse(tp.Name()),
+ nil,
+ p.factory.DeepCloneReparse(tp.AsTypeParameter().DefaultType),
+ )
+ reparse.AsTypeParameter().Constraint = p.factory.DeepCloneReparse(constraint.Type())
reparse.Loc = tp.Loc
- }
- if tag.AsJSDocTemplateTag().Host == nil {
- tag.AsJSDocTemplateTag().Host = host
- } else if firstTypeParameter {
- // don't panic for non-first type parameters like U,V in `@template T,U,V`; they share a host with the first one
- panic("JSDoc type parameter already has a host: " + tag.AsJSDocTemplateTag().Host.Kind.String())
+ } else {
+ reparse = p.factory.DeepCloneReparse(tp)
}
reparse.Flags |= ast.NodeFlagsReparsed
- p.finishReparsedNode(reparse)
+ p.finishReparsedNode(reparse, false)
typeParameters = append(typeParameters, reparse)
firstTypeParameter = false
}
@@ -284,103 +297,122 @@ func (p *Parser) reparseHosted(tag *ast.Node, parent *ast.Node, jsDoc *ast.Node)
case ast.KindVariableStatement:
if parent.AsVariableStatement().DeclarationList != nil {
for _, declaration := range parent.AsVariableStatement().DeclarationList.AsVariableDeclarationList().Declarations.Nodes {
- if declaration.AsVariableDeclaration().Type == nil {
- declaration.AsVariableDeclaration().Type = setHost(tag.AsJSDocTypeTag().TypeExpression, declaration)
- p.finishReparsedNode(declaration)
+ if declaration.AsVariableDeclaration().Type == nil && tag.AsJSDocTypeTag().TypeExpression != nil {
+ declaration.AsVariableDeclaration().Type = p.factory.DeepCloneReparse(tag.AsJSDocTypeTag().TypeExpression.Type())
+ // NOTE: for non-synthetic nodes, we actually only want to set one parent pointer, then recursively for that pointer.
+ // not sure if there's an elegant way to do that.
+ p.finishReparsedNode(declaration, true)
break
}
}
}
case ast.KindVariableDeclaration:
- if parent.AsVariableDeclaration().Type == nil {
- parent.AsVariableDeclaration().Type = setHost(tag.AsJSDocTypeTag().TypeExpression, parent)
- p.finishReparsedNode(parent)
+ if parent.AsVariableDeclaration().Type == nil && tag.AsJSDocTypeTag().TypeExpression != nil {
+ parent.AsVariableDeclaration().Type = p.factory.DeepCloneReparse(tag.AsJSDocTypeTag().TypeExpression.Type())
+ p.finishReparsedNode(parent, true)
}
case ast.KindCommonJSExport:
export := parent.AsCommonJSExport()
- if export.Type == nil {
- export.Type = setHost(tag.AsJSDocTypeTag().TypeExpression, parent)
- p.finishReparsedNode(parent)
+ if export.Type == nil && tag.AsJSDocTypeTag().TypeExpression != nil {
+ export.Type = p.factory.DeepCloneReparse(tag.AsJSDocTypeTag().TypeExpression.Type())
+ p.finishReparsedNode(parent, true)
}
case ast.KindPropertyDeclaration:
declaration := parent.AsPropertyDeclaration()
- if declaration.Type == nil {
- declaration.Type = setHost(tag.AsJSDocTypeTag().TypeExpression, parent)
- p.finishReparsedNode(parent)
+ if declaration.Type == nil && tag.AsJSDocTypeTag().TypeExpression != nil {
+ declaration.Type = p.factory.DeepCloneReparse(tag.AsJSDocTypeTag().TypeExpression.Type())
+ p.finishReparsedNode(parent, true)
}
case ast.KindPropertyAssignment:
prop := parent.AsPropertyAssignment()
- if prop.Type == nil {
- prop.Type = setHost(tag.AsJSDocTypeTag().TypeExpression, parent)
- p.finishReparsedNode(parent)
+ if prop.Type == nil && tag.AsJSDocTypeTag().TypeExpression != nil {
+ prop.Type = p.factory.DeepCloneReparse(tag.AsJSDocTypeTag().TypeExpression.Type())
+ p.finishReparsedNode(parent, true)
}
case ast.KindShorthandPropertyAssignment:
prop := parent.AsShorthandPropertyAssignment()
- if prop.Type == nil {
- prop.Type = setHost(tag.AsJSDocTypeTag().TypeExpression, parent)
- p.finishReparsedNode(parent)
+ if prop.Type == nil && tag.AsJSDocTypeTag().TypeExpression != nil {
+ prop.Type = p.factory.DeepCloneReparse(tag.AsJSDocTypeTag().TypeExpression.Type())
+ p.finishReparsedNode(parent, true)
}
case ast.KindExportAssignment, ast.KindJSExportAssignment:
export := parent.AsExportAssignment()
- if export.Type == nil {
- export.Type = setHost(tag.AsJSDocTypeTag().TypeExpression, parent)
- p.finishReparsedNode(parent)
+ if export.Type == nil && tag.AsJSDocTypeTag().TypeExpression != nil {
+ export.Type = p.factory.DeepCloneReparse(tag.AsJSDocTypeTag().TypeExpression.Type())
+ p.finishReparsedNode(parent, true)
}
case ast.KindReturnStatement:
ret := parent.AsReturnStatement()
- ret.Expression = p.makeNewCast(setHost(tag.AsJSDocTypeTag().TypeExpression, nil), ret.Expression, true /*isAssertion*/)
- p.finishReparsedNode(parent)
+ if tag.AsJSDocTypeTag().TypeExpression != nil {
+ ret.Expression = p.makeNewCast(
+ p.factory.DeepCloneReparse(tag.AsJSDocTypeTag().TypeExpression.Type()),
+ ret.Expression,
+ true /*isAssertion*/)
+ p.finishReparsedNode(parent, true)
+ }
case ast.KindParenthesizedExpression:
paren := parent.AsParenthesizedExpression()
- paren.Expression = p.makeNewCast(setHost(tag.AsJSDocTypeTag().TypeExpression, nil), paren.Expression, true /*isAssertion*/)
- p.finishReparsedNode(parent)
+ if tag.AsJSDocTypeTag().TypeExpression != nil {
+ paren.Expression = p.makeNewCast(
+ p.factory.DeepCloneReparse(tag.AsJSDocTypeTag().TypeExpression.Type()),
+ paren.Expression,
+ true /*isAssertion*/)
+ p.finishReparsedNode(parent, true)
+ }
case ast.KindExpressionStatement:
if parent.AsExpressionStatement().Expression.Kind == ast.KindBinaryExpression {
bin := parent.AsExpressionStatement().Expression.AsBinaryExpression()
- if kind := ast.GetAssignmentDeclarationKind(bin); kind != ast.JSDeclarationKindNone {
- bin.Type = setHost(tag.AsJSDocTypeTag().TypeExpression, parent.AsExpressionStatement().Expression)
- p.finishReparsedNode(bin.AsNode())
+ if kind := ast.GetAssignmentDeclarationKind(bin); kind != ast.JSDeclarationKindNone && tag.AsJSDocTypeTag().TypeExpression != nil {
+ bin.Type = p.factory.DeepCloneReparse(tag.AsJSDocTypeTag().TypeExpression.Type())
+ p.finishReparsedNode(bin.AsNode(), true)
}
}
}
case ast.KindJSDocSatisfiesTag:
if parent.Kind == ast.KindParenthesizedExpression {
paren := parent.AsParenthesizedExpression()
- paren.Expression = p.makeNewCast(setHost(tag.AsJSDocSatisfiesTag().TypeExpression, nil), paren.Expression, false /*isAssertion*/)
- p.finishReparsedNode(parent)
+ if tag.AsJSDocSatisfiesTag().TypeExpression != nil {
+ paren.Expression = p.makeNewCast(
+ p.factory.DeepCloneReparse(tag.AsJSDocSatisfiesTag().TypeExpression.Type()),
+ paren.Expression,
+ false /*isAssertion*/)
+ p.finishReparsedNode(parent, true)
+ }
}
case ast.KindJSDocTemplateTag:
if fun, ok := getFunctionLikeHost(parent); ok {
if fun.TypeParameters() == nil {
- fun.FunctionLikeData().TypeParameters = p.gatherTypeParameters(jsDoc, nil /*tagWithTypeParameters*/, fun)
- p.finishReparsedNode(fun)
+ fun.FunctionLikeData().TypeParameters = p.gatherTypeParameters(jsDoc, nil /*tagWithTypeParameters*/)
+ p.finishReparsedNode(fun, true)
}
} else if parent.Kind == ast.KindClassDeclaration {
class := parent.AsClassDeclaration()
if class.TypeParameters == nil {
- class.TypeParameters = p.gatherTypeParameters(jsDoc, nil /*tagWithTypeParameters*/, parent)
- p.finishReparsedNode(parent)
+ class.TypeParameters = p.gatherTypeParameters(jsDoc, nil /*tagWithTypeParameters*/)
+ p.finishReparsedNode(parent, true)
}
} else if parent.Kind == ast.KindClassExpression {
class := parent.AsClassExpression()
if class.TypeParameters == nil {
- class.TypeParameters = p.gatherTypeParameters(jsDoc, nil /*tagWithTypeParameters*/, parent)
- p.finishReparsedNode(parent)
+ class.TypeParameters = p.gatherTypeParameters(jsDoc, nil /*tagWithTypeParameters*/)
+ p.finishReparsedNode(parent, true)
}
}
case ast.KindJSDocParameterTag:
if fun, ok := getFunctionLikeHost(parent); ok {
parameterTag := tag.AsJSDocParameterOrPropertyTag()
if param, ok := findMatchingParameter(fun, parameterTag, jsDoc); ok {
- if param.Type == nil {
- param.AsParameterDeclaration().Type = p.reparseJSDocTypeLiteral(setHost(p.reparseJSDocTypeLiteral(parameterTag.TypeExpression), param.AsNode()))
+ if param.Type == nil && parameterTag.TypeExpression != nil {
+ // TODO: Why the double reparse? Once should be enough and the second should be a no-op in the old world.
+ // param.AsParameterDeclaration().Type = p.reparseJSDocTypeLiteral(p.factory.DeepCloneReparse(p.reparseJSDocTypeLiteral(parameterTag.TypeExpression)))
+ param.AsParameterDeclaration().Type = p.reparseJSDocTypeLiteral(parameterTag.TypeExpression.Type())
}
if param.QuestionToken == nil && param.Initializer == nil {
if question := p.makeQuestionIfOptional(parameterTag); question != nil {
param.QuestionToken = question
}
}
- p.finishReparsedNode(param.AsNode())
+ p.finishReparsedNode(param.AsNode(), true)
}
}
case ast.KindJSDocThisTag:
@@ -395,10 +427,12 @@ func (p *Parser) reparseHosted(tag *ast.Node, parent *ast.Node, jsDoc *ast.Node)
nil, /* type */
nil, /* initializer */
)
- thisParam.AsParameterDeclaration().Type = setHost(tag.AsJSDocThisTag().TypeExpression, thisParam)
+ if tag.AsJSDocThisTag().TypeExpression != nil {
+ thisParam.AsParameterDeclaration().Type = p.factory.DeepCloneReparse(tag.AsJSDocThisTag().TypeExpression)
+ }
thisParam.Loc = tag.AsJSDocThisTag().TagName.Loc
thisParam.Flags = p.contextFlags | ast.NodeFlagsReparsed
- p.finishReparsedNode(thisParam)
+ p.finishReparsedNode(thisParam, false)
newParams := p.nodeSlicePool.NewSlice(len(params) + 1)
newParams[0] = thisParam
@@ -407,14 +441,14 @@ func (p *Parser) reparseHosted(tag *ast.Node, parent *ast.Node, jsDoc *ast.Node)
}
fun.FunctionLikeData().Parameters = p.newNodeList(thisParam.Loc, newParams)
- p.finishReparsedNode(fun)
+ p.finishReparsedNode(fun, true)
}
}
case ast.KindJSDocReturnTag:
if fun, ok := getFunctionLikeHost(parent); ok {
- if fun.Type() == nil {
- fun.FunctionLikeData().Type = setHost(tag.AsJSDocReturnTag().TypeExpression, fun)
- p.finishReparsedNode(fun)
+ if fun.Type() == nil && tag.AsJSDocReturnTag().TypeExpression != nil {
+ fun.FunctionLikeData().Type = p.factory.DeepCloneReparse(tag.AsJSDocReturnTag().TypeExpression.Type())
+ p.finishReparsedNode(fun, true)
}
}
case ast.KindJSDocReadonlyTag, ast.KindJSDocPrivateTag, ast.KindJSDocPublicTag, ast.KindJSDocProtectedTag, ast.KindJSDocOverrideTag:
@@ -450,7 +484,7 @@ func (p *Parser) reparseHosted(tag *ast.Node, parent *ast.Node, jsDoc *ast.Node)
loc = parent.Modifiers().Loc
}
parent.AsMutable().SetModifiers(p.newModifierList(loc, nodes))
- p.finishReparsedNode(parent)
+ p.finishReparsedNode(parent, true)
}
case ast.KindJSDocImplementsTag:
if class := getClassLikeData(parent); class != nil {
@@ -460,18 +494,17 @@ func (p *Parser) reparseHosted(tag *ast.Node, parent *ast.Node, jsDoc *ast.Node)
if implementsClause := core.Find(class.HeritageClauses.Nodes, func(node *ast.Node) bool {
return node.AsHeritageClause().Token == ast.KindImplementsKeyword
}); implementsClause != nil {
- implementsClause.AsHeritageClause().Types.Nodes = append(implementsClause.AsHeritageClause().Types.Nodes, implementsTag.ClassName)
- p.finishReparsedNode(implementsClause)
+ implementsClause.AsHeritageClause().Types.Nodes = append(implementsClause.AsHeritageClause().Types.Nodes, p.factory.DeepCloneReparse(implementsTag.ClassName))
+ p.finishReparsedNode(implementsClause, true)
return
}
}
- implementsTag.ClassName.Flags |= ast.NodeFlagsReparsed
- typesList := p.newNodeList(implementsTag.ClassName.Loc, p.nodeSlicePool.NewSlice1(implementsTag.ClassName))
+ typesList := p.newNodeList(implementsTag.ClassName.Loc, p.nodeSlicePool.NewSlice1(p.factory.DeepCloneReparse(implementsTag.ClassName)))
heritageClause := p.factory.NewHeritageClause(ast.KindImplementsKeyword, typesList)
heritageClause.Loc = implementsTag.ClassName.Loc
heritageClause.Flags = p.contextFlags | ast.NodeFlagsReparsed
- p.finishReparsedNode(heritageClause)
+ p.finishReparsedNode(heritageClause, false)
if class.HeritageClauses == nil {
heritageClauses := p.newNodeList(implementsTag.ClassName.Loc, p.nodeSlicePool.NewSlice1(heritageClause))
@@ -479,7 +512,7 @@ func (p *Parser) reparseHosted(tag *ast.Node, parent *ast.Node, jsDoc *ast.Node)
} else {
class.HeritageClauses.Nodes = append(class.HeritageClauses.Nodes, heritageClause)
}
- p.finishReparsedNode(parent)
+ p.finishReparsedNode(parent, true)
}
case ast.KindJSDocAugmentsTag:
if class := getClassLikeData(parent); class != nil && class.HeritageClauses != nil {
@@ -490,13 +523,13 @@ func (p *Parser) reparseHosted(tag *ast.Node, parent *ast.Node, jsDoc *ast.Node)
source := tag.AsJSDocAugmentsTag().ClassName.AsExpressionWithTypeArguments()
if ast.HasSamePropertyAccessName(target.Expression, source.Expression) {
if target.TypeArguments == nil && source.TypeArguments != nil {
- target.TypeArguments = source.TypeArguments
- for _, typeArg := range source.TypeArguments.Nodes {
- typeArg.Flags |= ast.NodeFlagsReparsed
+ newArguments := p.nodeSlicePool.NewSlice(len(source.TypeArguments.Nodes))
+ for i, arg := range source.TypeArguments.Nodes {
+ newArguments[i] = p.factory.DeepCloneReparse(arg)
}
- p.finishReparsedNode(target.AsNode())
+ target.TypeArguments = p.newNodeList(source.TypeArguments.Loc, newArguments)
+ p.finishReparsedNode(target.AsNode(), true)
}
- return
}
}
}
@@ -564,29 +597,16 @@ func (p *Parser) makeNewCast(t *ast.TypeNode, e *ast.Node, isAssertion bool) *as
}
assert.Flags = p.contextFlags | ast.NodeFlagsReparsed
assert.Loc = core.NewTextRange(e.Pos(), e.End())
- p.finishReparsedNode(assert)
+ p.finishReparsedNode(assert, false)
return assert
}
-func setHost(typeExpression *ast.TypeNode, host *ast.Node) *ast.Node {
- if typeExpression == nil || typeExpression.Type() == nil {
- return nil
- }
- if typeExpression.AsJSDocTypeExpression().Host == nil {
- typeExpression.AsJSDocTypeExpression().Host = host
- } else if host.Kind != ast.KindJSExportAssignment && host.Kind != ast.KindCommonJSExport {
- panic("JSDoc type expression already has a host: " + typeExpression.AsJSDocTypeExpression().Host.Kind.String())
- }
- t := typeExpression.Type()
- t.Flags |= ast.NodeFlagsReparsed
- return t
-}
-
func getClassLikeData(parent *ast.Node) *ast.ClassLikeBase {
var class *ast.ClassLikeBase
- if parent.Kind == ast.KindClassDeclaration {
+ switch parent.Kind {
+ case ast.KindClassDeclaration:
class = parent.AsClassDeclaration().ClassLikeData()
- } else if parent.Kind == ast.KindClassExpression {
+ case ast.KindClassExpression:
class = parent.AsClassExpression().ClassLikeData()
}
return class
From bdad6fc1036ff9ef61088cc1e5018741b2f177d2 Mon Sep 17 00:00:00 2001
From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
Date: Wed, 16 Jul 2025 07:52:52 -0700
Subject: [PATCH 02/10] Compiler tests all pass
Some things are stricter now, almost all because module.exports.p with
module.exports= no longer binds a symbol. Also, type printing of aliases
of module.exports changed to print the thing itself instead of an
`import('.')`
Need to look at fourslash tests and code now.
---
internal/ast/utilities.go | 2 +
internal/parser/reparser.go | 2 +-
...ExportAssignmentNonMutableLocation.symbols | 1 -
...tAssignmentNonMutableLocation.symbols.diff | 2 +-
...jsExportAssignmentNonMutableLocation.types | 2 +-
...emberMergedWithModuleAugmentation3.symbols | 1 -
...MergedWithModuleAugmentation3.symbols.diff | 1 -
...tMemberMergedWithModuleAugmentation3.types | 2 +-
.../compiler/pushTypeGetTypeOfAlias.symbols | 1 -
.../pushTypeGetTypeOfAlias.symbols.diff | 2 +-
.../conformance/commonJSAliasedExport.symbols | 1 -
.../commonJSAliasedExport.symbols.diff | 2 +-
.../conformance/commonJSAliasedExport.types | 2 +-
...DeclarationsClassExtendsVisibility.symbols | 1 -
...rationsClassExtendsVisibility.symbols.diff | 5 +-
...jsDeclarationsClassExtendsVisibility.types | 2 +-
.../jsDeclarationsClassStatic.symbols | 1 -
.../jsDeclarationsClassStatic.symbols.diff | 4 +-
.../jsDeclarationsClassStatic.types | 2 +-
.../jsDeclarationsCrossfileMerge.symbols | 1 -
.../jsDeclarationsCrossfileMerge.symbols.diff | 5 +-
.../jsDeclarationsCrossfileMerge.types | 2 +-
...clarationsExportAssignedClassExpression.js | 20 +--
...tionsExportAssignedClassExpression.js.diff | 22 +--
...rationsExportAssignedClassExpression.types | 12 +-
...sExportAssignedClassExpressionAnonymous.js | 20 +--
...rtAssignedClassExpressionAnonymous.js.diff | 22 +--
...rtAssignedClassExpressionAnonymous.symbols | 4 +-
...ignedClassExpressionAnonymous.symbols.diff | 4 +-
...portAssignedClassExpressionAnonymous.types | 10 +-
...ClassExpressionAnonymousWithSub.errors.txt | 4 +-
...AssignedClassExpressionAnonymousWithSub.js | 4 +-
...nedClassExpressionAnonymousWithSub.js.diff | 4 +-
...nedClassExpressionAnonymousWithSub.symbols | 13 +-
...assExpressionAnonymousWithSub.symbols.diff | 14 +-
...ignedClassExpressionAnonymousWithSub.types | 32 ++--
...sExportAssignedClassExpressionShadowing.js | 10 +-
...rtAssignedClassExpressionShadowing.js.diff | 15 +-
...rtAssignedClassExpressionShadowing.symbols | 1 -
...ignedClassExpressionShadowing.symbols.diff | 2 +-
...portAssignedClassExpressionShadowing.types | 20 +--
...ationsExportAssignedClassInstance3.symbols | 1 -
...sExportAssignedClassInstance3.symbols.diff | 2 +-
...arationsExportAssignedClassInstance3.types | 2 +-
...AssignedConstructorFunctionWithSub.symbols | 1 -
...nedConstructorFunctionWithSub.symbols.diff | 1 -
...rtAssignedConstructorFunctionWithSub.types | 2 +-
.../jsDeclarationsExportAssignedVisibility.js | 8 +-
...clarationsExportAssignedVisibility.js.diff | 8 +-
...DeclarationsExportAssignedVisibility.types | 12 +-
...tAssignmentExpressionPlusSecondary.symbols | 1 -
...gnmentExpressionPlusSecondary.symbols.diff | 2 +-
...ortAssignmentExpressionPlusSecondary.types | 2 +-
...onsExportDoubleAssignmentInClosure.symbols | 1 -
...portDoubleAssignmentInClosure.symbols.diff | 4 +-
...tionsExportDoubleAssignmentInClosure.types | 2 +-
...jsDeclarationsExportSubAssignments.symbols | 1 -
...larationsExportSubAssignments.symbols.diff | 2 +-
.../jsDeclarationsExportSubAssignments.types | 2 +-
.../conformance/jsdocImportType2.types | 12 +-
...peReferenceToImportOfClassExpression.types | 22 +--
.../conformance/moduleExportAlias.symbols | 14 --
.../moduleExportAlias.symbols.diff | 100 ++++++-----
.../conformance/moduleExportAlias.types | 28 +--
.../conformance/moduleExportAlias4.symbols | 1 -
.../moduleExportAlias4.symbols.diff | 1 -
.../conformance/moduleExportAlias4.types | 8 +-
...leExportAliasElementAccessExpression.types | 4 +-
.../moduleExportAliasImported.symbols | 1 -
.../moduleExportAliasImported.symbols.diff | 2 +-
.../moduleExportAliasImported.types | 2 +-
.../moduleExportAliasUnknown.symbols | 1 -
.../moduleExportAliasUnknown.symbols.diff | 2 +-
.../moduleExportAssignment4.symbols | 1 -
.../moduleExportAssignment4.symbols.diff | 2 +-
.../conformance/moduleExportAssignment4.types | 2 +-
.../moduleExportAssignment5.symbols | 1 -
.../moduleExportAssignment5.symbols.diff | 2 +-
.../conformance/moduleExportAssignment5.types | 2 +-
...uleExportPropertyAssignmentDefault.symbols | 1 -
...portPropertyAssignmentDefault.symbols.diff | 2 +-
...oduleExportPropertyAssignmentDefault.types | 2 +-
...ExportWithExportPropertyAssignment.symbols | 1 -
...tWithExportPropertyAssignment.symbols.diff | 2 +-
...leExportWithExportPropertyAssignment.types | 2 +-
...xportWithExportPropertyAssignment2.symbols | 1 -
...WithExportPropertyAssignment2.symbols.diff | 2 +-
...eExportWithExportPropertyAssignment2.types | 2 +-
...xportWithExportPropertyAssignment3.symbols | 5 +-
...WithExportPropertyAssignment3.symbols.diff | 8 +-
...eExportWithExportPropertyAssignment3.types | 6 +-
...xportWithExportPropertyAssignment4.symbols | 5 +-
...WithExportPropertyAssignment4.symbols.diff | 6 +-
...eExportWithExportPropertyAssignment4.types | 6 +-
...moduleExportsElementAccessAssignment.types | 8 +-
.../conformance/typedefCrossModule2.symbols | 2 -
.../typedefCrossModule2.symbols.diff | 4 +-
.../conformance/typedefCrossModule2.types | 4 +-
...ortAssignmentNonMutableLocation.types.diff | 2 +-
...erMergedWithModuleAugmentation3.types.diff | 3 +-
.../commonJSAliasedExport.types.diff | 3 +-
...larationsClassExtendsVisibility.types.diff | 5 +-
.../jsDeclarationsClassStatic.types.diff | 5 +-
.../jsDeclarationsCrossfileMerge.types.diff | 3 +-
...nsExportAssignedClassExpression.types.diff | 12 +-
...ssignedClassExpressionAnonymous.types.diff | 10 +-
...ExpressionAnonymousWithSub.errors.txt.diff | 4 +-
...ClassExpressionAnonymousWithSub.types.diff | 33 ++--
...ssignedClassExpressionShadowing.types.diff | 21 +--
...onsExportAssignedClassInstance3.types.diff | 3 +-
...ignedConstructorFunctionWithSub.types.diff | 2 +-
...rationsExportAssignedVisibility.types.diff | 12 +-
...signmentExpressionPlusSecondary.types.diff | 3 +-
...ExportDoubleAssignmentInClosure.types.diff | 5 +-
...eclarationsExportSubAssignments.types.diff | 3 +-
.../conformance/jsdocImportType2.types.diff | 12 +-
...erenceToImportOfClassExpression.types.diff | 22 +--
.../conformance/moduleExportAlias.types.diff | 163 +++++++++++-------
.../conformance/moduleExportAlias4.types.diff | 15 +-
...ortAliasElementAccessExpression.types.diff | 8 +-
.../moduleExportAliasImported.types.diff | 3 +-
.../moduleExportAssignment4.types.diff | 4 +-
.../moduleExportAssignment5.types.diff | 3 +-
...ExportPropertyAssignmentDefault.types.diff | 2 +-
...ortWithExportPropertyAssignment.types.diff | 2 +-
...rtWithExportPropertyAssignment2.types.diff | 3 +-
...rtWithExportPropertyAssignment3.types.diff | 7 +-
...rtWithExportPropertyAssignment4.types.diff | 7 +-
...eExportsElementAccessAssignment.types.diff | 14 +-
.../typedefCrossModule2.types.diff | 6 +-
130 files changed, 504 insertions(+), 504 deletions(-)
diff --git a/internal/ast/utilities.go b/internal/ast/utilities.go
index 1d64978c3f..a128120700 100644
--- a/internal/ast/utilities.go
+++ b/internal/ast/utilities.go
@@ -1455,6 +1455,8 @@ func getAssignedName(node *Node) *Node {
}
}
}
+ case KindCommonJSExport:
+ return parent.AsCommonJSExport().Name()
case KindVariableDeclaration:
name := parent.AsVariableDeclaration().Name()
if IsIdentifier(name) {
diff --git a/internal/parser/reparser.go b/internal/parser/reparser.go
index 3b71f1e1e9..97d8190a65 100644
--- a/internal/parser/reparser.go
+++ b/internal/parser/reparser.go
@@ -428,7 +428,7 @@ func (p *Parser) reparseHosted(tag *ast.Node, parent *ast.Node, jsDoc *ast.Node)
nil, /* initializer */
)
if tag.AsJSDocThisTag().TypeExpression != nil {
- thisParam.AsParameterDeclaration().Type = p.factory.DeepCloneReparse(tag.AsJSDocThisTag().TypeExpression)
+ thisParam.AsParameterDeclaration().Type = p.factory.DeepCloneReparse(tag.AsJSDocThisTag().TypeExpression.Type())
}
thisParam.Loc = tag.AsJSDocThisTag().TagName.Loc
thisParam.Flags = p.contextFlags | ast.NodeFlagsReparsed
diff --git a/testdata/baselines/reference/submodule/compiler/jsExportAssignmentNonMutableLocation.symbols b/testdata/baselines/reference/submodule/compiler/jsExportAssignmentNonMutableLocation.symbols
index c6faa1ec8d..916f7562f3 100644
--- a/testdata/baselines/reference/submodule/compiler/jsExportAssignmentNonMutableLocation.symbols
+++ b/testdata/baselines/reference/submodule/compiler/jsExportAssignmentNonMutableLocation.symbols
@@ -18,6 +18,5 @@ module.exports = {
exports.customSymbol2 = Symbol("custom");
>exports : Symbol("file", Decl(file.js, 0, 0))
->customSymbol2 : Symbol(customSymbol2, Decl(file.js, 5, 2))
>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
diff --git a/testdata/baselines/reference/submodule/compiler/jsExportAssignmentNonMutableLocation.symbols.diff b/testdata/baselines/reference/submodule/compiler/jsExportAssignmentNonMutableLocation.symbols.diff
index 05b6d05104..a3d9141331 100644
--- a/testdata/baselines/reference/submodule/compiler/jsExportAssignmentNonMutableLocation.symbols.diff
+++ b/testdata/baselines/reference/submodule/compiler/jsExportAssignmentNonMutableLocation.symbols.diff
@@ -19,6 +19,6 @@
exports.customSymbol2 = Symbol("custom");
->exports.customSymbol2 : Symbol(customSymbol2, Decl(file.js, 5, 2))
->exports : Symbol(customSymbol2, Decl(file.js, 5, 2))
+->customSymbol2 : Symbol(customSymbol2, Decl(file.js, 5, 2))
+>exports : Symbol("file", Decl(file.js, 0, 0))
- >customSymbol2 : Symbol(customSymbol2, Decl(file.js, 5, 2))
>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
diff --git a/testdata/baselines/reference/submodule/compiler/jsExportAssignmentNonMutableLocation.types b/testdata/baselines/reference/submodule/compiler/jsExportAssignmentNonMutableLocation.types
index bdc838d831..7cf7bc14ae 100644
--- a/testdata/baselines/reference/submodule/compiler/jsExportAssignmentNonMutableLocation.types
+++ b/testdata/baselines/reference/submodule/compiler/jsExportAssignmentNonMutableLocation.types
@@ -24,7 +24,7 @@ exports.customSymbol2 = Symbol("custom");
>exports.customSymbol2 = Symbol("custom") : symbol
>exports.customSymbol2 : any
>exports : typeof import("./file")
->customSymbol2 : symbol
+>customSymbol2 : any
>Symbol("custom") : symbol
>Symbol : SymbolConstructor
>"custom" : "custom"
diff --git a/testdata/baselines/reference/submodule/compiler/jsExportMemberMergedWithModuleAugmentation3.symbols b/testdata/baselines/reference/submodule/compiler/jsExportMemberMergedWithModuleAugmentation3.symbols
index c24099df56..ec76d78072 100644
--- a/testdata/baselines/reference/submodule/compiler/jsExportMemberMergedWithModuleAugmentation3.symbols
+++ b/testdata/baselines/reference/submodule/compiler/jsExportMemberMergedWithModuleAugmentation3.symbols
@@ -5,7 +5,6 @@ module.exports.x = 1;
>module.exports : Symbol(export=, Decl(x.js, 0, 21))
>module : Symbol(module.exports)
>exports : Symbol(export=, Decl(x.js, 0, 21))
->x : Symbol(x, Decl(x.js, 0, 0))
module.exports = require("./y.js");
>module.exports : Symbol(export=, Decl(x.js, 0, 21))
diff --git a/testdata/baselines/reference/submodule/compiler/jsExportMemberMergedWithModuleAugmentation3.symbols.diff b/testdata/baselines/reference/submodule/compiler/jsExportMemberMergedWithModuleAugmentation3.symbols.diff
index af7d240bef..4f7e0ab0db 100644
--- a/testdata/baselines/reference/submodule/compiler/jsExportMemberMergedWithModuleAugmentation3.symbols.diff
+++ b/testdata/baselines/reference/submodule/compiler/jsExportMemberMergedWithModuleAugmentation3.symbols.diff
@@ -12,7 +12,6 @@
+>module.exports : Symbol(export=, Decl(x.js, 0, 21))
+>module : Symbol(module.exports)
+>exports : Symbol(export=, Decl(x.js, 0, 21))
-+>x : Symbol(x, Decl(x.js, 0, 0))
module.exports = require("./y.js");
->module.exports : Symbol(module.exports, Decl(x.js, 0, 0))
diff --git a/testdata/baselines/reference/submodule/compiler/jsExportMemberMergedWithModuleAugmentation3.types b/testdata/baselines/reference/submodule/compiler/jsExportMemberMergedWithModuleAugmentation3.types
index ee4e91419b..62f3736bfb 100644
--- a/testdata/baselines/reference/submodule/compiler/jsExportMemberMergedWithModuleAugmentation3.types
+++ b/testdata/baselines/reference/submodule/compiler/jsExportMemberMergedWithModuleAugmentation3.types
@@ -7,7 +7,7 @@ module.exports.x = 1;
>module.exports : typeof import("./y.js")
>module : { "export=": typeof import("./y.js"); }
>exports : typeof import("./y.js")
->x : 1
+>x : any
>1 : 1
module.exports = require("./y.js");
diff --git a/testdata/baselines/reference/submodule/compiler/pushTypeGetTypeOfAlias.symbols b/testdata/baselines/reference/submodule/compiler/pushTypeGetTypeOfAlias.symbols
index 3be97da01d..738988b717 100644
--- a/testdata/baselines/reference/submodule/compiler/pushTypeGetTypeOfAlias.symbols
+++ b/testdata/baselines/reference/submodule/compiler/pushTypeGetTypeOfAlias.symbols
@@ -8,6 +8,5 @@ module.exports = function () {};
exports.blah = exports.someProp;
>exports : Symbol("bar", Decl(bar.js, 0, 0))
->blah : Symbol(blah, Decl(bar.js, 0, 32))
>exports : Symbol("bar", Decl(bar.js, 0, 0))
diff --git a/testdata/baselines/reference/submodule/compiler/pushTypeGetTypeOfAlias.symbols.diff b/testdata/baselines/reference/submodule/compiler/pushTypeGetTypeOfAlias.symbols.diff
index cfcf13c667..0866617f76 100644
--- a/testdata/baselines/reference/submodule/compiler/pushTypeGetTypeOfAlias.symbols.diff
+++ b/testdata/baselines/reference/submodule/compiler/pushTypeGetTypeOfAlias.symbols.diff
@@ -13,6 +13,6 @@
exports.blah = exports.someProp;
->exports.blah : Symbol(blah, Decl(bar.js, 0, 32))
->exports : Symbol(blah, Decl(bar.js, 0, 32))
+->blah : Symbol(blah, Decl(bar.js, 0, 32))
+>exports : Symbol("bar", Decl(bar.js, 0, 0))
- >blah : Symbol(blah, Decl(bar.js, 0, 32))
>exports : Symbol("bar", Decl(bar.js, 0, 0))
diff --git a/testdata/baselines/reference/submodule/conformance/commonJSAliasedExport.symbols b/testdata/baselines/reference/submodule/conformance/commonJSAliasedExport.symbols
index bfad582d2d..8c3b8e0421 100644
--- a/testdata/baselines/reference/submodule/conformance/commonJSAliasedExport.symbols
+++ b/testdata/baselines/reference/submodule/conformance/commonJSAliasedExport.symbols
@@ -37,6 +37,5 @@ module.exports.funky = funky;
>module.exports : Symbol(donkey, Decl(commonJSAliasedExport.js, 0, 5))
>module : Symbol(module.exports)
>exports : Symbol(donkey, Decl(commonJSAliasedExport.js, 0, 5))
->funky : Symbol(funky, Decl(commonJSAliasedExport.js, 5, 24))
>funky : Symbol(funky, Decl(commonJSAliasedExport.js, 0, 29))
diff --git a/testdata/baselines/reference/submodule/conformance/commonJSAliasedExport.symbols.diff b/testdata/baselines/reference/submodule/conformance/commonJSAliasedExport.symbols.diff
index 823745175a..57e789428e 100644
--- a/testdata/baselines/reference/submodule/conformance/commonJSAliasedExport.symbols.diff
+++ b/testdata/baselines/reference/submodule/conformance/commonJSAliasedExport.symbols.diff
@@ -17,8 +17,8 @@
->module.exports : Symbol(funky, Decl(commonJSAliasedExport.js, 5, 24))
->module : Symbol(module, Decl(commonJSAliasedExport.js, 4, 1))
->exports : Symbol(module.exports, Decl(commonJSAliasedExport.js, 0, 0))
+->funky : Symbol(funky, Decl(commonJSAliasedExport.js, 5, 24))
+>module.exports : Symbol(donkey, Decl(commonJSAliasedExport.js, 0, 5))
+>module : Symbol(module.exports)
+>exports : Symbol(donkey, Decl(commonJSAliasedExport.js, 0, 5))
- >funky : Symbol(funky, Decl(commonJSAliasedExport.js, 5, 24))
>funky : Symbol(funky, Decl(commonJSAliasedExport.js, 0, 29))
diff --git a/testdata/baselines/reference/submodule/conformance/commonJSAliasedExport.types b/testdata/baselines/reference/submodule/conformance/commonJSAliasedExport.types
index 9fa899723e..b4d9bc810d 100644
--- a/testdata/baselines/reference/submodule/conformance/commonJSAliasedExport.types
+++ b/testdata/baselines/reference/submodule/conformance/commonJSAliasedExport.types
@@ -45,6 +45,6 @@ module.exports.funky = funky;
>module.exports : (ast: any) => any
>module : { readonly donkey: (ast: any) => any; }
>exports : (ast: any) => any
->funky : (declaration: any) => boolean
+>funky : any
>funky : (declaration: any) => boolean
diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.symbols
index 41ca988325..bd1cc110ec 100644
--- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.symbols
+++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.symbols
@@ -30,7 +30,6 @@ module.exports.Strings = Strings;
>module.exports : Symbol(Foo, Decl(cls.js, 4, 2))
>module : Symbol(module.exports)
>exports : Symbol(Foo, Decl(cls.js, 4, 2))
->Strings : Symbol(Strings, Decl(cls.js, 6, 21))
>Strings : Symbol(Strings, Decl(cls.js, 1, 5))
=== bar.js ===
diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.symbols.diff
index 81e6807cec..92f53b9b9c 100644
--- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.symbols.diff
+++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.symbols.diff
@@ -17,13 +17,14 @@
->module.exports : Symbol(Strings, Decl(cls.js, 6, 21))
->module : Symbol(module, Decl(cls.js, 5, 24))
->exports : Symbol(module.exports, Decl(cls.js, 0, 0))
+->Strings : Symbol(Strings, Decl(cls.js, 6, 21))
+>module.exports : Symbol(Foo, Decl(cls.js, 4, 2))
+>module : Symbol(module.exports)
+>exports : Symbol(Foo, Decl(cls.js, 4, 2))
- >Strings : Symbol(Strings, Decl(cls.js, 6, 21))
>Strings : Symbol(Strings, Decl(cls.js, 1, 5))
-@@= skipped -18, +17 lines =@@
+ === bar.js ===
+@@= skipped -18, +16 lines =@@
>Bar : Symbol(Bar, Decl(bar.js, 0, 0))
module.exports = Bar;
diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.types
index 5cf45c94be..d2474b76c9 100644
--- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.types
+++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.types
@@ -37,7 +37,7 @@ module.exports.Strings = Strings;
>module.exports : typeof Foo
>module : { Foo: typeof Foo; }
>exports : typeof Foo
->Strings : { a: string; b: string; }
+>Strings : any
>Strings : { a: string; b: string; }
=== bar.js ===
diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic.symbols
index edbfc17ea6..1ac50eb1ca 100644
--- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic.symbols
+++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic.symbols
@@ -39,7 +39,6 @@ module.exports.Strings = Strings
>module.exports : Symbol(Handler, Decl(source.js, 0, 0))
>module : Symbol(module.exports)
>exports : Symbol(Handler, Decl(source.js, 0, 0))
->Strings : Symbol(Strings, Decl(source.js, 14, 25))
>Strings : Symbol(Strings, Decl(source.js, 9, 5))
/**
diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic.symbols.diff
index cb7eb9a942..073884c653 100644
--- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic.symbols.diff
+++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic.symbols.diff
@@ -47,8 +47,10 @@
->module.exports : Symbol(Strings, Decl(source.js, 14, 25))
->module : Symbol(module, Decl(source.js, 12, 1))
->exports : Symbol(module.exports, Decl(source.js, 0, 0))
+->Strings : Symbol(Strings, Decl(source.js, 14, 25))
+>module.exports : Symbol(Handler, Decl(source.js, 0, 0))
+>module : Symbol(module.exports)
+>exports : Symbol(Handler, Decl(source.js, 0, 0))
- >Strings : Symbol(Strings, Decl(source.js, 14, 25))
>Strings : Symbol(Strings, Decl(source.js, 9, 5))
+
+ /**
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic.types
index 160a039d38..3901dc7659 100644
--- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic.types
+++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic.types
@@ -48,7 +48,7 @@ module.exports.Strings = Strings
>module.exports : typeof Handler
>module : { Handler: typeof Handler; }
>exports : typeof Handler
->Strings : { a: string; b: string; }
+>Strings : any
>Strings : { a: string; b: string; }
/**
diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsCrossfileMerge.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsCrossfileMerge.symbols
index 5f4b9038b2..b9ba0605bd 100644
--- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsCrossfileMerge.symbols
+++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsCrossfileMerge.symbols
@@ -18,7 +18,6 @@ module.exports.memberName = "thing";
>module.exports : Symbol(validate, Decl(exporter.js, 0, 0))
>module : Symbol(module.exports)
>exports : Symbol(validate, Decl(exporter.js, 0, 0))
->memberName : Symbol(memberName, Decl(index.js, 2, 27))
=== exporter.js ===
function validate() {}
diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsCrossfileMerge.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsCrossfileMerge.symbols.diff
index 8cdda24efc..7d0dc8fb9a 100644
--- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsCrossfileMerge.symbols.diff
+++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsCrossfileMerge.symbols.diff
@@ -25,9 +25,10 @@
->module.exports : Symbol(memberName, Decl(index.js, 2, 27))
->module : Symbol(module, Decl(index.js, 0, 32))
->exports : Symbol(module.exports, Decl(index.js, 0, 0))
+->memberName : Symbol(memberName, Decl(index.js, 2, 27))
+>module.exports : Symbol(validate, Decl(exporter.js, 0, 0))
+>module : Symbol(module.exports)
+>exports : Symbol(validate, Decl(exporter.js, 0, 0))
- >memberName : Symbol(memberName, Decl(index.js, 2, 27))
- === exporter.js ===
\ No newline at end of file
+ === exporter.js ===
+ function validate() {}
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsCrossfileMerge.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsCrossfileMerge.types
index bfa141dd6c..b61fc27bfe 100644
--- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsCrossfileMerge.types
+++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsCrossfileMerge.types
@@ -22,7 +22,7 @@ module.exports.memberName = "thing";
>module.exports : () => void
>module : { validate(): void; }
>exports : () => void
->memberName : "thing"
+>memberName : any
>"thing" : "thing"
=== exporter.js ===
diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpression.js b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpression.js
index 57400ad02e..69b1b02411 100644
--- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpression.js
+++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpression.js
@@ -23,22 +23,8 @@ module.exports = class Thing {
//// [index.d.ts]
declare const _default: {
- new (p: number): import(".");
+ new (p: number): {
+ t: number;
+ };
};
export = _default;
-
-
-//// [DtsFileErrors]
-
-
-out/index.d.ts(2,22): error TS1340: Module '.' does not refer to a type, but is used as a type here. Did you mean 'typeof import('.')'?
-
-
-==== out/index.d.ts (1 errors) ====
- declare const _default: {
- new (p: number): import(".");
- ~~~~~~~~~~~
-!!! error TS1340: Module '.' does not refer to a type, but is used as a type here. Did you mean 'typeof import('.')'?
- };
- export = _default;
-
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpression.js.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpression.js.diff
index d30ea0a4a7..0aa86d7b51 100644
--- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpression.js.diff
+++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpression.js.diff
@@ -13,22 +13,8 @@
- t: number;
-}
+declare const _default: {
-+ new (p: number): import(".");
-+};
-+export = _default;
-+
-+
-+//// [DtsFileErrors]
-+
-+
-+out/index.d.ts(2,22): error TS1340: Module '.' does not refer to a type, but is used as a type here. Did you mean 'typeof import('.')'?
-+
-+
-+==== out/index.d.ts (1 errors) ====
-+ declare const _default: {
-+ new (p: number): import(".");
-+ ~~~~~~~~~~~
-+!!! error TS1340: Module '.' does not refer to a type, but is used as a type here. Did you mean 'typeof import('.')'?
++ new (p: number): {
++ t: number;
+ };
-+ export = _default;
-+
\ No newline at end of file
++};
++export = _default;
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpression.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpression.types
index ec5001d822..d322982939 100644
--- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpression.types
+++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpression.types
@@ -2,12 +2,12 @@
=== index.js ===
module.exports = class Thing {
->module.exports = class Thing { /** * @param {number} p */ constructor(p) { this.t = 12 + p; }} : typeof import(".")
->module.exports : typeof import(".")
->module : { Thing: typeof import("."); }
->exports : typeof import(".")
->class Thing { /** * @param {number} p */ constructor(p) { this.t = 12 + p; }} : typeof import(".")
->Thing : typeof import(".")
+>module.exports = class Thing { /** * @param {number} p */ constructor(p) { this.t = 12 + p; }} : typeof Thing
+>module.exports : typeof Thing
+>module : { Thing: typeof Thing; }
+>exports : typeof Thing
+>class Thing { /** * @param {number} p */ constructor(p) { this.t = 12 + p; }} : typeof Thing
+>Thing : typeof Thing
/**
* @param {number} p
diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymous.js b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymous.js
index b6ac685f16..974f3feac0 100644
--- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymous.js
+++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymous.js
@@ -23,22 +23,8 @@ module.exports = class {
//// [index.d.ts]
declare const _default: {
- new (p: number): import(".");
+ new (p: number): {
+ t: number;
+ };
};
export = _default;
-
-
-//// [DtsFileErrors]
-
-
-out/index.d.ts(2,22): error TS1340: Module '.' does not refer to a type, but is used as a type here. Did you mean 'typeof import('.')'?
-
-
-==== out/index.d.ts (1 errors) ====
- declare const _default: {
- new (p: number): import(".");
- ~~~~~~~~~~~
-!!! error TS1340: Module '.' does not refer to a type, but is used as a type here. Did you mean 'typeof import('.')'?
- };
- export = _default;
-
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymous.js.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymous.js.diff
index e6561361bb..2f838b6669 100644
--- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymous.js.diff
+++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymous.js.diff
@@ -13,22 +13,8 @@
- t: number;
-}
+declare const _default: {
-+ new (p: number): import(".");
-+};
-+export = _default;
-+
-+
-+//// [DtsFileErrors]
-+
-+
-+out/index.d.ts(2,22): error TS1340: Module '.' does not refer to a type, but is used as a type here. Did you mean 'typeof import('.')'?
-+
-+
-+==== out/index.d.ts (1 errors) ====
-+ declare const _default: {
-+ new (p: number): import(".");
-+ ~~~~~~~~~~~
-+!!! error TS1340: Module '.' does not refer to a type, but is used as a type here. Did you mean 'typeof import('.')'?
++ new (p: number): {
++ t: number;
+ };
-+ export = _default;
-+
\ No newline at end of file
++};
++export = _default;
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymous.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymous.symbols
index 1af9593125..c283005c22 100644
--- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymous.symbols
+++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymous.symbols
@@ -2,9 +2,9 @@
=== index.js ===
module.exports = class {
->module.exports : Symbol(exports, Decl(index.js, 0, 16))
+>module.exports : Symbol((Anonymous class), Decl(index.js, 0, 16))
>module : Symbol(module.exports)
->exports : Symbol(exports, Decl(index.js, 0, 16))
+>exports : Symbol((Anonymous class), Decl(index.js, 0, 16))
/**
* @param {number} p
diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymous.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymous.symbols.diff
index 6511b45a1e..725d68b8d1 100644
--- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymous.symbols.diff
+++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymous.symbols.diff
@@ -7,9 +7,9 @@
->module.exports : Symbol(module.exports, Decl(index.js, 0, 0))
->module : Symbol(export=, Decl(index.js, 0, 0))
->exports : Symbol(export=, Decl(index.js, 0, 0))
-+>module.exports : Symbol(exports, Decl(index.js, 0, 16))
++>module.exports : Symbol((Anonymous class), Decl(index.js, 0, 16))
+>module : Symbol(module.exports)
-+>exports : Symbol(exports, Decl(index.js, 0, 16))
++>exports : Symbol((Anonymous class), Decl(index.js, 0, 16))
/**
* @param {number} p
diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymous.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymous.types
index 8734f829a1..fe4c7f96cc 100644
--- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymous.types
+++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymous.types
@@ -2,11 +2,11 @@
=== index.js ===
module.exports = class {
->module.exports = class { /** * @param {number} p */ constructor(p) { this.t = 12 + p; }} : typeof import(".")
->module.exports : typeof import(".")
->module : { "\uFFFDclass": typeof import("."); }
->exports : typeof import(".")
->class { /** * @param {number} p */ constructor(p) { this.t = 12 + p; }} : typeof import(".")
+>module.exports = class { /** * @param {number} p */ constructor(p) { this.t = 12 + p; }} : typeof exports
+>module.exports : typeof (Anonymous class)
+>module : { "\uFFFDclass": typeof (Anonymous class); }
+>exports : typeof (Anonymous class)
+>class { /** * @param {number} p */ constructor(p) { this.t = 12 + p; }} : typeof exports
/**
* @param {number} p
diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.errors.txt
index 22d27100d3..f3dcd0a4a2 100644
--- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.errors.txt
+++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.errors.txt
@@ -1,5 +1,5 @@
index.js(1,1): error TS2309: An export assignment cannot be used in a module with other exported elements.
-index.js(9,16): error TS2339: Property 'Sub' does not exist on type 'typeof exports'.
+index.js(9,16): error TS2339: Property 'Sub' does not exist on type 'typeof (Anonymous class)'.
==== index.js (2 errors) ====
@@ -22,7 +22,7 @@ index.js(9,16): error TS2339: Property 'Sub' does not exist on type 'typeof expo
!!! error TS2309: An export assignment cannot be used in a module with other exported elements.
module.exports.Sub = class {
~~~
-!!! error TS2339: Property 'Sub' does not exist on type 'typeof exports'.
+!!! error TS2339: Property 'Sub' does not exist on type 'typeof (Anonymous class)'.
constructor() {
this.instance = new module.exports(10);
}
diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.js b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.js
index 72dbfb79c7..feff514416 100644
--- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.js
+++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.js
@@ -41,7 +41,9 @@ module.exports.Sub = class {
//// [index.d.ts]
declare const _default: {
- new (p: number): import(".");
+ new (p: number): {
+ t: number;
+ };
};
export = _default;
export var Sub = class {
diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.js.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.js.diff
index 0ca2a3e82f..b8d1314888 100644
--- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.js.diff
+++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.js.diff
@@ -40,7 +40,9 @@
- instance: import(".");
-}
+declare const _default: {
-+ new (p: number): import(".");
++ new (p: number): {
++ t: number;
++ };
+};
+export = _default;
+export var Sub = class {
diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.symbols
index 42fcda9dbb..a5f58ea147 100644
--- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.symbols
+++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.symbols
@@ -2,9 +2,9 @@
=== index.js ===
module.exports = class {
->module.exports : Symbol(exports, Decl(index.js, 0, 16))
+>module.exports : Symbol((Anonymous class), Decl(index.js, 0, 16))
>module : Symbol(module.exports)
->exports : Symbol(exports, Decl(index.js, 0, 16))
+>exports : Symbol((Anonymous class), Decl(index.js, 0, 16))
/**
* @param {number} p
@@ -20,19 +20,18 @@ module.exports = class {
}
}
module.exports.Sub = class {
->module.exports : Symbol(exports, Decl(index.js, 0, 16))
+>module.exports : Symbol((Anonymous class), Decl(index.js, 0, 16))
>module : Symbol(module.exports)
->exports : Symbol(exports, Decl(index.js, 0, 16))
->Sub : Symbol(Sub, Decl(index.js, 7, 1))
+>exports : Symbol((Anonymous class), Decl(index.js, 0, 16))
constructor() {
this.instance = new module.exports(10);
>this.instance : Symbol(instance, Decl(index.js, 9, 19))
>this : Symbol(Sub, Decl(index.js, 8, 20))
>instance : Symbol(instance, Decl(index.js, 9, 19))
->module.exports : Symbol(exports, Decl(index.js, 0, 16))
+>module.exports : Symbol((Anonymous class), Decl(index.js, 0, 16))
>module : Symbol(module.exports)
->exports : Symbol(exports, Decl(index.js, 0, 16))
+>exports : Symbol((Anonymous class), Decl(index.js, 0, 16))
}
}
diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.symbols.diff
index ed8774b8e7..acb0d78ae9 100644
--- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.symbols.diff
+++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.symbols.diff
@@ -7,9 +7,9 @@
->module.exports : Symbol(module.exports, Decl(index.js, 0, 0))
->module : Symbol(export=, Decl(index.js, 0, 0))
->exports : Symbol(export=, Decl(index.js, 0, 0))
-+>module.exports : Symbol(exports, Decl(index.js, 0, 16))
++>module.exports : Symbol((Anonymous class), Decl(index.js, 0, 16))
+>module : Symbol(module.exports)
-+>exports : Symbol(exports, Decl(index.js, 0, 16))
++>exports : Symbol((Anonymous class), Decl(index.js, 0, 16))
/**
* @param {number} p
@@ -30,10 +30,10 @@
->module.exports : Symbol(Sub, Decl(index.js, 7, 1))
->module : Symbol(module, Decl(index.js, 0, 0), Decl(index.js, 10, 27))
->exports : Symbol(module.exports, Decl(index.js, 0, 0))
-+>module.exports : Symbol(exports, Decl(index.js, 0, 16))
+->Sub : Symbol(Sub, Decl(index.js, 7, 1))
++>module.exports : Symbol((Anonymous class), Decl(index.js, 0, 16))
+>module : Symbol(module.exports)
-+>exports : Symbol(exports, Decl(index.js, 0, 16))
- >Sub : Symbol(Sub, Decl(index.js, 7, 1))
++>exports : Symbol((Anonymous class), Decl(index.js, 0, 16))
constructor() {
this.instance = new module.exports(10);
@@ -45,8 +45,8 @@
->module : Symbol(module, Decl(index.js, 0, 0), Decl(index.js, 10, 27))
->exports : Symbol(module.exports, Decl(index.js, 0, 0))
+>instance : Symbol(instance, Decl(index.js, 9, 19))
-+>module.exports : Symbol(exports, Decl(index.js, 0, 16))
++>module.exports : Symbol((Anonymous class), Decl(index.js, 0, 16))
+>module : Symbol(module.exports)
-+>exports : Symbol(exports, Decl(index.js, 0, 16))
++>exports : Symbol((Anonymous class), Decl(index.js, 0, 16))
}
}
diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.types
index 0a80cd5e49..7faddc141a 100644
--- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.types
+++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.types
@@ -2,11 +2,11 @@
=== index.js ===
module.exports = class {
->module.exports = class { /** * @param {number} p */ constructor(p) { this.t = 12 + p; }} : typeof import(".")
->module.exports : typeof import(".")
->module : { "\uFFFDclass": typeof import("."); }
->exports : typeof import(".")
->class { /** * @param {number} p */ constructor(p) { this.t = 12 + p; }} : typeof import(".")
+>module.exports = class { /** * @param {number} p */ constructor(p) { this.t = 12 + p; }} : typeof exports
+>module.exports : typeof (Anonymous class)
+>module : { "\uFFFDclass": typeof (Anonymous class); }
+>exports : typeof (Anonymous class)
+>class { /** * @param {number} p */ constructor(p) { this.t = 12 + p; }} : typeof exports
/**
* @param {number} p
@@ -27,22 +27,22 @@ module.exports = class {
module.exports.Sub = class {
>module.exports.Sub = class { constructor() { this.instance = new module.exports(10); }} : typeof Sub
>module.exports.Sub : any
->module.exports : typeof import(".")
->module : { "\uFFFDclass": typeof import("."); }
->exports : typeof import(".")
->Sub : typeof Sub
+>module.exports : typeof (Anonymous class)
+>module : { "\uFFFDclass": typeof (Anonymous class); }
+>exports : typeof (Anonymous class)
+>Sub : any
>class { constructor() { this.instance = new module.exports(10); }} : typeof Sub
constructor() {
this.instance = new module.exports(10);
->this.instance = new module.exports(10) : import(".")
->this.instance : import(".")
+>this.instance = new module.exports(10) : (Anonymous class)
+>this.instance : (Anonymous class)
>this : this
->instance : import(".")
->new module.exports(10) : import(".")
->module.exports : typeof import(".")
->module : { "\uFFFDclass": typeof import("."); }
->exports : typeof import(".")
+>instance : (Anonymous class)
+>new module.exports(10) : (Anonymous class)
+>module.exports : typeof (Anonymous class)
+>module : { "\uFFFDclass": typeof (Anonymous class); }
+>exports : typeof (Anonymous class)
>10 : 10
}
}
diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionShadowing.js b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionShadowing.js
index 7e5016e232..0d111728d1 100644
--- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionShadowing.js
+++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionShadowing.js
@@ -39,8 +39,16 @@ module.exports.Another = Q;
//// [index.d.ts]
+declare class A {
+ member: Q;
+}
+declare class Q {
+ x: number;
+}
declare const _default: {
- new (): import(".");
+ new (): {
+ x: A;
+ };
};
export = _default;
export var Another = Q;
diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionShadowing.js.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionShadowing.js.diff
index a571be8c1d..79b32ca0bf 100644
--- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionShadowing.js.diff
+++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionShadowing.js.diff
@@ -39,14 +39,17 @@
-declare namespace Q {
- export { Q_1 as Another };
-}
--declare class A {
-- member: Q;
--}
+ declare class A {
+ member: Q;
+ }
-declare class Q_1 {
-- x: number;
--}
++declare class Q {
+ x: number;
+ }
+declare const _default: {
-+ new (): import(".");
++ new (): {
++ x: A;
++ };
+};
+export = _default;
+export var Another = Q;
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionShadowing.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionShadowing.symbols
index a1bd4f9755..4fcf0449c5 100644
--- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionShadowing.symbols
+++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionShadowing.symbols
@@ -32,6 +32,5 @@ module.exports.Another = Q;
>module.exports : Symbol(Q, Decl(index.js, 6, 16))
>module : Symbol(module.exports)
>exports : Symbol(Q, Decl(index.js, 6, 16))
->Another : Symbol(Another, Decl(index.js, 10, 1))
>Q : Symbol(Q, Decl(index.js, 2, 1))
diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionShadowing.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionShadowing.symbols.diff
index 9d9f791cdc..6ca85363f6 100644
--- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionShadowing.symbols.diff
+++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionShadowing.symbols.diff
@@ -39,8 +39,8 @@
->module.exports : Symbol(Another, Decl(index.js, 10, 1))
->module : Symbol(module, Decl(index.js, 5, 1))
->exports : Symbol(module.exports, Decl(index.js, 0, 0))
+->Another : Symbol(Another, Decl(index.js, 10, 1))
+>module.exports : Symbol(Q, Decl(index.js, 6, 16))
+>module : Symbol(module.exports)
+>exports : Symbol(Q, Decl(index.js, 6, 16))
- >Another : Symbol(Another, Decl(index.js, 10, 1))
>Q : Symbol(Q, Decl(index.js, 2, 1))
diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionShadowing.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionShadowing.types
index 832f5e4420..95a716be1d 100644
--- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionShadowing.types
+++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionShadowing.types
@@ -17,12 +17,12 @@ class Q {
>42 : 42
}
module.exports = class Q {
->module.exports = class Q { constructor() { this.x = new A(); }} : typeof import(".")
->module.exports : typeof import(".")
->module : { Q: typeof import("."); }
->exports : typeof import(".")
->class Q { constructor() { this.x = new A(); }} : typeof import(".")
->Q : typeof import(".")
+>module.exports = class Q { constructor() { this.x = new A(); }} : typeof Q
+>module.exports : typeof Q
+>module : { Q: typeof Q; }
+>exports : typeof Q
+>class Q { constructor() { this.x = new A(); }} : typeof Q
+>Q : typeof Q
constructor() {
this.x = new A();
@@ -37,9 +37,9 @@ module.exports = class Q {
module.exports.Another = Q;
>module.exports.Another = Q : typeof Q
>module.exports.Another : any
->module.exports : typeof import(".")
->module : { Q: typeof import("."); }
->exports : typeof import(".")
->Another : typeof Q
+>module.exports : typeof Q
+>module : { Q: typeof Q; }
+>exports : typeof Q
+>Another : any
>Q : typeof Q
diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassInstance3.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassInstance3.symbols
index b0e05682b1..7d970daaef 100644
--- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassInstance3.symbols
+++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassInstance3.symbols
@@ -21,5 +21,4 @@ module.exports.additional = 20;
>module.exports : Symbol(export=, Decl(index.js, 3, 1))
>module : Symbol(module.exports)
>exports : Symbol(export=, Decl(index.js, 3, 1))
->additional : Symbol(additional, Decl(index.js, 5, 27))
diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassInstance3.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassInstance3.symbols.diff
index 2a34a4e086..b7b0d03fcd 100644
--- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassInstance3.symbols.diff
+++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassInstance3.symbols.diff
@@ -25,7 +25,7 @@
->module.exports : Symbol(additional, Decl(index.js, 5, 27))
->module : Symbol(module, Decl(index.js, 3, 1))
->exports : Symbol(module.exports, Decl(index.js, 0, 0))
+->additional : Symbol(additional, Decl(index.js, 5, 27))
+>module.exports : Symbol(export=, Decl(index.js, 3, 1))
+>module : Symbol(module.exports)
+>exports : Symbol(export=, Decl(index.js, 3, 1))
- >additional : Symbol(additional, Decl(index.js, 5, 27))
diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassInstance3.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassInstance3.types
index 46201f1ec5..d8d5961fa5 100644
--- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassInstance3.types
+++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassInstance3.types
@@ -27,6 +27,6 @@ module.exports.additional = 20;
>module.exports : Foo
>module : { "export=": Foo; }
>exports : Foo
->additional : 20
+>additional : any
>20 : 20
diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedConstructorFunctionWithSub.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedConstructorFunctionWithSub.symbols
index 7309a8814b..472779ff9e 100644
--- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedConstructorFunctionWithSub.symbols
+++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedConstructorFunctionWithSub.symbols
@@ -17,7 +17,6 @@ module.exports.Sub = function() {
>module.exports : Symbol(export=, Decl(jsDeclarationsExportAssignedConstructorFunctionWithSub.js, 0, 0))
>module : Symbol(module.exports)
>exports : Symbol(export=, Decl(jsDeclarationsExportAssignedConstructorFunctionWithSub.js, 0, 0))
->Sub : Symbol(Sub, Decl(jsDeclarationsExportAssignedConstructorFunctionWithSub.js, 5, 1))
this.instance = new module.exports(10);
>module.exports : Symbol(export=, Decl(jsDeclarationsExportAssignedConstructorFunctionWithSub.js, 0, 0))
diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedConstructorFunctionWithSub.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedConstructorFunctionWithSub.symbols.diff
index bed12d2407..c239422c61 100644
--- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedConstructorFunctionWithSub.symbols.diff
+++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedConstructorFunctionWithSub.symbols.diff
@@ -26,7 +26,6 @@
+>module.exports : Symbol(export=, Decl(jsDeclarationsExportAssignedConstructorFunctionWithSub.js, 0, 0))
+>module : Symbol(module.exports)
+>exports : Symbol(export=, Decl(jsDeclarationsExportAssignedConstructorFunctionWithSub.js, 0, 0))
-+>Sub : Symbol(Sub, Decl(jsDeclarationsExportAssignedConstructorFunctionWithSub.js, 5, 1))
this.instance = new module.exports(10);
->this.instance : Symbol(Sub.instance, Decl(jsDeclarationsExportAssignedConstructorFunctionWithSub.js, 6, 33))
diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedConstructorFunctionWithSub.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedConstructorFunctionWithSub.types
index 3c764a6b5d..175998a419 100644
--- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedConstructorFunctionWithSub.types
+++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedConstructorFunctionWithSub.types
@@ -27,7 +27,7 @@ module.exports.Sub = function() {
>module.exports : (p: any) => void
>module : { "export=": (p: any) => void; }
>exports : (p: any) => void
->Sub : () => void
+>Sub : any
>function() { this.instance = new module.exports(10);} : () => void
this.instance = new module.exports(10);
diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedVisibility.js b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedVisibility.js
index 6ea1fe5f06..3930e64b47 100644
--- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedVisibility.js
+++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedVisibility.js
@@ -41,7 +41,9 @@ module.exports = Container;
//// [obj.d.ts]
declare const _default: {
- new (): import("./obj");
+ new (): {
+ x: number;
+ };
};
export = _default;
//// [index.d.ts]
@@ -61,7 +63,9 @@ out/index.d.ts(1,10): error TS2304: Cannot find name 'Container'.
==== out/obj.d.ts (0 errors) ====
declare const _default: {
- new (): import("./obj");
+ new (): {
+ x: number;
+ };
};
export = _default;
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedVisibility.js.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedVisibility.js.diff
index 9deb7e4f9c..2599d385e7 100644
--- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedVisibility.js.diff
+++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedVisibility.js.diff
@@ -26,7 +26,9 @@
- x: number;
-}
+declare const _default: {
-+ new (): import("./obj");
++ new (): {
++ x: number;
++ };
+};
+export = _default;
//// [index.d.ts]
@@ -50,7 +52,9 @@
+
+==== out/obj.d.ts (0 errors) ====
+ declare const _default: {
-+ new (): import("./obj");
++ new (): {
++ x: number;
++ };
+ };
+ export = _default;
+
\ No newline at end of file
diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedVisibility.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedVisibility.types
index 5c413e4beb..82d89b5177 100644
--- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedVisibility.types
+++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedVisibility.types
@@ -30,12 +30,12 @@ module.exports = Container;
=== obj.js ===
module.exports = class Obj {
->module.exports = class Obj { constructor() { this.x = 12; }} : typeof import("./obj")
->module.exports : typeof import("./obj")
->module : { Obj: typeof import("./obj"); }
->exports : typeof import("./obj")
->class Obj { constructor() { this.x = 12; }} : typeof import("./obj")
->Obj : typeof import("./obj")
+>module.exports = class Obj { constructor() { this.x = 12; }} : typeof Obj
+>module.exports : typeof Obj
+>module : { Obj: typeof Obj; }
+>exports : typeof Obj
+>class Obj { constructor() { this.x = 12; }} : typeof Obj
+>Obj : typeof Obj
constructor() {
this.x = 12;
diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignmentExpressionPlusSecondary.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignmentExpressionPlusSecondary.symbols
index 1dcdb59470..b2e68c2f07 100644
--- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignmentExpressionPlusSecondary.symbols
+++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignmentExpressionPlusSecondary.symbols
@@ -33,6 +33,5 @@ module.exports.Strings = Strings;
>module.exports : Symbol(export=, Decl(index.js, 3, 2))
>module : Symbol(module.exports)
>exports : Symbol(export=, Decl(index.js, 3, 2))
->Strings : Symbol(Strings, Decl(index.js, 10, 2))
>Strings : Symbol(Strings, Decl(index.js, 0, 5))
diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignmentExpressionPlusSecondary.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignmentExpressionPlusSecondary.symbols.diff
index 321f9314d2..d625cf320c 100644
--- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignmentExpressionPlusSecondary.symbols.diff
+++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignmentExpressionPlusSecondary.symbols.diff
@@ -19,8 +19,8 @@
->module.exports : Symbol(Strings, Decl(index.js, 10, 2))
->module : Symbol(module, Decl(index.js, 3, 2))
->exports : Symbol(module.exports, Decl(index.js, 0, 0))
+->Strings : Symbol(Strings, Decl(index.js, 10, 2))
+>module.exports : Symbol(export=, Decl(index.js, 3, 2))
+>module : Symbol(module.exports)
+>exports : Symbol(export=, Decl(index.js, 3, 2))
- >Strings : Symbol(Strings, Decl(index.js, 10, 2))
>Strings : Symbol(Strings, Decl(index.js, 0, 5))
diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignmentExpressionPlusSecondary.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignmentExpressionPlusSecondary.types
index ba5dc7573c..934820272b 100644
--- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignmentExpressionPlusSecondary.types
+++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignmentExpressionPlusSecondary.types
@@ -44,6 +44,6 @@ module.exports.Strings = Strings;
>module.exports : { thing: string; also: string; desc: { item: string; }; }
>module : { "export=": { thing: string; also: string; desc: { item: string; }; }; }
>exports : { thing: string; also: string; desc: { item: string; }; }
->Strings : { a: string; b: string; }
+>Strings : any
>Strings : { a: string; b: string; }
diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDoubleAssignmentInClosure.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDoubleAssignmentInClosure.symbols
index 7fa53c9314..d03e2da5ce 100644
--- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDoubleAssignmentInClosure.symbols
+++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDoubleAssignmentInClosure.symbols
@@ -25,7 +25,6 @@ function foo() {
}
exports.methods = m;
>exports : Symbol("index", Decl(index.js, 0, 0))
->methods : Symbol(methods, Decl(index.js, 7, 5))
>m : Symbol(m, Decl(index.js, 5, 9))
}
diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDoubleAssignmentInClosure.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDoubleAssignmentInClosure.symbols.diff
index 622ebe70e3..10a3348251 100644
--- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDoubleAssignmentInClosure.symbols.diff
+++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDoubleAssignmentInClosure.symbols.diff
@@ -16,7 +16,7 @@
}
exports.methods = m;
->exports : Symbol(methods, Decl(index.js, 7, 5))
+->methods : Symbol(methods, Decl(index.js, 7, 5))
+>exports : Symbol("index", Decl(index.js, 0, 0))
- >methods : Symbol(methods, Decl(index.js, 7, 5))
>m : Symbol(m, Decl(index.js, 5, 9))
- }
\ No newline at end of file
+ }
diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDoubleAssignmentInClosure.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDoubleAssignmentInClosure.types
index eb97480cb0..cd082c13a1 100644
--- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDoubleAssignmentInClosure.types
+++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportDoubleAssignmentInClosure.types
@@ -41,7 +41,7 @@ function foo() {
>exports.methods = m : () => void
>exports.methods : any
>exports : typeof import(".")
->methods : () => void
+>methods : any
>m : () => void
}
diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportSubAssignments.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportSubAssignments.symbols
index e6f5b059ca..b68cc7cae5 100644
--- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportSubAssignments.symbols
+++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportSubAssignments.symbols
@@ -24,6 +24,5 @@ module.exports.Strings = Strings;
>module.exports : Symbol(Foo, Decl(cls.js, 3, 2))
>module : Symbol(module.exports)
>exports : Symbol(Foo, Decl(cls.js, 3, 2))
->Strings : Symbol(Strings, Decl(cls.js, 5, 21))
>Strings : Symbol(Strings, Decl(cls.js, 0, 5))
diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportSubAssignments.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportSubAssignments.symbols.diff
index 9dd6a0c1a3..fbda01c9ed 100644
--- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportSubAssignments.symbols.diff
+++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportSubAssignments.symbols.diff
@@ -17,8 +17,8 @@
->module.exports : Symbol(Strings, Decl(cls.js, 5, 21))
->module : Symbol(module, Decl(cls.js, 4, 12))
->exports : Symbol(module.exports, Decl(cls.js, 0, 0))
+->Strings : Symbol(Strings, Decl(cls.js, 5, 21))
+>module.exports : Symbol(Foo, Decl(cls.js, 3, 2))
+>module : Symbol(module.exports)
+>exports : Symbol(Foo, Decl(cls.js, 3, 2))
- >Strings : Symbol(Strings, Decl(cls.js, 5, 21))
>Strings : Symbol(Strings, Decl(cls.js, 0, 5))
diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportSubAssignments.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportSubAssignments.types
index 2232cf861d..2bc348dc16 100644
--- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportSubAssignments.types
+++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportSubAssignments.types
@@ -30,6 +30,6 @@ module.exports.Strings = Strings;
>module.exports : typeof Foo
>module : { Foo: typeof Foo; }
>exports : typeof Foo
->Strings : { a: string; b: string; }
+>Strings : any
>Strings : { a: string; b: string; }
diff --git a/testdata/baselines/reference/submodule/conformance/jsdocImportType2.types b/testdata/baselines/reference/submodule/conformance/jsdocImportType2.types
index 3b14ed6cdc..239d377179 100644
--- a/testdata/baselines/reference/submodule/conformance/jsdocImportType2.types
+++ b/testdata/baselines/reference/submodule/conformance/jsdocImportType2.types
@@ -42,12 +42,12 @@ declare var module: { exports: any };
=== mod1.js ===
///
module.exports = class Chunk {
->module.exports = class Chunk { constructor() { this.chunk = 1; }} : typeof import("./mod1")
->module.exports : typeof import("./mod1")
->module : { Chunk: typeof import("./mod1"); }
->exports : typeof import("./mod1")
->class Chunk { constructor() { this.chunk = 1; }} : typeof import("./mod1")
->Chunk : typeof import("./mod1")
+>module.exports = class Chunk { constructor() { this.chunk = 1; }} : typeof Chunk
+>module.exports : typeof Chunk
+>module : { Chunk: typeof Chunk; }
+>exports : typeof Chunk
+>class Chunk { constructor() { this.chunk = 1; }} : typeof Chunk
+>Chunk : typeof Chunk
constructor() {
this.chunk = 1;
diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.types b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.types
index d1d05b562b..b88afbfeca 100644
--- a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.types
+++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.types
@@ -10,12 +10,12 @@ const MW = require("./MW");
/** @typedef {number} Cictema */
module.exports = class MC {
->module.exports = class MC { watch() { return new MW(this); }} : typeof import("./MC")
->module.exports : typeof import("./MC")
->module : { MC: typeof import("./MC"); }
->exports : typeof import("./MC")
->class MC { watch() { return new MW(this); }} : typeof import("./MC")
->MC : typeof import("./MC")
+>module.exports = class MC { watch() { return new MW(this); }} : typeof MC
+>module.exports : typeof MC
+>module : { MC: typeof MC; }
+>exports : typeof MC
+>class MC { watch() { return new MW(this); }} : typeof MC
+>MC : typeof MC
watch() {
>watch : () => MW
@@ -37,14 +37,14 @@ class MW {
* @param {MC} compiler the compiler
*/
constructor(compiler) {
->compiler : import("./MC")
+>compiler : MC
this.compiler = compiler;
->this.compiler = compiler : import("./MC")
->this.compiler : import("./MC")
+>this.compiler = compiler : MC
+>this.compiler : MC
>this : this
->compiler : import("./MC")
->compiler : import("./MC")
+>compiler : MC
+>compiler : MC
}
}
diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAlias.symbols b/testdata/baselines/reference/submodule/conformance/moduleExportAlias.symbols
index 2bba22ef22..db9cea396e 100644
--- a/testdata/baselines/reference/submodule/conformance/moduleExportAlias.symbols
+++ b/testdata/baselines/reference/submodule/conformance/moduleExportAlias.symbols
@@ -75,7 +75,6 @@ exportsAlias.func1 = function () { };
exports.func2 = function () { };
>exports : Symbol("b", Decl(b.js, 0, 0))
->func2 : Symbol(func2, Decl(b.js, 1, 37))
var moduleExportsAlias = module.exports;
>moduleExportsAlias : Symbol(moduleExportsAlias, Decl(b.js, 4, 3))
@@ -90,7 +89,6 @@ module.exports.func4 = function () { };
>module.exports : Symbol(export=, Decl(b.js, 41, 40))
>module : Symbol(module.exports)
>exports : Symbol(export=, Decl(b.js, 41, 40))
->func4 : Symbol(func4, Decl(b.js, 5, 43))
var multipleDeclarationAlias1 = exports = module.exports;
>multipleDeclarationAlias1 : Symbol(multipleDeclarationAlias1, Decl(b.js, 8, 3))
@@ -162,13 +160,11 @@ exports = module.exports = someOtherVariable = {};
exports.func11 = function () { };
>exports : Symbol("b", Decl(b.js, 0, 0))
->func11 : Symbol(func11, Decl(b.js, 27, 50), Decl(b.js, 31, 50))
module.exports.func12 = function () { };
>module.exports : Symbol(export=, Decl(b.js, 41, 40))
>module : Symbol(module.exports)
>exports : Symbol(export=, Decl(b.js, 41, 40))
->func12 : Symbol(func12, Decl(b.js, 28, 33), Decl(b.js, 32, 33))
exports = module.exports = someOtherVariable = {};
>exports : Symbol("b", Decl(b.js, 0, 0))
@@ -179,13 +175,11 @@ exports = module.exports = someOtherVariable = {};
exports.func11 = function () { };
>exports : Symbol("b", Decl(b.js, 0, 0))
->func11 : Symbol(func11, Decl(b.js, 27, 50), Decl(b.js, 31, 50))
module.exports.func12 = function () { };
>module.exports : Symbol(export=, Decl(b.js, 41, 40))
>module : Symbol(module.exports)
>exports : Symbol(export=, Decl(b.js, 41, 40))
->func12 : Symbol(func12, Decl(b.js, 28, 33), Decl(b.js, 32, 33))
exports = module.exports = {};
>exports : Symbol("b", Decl(b.js, 0, 0))
@@ -195,13 +189,11 @@ exports = module.exports = {};
exports.func13 = function () { };
>exports : Symbol("b", Decl(b.js, 0, 0))
->func13 : Symbol(func13, Decl(b.js, 35, 30))
module.exports.func14 = function () { };
>module.exports : Symbol(export=, Decl(b.js, 41, 40))
>module : Symbol(module.exports)
>exports : Symbol(export=, Decl(b.js, 41, 40))
->func14 : Symbol(func14, Decl(b.js, 36, 33))
exports = module.exports = {};
>exports : Symbol("b", Decl(b.js, 0, 0))
@@ -211,13 +203,11 @@ exports = module.exports = {};
exports.func15 = function () { };
>exports : Symbol("b", Decl(b.js, 0, 0))
->func15 : Symbol(func15, Decl(b.js, 39, 30))
module.exports.func16 = function () { };
>module.exports : Symbol(export=, Decl(b.js, 41, 40))
>module : Symbol(module.exports)
>exports : Symbol(export=, Decl(b.js, 41, 40))
->func16 : Symbol(func16, Decl(b.js, 40, 33))
module.exports = exports = {};
>module.exports : Symbol(export=, Decl(b.js, 41, 40))
@@ -227,13 +217,11 @@ module.exports = exports = {};
exports.func17 = function () { };
>exports : Symbol("b", Decl(b.js, 0, 0))
->func17 : Symbol(func17, Decl(b.js, 43, 30))
module.exports.func18 = function () { };
>module.exports : Symbol(export=, Decl(b.js, 41, 40))
>module : Symbol(module.exports)
>exports : Symbol(export=, Decl(b.js, 41, 40))
->func18 : Symbol(func18, Decl(b.js, 44, 33))
module.exports = {};
>module.exports : Symbol(export=, Decl(b.js, 41, 40))
@@ -242,12 +230,10 @@ module.exports = {};
exports.func19 = function () { };
>exports : Symbol("b", Decl(b.js, 0, 0))
->func19 : Symbol(func19, Decl(b.js, 47, 20))
module.exports.func20 = function () { };
>module.exports : Symbol(export=, Decl(b.js, 41, 40))
>module : Symbol(module.exports)
>exports : Symbol(export=, Decl(b.js, 41, 40))
->func20 : Symbol(func20, Decl(b.js, 48, 33))
diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAlias.symbols.diff b/testdata/baselines/reference/submodule/conformance/moduleExportAlias.symbols.diff
index 997672a24d..7c68f5c1af 100644
--- a/testdata/baselines/reference/submodule/conformance/moduleExportAlias.symbols.diff
+++ b/testdata/baselines/reference/submodule/conformance/moduleExportAlias.symbols.diff
@@ -116,8 +116,8 @@
exports.func2 = function () { };
->exports.func2 : Symbol(func2, Decl(b.js, 1, 37))
->exports : Symbol(func2, Decl(b.js, 1, 37))
+->func2 : Symbol(func2, Decl(b.js, 1, 37))
+>exports : Symbol("b", Decl(b.js, 0, 0))
- >func2 : Symbol(func2, Decl(b.js, 1, 37))
var moduleExportsAlias = module.exports;
>moduleExportsAlias : Symbol(moduleExportsAlias, Decl(b.js, 4, 3))
@@ -138,10 +138,10 @@
->module.exports : Symbol(func4, Decl(b.js, 5, 43))
->module : Symbol(module, Decl(b.js, 4, 24))
->exports : Symbol(module.exports, Decl(b.js, 0, 0))
+->func4 : Symbol(func4, Decl(b.js, 5, 43))
+>module.exports : Symbol(export=, Decl(b.js, 41, 40))
+>module : Symbol(module.exports)
+>exports : Symbol(export=, Decl(b.js, 41, 40))
- >func4 : Symbol(func4, Decl(b.js, 5, 43))
var multipleDeclarationAlias1 = exports = module.exports;
>multipleDeclarationAlias1 : Symbol(multipleDeclarationAlias1, Decl(b.js, 8, 3))
@@ -175,7 +175,7 @@
var someOtherVariable;
>someOtherVariable : Symbol(someOtherVariable, Decl(b.js, 14, 3))
-@@= skipped -60, +50 lines =@@
+@@= skipped -60, +48 lines =@@
>exports : Symbol("b", Decl(b.js, 0, 0))
multipleDeclarationAlias3.func7 = function () { };
@@ -227,58 +227,74 @@
->multipleDeclarationAlias6.func10 : Symbol(func10, Decl(b.js, 24, 62))
>multipleDeclarationAlias6 : Symbol(multipleDeclarationAlias6, Decl(b.js, 24, 3))
->func10 : Symbol(func10, Decl(b.js, 24, 62))
-
- exports = module.exports = someOtherVariable = {};
- >exports : Symbol("b", Decl(b.js, 0, 0))
+-
+-exports = module.exports = someOtherVariable = {};
+->exports : Symbol("b", Decl(b.js, 0, 0))
->module.exports : Symbol(module.exports, Decl(b.js, 0, 0))
->module : Symbol(module, Decl(b.js, 4, 24))
->exports : Symbol(module.exports, Decl(b.js, 0, 0))
-+>module.exports : Symbol(export=, Decl(b.js, 41, 40))
-+>module : Symbol(module.exports)
-+>exports : Symbol(export=, Decl(b.js, 41, 40))
- >someOtherVariable : Symbol(someOtherVariable, Decl(b.js, 14, 3))
-
- exports.func11 = function () { };
+->someOtherVariable : Symbol(someOtherVariable, Decl(b.js, 14, 3))
+-
+-exports.func11 = function () { };
->exports.func11 : Symbol(func11, Decl(b.js, 27, 50), Decl(b.js, 31, 50))
->exports : Symbol(func11, Decl(b.js, 27, 50), Decl(b.js, 31, 50))
-+>exports : Symbol("b", Decl(b.js, 0, 0))
- >func11 : Symbol(func11, Decl(b.js, 27, 50), Decl(b.js, 31, 50))
-
- module.exports.func12 = function () { };
+->func11 : Symbol(func11, Decl(b.js, 27, 50), Decl(b.js, 31, 50))
+-
+-module.exports.func12 = function () { };
->module.exports.func12 : Symbol(func12, Decl(b.js, 28, 33), Decl(b.js, 32, 33))
->module.exports : Symbol(func12, Decl(b.js, 28, 33), Decl(b.js, 32, 33))
->module : Symbol(module, Decl(b.js, 4, 24))
->exports : Symbol(module.exports, Decl(b.js, 0, 0))
-+>module.exports : Symbol(export=, Decl(b.js, 41, 40))
-+>module : Symbol(module.exports)
-+>exports : Symbol(export=, Decl(b.js, 41, 40))
- >func12 : Symbol(func12, Decl(b.js, 28, 33), Decl(b.js, 32, 33))
-
- exports = module.exports = someOtherVariable = {};
- >exports : Symbol("b", Decl(b.js, 0, 0))
+->func12 : Symbol(func12, Decl(b.js, 28, 33), Decl(b.js, 32, 33))
+-
+-exports = module.exports = someOtherVariable = {};
+->exports : Symbol("b", Decl(b.js, 0, 0))
->module.exports : Symbol(module.exports, Decl(b.js, 0, 0))
->module : Symbol(module, Decl(b.js, 4, 24))
->exports : Symbol(module.exports, Decl(b.js, 0, 0))
-+>module.exports : Symbol(export=, Decl(b.js, 41, 40))
-+>module : Symbol(module.exports)
-+>exports : Symbol(export=, Decl(b.js, 41, 40))
- >someOtherVariable : Symbol(someOtherVariable, Decl(b.js, 14, 3))
-
- exports.func11 = function () { };
+->someOtherVariable : Symbol(someOtherVariable, Decl(b.js, 14, 3))
+-
+-exports.func11 = function () { };
->exports.func11 : Symbol(func11, Decl(b.js, 27, 50), Decl(b.js, 31, 50))
->exports : Symbol(func11, Decl(b.js, 27, 50), Decl(b.js, 31, 50))
-+>exports : Symbol("b", Decl(b.js, 0, 0))
- >func11 : Symbol(func11, Decl(b.js, 27, 50), Decl(b.js, 31, 50))
-
- module.exports.func12 = function () { };
+->func11 : Symbol(func11, Decl(b.js, 27, 50), Decl(b.js, 31, 50))
+-
+-module.exports.func12 = function () { };
->module.exports.func12 : Symbol(func12, Decl(b.js, 28, 33), Decl(b.js, 32, 33))
->module.exports : Symbol(func12, Decl(b.js, 28, 33), Decl(b.js, 32, 33))
->module : Symbol(module, Decl(b.js, 4, 24))
->exports : Symbol(module.exports, Decl(b.js, 0, 0))
+->func12 : Symbol(func12, Decl(b.js, 28, 33), Decl(b.js, 32, 33))
++
++exports = module.exports = someOtherVariable = {};
++>exports : Symbol("b", Decl(b.js, 0, 0))
++>module.exports : Symbol(export=, Decl(b.js, 41, 40))
++>module : Symbol(module.exports)
++>exports : Symbol(export=, Decl(b.js, 41, 40))
++>someOtherVariable : Symbol(someOtherVariable, Decl(b.js, 14, 3))
++
++exports.func11 = function () { };
++>exports : Symbol("b", Decl(b.js, 0, 0))
++
++module.exports.func12 = function () { };
++>module.exports : Symbol(export=, Decl(b.js, 41, 40))
++>module : Symbol(module.exports)
++>exports : Symbol(export=, Decl(b.js, 41, 40))
++
++exports = module.exports = someOtherVariable = {};
++>exports : Symbol("b", Decl(b.js, 0, 0))
++>module.exports : Symbol(export=, Decl(b.js, 41, 40))
++>module : Symbol(module.exports)
++>exports : Symbol(export=, Decl(b.js, 41, 40))
++>someOtherVariable : Symbol(someOtherVariable, Decl(b.js, 14, 3))
++
++exports.func11 = function () { };
++>exports : Symbol("b", Decl(b.js, 0, 0))
++
++module.exports.func12 = function () { };
+>module.exports : Symbol(export=, Decl(b.js, 41, 40))
+>module : Symbol(module.exports)
+>exports : Symbol(export=, Decl(b.js, 41, 40))
- >func12 : Symbol(func12, Decl(b.js, 28, 33), Decl(b.js, 32, 33))
exports = module.exports = {};
>exports : Symbol("b", Decl(b.js, 0, 0))
@@ -292,18 +308,18 @@
exports.func13 = function () { };
->exports.func13 : Symbol(func13, Decl(b.js, 35, 30))
->exports : Symbol(func13, Decl(b.js, 35, 30))
+->func13 : Symbol(func13, Decl(b.js, 35, 30))
+>exports : Symbol("b", Decl(b.js, 0, 0))
- >func13 : Symbol(func13, Decl(b.js, 35, 30))
module.exports.func14 = function () { };
->module.exports.func14 : Symbol(func14, Decl(b.js, 36, 33))
->module.exports : Symbol(func14, Decl(b.js, 36, 33))
->module : Symbol(module, Decl(b.js, 4, 24))
->exports : Symbol(module.exports, Decl(b.js, 0, 0))
+->func14 : Symbol(func14, Decl(b.js, 36, 33))
+>module.exports : Symbol(export=, Decl(b.js, 41, 40))
+>module : Symbol(module.exports)
+>exports : Symbol(export=, Decl(b.js, 41, 40))
- >func14 : Symbol(func14, Decl(b.js, 36, 33))
exports = module.exports = {};
>exports : Symbol("b", Decl(b.js, 0, 0))
@@ -317,18 +333,18 @@
exports.func15 = function () { };
->exports.func15 : Symbol(func15, Decl(b.js, 39, 30))
->exports : Symbol(func15, Decl(b.js, 39, 30))
+->func15 : Symbol(func15, Decl(b.js, 39, 30))
+>exports : Symbol("b", Decl(b.js, 0, 0))
- >func15 : Symbol(func15, Decl(b.js, 39, 30))
module.exports.func16 = function () { };
->module.exports.func16 : Symbol(func16, Decl(b.js, 40, 33))
->module.exports : Symbol(func16, Decl(b.js, 40, 33))
->module : Symbol(module, Decl(b.js, 4, 24))
->exports : Symbol(module.exports, Decl(b.js, 0, 0))
+->func16 : Symbol(func16, Decl(b.js, 40, 33))
+>module.exports : Symbol(export=, Decl(b.js, 41, 40))
+>module : Symbol(module.exports)
+>exports : Symbol(export=, Decl(b.js, 41, 40))
- >func16 : Symbol(func16, Decl(b.js, 40, 33))
module.exports = exports = {};
->module.exports : Symbol(module.exports, Decl(b.js, 0, 0))
@@ -342,18 +358,18 @@
exports.func17 = function () { };
->exports.func17 : Symbol(func17, Decl(b.js, 43, 30))
->exports : Symbol(func17, Decl(b.js, 43, 30))
+->func17 : Symbol(func17, Decl(b.js, 43, 30))
+>exports : Symbol("b", Decl(b.js, 0, 0))
- >func17 : Symbol(func17, Decl(b.js, 43, 30))
module.exports.func18 = function () { };
->module.exports.func18 : Symbol(func18, Decl(b.js, 44, 33))
->module.exports : Symbol(func18, Decl(b.js, 44, 33))
->module : Symbol(module, Decl(b.js, 4, 24))
->exports : Symbol(module.exports, Decl(b.js, 0, 0))
+->func18 : Symbol(func18, Decl(b.js, 44, 33))
+>module.exports : Symbol(export=, Decl(b.js, 41, 40))
+>module : Symbol(module.exports)
+>exports : Symbol(export=, Decl(b.js, 41, 40))
- >func18 : Symbol(func18, Decl(b.js, 44, 33))
module.exports = {};
->module.exports : Symbol(module.exports, Decl(b.js, 0, 0))
@@ -366,16 +382,16 @@
exports.func19 = function () { };
->exports.func19 : Symbol(func19, Decl(b.js, 47, 20))
->exports : Symbol(func19, Decl(b.js, 47, 20))
+->func19 : Symbol(func19, Decl(b.js, 47, 20))
+>exports : Symbol("b", Decl(b.js, 0, 0))
- >func19 : Symbol(func19, Decl(b.js, 47, 20))
module.exports.func20 = function () { };
->module.exports.func20 : Symbol(func20, Decl(b.js, 48, 33))
->module.exports : Symbol(func20, Decl(b.js, 48, 33))
->module : Symbol(module, Decl(b.js, 4, 24))
->exports : Symbol(module.exports, Decl(b.js, 0, 0))
+->func20 : Symbol(func20, Decl(b.js, 48, 33))
+>module.exports : Symbol(export=, Decl(b.js, 41, 40))
+>module : Symbol(module.exports)
+>exports : Symbol(export=, Decl(b.js, 41, 40))
- >func20 : Symbol(func20, Decl(b.js, 48, 33))
diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAlias.types b/testdata/baselines/reference/submodule/conformance/moduleExportAlias.types
index fbeca727fe..c1a0b90c39 100644
--- a/testdata/baselines/reference/submodule/conformance/moduleExportAlias.types
+++ b/testdata/baselines/reference/submodule/conformance/moduleExportAlias.types
@@ -121,7 +121,7 @@ exports.func2 = function () { };
>exports.func2 = function () { } : () => void
>exports.func2 : any
>exports : typeof import("./b")
->func2 : () => void
+>func2 : any
>function () { } : () => void
var moduleExportsAlias = module.exports;
@@ -143,7 +143,7 @@ module.exports.func4 = function () { };
>module.exports : {}
>module : { "export=": {}; }
>exports : {}
->func4 : () => void
+>func4 : any
>function () { } : () => void
var multipleDeclarationAlias1 = exports = module.exports;
@@ -256,7 +256,7 @@ exports.func11 = function () { };
>exports.func11 = function () { } : () => void
>exports.func11 : any
>exports : typeof import("./b")
->func11 : () => void
+>func11 : any
>function () { } : () => void
module.exports.func12 = function () { };
@@ -265,7 +265,7 @@ module.exports.func12 = function () { };
>module.exports : {}
>module : { "export=": {}; }
>exports : {}
->func12 : () => void
+>func12 : any
>function () { } : () => void
exports = module.exports = someOtherVariable = {};
@@ -283,7 +283,7 @@ exports.func11 = function () { };
>exports.func11 = function () { } : () => void
>exports.func11 : any
>exports : typeof import("./b")
->func11 : () => void
+>func11 : any
>function () { } : () => void
module.exports.func12 = function () { };
@@ -292,7 +292,7 @@ module.exports.func12 = function () { };
>module.exports : {}
>module : { "export=": {}; }
>exports : {}
->func12 : () => void
+>func12 : any
>function () { } : () => void
exports = module.exports = {};
@@ -308,7 +308,7 @@ exports.func13 = function () { };
>exports.func13 = function () { } : () => void
>exports.func13 : any
>exports : typeof import("./b")
->func13 : () => void
+>func13 : any
>function () { } : () => void
module.exports.func14 = function () { };
@@ -317,7 +317,7 @@ module.exports.func14 = function () { };
>module.exports : {}
>module : { "export=": {}; }
>exports : {}
->func14 : () => void
+>func14 : any
>function () { } : () => void
exports = module.exports = {};
@@ -333,7 +333,7 @@ exports.func15 = function () { };
>exports.func15 = function () { } : () => void
>exports.func15 : any
>exports : typeof import("./b")
->func15 : () => void
+>func15 : any
>function () { } : () => void
module.exports.func16 = function () { };
@@ -342,7 +342,7 @@ module.exports.func16 = function () { };
>module.exports : {}
>module : { "export=": {}; }
>exports : {}
->func16 : () => void
+>func16 : any
>function () { } : () => void
module.exports = exports = {};
@@ -358,7 +358,7 @@ exports.func17 = function () { };
>exports.func17 = function () { } : () => void
>exports.func17 : any
>exports : typeof import("./b")
->func17 : () => void
+>func17 : any
>function () { } : () => void
module.exports.func18 = function () { };
@@ -367,7 +367,7 @@ module.exports.func18 = function () { };
>module.exports : {}
>module : { "export=": {}; }
>exports : {}
->func18 : () => void
+>func18 : any
>function () { } : () => void
module.exports = {};
@@ -381,7 +381,7 @@ exports.func19 = function () { };
>exports.func19 = function () { } : () => void
>exports.func19 : any
>exports : typeof import("./b")
->func19 : () => void
+>func19 : any
>function () { } : () => void
module.exports.func20 = function () { };
@@ -390,7 +390,7 @@ module.exports.func20 = function () { };
>module.exports : {}
>module : { "export=": {}; }
>exports : {}
->func20 : () => void
+>func20 : any
>function () { } : () => void
diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAlias4.symbols b/testdata/baselines/reference/submodule/conformance/moduleExportAlias4.symbols
index 707190491a..b87494dc53 100644
--- a/testdata/baselines/reference/submodule/conformance/moduleExportAlias4.symbols
+++ b/testdata/baselines/reference/submodule/conformance/moduleExportAlias4.symbols
@@ -17,6 +17,5 @@ module.exports.D = class D { }
>module.exports : Symbol(C, Decl(bug24024.js, 2, 16))
>module : Symbol(module.exports)
>exports : Symbol(C, Decl(bug24024.js, 2, 16))
->D : Symbol(D, Decl(bug24024.js, 2, 27))
>D : Symbol(D, Decl(bug24024.js, 3, 18))
diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAlias4.symbols.diff b/testdata/baselines/reference/submodule/conformance/moduleExportAlias4.symbols.diff
index 043c63a645..eb88743e90 100644
--- a/testdata/baselines/reference/submodule/conformance/moduleExportAlias4.symbols.diff
+++ b/testdata/baselines/reference/submodule/conformance/moduleExportAlias4.symbols.diff
@@ -23,5 +23,4 @@
+>module.exports : Symbol(C, Decl(bug24024.js, 2, 16))
+>module : Symbol(module.exports)
+>exports : Symbol(C, Decl(bug24024.js, 2, 16))
-+>D : Symbol(D, Decl(bug24024.js, 2, 27))
+>D : Symbol(D, Decl(bug24024.js, 3, 18))
diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAlias4.types b/testdata/baselines/reference/submodule/conformance/moduleExportAlias4.types
index 0a70bddce0..4f19af0b72 100644
--- a/testdata/baselines/reference/submodule/conformance/moduleExportAlias4.types
+++ b/testdata/baselines/reference/submodule/conformance/moduleExportAlias4.types
@@ -9,12 +9,12 @@ var wat = require('./bug24024')
>'./bug24024' : "./bug24024"
module.exports = class C {}
->module.exports = class C {} : typeof wat
+>module.exports = class C {} : typeof C
>module.exports : typeof wat
>module : { C: typeof wat; }
>exports : typeof wat
->class C {} : typeof wat
->C : typeof wat
+>class C {} : typeof C
+>C : typeof C
module.exports.D = class D { }
>module.exports.D = class D { } : typeof D
@@ -22,7 +22,7 @@ module.exports.D = class D { }
>module.exports : typeof wat
>module : { C: typeof wat; }
>exports : typeof wat
->D : typeof D
+>D : any
>class D { } : typeof D
>D : typeof D
diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAliasElementAccessExpression.types b/testdata/baselines/reference/submodule/conformance/moduleExportAliasElementAccessExpression.types
index 7b52d06f08..e8e3ae4cbe 100644
--- a/testdata/baselines/reference/submodule/conformance/moduleExportAliasElementAccessExpression.types
+++ b/testdata/baselines/reference/submodule/conformance/moduleExportAliasElementAccessExpression.types
@@ -8,7 +8,7 @@ exports["D"] = D;
>exports["D"] = D : () => void
>exports["D"] : () => void
>exports : typeof import("./moduleExportAliasElementAccessExpression")
->"D" : () => void
+>"D" : "D"
>D : () => void
// (the only package I could find that uses spaces in identifiers is webidl-conversions)
@@ -16,6 +16,6 @@ exports["Does not work yet"] = D;
>exports["Does not work yet"] = D : () => void
>exports["Does not work yet"] : () => void
>exports : typeof import("./moduleExportAliasElementAccessExpression")
->"Does not work yet" : () => void
+>"Does not work yet" : "Does not work yet"
>D : () => void
diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAliasImported.symbols b/testdata/baselines/reference/submodule/conformance/moduleExportAliasImported.symbols
index 6f8bcd86e4..7f1206e1a5 100644
--- a/testdata/baselines/reference/submodule/conformance/moduleExportAliasImported.symbols
+++ b/testdata/baselines/reference/submodule/conformance/moduleExportAliasImported.symbols
@@ -3,7 +3,6 @@
=== bug28014.js ===
exports.version = 1
>exports : Symbol("bug28014", Decl(bug28014.js, 0, 0))
->version : Symbol(version, Decl(bug28014.js, 0, 0))
function alias() { }
>alias : Symbol(alias, Decl(bug28014.js, 0, 19))
diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAliasImported.symbols.diff b/testdata/baselines/reference/submodule/conformance/moduleExportAliasImported.symbols.diff
index 052bd5f1ab..3de71be421 100644
--- a/testdata/baselines/reference/submodule/conformance/moduleExportAliasImported.symbols.diff
+++ b/testdata/baselines/reference/submodule/conformance/moduleExportAliasImported.symbols.diff
@@ -6,8 +6,8 @@
exports.version = 1
->exports.version : Symbol(version, Decl(bug28014.js, 0, 0))
->exports : Symbol(version, Decl(bug28014.js, 0, 0))
+->version : Symbol(version, Decl(bug28014.js, 0, 0))
+>exports : Symbol("bug28014", Decl(bug28014.js, 0, 0))
- >version : Symbol(version, Decl(bug28014.js, 0, 0))
function alias() { }
>alias : Symbol(alias, Decl(bug28014.js, 0, 19))
diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAliasImported.types b/testdata/baselines/reference/submodule/conformance/moduleExportAliasImported.types
index 853d3adb4c..8aae436c98 100644
--- a/testdata/baselines/reference/submodule/conformance/moduleExportAliasImported.types
+++ b/testdata/baselines/reference/submodule/conformance/moduleExportAliasImported.types
@@ -5,7 +5,7 @@ exports.version = 1
>exports.version = 1 : 1
>exports.version : any
>exports : typeof import("./bug28014")
->version : 1
+>version : any
>1 : 1
function alias() { }
diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAliasUnknown.symbols b/testdata/baselines/reference/submodule/conformance/moduleExportAliasUnknown.symbols
index 354fc497a9..33e6b8ac42 100644
--- a/testdata/baselines/reference/submodule/conformance/moduleExportAliasUnknown.symbols
+++ b/testdata/baselines/reference/submodule/conformance/moduleExportAliasUnknown.symbols
@@ -9,5 +9,4 @@ module.exports = window.nonprop;
exports.foo = bar;
>exports : Symbol("bug27025", Decl(bug27025.js, 0, 0))
->foo : Symbol(foo, Decl(bug27025.js, 0, 32))
diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAliasUnknown.symbols.diff b/testdata/baselines/reference/submodule/conformance/moduleExportAliasUnknown.symbols.diff
index 930775c079..179701bcbd 100644
--- a/testdata/baselines/reference/submodule/conformance/moduleExportAliasUnknown.symbols.diff
+++ b/testdata/baselines/reference/submodule/conformance/moduleExportAliasUnknown.symbols.diff
@@ -14,5 +14,5 @@
exports.foo = bar;
->exports : Symbol(foo, Decl(bug27025.js, 0, 32))
+->foo : Symbol(foo, Decl(bug27025.js, 0, 32))
+>exports : Symbol("bug27025", Decl(bug27025.js, 0, 0))
- >foo : Symbol(foo, Decl(bug27025.js, 0, 32))
diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment4.symbols b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment4.symbols
index 77637d117b..723e4e6100 100644
--- a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment4.symbols
+++ b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment4.symbols
@@ -3,7 +3,6 @@
=== async.js ===
exports.default = { m: 1, a: 1 }
>exports : Symbol("async", Decl(async.js, 0, 0))
->default : Symbol(default, Decl(async.js, 0, 0))
>m : Symbol(m, Decl(async.js, 0, 19))
>a : Symbol(a, Decl(async.js, 0, 25))
diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment4.symbols.diff b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment4.symbols.diff
index b1450f31be..2ea079bfe5 100644
--- a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment4.symbols.diff
+++ b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment4.symbols.diff
@@ -5,8 +5,8 @@
=== async.js ===
exports.default = { m: 1, a: 1 }
->exports : Symbol(default, Decl(async.js, 0, 0))
+->default : Symbol(default, Decl(async.js, 0, 0))
+>exports : Symbol("async", Decl(async.js, 0, 0))
- >default : Symbol(default, Decl(async.js, 0, 0))
>m : Symbol(m, Decl(async.js, 0, 19))
>a : Symbol(a, Decl(async.js, 0, 25))
diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment4.types b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment4.types
index 2030ce4503..155e39e2e2 100644
--- a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment4.types
+++ b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment4.types
@@ -5,7 +5,7 @@ exports.default = { m: 1, a: 1 }
>exports.default = { m: 1, a: 1 } : { m: number; a: number; }
>exports.default : any
>exports : typeof import("./async")
->default : { m: number; a: number; }
+>default : any
>{ m: 1, a: 1 } : { m: number; a: number; }
>m : number
>1 : 1
diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment5.symbols b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment5.symbols
index 73fbdc5ef8..e1144e754b 100644
--- a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment5.symbols
+++ b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment5.symbols
@@ -29,6 +29,5 @@ module.exports.default = axios;
>module.exports : Symbol(axios, Decl(axios.js, 5, 3))
>module : Symbol(module.exports)
>exports : Symbol(axios, Decl(axios.js, 5, 3))
->default : Symbol(default, Decl(axios.js, 8, 23))
>axios : Symbol(axios, Decl(axios.js, 5, 3))
diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment5.symbols.diff b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment5.symbols.diff
index 3a6d0a5407..8bddad8825 100644
--- a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment5.symbols.diff
+++ b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment5.symbols.diff
@@ -33,8 +33,8 @@
->module.exports : Symbol(default, Decl(axios.js, 8, 23))
->module : Symbol(module, Decl(axios.js, 7, 9))
->exports : Symbol(module.exports, Decl(axios.js, 0, 0))
+->default : Symbol(default, Decl(axios.js, 8, 23))
+>module.exports : Symbol(axios, Decl(axios.js, 5, 3))
+>module : Symbol(module.exports)
+>exports : Symbol(axios, Decl(axios.js, 5, 3))
- >default : Symbol(default, Decl(axios.js, 8, 23))
>axios : Symbol(axios, Decl(axios.js, 5, 3))
diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment5.types b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment5.types
index 012970f595..68d421dd4e 100644
--- a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment5.types
+++ b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment5.types
@@ -34,6 +34,6 @@ module.exports.default = axios;
>module.exports : Axios
>module : { axios: Axios; }
>exports : Axios
->default : Axios
+>default : any
>axios : Axios
diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportPropertyAssignmentDefault.symbols b/testdata/baselines/reference/submodule/conformance/moduleExportPropertyAssignmentDefault.symbols
index bc9feb80c2..49ff0d0d69 100644
--- a/testdata/baselines/reference/submodule/conformance/moduleExportPropertyAssignmentDefault.symbols
+++ b/testdata/baselines/reference/submodule/conformance/moduleExportPropertyAssignmentDefault.symbols
@@ -14,6 +14,5 @@ module.exports.default = axios
>module.exports : Symbol(axios, Decl(axios.js, 0, 3))
>module : Symbol(module.exports)
>exports : Symbol(axios, Decl(axios.js, 0, 3))
->default : Symbol(default, Decl(axios.js, 1, 22))
>axios : Symbol(axios, Decl(axios.js, 0, 3))
diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportPropertyAssignmentDefault.symbols.diff b/testdata/baselines/reference/submodule/conformance/moduleExportPropertyAssignmentDefault.symbols.diff
index 0fdd48e9aa..d12f7626db 100644
--- a/testdata/baselines/reference/submodule/conformance/moduleExportPropertyAssignmentDefault.symbols.diff
+++ b/testdata/baselines/reference/submodule/conformance/moduleExportPropertyAssignmentDefault.symbols.diff
@@ -17,8 +17,8 @@
->module.exports : Symbol(default, Decl(axios.js, 1, 22))
->module : Symbol(module, Decl(axios.js, 0, 14))
->exports : Symbol(module.exports, Decl(axios.js, 0, 0))
+->default : Symbol(default, Decl(axios.js, 1, 22))
+>module.exports : Symbol(axios, Decl(axios.js, 0, 3))
+>module : Symbol(module.exports)
+>exports : Symbol(axios, Decl(axios.js, 0, 3))
- >default : Symbol(default, Decl(axios.js, 1, 22))
>axios : Symbol(axios, Decl(axios.js, 0, 3))
diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportPropertyAssignmentDefault.types b/testdata/baselines/reference/submodule/conformance/moduleExportPropertyAssignmentDefault.types
index 4d8af48105..722a2dd211 100644
--- a/testdata/baselines/reference/submodule/conformance/moduleExportPropertyAssignmentDefault.types
+++ b/testdata/baselines/reference/submodule/conformance/moduleExportPropertyAssignmentDefault.types
@@ -18,6 +18,6 @@ module.exports.default = axios
>module.exports : {}
>module : { axios: {}; }
>exports : {}
->default : {}
+>default : any
>axios : {}
diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment.symbols b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment.symbols
index 24841a0c3b..72949ef09f 100644
--- a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment.symbols
+++ b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment.symbols
@@ -34,6 +34,5 @@ module.exports.f = function (a) { }
>module.exports : Symbol(export=, Decl(mod1.js, 0, 0))
>module : Symbol(module.exports)
>exports : Symbol(export=, Decl(mod1.js, 0, 0))
->f : Symbol(f, Decl(mod1.js, 1, 32))
>a : Symbol(a, Decl(mod1.js, 3, 29))
diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment.symbols.diff b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment.symbols.diff
index 39f31df60d..1f47a437b4 100644
--- a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment.symbols.diff
+++ b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment.symbols.diff
@@ -26,8 +26,8 @@
->module.exports : Symbol(f, Decl(mod1.js, 1, 32))
->module : Symbol(module, Decl(mod1.js, 0, 0))
->exports : Symbol(module.exports, Decl(mod1.js, 0, 0))
+->f : Symbol(f, Decl(mod1.js, 1, 32))
+>module.exports : Symbol(export=, Decl(mod1.js, 0, 0))
+>module : Symbol(module.exports)
+>exports : Symbol(export=, Decl(mod1.js, 0, 0))
- >f : Symbol(f, Decl(mod1.js, 1, 32))
>a : Symbol(a, Decl(mod1.js, 3, 29))
diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment.types b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment.types
index aa185d0bff..ee42485873 100644
--- a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment.types
+++ b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment.types
@@ -43,7 +43,7 @@ module.exports.f = function (a) { }
>module.exports : () => void
>module : { "export=": () => void; }
>exports : () => void
->f : (a: any) => void
+>f : any
>function (a) { } : (a: any) => void
>a : any
diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment2.symbols b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment2.symbols
index d503b48b98..ab4d96a505 100644
--- a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment2.symbols
+++ b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment2.symbols
@@ -35,5 +35,4 @@ module.exports.f = function () { }
>module.exports : Symbol(export=, Decl(mod1.js, 0, 0))
>module : Symbol(module.exports)
>exports : Symbol(export=, Decl(mod1.js, 0, 0))
->f : Symbol(f, Decl(mod1.js, 1, 18))
diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment2.symbols.diff b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment2.symbols.diff
index f57088913f..3f7dac72aa 100644
--- a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment2.symbols.diff
+++ b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment2.symbols.diff
@@ -26,7 +26,7 @@
->module.exports : Symbol(f, Decl(mod1.js, 1, 18))
->module : Symbol(module, Decl(mod1.js, 0, 0))
->exports : Symbol(module.exports, Decl(mod1.js, 0, 0))
+->f : Symbol(f, Decl(mod1.js, 1, 18))
+>module.exports : Symbol(export=, Decl(mod1.js, 0, 0))
+>module : Symbol(module.exports)
+>exports : Symbol(export=, Decl(mod1.js, 0, 0))
- >f : Symbol(f, Decl(mod1.js, 1, 18))
diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment2.types b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment2.types
index 99ade937ce..8c1b21c209 100644
--- a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment2.types
+++ b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment2.types
@@ -45,6 +45,6 @@ module.exports.f = function () { }
>module.exports : 1
>module : { "export=": 1; }
>exports : 1
->f : () => void
+>f : any
>function () { } : () => void
diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment3.symbols b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment3.symbols
index c64bb0e83f..98651fb010 100644
--- a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment3.symbols
+++ b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment3.symbols
@@ -47,7 +47,7 @@ module.exports.bothBefore = 'string'
>module.exports : Symbol(export=, Decl(mod1.js, 1, 36))
>module : Symbol(module.exports)
>exports : Symbol(export=, Decl(mod1.js, 1, 36))
->bothBefore : Symbol(bothBefore, Decl(mod1.js, 0, 0))
+>bothBefore : Symbol(bothBefore, Decl(mod1.js, 3, 18))
module.exports = {
>module.exports : Symbol(export=, Decl(mod1.js, 1, 36))
@@ -68,11 +68,10 @@ module.exports.bothAfter = 'string'
>module.exports : Symbol(export=, Decl(mod1.js, 1, 36))
>module : Symbol(module.exports)
>exports : Symbol(export=, Decl(mod1.js, 1, 36))
->bothAfter : Symbol(bothAfter, Decl(mod1.js, 6, 1))
+>bothAfter : Symbol(bothAfter, Decl(mod1.js, 4, 18))
module.exports.justProperty = 'string'
>module.exports : Symbol(export=, Decl(mod1.js, 1, 36))
>module : Symbol(module.exports)
>exports : Symbol(export=, Decl(mod1.js, 1, 36))
->justProperty : Symbol(justProperty, Decl(mod1.js, 7, 35))
diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment3.symbols.diff b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment3.symbols.diff
index 2274077249..197654e3e3 100644
--- a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment3.symbols.diff
+++ b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment3.symbols.diff
@@ -47,11 +47,12 @@
->module.exports : Symbol(bothBefore, Decl(mod1.js, 0, 0))
->module : Symbol(module, Decl(mod1.js, 0, 0))
->exports : Symbol(module.exports, Decl(mod1.js, 0, 0))
+->bothBefore : Symbol(bothBefore, Decl(mod1.js, 0, 0))
+>module.exports.bothBefore : Symbol(bothBefore, Decl(mod1.js, 3, 18))
+>module.exports : Symbol(export=, Decl(mod1.js, 1, 36))
+>module : Symbol(module.exports)
+>exports : Symbol(export=, Decl(mod1.js, 1, 36))
- >bothBefore : Symbol(bothBefore, Decl(mod1.js, 0, 0))
++>bothBefore : Symbol(bothBefore, Decl(mod1.js, 3, 18))
module.exports = {
->module.exports : Symbol(module.exports, Decl(mod1.js, 0, 0))
@@ -69,18 +70,19 @@
->module.exports : Symbol(bothAfter, Decl(mod1.js, 6, 1))
->module : Symbol(module, Decl(mod1.js, 0, 0))
->exports : Symbol(module.exports, Decl(mod1.js, 0, 0))
+->bothAfter : Symbol(bothAfter, Decl(mod1.js, 6, 1))
+>module.exports.bothAfter : Symbol(bothAfter, Decl(mod1.js, 4, 18))
+>module.exports : Symbol(export=, Decl(mod1.js, 1, 36))
+>module : Symbol(module.exports)
+>exports : Symbol(export=, Decl(mod1.js, 1, 36))
- >bothAfter : Symbol(bothAfter, Decl(mod1.js, 6, 1))
++>bothAfter : Symbol(bothAfter, Decl(mod1.js, 4, 18))
module.exports.justProperty = 'string'
->module.exports.justProperty : Symbol(justProperty, Decl(mod1.js, 7, 35))
->module.exports : Symbol(justProperty, Decl(mod1.js, 7, 35))
->module : Symbol(module, Decl(mod1.js, 0, 0))
->exports : Symbol(module.exports, Decl(mod1.js, 0, 0))
+->justProperty : Symbol(justProperty, Decl(mod1.js, 7, 35))
+>module.exports : Symbol(export=, Decl(mod1.js, 1, 36))
+>module : Symbol(module.exports)
+>exports : Symbol(export=, Decl(mod1.js, 1, 36))
- >justProperty : Symbol(justProperty, Decl(mod1.js, 7, 35))
diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment3.types b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment3.types
index 837b8ef76b..f3b476d806 100644
--- a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment3.types
+++ b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment3.types
@@ -56,7 +56,7 @@ module.exports.bothBefore = 'string'
>module.exports : { justExport: number; bothBefore: number; bothAfter: number; }
>module : { "export=": { justExport: number; bothBefore: number; bothAfter: number; }; }
>exports : { justExport: number; bothBefore: number; bothAfter: number; }
->bothBefore : "string"
+>bothBefore : number
>'string' : "string"
module.exports = {
@@ -84,7 +84,7 @@ module.exports.bothAfter = 'string'
>module.exports : { justExport: number; bothBefore: number; bothAfter: number; }
>module : { "export=": { justExport: number; bothBefore: number; bothAfter: number; }; }
>exports : { justExport: number; bothBefore: number; bothAfter: number; }
->bothAfter : "string"
+>bothAfter : number
>'string' : "string"
module.exports.justProperty = 'string'
@@ -93,6 +93,6 @@ module.exports.justProperty = 'string'
>module.exports : { justExport: number; bothBefore: number; bothAfter: number; }
>module : { "export=": { justExport: number; bothBefore: number; bothAfter: number; }; }
>exports : { justExport: number; bothBefore: number; bothAfter: number; }
->justProperty : "string"
+>justProperty : any
>'string' : "string"
diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.symbols b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.symbols
index 996bd6e42d..b236c055da 100644
--- a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.symbols
+++ b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.symbols
@@ -47,7 +47,7 @@ module.exports.bothBefore = 'string'
>module.exports : Symbol(A, Decl(mod1.js, 5, 18))
>module : Symbol(module.exports)
>exports : Symbol(A, Decl(mod1.js, 5, 18))
->bothBefore : Symbol(bothBefore, Decl(mod1.js, 0, 0))
+>bothBefore : Symbol(bothBefore, Decl(mod1.js, 2, 16))
A.justExport = 4
>A.justExport : Symbol(justExport, Decl(mod1.js, 1, 36))
@@ -80,11 +80,10 @@ module.exports.bothAfter = 'string'
>module.exports : Symbol(A, Decl(mod1.js, 5, 18))
>module : Symbol(module.exports)
>exports : Symbol(A, Decl(mod1.js, 5, 18))
->bothAfter : Symbol(bothAfter, Decl(mod1.js, 8, 1))
+>bothAfter : Symbol(bothAfter, Decl(mod1.js, 3, 16))
module.exports.justProperty = 'string'
>module.exports : Symbol(A, Decl(mod1.js, 5, 18))
>module : Symbol(module.exports)
>exports : Symbol(A, Decl(mod1.js, 5, 18))
->justProperty : Symbol(justProperty, Decl(mod1.js, 9, 35))
diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.symbols.diff b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.symbols.diff
index b077f732f4..1c0d1c740e 100644
--- a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.symbols.diff
+++ b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.symbols.diff
@@ -54,7 +54,7 @@
+>module.exports : Symbol(A, Decl(mod1.js, 5, 18))
+>module : Symbol(module.exports)
+>exports : Symbol(A, Decl(mod1.js, 5, 18))
-+>bothBefore : Symbol(bothBefore, Decl(mod1.js, 0, 0))
++>bothBefore : Symbol(bothBefore, Decl(mod1.js, 2, 16))
A.justExport = 4
->A.justExport : Symbol(A.justExport, Decl(mod1.js, 1, 36))
@@ -109,14 +109,14 @@
+>module.exports : Symbol(A, Decl(mod1.js, 5, 18))
+>module : Symbol(module.exports)
+>exports : Symbol(A, Decl(mod1.js, 5, 18))
-+>bothAfter : Symbol(bothAfter, Decl(mod1.js, 8, 1))
++>bothAfter : Symbol(bothAfter, Decl(mod1.js, 3, 16))
module.exports.justProperty = 'string'
->module.exports.justProperty : Symbol(justProperty, Decl(mod1.js, 9, 35))
->module.exports : Symbol(justProperty, Decl(mod1.js, 9, 35))
->module : Symbol(module, Decl(mod1.js, 0, 0))
->exports : Symbol(module.exports, Decl(mod1.js, 0, 0))
+->justProperty : Symbol(justProperty, Decl(mod1.js, 9, 35))
+>module.exports : Symbol(A, Decl(mod1.js, 5, 18))
+>module : Symbol(module.exports)
+>exports : Symbol(A, Decl(mod1.js, 5, 18))
- >justProperty : Symbol(justProperty, Decl(mod1.js, 9, 35))
diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.types b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.types
index f39707c789..48e342babc 100644
--- a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.types
+++ b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.types
@@ -56,7 +56,7 @@ module.exports.bothBefore = 'string'
>module.exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; }
>module : { A: { (): void; justExport: number; bothBefore: number; bothAfter: number; }; }
>exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; }
->bothBefore : "string"
+>bothBefore : number
>'string' : "string"
A.justExport = 4
@@ -103,7 +103,7 @@ module.exports.bothAfter = 'string'
>module.exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; }
>module : { A: { (): void; justExport: number; bothBefore: number; bothAfter: number; }; }
>exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; }
->bothAfter : "string"
+>bothAfter : number
>'string' : "string"
module.exports.justProperty = 'string'
@@ -112,6 +112,6 @@ module.exports.justProperty = 'string'
>module.exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; }
>module : { A: { (): void; justExport: number; bothBefore: number; bothAfter: number; }; }
>exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; }
->justProperty : "string"
+>justProperty : any
>'string' : "string"
diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportsElementAccessAssignment.types b/testdata/baselines/reference/submodule/conformance/moduleExportsElementAccessAssignment.types
index 861ad3cd3e..c84643db7c 100644
--- a/testdata/baselines/reference/submodule/conformance/moduleExportsElementAccessAssignment.types
+++ b/testdata/baselines/reference/submodule/conformance/moduleExportsElementAccessAssignment.types
@@ -53,7 +53,7 @@ exports["b"] = { x: "x" };
>exports["b"] = { x: "x" } : { x: string; }
>exports["b"] : { x: string; }
>exports : typeof import("./mod1")
->"b" : { x: string; }
+>"b" : "b"
>{ x: "x" } : { x: string; }
>x : string
>"x" : "x"
@@ -62,7 +62,7 @@ exports["default"] = { x: "x" };
>exports["default"] = { x: "x" } : { x: string; }
>exports["default"] : { x: string; }
>exports : typeof import("./mod1")
->"default" : { x: string; }
+>"default" : "default"
>{ x: "x" } : { x: string; }
>x : string
>"x" : "x"
@@ -73,7 +73,7 @@ module.exports["c"] = { x: "x" };
>module.exports : typeof import("./mod1")
>module : { "\"mod1\"": typeof import("./mod1"); }
>exports : typeof import("./mod1")
->"c" : { x: string; }
+>"c" : "c"
>{ x: "x" } : { x: string; }
>x : string
>"x" : "x"
@@ -84,7 +84,7 @@ module["exports"]["d"] = {};
>module["exports"] : typeof import("./mod1")
>module : { "\"mod1\"": typeof import("./mod1"); }
>"exports" : "exports"
->"d" : {}
+>"d" : "d"
>{} : {}
module["exports"]["d"].e = 0;
diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.symbols b/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.symbols
index 859b7d29e7..2104a285c8 100644
--- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.symbols
+++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.symbols
@@ -30,7 +30,6 @@ class Foo { } // should error
/** @typedef {number} Bar */
exports.Bar = class { }
>exports : Symbol("mod1", Decl(mod1.js, 0, 0))
->Bar : Symbol(Bar, Decl(mod1.js, 5, 4), Decl(mod1.js, 3, 13))
/** @typedef {number} Baz */
module.exports = {
@@ -51,7 +50,6 @@ var Qux = 2;
/** @typedef {number} Quid */
exports.Quid = 2;
>exports : Symbol("mod1", Decl(mod1.js, 0, 0))
->Quid : Symbol(Quid, Decl(mod1.js, 18, 4), Decl(mod1.js, 16, 12))
/** @typedef {number} Quack */
module.exports = {
diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.symbols.diff b/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.symbols.diff
index ad7f9a063e..b01cc9dce5 100644
--- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.symbols.diff
+++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.symbols.diff
@@ -24,7 +24,6 @@
->exports : Symbol(Bar, Decl(mod1.js, 3, 13), Decl(mod1.js, 5, 4))
->Bar : Symbol(Bar, Decl(mod1.js, 3, 13), Decl(mod1.js, 5, 4))
+>exports : Symbol("mod1", Decl(mod1.js, 0, 0))
-+>Bar : Symbol(Bar, Decl(mod1.js, 5, 4), Decl(mod1.js, 3, 13))
/** @typedef {number} Baz */
module.exports = {
@@ -37,7 +36,7 @@
Baz: class { }
>Baz : Symbol(Baz, Decl(mod1.js, 9, 18))
-@@= skipped -31, +30 lines =@@
+@@= skipped -31, +29 lines =@@
/** @typedef {number} Qux */
var Qux = 2;
@@ -50,7 +49,6 @@
->exports : Symbol(Quid, Decl(mod1.js, 16, 12), Decl(mod1.js, 18, 4))
->Quid : Symbol(Quid, Decl(mod1.js, 16, 12), Decl(mod1.js, 18, 4))
+>exports : Symbol("mod1", Decl(mod1.js, 0, 0))
-+>Quid : Symbol(Quid, Decl(mod1.js, 18, 4), Decl(mod1.js, 16, 12))
/** @typedef {number} Quack */
module.exports = {
diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.types b/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.types
index ccb1bf27ab..e597356b31 100644
--- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.types
+++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.types
@@ -34,7 +34,7 @@ exports.Bar = class { }
>exports.Bar = class { } : typeof Bar
>exports.Bar : any
>exports : typeof import("./mod1")
->Bar : typeof Bar
+>Bar : any
>class { } : typeof Bar
/** @typedef {number} Baz */
@@ -62,7 +62,7 @@ exports.Quid = 2;
>exports.Quid = 2 : 2
>exports.Quid : any
>exports : typeof import("./mod1")
->Quid : 2
+>Quid : any
>2 : 2
/** @typedef {number} Quack */
diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsExportAssignmentNonMutableLocation.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsExportAssignmentNonMutableLocation.types.diff
index 848456ac7f..9cf27815e6 100644
--- a/testdata/baselines/reference/submoduleAccepted/compiler/jsExportAssignmentNonMutableLocation.types.diff
+++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsExportAssignmentNonMutableLocation.types.diff
@@ -27,7 +27,7 @@
+>exports.customSymbol2 = Symbol("custom") : symbol
+>exports.customSymbol2 : any
+>exports : typeof import("./file")
-+>customSymbol2 : symbol
++>customSymbol2 : any
+>Symbol("custom") : symbol
>Symbol : SymbolConstructor
>"custom" : "custom"
diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsExportMemberMergedWithModuleAugmentation3.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsExportMemberMergedWithModuleAugmentation3.types.diff
index 43753a1571..0d098f61be 100644
--- a/testdata/baselines/reference/submoduleAccepted/compiler/jsExportMemberMergedWithModuleAugmentation3.types.diff
+++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsExportMemberMergedWithModuleAugmentation3.types.diff
@@ -8,11 +8,12 @@
->module.exports : typeof import("/y")
->module : { exports: typeof import("/y"); }
->exports : typeof import("/y")
+->x : 1
+>module.exports.x : any
+>module.exports : typeof import("./y.js")
+>module : { "export=": typeof import("./y.js"); }
+>exports : typeof import("./y.js")
- >x : 1
++>x : any
>1 : 1
module.exports = require("./y.js");
diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/commonJSAliasedExport.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/commonJSAliasedExport.types.diff
index cb7ae9e15e..77a534523c 100644
--- a/testdata/baselines/reference/submoduleAccepted/conformance/commonJSAliasedExport.types.diff
+++ b/testdata/baselines/reference/submoduleAccepted/conformance/commonJSAliasedExport.types.diff
@@ -40,9 +40,10 @@
->module.exports : { (ast: any): any; funky: (declaration: any) => boolean; }
->module : { exports: { (ast: any): any; funky: (declaration: any) => boolean; }; }
->exports : { (ast: any): any; funky: (declaration: any) => boolean; }
+->funky : (declaration: any) => boolean
+>module.exports.funky : any
+>module.exports : (ast: any) => any
+>module : { readonly donkey: (ast: any) => any; }
+>exports : (ast: any) => any
- >funky : (declaration: any) => boolean
++>funky : any
>funky : (declaration: any) => boolean
diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClassExtendsVisibility.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClassExtendsVisibility.types.diff
index 3131e07864..90fb3fbf2c 100644
--- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClassExtendsVisibility.types.diff
+++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClassExtendsVisibility.types.diff
@@ -17,8 +17,11 @@
->module : { exports: typeof Foo; }
+>module : { Foo: typeof Foo; }
>exports : typeof Foo
+->Strings : { a: string; b: string; }
++>Strings : any
>Strings : { a: string; b: string; }
- >Strings : { a: string; b: string; }
+
+ === bar.js ===
@@= skipped -20, +20 lines =@@
module.exports = Bar;
>module.exports = Bar : typeof Bar
diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClassStatic.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClassStatic.types.diff
index 25e8e64f18..2366108956 100644
--- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClassStatic.types.diff
+++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClassStatic.types.diff
@@ -17,5 +17,8 @@
->module : { exports: typeof Handler; }
+>module : { Handler: typeof Handler; }
>exports : typeof Handler
+->Strings : { a: string; b: string; }
++>Strings : any
>Strings : { a: string; b: string; }
- >Strings : { a: string; b: string; }
\ No newline at end of file
+
+ /**
\ No newline at end of file
diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsCrossfileMerge.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsCrossfileMerge.types.diff
index 13a3d346f8..72e62b10b6 100644
--- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsCrossfileMerge.types.diff
+++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsCrossfileMerge.types.diff
@@ -24,11 +24,12 @@
->module.exports : typeof m.default
->module : { exports: typeof m.default; }
->exports : typeof m.default
+->memberName : "thing"
+>module.exports.memberName : any
+>module.exports : () => void
+>module : { validate(): void; }
+>exports : () => void
- >memberName : "thing"
++>memberName : any
>"thing" : "thing"
=== exporter.js ===
diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedClassExpression.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedClassExpression.types.diff
index 0d960581f2..cb577be40b 100644
--- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedClassExpression.types.diff
+++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedClassExpression.types.diff
@@ -10,12 +10,12 @@
->exports : typeof import("index")
->class Thing { /** * @param {number} p */ constructor(p) { this.t = 12 + p; }} : typeof import("index")
->Thing : typeof import("index")
-+>module.exports = class Thing { /** * @param {number} p */ constructor(p) { this.t = 12 + p; }} : typeof import(".")
-+>module.exports : typeof import(".")
-+>module : { Thing: typeof import("."); }
-+>exports : typeof import(".")
-+>class Thing { /** * @param {number} p */ constructor(p) { this.t = 12 + p; }} : typeof import(".")
-+>Thing : typeof import(".")
++>module.exports = class Thing { /** * @param {number} p */ constructor(p) { this.t = 12 + p; }} : typeof Thing
++>module.exports : typeof Thing
++>module : { Thing: typeof Thing; }
++>exports : typeof Thing
++>class Thing { /** * @param {number} p */ constructor(p) { this.t = 12 + p; }} : typeof Thing
++>Thing : typeof Thing
/**
* @param {number} p
diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedClassExpressionAnonymous.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedClassExpressionAnonymous.types.diff
index 4d7c3fe356..d73eb4f4b1 100644
--- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedClassExpressionAnonymous.types.diff
+++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedClassExpressionAnonymous.types.diff
@@ -9,11 +9,11 @@
->module : { exports: typeof import("index"); }
->exports : typeof import("index")
->class { /** * @param {number} p */ constructor(p) { this.t = 12 + p; }} : typeof import("index")
-+>module.exports = class { /** * @param {number} p */ constructor(p) { this.t = 12 + p; }} : typeof import(".")
-+>module.exports : typeof import(".")
-+>module : { "\uFFFDclass": typeof import("."); }
-+>exports : typeof import(".")
-+>class { /** * @param {number} p */ constructor(p) { this.t = 12 + p; }} : typeof import(".")
++>module.exports = class { /** * @param {number} p */ constructor(p) { this.t = 12 + p; }} : typeof exports
++>module.exports : typeof (Anonymous class)
++>module : { "\uFFFDclass": typeof (Anonymous class); }
++>exports : typeof (Anonymous class)
++>class { /** * @param {number} p */ constructor(p) { this.t = 12 + p; }} : typeof exports
/**
* @param {number} p
diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.errors.txt.diff
index b6ab682031..2fed47c399 100644
--- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.errors.txt.diff
+++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.errors.txt.diff
@@ -3,7 +3,7 @@
@@= skipped -0, +0 lines =@@
-
+index.js(1,1): error TS2309: An export assignment cannot be used in a module with other exported elements.
-+index.js(9,16): error TS2339: Property 'Sub' does not exist on type 'typeof exports'.
++index.js(9,16): error TS2339: Property 'Sub' does not exist on type 'typeof (Anonymous class)'.
+
+
+==== index.js (2 errors) ====
@@ -26,7 +26,7 @@
+!!! error TS2309: An export assignment cannot be used in a module with other exported elements.
+ module.exports.Sub = class {
+ ~~~
-+!!! error TS2339: Property 'Sub' does not exist on type 'typeof exports'.
++!!! error TS2339: Property 'Sub' does not exist on type 'typeof (Anonymous class)'.
+ constructor() {
+ this.instance = new module.exports(10);
+ }
diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.types.diff
index c325c55012..8bac1ac16d 100644
--- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.types.diff
+++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.types.diff
@@ -9,11 +9,11 @@
->module : { exports: typeof import("index"); }
->exports : typeof import("index")
->class { /** * @param {number} p */ constructor(p) { this.t = 12 + p; }} : typeof import("index")
-+>module.exports = class { /** * @param {number} p */ constructor(p) { this.t = 12 + p; }} : typeof import(".")
-+>module.exports : typeof import(".")
-+>module : { "\uFFFDclass": typeof import("."); }
-+>exports : typeof import(".")
-+>class { /** * @param {number} p */ constructor(p) { this.t = 12 + p; }} : typeof import(".")
++>module.exports = class { /** * @param {number} p */ constructor(p) { this.t = 12 + p; }} : typeof exports
++>module.exports : typeof (Anonymous class)
++>module : { "\uFFFDclass": typeof (Anonymous class); }
++>exports : typeof (Anonymous class)
++>class { /** * @param {number} p */ constructor(p) { this.t = 12 + p; }} : typeof exports
/**
* @param {number} p
@@ -37,30 +37,31 @@
->module.exports : typeof import("index")
->module : { exports: typeof import("index"); }
->exports : typeof import("index")
+->Sub : typeof Sub
+>module.exports.Sub : any
-+>module.exports : typeof import(".")
-+>module : { "\uFFFDclass": typeof import("."); }
-+>exports : typeof import(".")
- >Sub : typeof Sub
++>module.exports : typeof (Anonymous class)
++>module : { "\uFFFDclass": typeof (Anonymous class); }
++>exports : typeof (Anonymous class)
++>Sub : any
>class { constructor() { this.instance = new module.exports(10); }} : typeof Sub
constructor() {
this.instance = new module.exports(10);
->this.instance = new module.exports(10) : import("index")
->this.instance : any
-+>this.instance = new module.exports(10) : import(".")
-+>this.instance : import(".")
++>this.instance = new module.exports(10) : (Anonymous class)
++>this.instance : (Anonymous class)
>this : this
->instance : any
->new module.exports(10) : import("index")
->module.exports : typeof import("index")
->module : { exports: typeof import("index"); }
->exports : typeof import("index")
-+>instance : import(".")
-+>new module.exports(10) : import(".")
-+>module.exports : typeof import(".")
-+>module : { "\uFFFDclass": typeof import("."); }
-+>exports : typeof import(".")
++>instance : (Anonymous class)
++>new module.exports(10) : (Anonymous class)
++>module.exports : typeof (Anonymous class)
++>module : { "\uFFFDclass": typeof (Anonymous class); }
++>exports : typeof (Anonymous class)
>10 : 10
}
}
\ No newline at end of file
diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedClassExpressionShadowing.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedClassExpressionShadowing.types.diff
index e3d1c5685d..912ed2d996 100644
--- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedClassExpressionShadowing.types.diff
+++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedClassExpressionShadowing.types.diff
@@ -10,12 +10,12 @@
->exports : typeof import("index")
->class Q { constructor() { this.x = new A(); }} : typeof import("index")
->Q : typeof import("index")
-+>module.exports = class Q { constructor() { this.x = new A(); }} : typeof import(".")
-+>module.exports : typeof import(".")
-+>module : { Q: typeof import("."); }
-+>exports : typeof import(".")
-+>class Q { constructor() { this.x = new A(); }} : typeof import(".")
-+>Q : typeof import(".")
++>module.exports = class Q { constructor() { this.x = new A(); }} : typeof Q
++>module.exports : typeof Q
++>module : { Q: typeof Q; }
++>exports : typeof Q
++>class Q { constructor() { this.x = new A(); }} : typeof Q
++>Q : typeof Q
constructor() {
this.x = new A();
@@ -35,9 +35,10 @@
->module.exports : typeof import("index")
->module : { exports: typeof import("index"); }
->exports : typeof import("index")
+->Another : typeof Q
+>module.exports.Another : any
-+>module.exports : typeof import(".")
-+>module : { Q: typeof import("."); }
-+>exports : typeof import(".")
- >Another : typeof Q
++>module.exports : typeof Q
++>module : { Q: typeof Q; }
++>exports : typeof Q
++>Another : any
>Q : typeof Q
diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedClassInstance3.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedClassInstance3.types.diff
index 145c4adaaf..a8e58d7687 100644
--- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedClassInstance3.types.diff
+++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedClassInstance3.types.diff
@@ -21,9 +21,10 @@
->module.exports : { member: number; additional: 20; }
->module : { exports: { member: number; additional: 20; }; }
->exports : { member: number; additional: 20; }
+->additional : 20
+>module.exports.additional : any
+>module.exports : Foo
+>module : { "export=": Foo; }
+>exports : Foo
- >additional : 20
++>additional : any
>20 : 20
diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedConstructorFunctionWithSub.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedConstructorFunctionWithSub.types.diff
index 2cc9e8cb17..61fe270fcd 100644
--- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedConstructorFunctionWithSub.types.diff
+++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedConstructorFunctionWithSub.types.diff
@@ -43,7 +43,7 @@
+>module.exports : (p: any) => void
+>module : { "export=": (p: any) => void; }
+>exports : (p: any) => void
-+>Sub : () => void
++>Sub : any
+>function() { this.instance = new module.exports(10);} : () => void
this.instance = new module.exports(10);
diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedVisibility.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedVisibility.types.diff
index b47289a907..b5c033e5f6 100644
--- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedVisibility.types.diff
+++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedVisibility.types.diff
@@ -29,12 +29,12 @@
->exports : typeof import("obj")
->class Obj { constructor() { this.x = 12; }} : typeof import("obj")
->Obj : typeof import("obj")
-+>module.exports = class Obj { constructor() { this.x = 12; }} : typeof import("./obj")
-+>module.exports : typeof import("./obj")
-+>module : { Obj: typeof import("./obj"); }
-+>exports : typeof import("./obj")
-+>class Obj { constructor() { this.x = 12; }} : typeof import("./obj")
-+>Obj : typeof import("./obj")
++>module.exports = class Obj { constructor() { this.x = 12; }} : typeof Obj
++>module.exports : typeof Obj
++>module : { Obj: typeof Obj; }
++>exports : typeof Obj
++>class Obj { constructor() { this.x = 12; }} : typeof Obj
++>Obj : typeof Obj
constructor() {
this.x = 12;
diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignmentExpressionPlusSecondary.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignmentExpressionPlusSecondary.types.diff
index 70bcd2d5e4..96c4f08cc2 100644
--- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignmentExpressionPlusSecondary.types.diff
+++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignmentExpressionPlusSecondary.types.diff
@@ -23,9 +23,10 @@
->module.exports : { thing: string; also: string; desc: { item: string; }; Strings: { a: string; b: string; }; }
->module : { exports: { thing: string; also: string; desc: { item: string; }; Strings: { a: string; b: string; }; }; }
->exports : { thing: string; also: string; desc: { item: string; }; Strings: { a: string; b: string; }; }
+->Strings : { a: string; b: string; }
+>module.exports.Strings : any
+>module.exports : { thing: string; also: string; desc: { item: string; }; }
+>module : { "export=": { thing: string; also: string; desc: { item: string; }; }; }
+>exports : { thing: string; also: string; desc: { item: string; }; }
- >Strings : { a: string; b: string; }
++>Strings : any
>Strings : { a: string; b: string; }
diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportDoubleAssignmentInClosure.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportDoubleAssignmentInClosure.types.diff
index 9a119ca258..ffb4c2c0cf 100644
--- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportDoubleAssignmentInClosure.types.diff
+++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportDoubleAssignmentInClosure.types.diff
@@ -46,8 +46,7 @@
>exports.methods = m : () => void
>exports.methods : any
->exports : any
-->methods : any
+>exports : typeof import(".")
-+>methods : () => void
+ >methods : any
>m : () => void
- }
+ }
\ No newline at end of file
diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportSubAssignments.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportSubAssignments.types.diff
index 7544619a0d..b518598bbc 100644
--- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportSubAssignments.types.diff
+++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportSubAssignments.types.diff
@@ -17,5 +17,6 @@
->module : { exports: typeof Foo; }
+>module : { Foo: typeof Foo; }
>exports : typeof Foo
+->Strings : { a: string; b: string; }
++>Strings : any
>Strings : { a: string; b: string; }
- >Strings : { a: string; b: string; }
\ No newline at end of file
diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImportType2.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImportType2.types.diff
index 2146881d0b..7b7bbcc005 100644
--- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImportType2.types.diff
+++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImportType2.types.diff
@@ -10,12 +10,12 @@
->exports : typeof import("mod1")
->class Chunk { constructor() { this.chunk = 1; }} : typeof import("mod1")
->Chunk : typeof import("mod1")
-+>module.exports = class Chunk { constructor() { this.chunk = 1; }} : typeof import("./mod1")
-+>module.exports : typeof import("./mod1")
-+>module : { Chunk: typeof import("./mod1"); }
-+>exports : typeof import("./mod1")
-+>class Chunk { constructor() { this.chunk = 1; }} : typeof import("./mod1")
-+>Chunk : typeof import("./mod1")
++>module.exports = class Chunk { constructor() { this.chunk = 1; }} : typeof Chunk
++>module.exports : typeof Chunk
++>module : { Chunk: typeof Chunk; }
++>exports : typeof Chunk
++>class Chunk { constructor() { this.chunk = 1; }} : typeof Chunk
++>Chunk : typeof Chunk
constructor() {
this.chunk = 1;
diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfClassExpression.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfClassExpression.types.diff
index 23c7215e5f..813b28574d 100644
--- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfClassExpression.types.diff
+++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfClassExpression.types.diff
@@ -10,12 +10,12 @@
->exports : typeof import("MC")
->class MC { watch() { return new MW(this); }} : typeof import("MC")
->MC : typeof import("MC")
-+>module.exports = class MC { watch() { return new MW(this); }} : typeof import("./MC")
-+>module.exports : typeof import("./MC")
-+>module : { MC: typeof import("./MC"); }
-+>exports : typeof import("./MC")
-+>class MC { watch() { return new MW(this); }} : typeof import("./MC")
-+>MC : typeof import("./MC")
++>module.exports = class MC { watch() { return new MW(this); }} : typeof MC
++>module.exports : typeof MC
++>module : { MC: typeof MC; }
++>exports : typeof MC
++>class MC { watch() { return new MW(this); }} : typeof MC
++>MC : typeof MC
watch() {
>watch : () => MW
@@ -24,18 +24,18 @@
*/
constructor(compiler) {
->compiler : import("MC")
-+>compiler : import("./MC")
++>compiler : MC
this.compiler = compiler;
->this.compiler = compiler : import("MC")
->this.compiler : any
-+>this.compiler = compiler : import("./MC")
-+>this.compiler : import("./MC")
++>this.compiler = compiler : MC
++>this.compiler : MC
>this : this
->compiler : any
->compiler : import("MC")
-+>compiler : import("./MC")
-+>compiler : import("./MC")
++>compiler : MC
++>compiler : MC
}
}
diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAlias.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAlias.types.diff
index 7280e45e16..91276e3db0 100644
--- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAlias.types.diff
+++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAlias.types.diff
@@ -189,9 +189,10 @@
>exports.func2 = function () { } : () => void
->exports.func2 : () => void
->exports : typeof import("b")
+->func2 : () => void
+>exports.func2 : any
+>exports : typeof import("./b")
- >func2 : () => void
++>func2 : any
>function () { } : () => void
var moduleExportsAlias = module.exports;
@@ -220,11 +221,12 @@
->module.exports : typeof module.exports
->module : { exports: typeof module.exports; }
->exports : typeof module.exports
+->func4 : () => void
+>module.exports.func4 : any
+>module.exports : {}
+>module : { "export=": {}; }
+>exports : {}
- >func4 : () => void
++>func4 : any
>function () { } : () => void
var multipleDeclarationAlias1 = exports = module.exports;
@@ -368,87 +370,117 @@
->multipleDeclarationAlias6.func10 : () => void
->multipleDeclarationAlias6 : typeof module.exports
->func10 : () => void
-+>multipleDeclarationAlias6.func10 : any
-+>multipleDeclarationAlias6 : {}
-+>func10 : any
- >function () { } : () => void
-
- exports = module.exports = someOtherVariable = {};
+->function () { } : () => void
+-
+-exports = module.exports = someOtherVariable = {};
->exports = module.exports = someOtherVariable = {} : typeof module.exports
->exports : typeof import("b")
->module.exports = someOtherVariable = {} : typeof module.exports
->module.exports : typeof module.exports
->module : { exports: typeof module.exports; }
->exports : typeof module.exports
-+>exports = module.exports = someOtherVariable = {} : {}
-+>exports : any
-+>module.exports = someOtherVariable = {} : {}
-+>module.exports : {}
-+>module : { "export=": {}; }
-+>exports : {}
- >someOtherVariable = {} : {}
- >someOtherVariable : any
- >{} : {}
-
- exports.func11 = function () { };
- >exports.func11 = function () { } : () => void
+->someOtherVariable = {} : {}
+->someOtherVariable : any
+->{} : {}
+-
+-exports.func11 = function () { };
+->exports.func11 = function () { } : () => void
->exports.func11 : () => void
->exports : typeof import("b")
-+>exports.func11 : any
-+>exports : typeof import("./b")
- >func11 : () => void
- >function () { } : () => void
-
- module.exports.func12 = function () { };
- >module.exports.func12 = function () { } : () => void
+->func11 : () => void
+->function () { } : () => void
+-
+-module.exports.func12 = function () { };
+->module.exports.func12 = function () { } : () => void
->module.exports.func12 : () => void
->module.exports : typeof module.exports
->module : { exports: typeof module.exports; }
->exports : typeof module.exports
-+>module.exports.func12 : any
-+>module.exports : {}
-+>module : { "export=": {}; }
-+>exports : {}
- >func12 : () => void
- >function () { } : () => void
-
- exports = module.exports = someOtherVariable = {};
+->func12 : () => void
+->function () { } : () => void
+-
+-exports = module.exports = someOtherVariable = {};
->exports = module.exports = someOtherVariable = {} : typeof module.exports
->exports : typeof import("b")
->module.exports = someOtherVariable = {} : typeof module.exports
->module.exports : typeof module.exports
->module : { exports: typeof module.exports; }
->exports : typeof module.exports
+->someOtherVariable = {} : {}
+->someOtherVariable : any
+->{} : {}
+-
+-exports.func11 = function () { };
+->exports.func11 = function () { } : () => void
+->exports.func11 : () => void
+->exports : typeof import("b")
+->func11 : () => void
+->function () { } : () => void
+-
+-module.exports.func12 = function () { };
+->module.exports.func12 = function () { } : () => void
+->module.exports.func12 : () => void
+->module.exports : typeof module.exports
+->module : { exports: typeof module.exports; }
+->exports : typeof module.exports
+->func12 : () => void
++>multipleDeclarationAlias6.func10 : any
++>multipleDeclarationAlias6 : {}
++>func10 : any
++>function () { } : () => void
++
++exports = module.exports = someOtherVariable = {};
+>exports = module.exports = someOtherVariable = {} : {}
+>exports : any
+>module.exports = someOtherVariable = {} : {}
+>module.exports : {}
+>module : { "export=": {}; }
+>exports : {}
- >someOtherVariable = {} : {}
- >someOtherVariable : any
- >{} : {}
-
- exports.func11 = function () { };
- >exports.func11 = function () { } : () => void
-->exports.func11 : () => void
-->exports : typeof import("b")
++>someOtherVariable = {} : {}
++>someOtherVariable : any
++>{} : {}
++
++exports.func11 = function () { };
++>exports.func11 = function () { } : () => void
+>exports.func11 : any
+>exports : typeof import("./b")
- >func11 : () => void
- >function () { } : () => void
-
- module.exports.func12 = function () { };
- >module.exports.func12 = function () { } : () => void
-->module.exports.func12 : () => void
-->module.exports : typeof module.exports
-->module : { exports: typeof module.exports; }
-->exports : typeof module.exports
++>func11 : any
++>function () { } : () => void
++
++module.exports.func12 = function () { };
++>module.exports.func12 = function () { } : () => void
++>module.exports.func12 : any
++>module.exports : {}
++>module : { "export=": {}; }
++>exports : {}
++>func12 : any
++>function () { } : () => void
++
++exports = module.exports = someOtherVariable = {};
++>exports = module.exports = someOtherVariable = {} : {}
++>exports : any
++>module.exports = someOtherVariable = {} : {}
++>module.exports : {}
++>module : { "export=": {}; }
++>exports : {}
++>someOtherVariable = {} : {}
++>someOtherVariable : any
++>{} : {}
++
++exports.func11 = function () { };
++>exports.func11 = function () { } : () => void
++>exports.func11 : any
++>exports : typeof import("./b")
++>func11 : any
++>function () { } : () => void
++
++module.exports.func12 = function () { };
++>module.exports.func12 = function () { } : () => void
+>module.exports.func12 : any
+>module.exports : {}
+>module : { "export=": {}; }
+>exports : {}
- >func12 : () => void
++>func12 : any
>function () { } : () => void
exports = module.exports = {};
@@ -470,9 +502,10 @@
>exports.func13 = function () { } : () => void
->exports.func13 : () => void
->exports : typeof import("b")
+->func13 : () => void
+>exports.func13 : any
+>exports : typeof import("./b")
- >func13 : () => void
++>func13 : any
>function () { } : () => void
module.exports.func14 = function () { };
@@ -481,11 +514,12 @@
->module.exports : typeof module.exports
->module : { exports: typeof module.exports; }
->exports : typeof module.exports
+->func14 : () => void
+>module.exports.func14 : any
+>module.exports : {}
+>module : { "export=": {}; }
+>exports : {}
- >func14 : () => void
++>func14 : any
>function () { } : () => void
exports = module.exports = {};
@@ -507,9 +541,10 @@
>exports.func15 = function () { } : () => void
->exports.func15 : () => void
->exports : typeof import("b")
+->func15 : () => void
+>exports.func15 : any
+>exports : typeof import("./b")
- >func15 : () => void
++>func15 : any
>function () { } : () => void
module.exports.func16 = function () { };
@@ -518,11 +553,12 @@
->module.exports : typeof module.exports
->module : { exports: typeof module.exports; }
->exports : typeof module.exports
+->func16 : () => void
+>module.exports.func16 : any
+>module.exports : {}
+>module : { "export=": {}; }
+>exports : {}
- >func16 : () => void
++>func16 : any
>function () { } : () => void
module.exports = exports = {};
@@ -543,9 +579,10 @@
>exports.func17 = function () { } : () => void
->exports.func17 : () => void
->exports : typeof import("b")
+->func17 : () => void
+>exports.func17 : any
+>exports : typeof import("./b")
- >func17 : () => void
++>func17 : any
>function () { } : () => void
module.exports.func18 = function () { };
@@ -554,11 +591,12 @@
->module.exports : typeof module.exports
->module : { exports: typeof module.exports; }
->exports : typeof module.exports
+->func18 : () => void
+>module.exports.func18 : any
+>module.exports : {}
+>module : { "export=": {}; }
+>exports : {}
- >func18 : () => void
++>func18 : any
>function () { } : () => void
module.exports = {};
@@ -576,9 +614,10 @@
>exports.func19 = function () { } : () => void
->exports.func19 : () => void
->exports : typeof import("b")
+->func19 : () => void
+>exports.func19 : any
+>exports : typeof import("./b")
- >func19 : () => void
++>func19 : any
>function () { } : () => void
module.exports.func20 = function () { };
@@ -587,9 +626,11 @@
->module.exports : typeof module.exports
->module : { exports: typeof module.exports; }
->exports : typeof module.exports
+->func20 : () => void
+>module.exports.func20 : any
+>module.exports : {}
+>module : { "export=": {}; }
+>exports : {}
- >func20 : () => void
++>func20 : any
>function () { } : () => void
+
diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAlias4.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAlias4.types.diff
index 68d1637176..dc7c57f3aa 100644
--- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAlias4.types.diff
+++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAlias4.types.diff
@@ -1,14 +1,19 @@
--- old.moduleExportAlias4.types
+++ new.moduleExportAlias4.types
-@@= skipped -10, +10 lines =@@
+@@= skipped -8, +8 lines =@@
+ >'./bug24024' : "./bug24024"
+
module.exports = class C {}
- >module.exports = class C {} : typeof wat
+->module.exports = class C {} : typeof wat
++>module.exports = class C {} : typeof C
>module.exports : typeof wat
->module : { exports: typeof wat; }
+>module : { C: typeof wat; }
>exports : typeof wat
- >class C {} : typeof wat
- >C : typeof wat
+->class C {} : typeof wat
+->C : typeof wat
++>class C {} : typeof C
++>C : typeof C
module.exports.D = class D { }
->module.exports.D = class D { } : typeof wat.D
@@ -22,6 +27,6 @@
->D : typeof wat.D
->class D { } : typeof wat.D
->D : typeof wat.D
-+>D : typeof D
++>D : any
+>class D { } : typeof D
+>D : typeof D
diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAliasElementAccessExpression.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAliasElementAccessExpression.types.diff
index 7ed1b2bc40..4b590a05fe 100644
--- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAliasElementAccessExpression.types.diff
+++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAliasElementAccessExpression.types.diff
@@ -5,17 +5,15 @@
>exports["D"] = D : () => void
>exports["D"] : () => void
->exports : typeof import("moduleExportAliasElementAccessExpression")
-->"D" : "D"
+>exports : typeof import("./moduleExportAliasElementAccessExpression")
-+>"D" : () => void
+ >"D" : "D"
>D : () => void
- // (the only package I could find that uses spaces in identifiers is webidl-conversions)
+@@= skipped -8, +8 lines =@@
exports["Does not work yet"] = D;
>exports["Does not work yet"] = D : () => void
>exports["Does not work yet"] : () => void
->exports : typeof import("moduleExportAliasElementAccessExpression")
-->"Does not work yet" : "Does not work yet"
+>exports : typeof import("./moduleExportAliasElementAccessExpression")
-+>"Does not work yet" : () => void
+ >"Does not work yet" : "Does not work yet"
>D : () => void
diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAliasImported.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAliasImported.types.diff
index 24d661c0ab..c2ddbdd552 100644
--- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAliasImported.types.diff
+++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAliasImported.types.diff
@@ -6,9 +6,10 @@
>exports.version = 1 : 1
->exports.version : 1
->exports : typeof alias
+->version : 1
+>exports.version : any
+>exports : typeof import("./bug28014")
- >version : 1
++>version : any
>1 : 1
function alias() { }
diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment4.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment4.types.diff
index 12049554e2..343c89c389 100644
--- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment4.types.diff
+++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment4.types.diff
@@ -5,12 +5,10 @@
>exports.default = { m: 1, a: 1 } : { m: number; a: number; }
>exports.default : any
->exports : any
-->default : any
+>exports : typeof import("./async")
-+>default : { m: number; a: number; }
+ >default : any
>{ m: 1, a: 1 } : { m: number; a: number; }
>m : number
- >1 : 1
@@= skipped -9, +9 lines =@@
>1 : 1
diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment5.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment5.types.diff
index 8aad28b2dd..a9346d39e9 100644
--- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment5.types.diff
+++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment5.types.diff
@@ -20,9 +20,10 @@
->module.exports : { m(): void; default: Axios; }
->module : { exports: { m(): void; default: Axios; }; }
->exports : { m(): void; default: Axios; }
+->default : Axios
+>module.exports.default : any
+>module.exports : Axios
+>module : { axios: Axios; }
+>exports : Axios
- >default : Axios
++>default : any
>axios : Axios
diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportPropertyAssignmentDefault.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportPropertyAssignmentDefault.types.diff
index 3c08ff6172..ed40ccdb9e 100644
--- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportPropertyAssignmentDefault.types.diff
+++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportPropertyAssignmentDefault.types.diff
@@ -33,5 +33,5 @@
+>module.exports : {}
+>module : { axios: {}; }
+>exports : {}
-+>default : {}
++>default : any
+>axios : {}
diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment.types.diff
index 731b08cc0d..7179afaef8 100644
--- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment.types.diff
+++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment.types.diff
@@ -57,6 +57,6 @@
+>module.exports : () => void
+>module : { "export=": () => void; }
+>exports : () => void
-+>f : (a: any) => void
++>f : any
+>function (a) { } : (a: any) => void
+>a : any
diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment2.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment2.types.diff
index 671dd77965..9bbc38b930 100644
--- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment2.types.diff
+++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment2.types.diff
@@ -47,9 +47,8 @@
->module.exports : number
->module : { exports: number; }
->exports : number
-->f : any
+>module.exports : 1
+>module : { "export=": 1; }
+>exports : 1
-+>f : () => void
+ >f : any
>function () { } : () => void
diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment3.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment3.types.diff
index 157aa7624a..2db4d6cc09 100644
--- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment3.types.diff
+++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment3.types.diff
@@ -75,7 +75,7 @@
+>module.exports : { justExport: number; bothBefore: number; bothAfter: number; }
+>module : { "export=": { justExport: number; bothBefore: number; bothAfter: number; }; }
+>exports : { justExport: number; bothBefore: number; bothAfter: number; }
-+>bothBefore : "string"
++>bothBefore : number
>'string' : "string"
module.exports = {
@@ -103,7 +103,7 @@
+>module.exports : { justExport: number; bothBefore: number; bothAfter: number; }
+>module : { "export=": { justExport: number; bothBefore: number; bothAfter: number; }; }
+>exports : { justExport: number; bothBefore: number; bothAfter: number; }
-+>bothAfter : "string"
++>bothAfter : number
>'string' : "string"
module.exports.justProperty = 'string'
@@ -112,9 +112,10 @@
->module.exports : { justExport: number; bothBefore: number | "string"; bothAfter: number | "string"; justProperty: "string"; }
->module : { exports: { justExport: number; bothBefore: number | "string"; bothAfter: number | "string"; justProperty: "string"; }; }
->exports : { justExport: number; bothBefore: number | "string"; bothAfter: number | "string"; justProperty: "string"; }
+->justProperty : "string"
+>module.exports.justProperty : any
+>module.exports : { justExport: number; bothBefore: number; bothAfter: number; }
+>module : { "export=": { justExport: number; bothBefore: number; bothAfter: number; }; }
+>exports : { justExport: number; bothBefore: number; bothAfter: number; }
- >justProperty : "string"
++>justProperty : any
>'string' : "string"
diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment4.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment4.types.diff
index 18cabe3453..ad7a4d3685 100644
--- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment4.types.diff
+++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment4.types.diff
@@ -75,7 +75,7 @@
+>module.exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; }
+>module : { A: { (): void; justExport: number; bothBefore: number; bothAfter: number; }; }
+>exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; }
-+>bothBefore : "string"
++>bothBefore : number
>'string' : "string"
A.justExport = 4
@@ -141,7 +141,7 @@
+>module.exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; }
+>module : { A: { (): void; justExport: number; bothBefore: number; bothAfter: number; }; }
+>exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; }
-+>bothAfter : "string"
++>bothAfter : number
>'string' : "string"
module.exports.justProperty = 'string'
@@ -150,9 +150,10 @@
->module.exports : typeof A
->module : { exports: typeof A; }
->exports : typeof A
+->justProperty : "string"
+>module.exports.justProperty : any
+>module.exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; }
+>module : { A: { (): void; justExport: number; bothBefore: number; bothAfter: number; }; }
+>exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; }
- >justProperty : "string"
++>justProperty : any
>'string' : "string"
diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportsElementAccessAssignment.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportsElementAccessAssignment.types.diff
index 315180f865..af3ced87ac 100644
--- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportsElementAccessAssignment.types.diff
+++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportsElementAccessAssignment.types.diff
@@ -37,23 +37,19 @@
>exports["b"] = { x: "x" } : { x: string; }
>exports["b"] : { x: string; }
->exports : typeof import("mod1")
-->"b" : "b"
+>exports : typeof import("./mod1")
-+>"b" : { x: string; }
+ >"b" : "b"
>{ x: "x" } : { x: string; }
>x : string
- >"x" : "x"
@@= skipped -9, +9 lines =@@
exports["default"] = { x: "x" };
>exports["default"] = { x: "x" } : { x: string; }
>exports["default"] : { x: string; }
->exports : typeof import("mod1")
-->"default" : "default"
+>exports : typeof import("./mod1")
-+>"default" : { x: string; }
+ >"default" : "default"
>{ x: "x" } : { x: string; }
>x : string
- >"x" : "x"
@@= skipped -9, +9 lines =@@
module.exports["c"] = { x: "x" };
>module.exports["c"] = { x: "x" } : { x: string; }
@@ -61,11 +57,10 @@
->module.exports : typeof module.exports
->module : { exports: typeof module.exports; }
->exports : typeof module.exports
-->"c" : "c"
+>module.exports : typeof import("./mod1")
+>module : { "\"mod1\"": typeof import("./mod1"); }
+>exports : typeof import("./mod1")
-+>"c" : { x: string; }
+ >"c" : "c"
>{ x: "x" } : { x: string; }
>x : string
>"x" : "x"
@@ -80,8 +75,7 @@
+>module["exports"] : typeof import("./mod1")
+>module : { "\"mod1\"": typeof import("./mod1"); }
>"exports" : "exports"
-->"d" : "d"
-+>"d" : {}
+ >"d" : "d"
>{} : {}
module["exports"]["d"].e = 0;
diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule2.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule2.types.diff
index 957890343f..f33a595b97 100644
--- a/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule2.types.diff
+++ b/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule2.types.diff
@@ -36,9 +36,10 @@
>exports.Bar = class { } : typeof Bar
->exports.Bar : typeof Bar
->exports : { Bar: typeof Bar; Baz: typeof Baz; Quid: 2; Quack?: undefined; } | { Bar: typeof Bar; Baz?: undefined; Quid: 2; Quack: number; }
+->Bar : typeof Bar
+>exports.Bar : any
+>exports : typeof import("./mod1")
- >Bar : typeof Bar
++>Bar : any
>class { } : typeof Bar
/** @typedef {number} Baz */
@@ -60,9 +61,10 @@
>exports.Quid = 2 : 2
->exports.Quid : 2
->exports : { Bar: typeof Bar; Baz: typeof Baz; Quid: 2; Quack?: undefined; } | { Bar: typeof Bar; Baz?: undefined; Quid: 2; Quack: number; }
+->Quid : 2
+>exports.Quid : any
+>exports : typeof import("./mod1")
- >Quid : 2
++>Quid : any
>2 : 2
/** @typedef {number} Quack */
From dc27fd8af2867113ea21a7ee58ba15bc2c20857d Mon Sep 17 00:00:00 2001
From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
Date: Wed, 16 Jul 2025 08:56:59 -0700
Subject: [PATCH 03/10] Accept fourslash test diffs
As far as I can tell, FAR didn't work with jsdoc before and doesn't work
now at about the same level of brokenness.
---
...eferencesJsRequireDestructuring.baseline.jsonc | 7 -------
...ferencesJsRequireDestructuring1.baseline.jsonc | 5 -----
.../findAllRef/FindAllRefsTypedef.baseline.jsonc | 15 +--------------
.../FindAllRefsTypedef_importType.baseline.jsonc | 5 -----
.../findAllRef/FindAllRefs_jsEnum.baseline.jsonc | 7 +++++++
...JsdocTypedefTagSemanticMeaning0.baseline.jsonc | 12 ++++++------
...JsdocTypedefTagSemanticMeaning1.baseline.jsonc | 6 ++++++
7 files changed, 20 insertions(+), 37 deletions(-)
diff --git a/testdata/baselines/reference/fourslash/findAllRef/FindAllReferencesJsRequireDestructuring.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllRef/FindAllReferencesJsRequireDestructuring.baseline.jsonc
index e56d91f46d..da9b88ff2a 100644
--- a/testdata/baselines/reference/fourslash/findAllRef/FindAllReferencesJsRequireDestructuring.baseline.jsonc
+++ b/testdata/baselines/reference/fourslash/findAllRef/FindAllReferencesJsRequireDestructuring.baseline.jsonc
@@ -2,10 +2,3 @@
// === /bar.js ===
// const { /*FIND ALL REFS*/[|foo|]: bar } = require('./foo');
-
-
-// === /foo.js ===
-
-// module.exports = {
-// [|foo|]: '1'
-// };
diff --git a/testdata/baselines/reference/fourslash/findAllRef/FindAllReferencesJsRequireDestructuring1.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllRef/FindAllReferencesJsRequireDestructuring1.baseline.jsonc
index 10edd78b3e..d2354a097c 100644
--- a/testdata/baselines/reference/fourslash/findAllRef/FindAllReferencesJsRequireDestructuring1.baseline.jsonc
+++ b/testdata/baselines/reference/fourslash/findAllRef/FindAllReferencesJsRequireDestructuring1.baseline.jsonc
@@ -1,9 +1,4 @@
// === findAllReferences ===
-// === /X.js ===
-
-// module.exports = { [|x|]: 1 };
-
-
// === /Y.js ===
// const { /*FIND ALL REFS*/[|x|]: { y } } = require("./X");
diff --git a/testdata/baselines/reference/fourslash/findAllRef/FindAllRefsTypedef.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllRef/FindAllRefsTypedef.baseline.jsonc
index 19ad0586a1..1adb99cba4 100644
--- a/testdata/baselines/reference/fourslash/findAllRef/FindAllRefsTypedef.baseline.jsonc
+++ b/testdata/baselines/reference/fourslash/findAllRef/FindAllRefsTypedef.baseline.jsonc
@@ -4,16 +4,6 @@
// === findAllReferences ===
-// === /a.js ===
-
-// /**
-// * @typedef I {Object}
-// * @prop /*FIND ALL REFS*/[|p|] {number}
-// */
-//
-// /** @type {I} */
-// let x;
-// x.[|p|];
@@ -21,10 +11,7 @@
// === findAllReferences ===
// === /a.js ===
-// /**
-// * @typedef I {Object}
-// * @prop [|p|] {number}
-// */
+// --- (line: 4) skipped ---
//
// /** @type {I} */
// let x;
diff --git a/testdata/baselines/reference/fourslash/findAllRef/FindAllRefsTypedef_importType.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllRef/FindAllRefsTypedef_importType.baseline.jsonc
index 6b69058655..71b72ba405 100644
--- a/testdata/baselines/reference/fourslash/findAllRef/FindAllRefsTypedef_importType.baseline.jsonc
+++ b/testdata/baselines/reference/fourslash/findAllRef/FindAllRefsTypedef_importType.baseline.jsonc
@@ -4,11 +4,6 @@
// === findAllReferences ===
-// === /a.js ===
-
-// module.exports = 0;
-// /** @typedef {number} /*FIND ALL REFS*/[|Foo|] */
-// const dummy = 0;
diff --git a/testdata/baselines/reference/fourslash/findAllRef/FindAllRefs_jsEnum.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllRef/FindAllRefs_jsEnum.baseline.jsonc
index 49ccd3768e..58ecc4bbc7 100644
--- a/testdata/baselines/reference/fourslash/findAllRef/FindAllRefs_jsEnum.baseline.jsonc
+++ b/testdata/baselines/reference/fourslash/findAllRef/FindAllRefs_jsEnum.baseline.jsonc
@@ -28,6 +28,13 @@
// === findAllReferences ===
+// === /a.js ===
+
+// /** @enum {string} */
+// const E = { A: "" };
+// E["A"];
+// /** @type {/*FIND ALL REFS*/[|E|]} */
+// const e = E.A;
diff --git a/testdata/baselines/reference/fourslash/findAllRef/JsdocTypedefTagSemanticMeaning0.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllRef/JsdocTypedefTagSemanticMeaning0.baseline.jsonc
index 2bdc8e4ec9..a2699d0c3f 100644
--- a/testdata/baselines/reference/fourslash/findAllRef/JsdocTypedefTagSemanticMeaning0.baseline.jsonc
+++ b/testdata/baselines/reference/fourslash/findAllRef/JsdocTypedefTagSemanticMeaning0.baseline.jsonc
@@ -4,12 +4,6 @@
// === findAllReferences ===
-// === /a.js ===
-
-// /** @typedef {number} /*FIND ALL REFS*/[|T|] */
-// const T = 1;
-// /** @type {T} */
-// const n = T;
@@ -31,6 +25,12 @@
// === findAllReferences ===
+// === /a.js ===
+
+// /** @typedef {number} T */
+// const T = 1;
+// /** @type {/*FIND ALL REFS*/[|T|]} */
+// const n = T;
diff --git a/testdata/baselines/reference/fourslash/findAllRef/JsdocTypedefTagSemanticMeaning1.baseline.jsonc b/testdata/baselines/reference/fourslash/findAllRef/JsdocTypedefTagSemanticMeaning1.baseline.jsonc
index 019359fafa..362fbb6835 100644
--- a/testdata/baselines/reference/fourslash/findAllRef/JsdocTypedefTagSemanticMeaning1.baseline.jsonc
+++ b/testdata/baselines/reference/fourslash/findAllRef/JsdocTypedefTagSemanticMeaning1.baseline.jsonc
@@ -15,6 +15,12 @@
// === findAllReferences ===
+// === /a.js ===
+
+// /** @typedef {number} */
+// const T = 1;
+// /** @type {/*FIND ALL REFS*/[|T|]} */
+// const n = T;
From 7e02714f23984f85bbe2871f1e0084af506ecb89 Mon Sep 17 00:00:00 2001
From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
Date: Wed, 16 Jul 2025 09:19:31 -0700
Subject: [PATCH 04/10] simplify binder diff
---
internal/binder/binder.go | 4 ----
1 file changed, 4 deletions(-)
diff --git a/internal/binder/binder.go b/internal/binder/binder.go
index d6b363eedf..4b88f37a84 100644
--- a/internal/binder/binder.go
+++ b/internal/binder/binder.go
@@ -1651,10 +1651,6 @@ func (b *Binder) bindChildren(node *ast.Node) {
case ast.KindObjectLiteralExpression, ast.KindArrayLiteralExpression, ast.KindPropertyAssignment, ast.KindSpreadElement:
b.inAssignmentPattern = saveInAssignmentPattern
b.bindEachChild(node)
- case ast.KindJSExportAssignment, ast.KindCommonJSExport:
- // TODO: Probably need some shenanigans in the checker to connect the original syntax's object literal symbols with the cloned, exported object's symbols
- // or maybe the checker will be OK and it will be the services that have to worry about it.
- b.bindEachChild(node)
default:
b.bindEachChild(node)
}
From fe63e186fdc0062bc5eb47a23397a115a81bb968 Mon Sep 17 00:00:00 2001
From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
Date: Wed, 16 Jul 2025 14:16:45 -0700
Subject: [PATCH 05/10] Make reparser code more efficient and readable
---
internal/ast/deepclone.go | 16 +--
internal/parser/reparser.go | 121 +++++++-----------
.../tsbaseline/type_symbol_baseline.go | 5 +-
3 files changed, 54 insertions(+), 88 deletions(-)
diff --git a/internal/ast/deepclone.go b/internal/ast/deepclone.go
index 9ffb853e33..d359b00c39 100644
--- a/internal/ast/deepclone.go
+++ b/internal/ast/deepclone.go
@@ -3,24 +3,19 @@ package ast
import "github.com/microsoft/typescript-go/internal/core"
// Ideally, this would get cached on the node factory so there's only ever one set of closures made per factory
-func getDeepCloneVisitor(f *NodeFactory, reparse bool) *NodeVisitor {
+func getDeepCloneVisitor(f *NodeFactory, syntheticLocation bool) *NodeVisitor {
var visitor *NodeVisitor
visitor = NewNodeVisitor(
func(node *Node) *Node {
visited := visitor.VisitEachChild(node)
if visited != node {
- if reparse {
- // visited.Flags |= NodeFlagsReparsed
- }
return visited
}
c := node.Clone(f) // forcibly clone leaf nodes, which will then cascade new nodes/arrays upwards via `update` calls
// In strada, `factory.cloneNode` was dynamic and did _not_ clone positions for any "special cases", meanwhile
// Node.Clone in corsa reliably uses `Update` calls for all nodes and so copies locations by default.
// Deep clones are done to copy a node across files, so here, we explicitly make the location range synthetic on all cloned nodes
- if reparse {
- // c.Flags |= NodeFlagsReparsed
- } else {
+ if syntheticLocation {
c.Loc = core.NewTextRange(-1, -1)
}
return c
@@ -53,17 +48,18 @@ func getDeepCloneVisitor(f *NodeFactory, reparse bool) *NodeVisitor {
}
func (f *NodeFactory) DeepCloneNode(node *Node) *Node {
- return getDeepCloneVisitor(f, false /*reparse*/).VisitNode(node)
+ return getDeepCloneVisitor(f, true /*syntheticLocation*/).VisitNode(node)
}
func (f *NodeFactory) DeepCloneReparse(node *Node) *Node {
if node != nil {
- node = getDeepCloneVisitor(f, true /*reparse*/).VisitNode(node)
+ node = getDeepCloneVisitor(f, false /*syntheticLocation*/).VisitNode(node)
+ SetParentInChildren(node)
node.Flags |= NodeFlagsReparsed
}
return node
}
func (f *NodeFactory) DeepCloneReparseModifiers(modifiers *ModifierList) *ModifierList {
- return getDeepCloneVisitor(f, true /*reparse*/).VisitModifiers(modifiers)
+ return getDeepCloneVisitor(f, false /*syntheticLocation*/).VisitModifiers(modifiers)
}
diff --git a/internal/parser/reparser.go b/internal/parser/reparser.go
index 97d8190a65..becc3cd5d3 100644
--- a/internal/parser/reparser.go
+++ b/internal/parser/reparser.go
@@ -5,15 +5,10 @@ import (
"github.com/microsoft/typescript-go/internal/core"
)
-func (p *Parser) finishReparsedNode(node *ast.Node, recursive bool) {
- // TODO: Maybe every single call to this should be ast.SetParentInChildren--seems likely
- // TODO: try setting pos and flags here too
- // TODO: make a purpose-built one-child + recursive setter and call that for the non-fresh case
- if recursive {
- ast.SetParentInChildren(node)
- } else {
- p.overrideParentInImmediateChildren(node)
- }
+func (p *Parser) finishReparsedNode(node *ast.Node, locationNode *ast.Node) {
+ node.Flags = p.contextFlags | ast.NodeFlagsReparsed
+ node.Loc = locationNode.Loc
+ p.overrideParentInImmediateChildren(node)
}
func (p *Parser) reparseCommonJS(node *ast.Node, jsdoc []*ast.Node) {
@@ -37,14 +32,10 @@ func (p *Parser) reparseCommonJS(node *ast.Node, jsdoc []*ast.Node) {
export = p.factory.NewCommonJSExport(p.newModifierList(bin.Loc, p.nodeSlicePool.NewSlice1(mod)), p.factory.DeepCloneReparse(ast.GetElementOrPropertyAccessName(bin.Left)), nil /*typeNode*/, p.factory.DeepCloneReparse(bin.Right))
}
if export != nil {
- export.Flags = ast.NodeFlagsReparsed
- export.Loc = bin.Loc
p.reparseList = append(p.reparseList, export)
p.commonJSModuleIndicator = export
p.reparseTags(export, jsdoc)
- p.finishReparsedNode(export, true)
- // TODO: This will probably be the first place that Original pointer is needed.
- // p.finishReparsedNode(bin.AsNode()) // TODO: the same node appears in both the new export declaration and the original binary expression - both locations cannot have correct `.Parent` pointers. For now, the binary expression being correctly parented is baselined behavior, since it appears first in the AST.
+ p.finishReparsedNode(export, bin.AsNode())
}
}
@@ -93,9 +84,7 @@ func (p *Parser) reparseUnhosted(tag *ast.Node, parent *ast.Node, jsDoc *ast.Nod
panic("typedef tag type expression should be a name reference or a type expression" + typeExpression.Kind.String())
}
typeAlias.AsTypeAliasDeclaration().Type = t
- typeAlias.Loc = tag.Loc
- typeAlias.Flags = p.contextFlags | ast.NodeFlagsReparsed
- p.finishReparsedNode(typeAlias, true)
+ p.finishReparsedNode(typeAlias, tag)
p.reparseList = append(p.reparseList, typeAlias)
case ast.KindJSDocCallbackTag:
callbackTag := tag.AsJSDocCallbackTag()
@@ -111,9 +100,7 @@ func (p *Parser) reparseUnhosted(tag *ast.Node, parent *ast.Node, jsDoc *ast.Nod
typeAlias := p.factory.NewJSTypeAliasDeclaration(modifiers, p.factory.DeepCloneReparse(callbackTag.FullName), nil, functionType)
typeAlias.AsTypeAliasDeclaration().TypeParameters = p.gatherTypeParameters(jsDoc, tag)
- typeAlias.Loc = tag.Loc
- typeAlias.Flags = p.contextFlags | ast.NodeFlagsReparsed
- p.finishReparsedNode(typeAlias, true)
+ p.finishReparsedNode(typeAlias,tag)
p.reparseList = append(p.reparseList, typeAlias)
case ast.KindJSDocImportTag:
importTag := tag.AsJSDocImportTag()
@@ -128,14 +115,11 @@ func (p *Parser) reparseUnhosted(tag *ast.Node, parent *ast.Node, jsDoc *ast.Nod
p.factory.DeepCloneReparse(importTag.ModuleSpecifier),
p.factory.DeepCloneReparse(importTag.Attributes),
)
- importDeclaration.Loc = tag.Loc
- importDeclaration.Flags = p.contextFlags | ast.NodeFlagsReparsed
- p.finishReparsedNode(importDeclaration, true)
+ p.finishReparsedNode(importDeclaration, tag)
p.reparseList = append(p.reparseList, importDeclaration)
case ast.KindJSDocOverloadTag:
if fun, ok := getFunctionLikeHost(parent); ok {
p.reparseList = append(p.reparseList, p.reparseJSDocSignature(tag.AsJSDocOverloadTag().TypeExpression, fun, jsDoc, tag))
- // p.finishReparsedNode(fun)
}
}
}
@@ -177,9 +161,7 @@ func (p *Parser) reparseJSDocSignature(jsSignature *ast.Node, fun *ast.Node, jsD
parameter.AsParameterDeclaration().Type = p.reparseJSDocTypeLiteral(jsparam.TypeExpression.Type())
}
}
- parameter.Loc = param.Loc
- parameter.Flags = p.contextFlags | ast.NodeFlagsReparsed
- p.finishReparsedNode(parameter, false)
+ p.finishReparsedNode(parameter, param)
parameters = append(parameters, parameter)
}
signature.FunctionLikeData().Parameters = p.newNodeList(jsSignature.AsJSDocSignature().Parameters.Loc, parameters)
@@ -187,12 +169,11 @@ func (p *Parser) reparseJSDocSignature(jsSignature *ast.Node, fun *ast.Node, jsD
if jsSignature.Type() != nil && jsSignature.Type().AsJSDocReturnTag().TypeExpression != nil {
signature.FunctionLikeData().Type = p.factory.DeepCloneReparse(jsSignature.Type().AsJSDocReturnTag().TypeExpression.Type())
}
- signature.Loc = tag.Loc
+ loc := tag
if tag.Kind == ast.KindJSDocOverloadTag {
- signature.Loc = tag.AsJSDocOverloadTag().TagName.Loc
+ loc = tag.AsJSDocOverloadTag().TagName
}
- signature.Flags = p.contextFlags | ast.NodeFlagsReparsed
- p.finishReparsedNode(signature, true)
+ p.finishReparsedNode(signature, loc)
return signature
}
@@ -215,7 +196,6 @@ func (p *Parser) reparseJSDocTypeLiteral(t *ast.TypeNode) *ast.Node {
}
property.Loc = prop.Loc
property.Flags = p.contextFlags | ast.NodeFlagsReparsed
- p.finishReparsedNode(property, false)
properties = append(properties, property)
}
loc := t.Loc
@@ -223,18 +203,16 @@ func (p *Parser) reparseJSDocTypeLiteral(t *ast.TypeNode) *ast.Node {
t.Loc = loc
t.Flags = p.contextFlags | ast.NodeFlagsReparsed
if isArrayType {
- p.finishReparsedNode(t, true)
t = p.factory.NewArrayTypeNode(t)
t.Flags = p.contextFlags | ast.NodeFlagsReparsed
t.Loc = loc
}
- p.finishReparsedNode(t, true)
}
return p.factory.DeepCloneReparse(t)
}
func (p *Parser) gatherTypeParameters(j *ast.Node, tagWithTypeParameters *ast.Node) *ast.NodeList {
- typeParameters := p.nodeSlicePool.NewSlice(0)
+ var typeParameters []*ast.Node
pos := -1
endPos := -1
firstTemplate := true
@@ -269,16 +247,17 @@ func (p *Parser) gatherTypeParameters(j *ast.Node, tagWithTypeParameters *ast.No
reparse = p.factory.NewTypeParameterDeclaration(
p.factory.DeepCloneReparseModifiers(tp.Modifiers()),
p.factory.DeepCloneReparse(tp.Name()),
- nil,
+ p.factory.DeepCloneReparse(constraint.Type()),
p.factory.DeepCloneReparse(tp.AsTypeParameter().DefaultType),
)
- reparse.AsTypeParameter().Constraint = p.factory.DeepCloneReparse(constraint.Type())
- reparse.Loc = tp.Loc
+ p.finishReparsedNode(reparse, tp)
} else {
reparse = p.factory.DeepCloneReparse(tp)
}
reparse.Flags |= ast.NodeFlagsReparsed
- p.finishReparsedNode(reparse, false)
+ if typeParameters == nil {
+ typeParameters = p.nodeSlicePool.NewSlice(0)
+ }
typeParameters = append(typeParameters, reparse)
firstTypeParameter = false
}
@@ -299,9 +278,7 @@ func (p *Parser) reparseHosted(tag *ast.Node, parent *ast.Node, jsDoc *ast.Node)
for _, declaration := range parent.AsVariableStatement().DeclarationList.AsVariableDeclarationList().Declarations.Nodes {
if declaration.AsVariableDeclaration().Type == nil && tag.AsJSDocTypeTag().TypeExpression != nil {
declaration.AsVariableDeclaration().Type = p.factory.DeepCloneReparse(tag.AsJSDocTypeTag().TypeExpression.Type())
- // NOTE: for non-synthetic nodes, we actually only want to set one parent pointer, then recursively for that pointer.
- // not sure if there's an elegant way to do that.
- p.finishReparsedNode(declaration, true)
+ p.overrideParentInImmediateChildren(declaration)
break
}
}
@@ -309,62 +286,62 @@ func (p *Parser) reparseHosted(tag *ast.Node, parent *ast.Node, jsDoc *ast.Node)
case ast.KindVariableDeclaration:
if parent.AsVariableDeclaration().Type == nil && tag.AsJSDocTypeTag().TypeExpression != nil {
parent.AsVariableDeclaration().Type = p.factory.DeepCloneReparse(tag.AsJSDocTypeTag().TypeExpression.Type())
- p.finishReparsedNode(parent, true)
+ p.overrideParentInImmediateChildren(parent)
}
case ast.KindCommonJSExport:
export := parent.AsCommonJSExport()
if export.Type == nil && tag.AsJSDocTypeTag().TypeExpression != nil {
export.Type = p.factory.DeepCloneReparse(tag.AsJSDocTypeTag().TypeExpression.Type())
- p.finishReparsedNode(parent, true)
+ p.overrideParentInImmediateChildren(parent)
}
case ast.KindPropertyDeclaration:
declaration := parent.AsPropertyDeclaration()
if declaration.Type == nil && tag.AsJSDocTypeTag().TypeExpression != nil {
declaration.Type = p.factory.DeepCloneReparse(tag.AsJSDocTypeTag().TypeExpression.Type())
- p.finishReparsedNode(parent, true)
+ p.overrideParentInImmediateChildren(parent)
}
case ast.KindPropertyAssignment:
prop := parent.AsPropertyAssignment()
if prop.Type == nil && tag.AsJSDocTypeTag().TypeExpression != nil {
prop.Type = p.factory.DeepCloneReparse(tag.AsJSDocTypeTag().TypeExpression.Type())
- p.finishReparsedNode(parent, true)
+ p.overrideParentInImmediateChildren(parent)
}
case ast.KindShorthandPropertyAssignment:
prop := parent.AsShorthandPropertyAssignment()
if prop.Type == nil && tag.AsJSDocTypeTag().TypeExpression != nil {
prop.Type = p.factory.DeepCloneReparse(tag.AsJSDocTypeTag().TypeExpression.Type())
- p.finishReparsedNode(parent, true)
+ p.overrideParentInImmediateChildren(parent)
}
case ast.KindExportAssignment, ast.KindJSExportAssignment:
export := parent.AsExportAssignment()
if export.Type == nil && tag.AsJSDocTypeTag().TypeExpression != nil {
export.Type = p.factory.DeepCloneReparse(tag.AsJSDocTypeTag().TypeExpression.Type())
- p.finishReparsedNode(parent, true)
+ p.overrideParentInImmediateChildren(parent)
}
case ast.KindReturnStatement:
ret := parent.AsReturnStatement()
if tag.AsJSDocTypeTag().TypeExpression != nil {
ret.Expression = p.makeNewCast(
p.factory.DeepCloneReparse(tag.AsJSDocTypeTag().TypeExpression.Type()),
- ret.Expression,
+ p.factory.DeepCloneReparse(ret.Expression),
true /*isAssertion*/)
- p.finishReparsedNode(parent, true)
+ p.overrideParentInImmediateChildren(parent)
}
case ast.KindParenthesizedExpression:
paren := parent.AsParenthesizedExpression()
if tag.AsJSDocTypeTag().TypeExpression != nil {
paren.Expression = p.makeNewCast(
p.factory.DeepCloneReparse(tag.AsJSDocTypeTag().TypeExpression.Type()),
- paren.Expression,
+ p.factory.DeepCloneReparse(paren.Expression),
true /*isAssertion*/)
- p.finishReparsedNode(parent, true)
+ p.overrideParentInImmediateChildren(parent)
}
case ast.KindExpressionStatement:
if parent.AsExpressionStatement().Expression.Kind == ast.KindBinaryExpression {
bin := parent.AsExpressionStatement().Expression.AsBinaryExpression()
if kind := ast.GetAssignmentDeclarationKind(bin); kind != ast.JSDeclarationKindNone && tag.AsJSDocTypeTag().TypeExpression != nil {
bin.Type = p.factory.DeepCloneReparse(tag.AsJSDocTypeTag().TypeExpression.Type())
- p.finishReparsedNode(bin.AsNode(), true)
+ p.overrideParentInImmediateChildren(bin.AsNode())
}
}
}
@@ -374,28 +351,28 @@ func (p *Parser) reparseHosted(tag *ast.Node, parent *ast.Node, jsDoc *ast.Node)
if tag.AsJSDocSatisfiesTag().TypeExpression != nil {
paren.Expression = p.makeNewCast(
p.factory.DeepCloneReparse(tag.AsJSDocSatisfiesTag().TypeExpression.Type()),
- paren.Expression,
+ p.factory.DeepCloneReparse(paren.Expression),
false /*isAssertion*/)
- p.finishReparsedNode(parent, true)
+ p.overrideParentInImmediateChildren(parent)
}
}
case ast.KindJSDocTemplateTag:
if fun, ok := getFunctionLikeHost(parent); ok {
if fun.TypeParameters() == nil {
fun.FunctionLikeData().TypeParameters = p.gatherTypeParameters(jsDoc, nil /*tagWithTypeParameters*/)
- p.finishReparsedNode(fun, true)
+ p.overrideParentInImmediateChildren(fun)
}
} else if parent.Kind == ast.KindClassDeclaration {
class := parent.AsClassDeclaration()
if class.TypeParameters == nil {
class.TypeParameters = p.gatherTypeParameters(jsDoc, nil /*tagWithTypeParameters*/)
- p.finishReparsedNode(parent, true)
+ p.overrideParentInImmediateChildren(parent)
}
} else if parent.Kind == ast.KindClassExpression {
class := parent.AsClassExpression()
if class.TypeParameters == nil {
class.TypeParameters = p.gatherTypeParameters(jsDoc, nil /*tagWithTypeParameters*/)
- p.finishReparsedNode(parent, true)
+ p.overrideParentInImmediateChildren(parent)
}
}
case ast.KindJSDocParameterTag:
@@ -403,8 +380,6 @@ func (p *Parser) reparseHosted(tag *ast.Node, parent *ast.Node, jsDoc *ast.Node)
parameterTag := tag.AsJSDocParameterOrPropertyTag()
if param, ok := findMatchingParameter(fun, parameterTag, jsDoc); ok {
if param.Type == nil && parameterTag.TypeExpression != nil {
- // TODO: Why the double reparse? Once should be enough and the second should be a no-op in the old world.
- // param.AsParameterDeclaration().Type = p.reparseJSDocTypeLiteral(p.factory.DeepCloneReparse(p.reparseJSDocTypeLiteral(parameterTag.TypeExpression)))
param.AsParameterDeclaration().Type = p.reparseJSDocTypeLiteral(parameterTag.TypeExpression.Type())
}
if param.QuestionToken == nil && param.Initializer == nil {
@@ -412,7 +387,7 @@ func (p *Parser) reparseHosted(tag *ast.Node, parent *ast.Node, jsDoc *ast.Node)
param.QuestionToken = question
}
}
- p.finishReparsedNode(param.AsNode(), true)
+ p.overrideParentInImmediateChildren(param.AsNode())
}
}
case ast.KindJSDocThisTag:
@@ -430,9 +405,7 @@ func (p *Parser) reparseHosted(tag *ast.Node, parent *ast.Node, jsDoc *ast.Node)
if tag.AsJSDocThisTag().TypeExpression != nil {
thisParam.AsParameterDeclaration().Type = p.factory.DeepCloneReparse(tag.AsJSDocThisTag().TypeExpression.Type())
}
- thisParam.Loc = tag.AsJSDocThisTag().TagName.Loc
- thisParam.Flags = p.contextFlags | ast.NodeFlagsReparsed
- p.finishReparsedNode(thisParam, false)
+ p.finishReparsedNode(thisParam, tag.AsJSDocThisTag().TagName)
newParams := p.nodeSlicePool.NewSlice(len(params) + 1)
newParams[0] = thisParam
@@ -441,14 +414,14 @@ func (p *Parser) reparseHosted(tag *ast.Node, parent *ast.Node, jsDoc *ast.Node)
}
fun.FunctionLikeData().Parameters = p.newNodeList(thisParam.Loc, newParams)
- p.finishReparsedNode(fun, true)
+ p.overrideParentInImmediateChildren(fun)
}
}
case ast.KindJSDocReturnTag:
if fun, ok := getFunctionLikeHost(parent); ok {
if fun.Type() == nil && tag.AsJSDocReturnTag().TypeExpression != nil {
fun.FunctionLikeData().Type = p.factory.DeepCloneReparse(tag.AsJSDocReturnTag().TypeExpression.Type())
- p.finishReparsedNode(fun, true)
+ p.overrideParentInImmediateChildren(fun)
}
}
case ast.KindJSDocReadonlyTag, ast.KindJSDocPrivateTag, ast.KindJSDocPublicTag, ast.KindJSDocProtectedTag, ast.KindJSDocOverrideTag:
@@ -484,7 +457,7 @@ func (p *Parser) reparseHosted(tag *ast.Node, parent *ast.Node, jsDoc *ast.Node)
loc = parent.Modifiers().Loc
}
parent.AsMutable().SetModifiers(p.newModifierList(loc, nodes))
- p.finishReparsedNode(parent, true)
+ p.overrideParentInImmediateChildren(parent)
}
case ast.KindJSDocImplementsTag:
if class := getClassLikeData(parent); class != nil {
@@ -495,16 +468,14 @@ func (p *Parser) reparseHosted(tag *ast.Node, parent *ast.Node, jsDoc *ast.Node)
return node.AsHeritageClause().Token == ast.KindImplementsKeyword
}); implementsClause != nil {
implementsClause.AsHeritageClause().Types.Nodes = append(implementsClause.AsHeritageClause().Types.Nodes, p.factory.DeepCloneReparse(implementsTag.ClassName))
- p.finishReparsedNode(implementsClause, true)
+ p.overrideParentInImmediateChildren(implementsClause)
return
}
}
typesList := p.newNodeList(implementsTag.ClassName.Loc, p.nodeSlicePool.NewSlice1(p.factory.DeepCloneReparse(implementsTag.ClassName)))
heritageClause := p.factory.NewHeritageClause(ast.KindImplementsKeyword, typesList)
- heritageClause.Loc = implementsTag.ClassName.Loc
- heritageClause.Flags = p.contextFlags | ast.NodeFlagsReparsed
- p.finishReparsedNode(heritageClause, false)
+ p.finishReparsedNode(heritageClause, implementsTag.ClassName)
if class.HeritageClauses == nil {
heritageClauses := p.newNodeList(implementsTag.ClassName.Loc, p.nodeSlicePool.NewSlice1(heritageClause))
@@ -512,7 +483,7 @@ func (p *Parser) reparseHosted(tag *ast.Node, parent *ast.Node, jsDoc *ast.Node)
} else {
class.HeritageClauses.Nodes = append(class.HeritageClauses.Nodes, heritageClause)
}
- p.finishReparsedNode(parent, true)
+ p.overrideParentInImmediateChildren(parent)
}
case ast.KindJSDocAugmentsTag:
if class := getClassLikeData(parent); class != nil && class.HeritageClauses != nil {
@@ -528,7 +499,7 @@ func (p *Parser) reparseHosted(tag *ast.Node, parent *ast.Node, jsDoc *ast.Node)
newArguments[i] = p.factory.DeepCloneReparse(arg)
}
target.TypeArguments = p.newNodeList(source.TypeArguments.Loc, newArguments)
- p.finishReparsedNode(target.AsNode(), true)
+ p.overrideParentInImmediateChildren(target.AsNode())
}
}
}
@@ -595,9 +566,7 @@ func (p *Parser) makeNewCast(t *ast.TypeNode, e *ast.Node, isAssertion bool) *as
} else {
assert = p.factory.NewSatisfiesExpression(e, t)
}
- assert.Flags = p.contextFlags | ast.NodeFlagsReparsed
- assert.Loc = core.NewTextRange(e.Pos(), e.End())
- p.finishReparsedNode(assert, false)
+ p.finishReparsedNode(assert, e)
return assert
}
diff --git a/internal/testutil/tsbaseline/type_symbol_baseline.go b/internal/testutil/tsbaseline/type_symbol_baseline.go
index ea072ba0dd..e7ae7600cb 100644
--- a/internal/testutil/tsbaseline/type_symbol_baseline.go
+++ b/internal/testutil/tsbaseline/type_symbol_baseline.go
@@ -327,8 +327,9 @@ func forEachASTNode(node *ast.Node) []*ast.Node {
for len(work) > 0 {
elem := work[len(work)-1]
work = work[:len(work)-1]
- if elem.Flags&ast.NodeFlagsReparsed == 0 || elem.Kind == ast.KindAsExpression || elem.Kind == ast.KindSatisfiesExpression {
- if elem.Flags&ast.NodeFlagsReparsed == 0 {
+ if elem.Flags&ast.NodeFlagsReparsed == 0 || elem.Kind == ast.KindAsExpression || elem.Kind == ast.KindSatisfiesExpression ||
+ ((elem.Parent.Kind == ast.KindSatisfiesExpression || elem.Parent.Kind == ast.KindAsExpression) && elem == elem.Parent.Expression()) {
+ if elem.Flags&ast.NodeFlagsReparsed == 0 || elem.Parent.Kind == ast.KindAsExpression || elem.Parent.Kind == ast.KindSatisfiesExpression {
result = append(result, elem)
}
elem.ForEachChild(addChild)
From c2bae732b3398b238c6ff8e20134b36cbe5cbb74 Mon Sep 17 00:00:00 2001
From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
Date: Wed, 16 Jul 2025 14:19:58 -0700
Subject: [PATCH 06/10] remove parent pointer test exemption
---
internal/testrunner/compiler_runner.go | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/internal/testrunner/compiler_runner.go b/internal/testrunner/compiler_runner.go
index e48cc738ec..9b1891d081 100644
--- a/internal/testrunner/compiler_runner.go
+++ b/internal/testrunner/compiler_runner.go
@@ -558,13 +558,7 @@ func (c *compilerTest) verifyParentPointers(t *testing.T) {
} else {
elab += "!synthetic! no text available"
}
- if ((n.Parent.Kind == ast.KindBinaryExpression || n.Parent.Kind == ast.KindPropertyAccessExpression || n.Parent.Kind == ast.KindElementAccessExpression) && (parent.Kind == ast.KindJSExportAssignment || parent.Kind == ast.KindCommonJSExport)) ||
- ((parent.Kind == ast.KindBinaryExpression || parent.Kind == ast.KindPropertyAccessExpression || parent.Kind == ast.KindElementAccessExpression) && (n.Parent.Kind == ast.KindJSExportAssignment || n.Parent.Kind == ast.KindCommonJSExport)) ||
- (ast.IsFunctionLike(n.Parent) && ast.IsFunctionLike(parent)) {
- // known current violation of parent pointer invariant, ignore (type nodes on js exports/binary expressions, names on signatures)
- } else {
- assert.Assert(t, n.Parent == parent, "parent node does not match traversed parent: "+n.Kind.String()+": "+elab)
- }
+ assert.Assert(t, n.Parent == parent, "parent node does not match traversed parent: "+n.Kind.String()+": "+elab)
oldParent := parent
parent = n
n.ForEachChild(verifier)
From 2ee069d5c1289cce7351ada42cc806a919e18b39 Mon Sep 17 00:00:00 2001
From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
Date: Thu, 17 Jul 2025 06:27:49 -0700
Subject: [PATCH 07/10] hereby format
---
internal/ast/ast.go | 6 +++---
internal/parser/reparser.go | 2 +-
internal/testutil/tsbaseline/type_symbol_baseline.go | 4 ++--
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/internal/ast/ast.go b/internal/ast/ast.go
index 2b3a79da65..8d948f931d 100644
--- a/internal/ast/ast.go
+++ b/internal/ast/ast.go
@@ -9810,9 +9810,9 @@ func (node *JSDocThisTag) Clone(f NodeFactoryCoercible) *Node {
// JSDocImportTag
type JSDocImportTag struct {
JSDocTagBase
- ImportClause *Declaration
- ModuleSpecifier *Expression
- Attributes *Node
+ ImportClause *Declaration
+ ModuleSpecifier *Expression
+ Attributes *Node
}
func (f *NodeFactory) NewJSDocImportTag(tagName *IdentifierNode, importClause *Declaration, moduleSpecifier *Node, attributes *Node, comment *NodeList) *Node {
diff --git a/internal/parser/reparser.go b/internal/parser/reparser.go
index becc3cd5d3..9852b85849 100644
--- a/internal/parser/reparser.go
+++ b/internal/parser/reparser.go
@@ -100,7 +100,7 @@ func (p *Parser) reparseUnhosted(tag *ast.Node, parent *ast.Node, jsDoc *ast.Nod
typeAlias := p.factory.NewJSTypeAliasDeclaration(modifiers, p.factory.DeepCloneReparse(callbackTag.FullName), nil, functionType)
typeAlias.AsTypeAliasDeclaration().TypeParameters = p.gatherTypeParameters(jsDoc, tag)
- p.finishReparsedNode(typeAlias,tag)
+ p.finishReparsedNode(typeAlias, tag)
p.reparseList = append(p.reparseList, typeAlias)
case ast.KindJSDocImportTag:
importTag := tag.AsJSDocImportTag()
diff --git a/internal/testutil/tsbaseline/type_symbol_baseline.go b/internal/testutil/tsbaseline/type_symbol_baseline.go
index e7ae7600cb..19dc7d9843 100644
--- a/internal/testutil/tsbaseline/type_symbol_baseline.go
+++ b/internal/testutil/tsbaseline/type_symbol_baseline.go
@@ -327,8 +327,8 @@ func forEachASTNode(node *ast.Node) []*ast.Node {
for len(work) > 0 {
elem := work[len(work)-1]
work = work[:len(work)-1]
- if elem.Flags&ast.NodeFlagsReparsed == 0 || elem.Kind == ast.KindAsExpression || elem.Kind == ast.KindSatisfiesExpression ||
- ((elem.Parent.Kind == ast.KindSatisfiesExpression || elem.Parent.Kind == ast.KindAsExpression) && elem == elem.Parent.Expression()) {
+ if elem.Flags&ast.NodeFlagsReparsed == 0 || elem.Kind == ast.KindAsExpression || elem.Kind == ast.KindSatisfiesExpression ||
+ ((elem.Parent.Kind == ast.KindSatisfiesExpression || elem.Parent.Kind == ast.KindAsExpression) && elem == elem.Parent.Expression()) {
if elem.Flags&ast.NodeFlagsReparsed == 0 || elem.Parent.Kind == ast.KindAsExpression || elem.Parent.Kind == ast.KindSatisfiesExpression {
result = append(result, elem)
}
From 0fa72bbe95f83f6313c83f3ef9faafa08c2a88cf Mon Sep 17 00:00:00 2001
From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
Date: Thu, 17 Jul 2025 07:02:52 -0700
Subject: [PATCH 08/10] readability improvements from the PR
---
internal/parser/reparser.go | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/internal/parser/reparser.go b/internal/parser/reparser.go
index 9852b85849..77fb0dedb0 100644
--- a/internal/parser/reparser.go
+++ b/internal/parser/reparser.go
@@ -29,7 +29,11 @@ func (p *Parser) reparseCommonJS(node *ast.Node, jsdoc []*ast.Node) {
mod.Flags = p.contextFlags | ast.NodeFlagsReparsed
mod.Loc = bin.Loc
// TODO: Name can sometimes be a string literal, so downstream code needs to handle this
- export = p.factory.NewCommonJSExport(p.newModifierList(bin.Loc, p.nodeSlicePool.NewSlice1(mod)), p.factory.DeepCloneReparse(ast.GetElementOrPropertyAccessName(bin.Left)), nil /*typeNode*/, p.factory.DeepCloneReparse(bin.Right))
+ export = p.factory.NewCommonJSExport(
+ p.newModifierList(bin.Loc, p.nodeSlicePool.NewSlice1(mod)),
+ p.factory.DeepCloneReparse(ast.GetElementOrPropertyAccessName(bin.Left)),
+ nil, /*typeNode*/
+ p.factory.DeepCloneReparse(bin.Right))
}
if export != nil {
p.reparseList = append(p.reparseList, export)
@@ -182,9 +186,10 @@ func (p *Parser) reparseJSDocTypeLiteral(t *ast.TypeNode) *ast.Node {
return nil
}
if t.Kind == ast.KindJSDocTypeLiteral {
- isArrayType := t.AsJSDocTypeLiteral().IsArrayType
+ jstypeliteral := t.AsJSDocTypeLiteral()
+ isArrayType := jstypeliteral.IsArrayType
properties := p.nodeSlicePool.NewSlice(0)
- for _, prop := range t.AsJSDocTypeLiteral().JSDocPropertyTags {
+ for _, prop := range jstypeliteral.JSDocPropertyTags {
jsprop := prop.AsJSDocParameterOrPropertyTag()
name := prop.Name()
if name.Kind == ast.KindQualifiedName {
@@ -194,19 +199,15 @@ func (p *Parser) reparseJSDocTypeLiteral(t *ast.TypeNode) *ast.Node {
if jsprop.TypeExpression != nil {
property.AsPropertySignatureDeclaration().Type = p.reparseJSDocTypeLiteral(jsprop.TypeExpression.Type())
}
- property.Loc = prop.Loc
- property.Flags = p.contextFlags | ast.NodeFlagsReparsed
+ p.finishReparsedNode(property, prop)
properties = append(properties, property)
}
- loc := t.Loc
- t = p.factory.NewTypeLiteralNode(p.newNodeList(loc, properties))
- t.Loc = loc
- t.Flags = p.contextFlags | ast.NodeFlagsReparsed
+ t = p.factory.NewTypeLiteralNode(p.newNodeList(jstypeliteral.Loc, properties))
if isArrayType {
+ p.finishReparsedNode(t, jstypeliteral.AsNode())
t = p.factory.NewArrayTypeNode(t)
- t.Flags = p.contextFlags | ast.NodeFlagsReparsed
- t.Loc = loc
}
+ p.finishReparsedNode(t, jstypeliteral.AsNode())
}
return p.factory.DeepCloneReparse(t)
}
@@ -254,7 +255,6 @@ func (p *Parser) gatherTypeParameters(j *ast.Node, tagWithTypeParameters *ast.No
} else {
reparse = p.factory.DeepCloneReparse(tp)
}
- reparse.Flags |= ast.NodeFlagsReparsed
if typeParameters == nil {
typeParameters = p.nodeSlicePool.NewSlice(0)
}
From 478b7e202a53cd9ec5d50106c474154bab6d978d Mon Sep 17 00:00:00 2001
From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
Date: Thu, 17 Jul 2025 09:20:32 -0700
Subject: [PATCH 09/10] add unit tests showing that hover of jsdoc nodes does
not work yet
---
internal/ls/hover_test.go | 86 +++++++++++++++++++++++++++++++++++++++
1 file changed, 86 insertions(+)
diff --git a/internal/ls/hover_test.go b/internal/ls/hover_test.go
index 239bf040f8..71f99ccf57 100644
--- a/internal/ls/hover_test.go
+++ b/internal/ls/hover_test.go
@@ -50,6 +50,92 @@ function myFunction() {
},
},
},
+ {
+ title: "JSDocParamHoverFunctionDeclaration",
+ input: `
+// @filename: index.js
+/**
+ * @param {string} param - the greatest of days
+ */
+function /*marker*/myFunction(param) {
+ return "test" + param;
+}
+
+myFunction();`,
+ expected: map[string]*lsproto.Hover{
+ "marker": {
+ Contents: lsproto.MarkupContentOrMarkedStringOrMarkedStrings{
+ MarkupContent: &lsproto.MarkupContent{
+ Kind: lsproto.MarkupKindMarkdown,
+ Value: "```tsx\nfunction myFunction(param: string): string\n```\n\n\n*@param* `param` - the greatest of days\n",
+ },
+ },
+ },
+ },
+ },
+ {
+ title: "JSDocParamHoverFunctionCall",
+ input: `
+// @filename: index.js
+/**
+ * @param {string} param - the greatest of days
+ */
+function myFunction(param) {
+ return "test" + param;
+}
+
+/*marker*/myFunction();`,
+ expected: map[string]*lsproto.Hover{
+ "marker": {
+ Contents: lsproto.MarkupContentOrMarkedStringOrMarkedStrings{
+ MarkupContent: &lsproto.MarkupContent{
+ Kind: lsproto.MarkupKindMarkdown,
+ Value: "```tsx\nfunction myFunction(param: string): string\n```\n\n\n*@param* `param` - the greatest of days\n",
+ },
+ },
+ },
+ },
+ },
+ {
+ title: "JSDocParamHoverParameter",
+ input: `
+// @filename: index.js
+/**
+ * @param {string} param - the greatest of days
+ */
+function myFunction(/*marker*/param) {
+ return "test" + param;
+}
+
+myFunction();`,
+ expected: map[string]*lsproto.Hover{
+ "marker": {
+ Contents: lsproto.MarkupContentOrMarkedStringOrMarkedStrings{
+ MarkupContent: &lsproto.MarkupContent{
+ Kind: lsproto.MarkupKindMarkdown,
+ Value: "```tsx\n(parameter) param: string\n```\n- the greatest of days\n",
+ },
+ },
+ },
+ },
+ },
+ {
+ title: "JSDocParamHoverTagIdentifier",
+ input: `
+// @filename: index.js
+/**
+ * @param {string} /*marker*/param - the greatest of days
+ */
+function myFunction(param) {
+ return "test" + param;
+}
+
+myFunction();`,
+ expected: map[string]*lsproto.Hover{
+ // TODO: Should have same result as hovering on the parameter itself.
+ "marker": nil,
+ },
+ },
}
for _, testCase := range testCases {
From 139841e222867638b847abfc8f65513464b01b82 Mon Sep 17 00:00:00 2001
From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
Date: Fri, 18 Jul 2025 06:07:41 -0700
Subject: [PATCH 10/10] purpose-named wrapper for
overrideParentInImmediateChildren
---
internal/parser/reparser.go | 46 ++++++++++++++++++++-----------------
1 file changed, 25 insertions(+), 21 deletions(-)
diff --git a/internal/parser/reparser.go b/internal/parser/reparser.go
index 77fb0dedb0..cb055c9659 100644
--- a/internal/parser/reparser.go
+++ b/internal/parser/reparser.go
@@ -11,6 +11,10 @@ func (p *Parser) finishReparsedNode(node *ast.Node, locationNode *ast.Node) {
p.overrideParentInImmediateChildren(node)
}
+func (p *Parser) finishMutatedNode(node *ast.Node) {
+ p.overrideParentInImmediateChildren(node)
+}
+
func (p *Parser) reparseCommonJS(node *ast.Node, jsdoc []*ast.Node) {
if p.scriptKind != core.ScriptKindJS && p.scriptKind != core.ScriptKindJSX {
return
@@ -278,7 +282,7 @@ func (p *Parser) reparseHosted(tag *ast.Node, parent *ast.Node, jsDoc *ast.Node)
for _, declaration := range parent.AsVariableStatement().DeclarationList.AsVariableDeclarationList().Declarations.Nodes {
if declaration.AsVariableDeclaration().Type == nil && tag.AsJSDocTypeTag().TypeExpression != nil {
declaration.AsVariableDeclaration().Type = p.factory.DeepCloneReparse(tag.AsJSDocTypeTag().TypeExpression.Type())
- p.overrideParentInImmediateChildren(declaration)
+ p.finishMutatedNode(declaration)
break
}
}
@@ -286,37 +290,37 @@ func (p *Parser) reparseHosted(tag *ast.Node, parent *ast.Node, jsDoc *ast.Node)
case ast.KindVariableDeclaration:
if parent.AsVariableDeclaration().Type == nil && tag.AsJSDocTypeTag().TypeExpression != nil {
parent.AsVariableDeclaration().Type = p.factory.DeepCloneReparse(tag.AsJSDocTypeTag().TypeExpression.Type())
- p.overrideParentInImmediateChildren(parent)
+ p.finishMutatedNode(parent)
}
case ast.KindCommonJSExport:
export := parent.AsCommonJSExport()
if export.Type == nil && tag.AsJSDocTypeTag().TypeExpression != nil {
export.Type = p.factory.DeepCloneReparse(tag.AsJSDocTypeTag().TypeExpression.Type())
- p.overrideParentInImmediateChildren(parent)
+ p.finishMutatedNode(parent)
}
case ast.KindPropertyDeclaration:
declaration := parent.AsPropertyDeclaration()
if declaration.Type == nil && tag.AsJSDocTypeTag().TypeExpression != nil {
declaration.Type = p.factory.DeepCloneReparse(tag.AsJSDocTypeTag().TypeExpression.Type())
- p.overrideParentInImmediateChildren(parent)
+ p.finishMutatedNode(parent)
}
case ast.KindPropertyAssignment:
prop := parent.AsPropertyAssignment()
if prop.Type == nil && tag.AsJSDocTypeTag().TypeExpression != nil {
prop.Type = p.factory.DeepCloneReparse(tag.AsJSDocTypeTag().TypeExpression.Type())
- p.overrideParentInImmediateChildren(parent)
+ p.finishMutatedNode(parent)
}
case ast.KindShorthandPropertyAssignment:
prop := parent.AsShorthandPropertyAssignment()
if prop.Type == nil && tag.AsJSDocTypeTag().TypeExpression != nil {
prop.Type = p.factory.DeepCloneReparse(tag.AsJSDocTypeTag().TypeExpression.Type())
- p.overrideParentInImmediateChildren(parent)
+ p.finishMutatedNode(parent)
}
case ast.KindExportAssignment, ast.KindJSExportAssignment:
export := parent.AsExportAssignment()
if export.Type == nil && tag.AsJSDocTypeTag().TypeExpression != nil {
export.Type = p.factory.DeepCloneReparse(tag.AsJSDocTypeTag().TypeExpression.Type())
- p.overrideParentInImmediateChildren(parent)
+ p.finishMutatedNode(parent)
}
case ast.KindReturnStatement:
ret := parent.AsReturnStatement()
@@ -325,7 +329,7 @@ func (p *Parser) reparseHosted(tag *ast.Node, parent *ast.Node, jsDoc *ast.Node)
p.factory.DeepCloneReparse(tag.AsJSDocTypeTag().TypeExpression.Type()),
p.factory.DeepCloneReparse(ret.Expression),
true /*isAssertion*/)
- p.overrideParentInImmediateChildren(parent)
+ p.finishMutatedNode(parent)
}
case ast.KindParenthesizedExpression:
paren := parent.AsParenthesizedExpression()
@@ -334,14 +338,14 @@ func (p *Parser) reparseHosted(tag *ast.Node, parent *ast.Node, jsDoc *ast.Node)
p.factory.DeepCloneReparse(tag.AsJSDocTypeTag().TypeExpression.Type()),
p.factory.DeepCloneReparse(paren.Expression),
true /*isAssertion*/)
- p.overrideParentInImmediateChildren(parent)
+ p.finishMutatedNode(parent)
}
case ast.KindExpressionStatement:
if parent.AsExpressionStatement().Expression.Kind == ast.KindBinaryExpression {
bin := parent.AsExpressionStatement().Expression.AsBinaryExpression()
if kind := ast.GetAssignmentDeclarationKind(bin); kind != ast.JSDeclarationKindNone && tag.AsJSDocTypeTag().TypeExpression != nil {
bin.Type = p.factory.DeepCloneReparse(tag.AsJSDocTypeTag().TypeExpression.Type())
- p.overrideParentInImmediateChildren(bin.AsNode())
+ p.finishMutatedNode(bin.AsNode())
}
}
}
@@ -353,26 +357,26 @@ func (p *Parser) reparseHosted(tag *ast.Node, parent *ast.Node, jsDoc *ast.Node)
p.factory.DeepCloneReparse(tag.AsJSDocSatisfiesTag().TypeExpression.Type()),
p.factory.DeepCloneReparse(paren.Expression),
false /*isAssertion*/)
- p.overrideParentInImmediateChildren(parent)
+ p.finishMutatedNode(parent)
}
}
case ast.KindJSDocTemplateTag:
if fun, ok := getFunctionLikeHost(parent); ok {
if fun.TypeParameters() == nil {
fun.FunctionLikeData().TypeParameters = p.gatherTypeParameters(jsDoc, nil /*tagWithTypeParameters*/)
- p.overrideParentInImmediateChildren(fun)
+ p.finishMutatedNode(fun)
}
} else if parent.Kind == ast.KindClassDeclaration {
class := parent.AsClassDeclaration()
if class.TypeParameters == nil {
class.TypeParameters = p.gatherTypeParameters(jsDoc, nil /*tagWithTypeParameters*/)
- p.overrideParentInImmediateChildren(parent)
+ p.finishMutatedNode(parent)
}
} else if parent.Kind == ast.KindClassExpression {
class := parent.AsClassExpression()
if class.TypeParameters == nil {
class.TypeParameters = p.gatherTypeParameters(jsDoc, nil /*tagWithTypeParameters*/)
- p.overrideParentInImmediateChildren(parent)
+ p.finishMutatedNode(parent)
}
}
case ast.KindJSDocParameterTag:
@@ -387,7 +391,7 @@ func (p *Parser) reparseHosted(tag *ast.Node, parent *ast.Node, jsDoc *ast.Node)
param.QuestionToken = question
}
}
- p.overrideParentInImmediateChildren(param.AsNode())
+ p.finishMutatedNode(param.AsNode())
}
}
case ast.KindJSDocThisTag:
@@ -414,14 +418,14 @@ func (p *Parser) reparseHosted(tag *ast.Node, parent *ast.Node, jsDoc *ast.Node)
}
fun.FunctionLikeData().Parameters = p.newNodeList(thisParam.Loc, newParams)
- p.overrideParentInImmediateChildren(fun)
+ p.finishMutatedNode(fun)
}
}
case ast.KindJSDocReturnTag:
if fun, ok := getFunctionLikeHost(parent); ok {
if fun.Type() == nil && tag.AsJSDocReturnTag().TypeExpression != nil {
fun.FunctionLikeData().Type = p.factory.DeepCloneReparse(tag.AsJSDocReturnTag().TypeExpression.Type())
- p.overrideParentInImmediateChildren(fun)
+ p.finishMutatedNode(fun)
}
}
case ast.KindJSDocReadonlyTag, ast.KindJSDocPrivateTag, ast.KindJSDocPublicTag, ast.KindJSDocProtectedTag, ast.KindJSDocOverrideTag:
@@ -457,7 +461,7 @@ func (p *Parser) reparseHosted(tag *ast.Node, parent *ast.Node, jsDoc *ast.Node)
loc = parent.Modifiers().Loc
}
parent.AsMutable().SetModifiers(p.newModifierList(loc, nodes))
- p.overrideParentInImmediateChildren(parent)
+ p.finishMutatedNode(parent)
}
case ast.KindJSDocImplementsTag:
if class := getClassLikeData(parent); class != nil {
@@ -468,7 +472,7 @@ func (p *Parser) reparseHosted(tag *ast.Node, parent *ast.Node, jsDoc *ast.Node)
return node.AsHeritageClause().Token == ast.KindImplementsKeyword
}); implementsClause != nil {
implementsClause.AsHeritageClause().Types.Nodes = append(implementsClause.AsHeritageClause().Types.Nodes, p.factory.DeepCloneReparse(implementsTag.ClassName))
- p.overrideParentInImmediateChildren(implementsClause)
+ p.finishMutatedNode(implementsClause)
return
}
}
@@ -483,7 +487,7 @@ func (p *Parser) reparseHosted(tag *ast.Node, parent *ast.Node, jsDoc *ast.Node)
} else {
class.HeritageClauses.Nodes = append(class.HeritageClauses.Nodes, heritageClause)
}
- p.overrideParentInImmediateChildren(parent)
+ p.finishMutatedNode(parent)
}
case ast.KindJSDocAugmentsTag:
if class := getClassLikeData(parent); class != nil && class.HeritageClauses != nil {
@@ -499,7 +503,7 @@ func (p *Parser) reparseHosted(tag *ast.Node, parent *ast.Node, jsDoc *ast.Node)
newArguments[i] = p.factory.DeepCloneReparse(arg)
}
target.TypeArguments = p.newNodeList(source.TypeArguments.Loc, newArguments)
- p.overrideParentInImmediateChildren(target.AsNode())
+ p.finishMutatedNode(target.AsNode())
}
}
}