Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions tsc/internal/checker/checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -705,22 +705,22 @@ type Checker struct {
switchStatementLinks core.LinkStore[*ast.Node, SwitchStatementLinks]
jsxElementLinks core.LinkStore[*ast.Node, JsxElementLinks]
computedNameLinks core.LinkStore[*ast.Node, ComputedNameNodeLinks]
symbolReferenceLinks core.LinkStore[*ast.Symbol, SymbolReferenceLinks]
symbolReferenceLinks symbolLinkStore[SymbolReferenceLinks]
valueSymbolLinks symbolLinkStore[ValueSymbolLinks]
mappedSymbolLinks core.LinkStore[*ast.Symbol, MappedSymbolLinks]
deferredSymbolLinks core.LinkStore[*ast.Symbol, DeferredSymbolLinks]
aliasSymbolLinks core.LinkStore[*ast.Symbol, AliasSymbolLinks]
moduleSymbolLinks core.LinkStore[*ast.Symbol, ModuleSymbolLinks]
lateBoundLinks core.LinkStore[*ast.Symbol, LateBoundLinks]
exportTypeLinks core.LinkStore[*ast.Symbol, ExportTypeLinks]
membersAndExportsLinks core.LinkStore[*ast.Symbol, MembersAndExportsLinks]
typeAliasLinks core.LinkStore[*ast.Symbol, TypeAliasLinks]
declaredTypeLinks core.LinkStore[*ast.Symbol, DeclaredTypeLinks]
spreadLinks core.LinkStore[*ast.Symbol, SpreadLinks]
varianceLinks core.LinkStore[*ast.Symbol, VarianceLinks]
ReverseMappedSymbolLinks core.LinkStore[*ast.Symbol, ReverseMappedSymbolLinks]
markedAssignmentSymbolLinks core.LinkStore[*ast.Symbol, MarkedAssignmentSymbolLinks]
symbolContainerLinks core.LinkStore[*ast.Symbol, ContainingSymbolLinks]
mappedSymbolLinks symbolLinkStore[MappedSymbolLinks]
deferredSymbolLinks symbolLinkStore[DeferredSymbolLinks]
aliasSymbolLinks symbolLinkStore[AliasSymbolLinks]
moduleSymbolLinks symbolLinkStore[ModuleSymbolLinks]
lateBoundLinks symbolLinkStore[LateBoundLinks]
exportTypeLinks symbolLinkStore[ExportTypeLinks]
membersAndExportsLinks symbolLinkStore[MembersAndExportsLinks]
typeAliasLinks symbolLinkStore[TypeAliasLinks]
declaredTypeLinks symbolLinkStore[DeclaredTypeLinks]
spreadLinks symbolLinkStore[SpreadLinks]
varianceLinks symbolLinkStore[VarianceLinks]
reverseMappedSymbolLinks symbolLinkStore[ReverseMappedSymbolLinks]
markedAssignmentSymbolLinks symbolLinkStore[MarkedAssignmentSymbolLinks]
symbolContainerLinks symbolLinkStore[ContainingSymbolLinks]
externalModuleContainers *externalModuleContainerIndex
sourceFileLinks core.LinkStore[*ast.SourceFile, SourceFileLinks]
regExpScanner *scanner.Scanner
Expand Down
2 changes: 1 addition & 1 deletion tsc/internal/checker/emitsupport.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ func (c *Checker) requiresAddingImplicitUndefined(declaration *ast.Node, symbol
}
t := c.getTypeOfSymbol(symbol)
c.mappedSymbolLinks.Has(symbol)
return (symbol.Flags()&ast.SymbolFlagsProperty != 0) && (symbol.Flags()&ast.SymbolFlagsOptional != 0) && isOptionalDeclaration(declaration) && c.ReverseMappedSymbolLinks.Has(symbol) && c.ReverseMappedSymbolLinks.Get(symbol).mappedType != nil && containsNonMissingUndefinedType(c, t)
return (symbol.Flags()&ast.SymbolFlagsProperty != 0) && (symbol.Flags()&ast.SymbolFlagsOptional != 0) && isOptionalDeclaration(declaration) && c.reverseMappedSymbolLinks.Has(symbol) && c.reverseMappedSymbolLinks.Get(symbol).mappedType != nil && containsNonMissingUndefinedType(c, t)
case ast.KindParameter, ast.KindJSDocParameterTag:
return c.requiresAddingImplicitUndefinedWorker(declaration, enclosingDeclaration)
default:
Expand Down
4 changes: 2 additions & 2 deletions tsc/internal/checker/inference.go
Original file line number Diff line number Diff line change
Expand Up @@ -1133,7 +1133,7 @@ func (c *Checker) resolveReverseMappedTypeMembers(t *Type) {
inferredProp := c.newSymbolEx(ast.SymbolFlagsProperty|prop.Flags()&optionalMask, prop.Name(), checkFlags)
inferredProp.SetDeclarations(prop.Declarations())
c.valueSymbolLinks.Get(inferredProp).setNameType(c, c.valueSymbolLinks.Get(prop).getNameType())
links := c.ReverseMappedSymbolLinks.Get(inferredProp)
links := c.reverseMappedSymbolLinks.Get(inferredProp)
links.propertyType = c.getTypeOfSymbol(prop)
constraintTarget := r.constraintType.AsIndexType().target
if constraintTarget.flags&TypeFlagsIndexedAccess != 0 && constraintTarget.AsIndexedAccessType().objectType.flags&TypeFlagsTypeParameter != 0 && constraintTarget.AsIndexedAccessType().indexType.flags&TypeFlagsTypeParameter != 0 {
Expand All @@ -1156,7 +1156,7 @@ func (c *Checker) resolveReverseMappedTypeMembers(t *Type) {
func (c *Checker) getTypeOfReverseMappedSymbol(symbol *ast.Symbol) *Type {
links := c.valueSymbolLinks.Get(symbol)
if links.resolvedType == nil {
reverseLinks := c.ReverseMappedSymbolLinks.Get(symbol)
reverseLinks := c.reverseMappedSymbolLinks.Get(symbol)
links.resolvedType = core.OrElse(c.inferReverseMappedType(reverseLinks.propertyType, reverseLinks.mappedType, reverseLinks.constraintType), c.unknownType)
}
return links.resolvedType
Expand Down
12 changes: 6 additions & 6 deletions tsc/internal/checker/nodebuilderimpl.go
Original file line number Diff line number Diff line change
Expand Up @@ -2408,8 +2408,8 @@ func (b *NodeBuilderImpl) shouldUsePlaceholderForProperty(propertySymbol *ast.Sy
// (2)
if len(b.ctx.reverseMappedStack) > 0 {
last := b.ctx.reverseMappedStack[len(b.ctx.reverseMappedStack)-1]
if b.ch.ReverseMappedSymbolLinks.Has(last) {
links := b.ch.ReverseMappedSymbolLinks.TryGet(last)
if b.ch.reverseMappedSymbolLinks.Has(last) {
links := b.ch.reverseMappedSymbolLinks.TryGet(last)
propertyType := links.propertyType
if propertyType != nil && propertyType.objectFlags&ObjectFlagsAnonymous == 0 {
return true
Expand All @@ -2422,10 +2422,10 @@ func (b *NodeBuilderImpl) shouldUsePlaceholderForProperty(propertySymbol *ast.Sy
if len(b.ctx.reverseMappedStack) < MAX_REVERSE_MAPPED_NESTING_INSPECTION_DEPTH {
return false
}
if !b.ch.ReverseMappedSymbolLinks.Has(propertySymbol) {
if !b.ch.reverseMappedSymbolLinks.Has(propertySymbol) {
return false
}
propertyLinks := b.ch.ReverseMappedSymbolLinks.TryGet(propertySymbol)
propertyLinks := b.ch.reverseMappedSymbolLinks.TryGet(propertySymbol)
propMappedType := propertyLinks.mappedType
if propMappedType == nil || propMappedType.symbol == nil {
return false
Expand All @@ -2435,8 +2435,8 @@ func (b *NodeBuilderImpl) shouldUsePlaceholderForProperty(propertySymbol *ast.Sy
break
}
prop := b.ctx.reverseMappedStack[len(b.ctx.reverseMappedStack)-1-i]
if b.ch.ReverseMappedSymbolLinks.Has(prop) {
links := b.ch.ReverseMappedSymbolLinks.TryGet(prop)
if b.ch.reverseMappedSymbolLinks.Has(prop) {
links := b.ch.reverseMappedSymbolLinks.TryGet(prop)
mappedType := links.mappedType
if mappedType != nil && mappedType.symbol == propMappedType.symbol {
return true
Expand Down
Loading