Skip to content

Segmentation fault #1731

@pfhayes

Description

@pfhayes

Stack trace

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x104f1abc8]

goroutine 1198 [running]:
github.com/microsoft/typescript-go/internal/ast.(*Node).Text(0x140012e4008?)
	external/_main~_repo_rules~typescript_go/internal/ast/ast.go:304 +0x18
github.com/microsoft/typescript-go/internal/checker.(*Checker).checkAndReportErrorForResolvingImportAliasToTypeOnlySymbol(0x140012e4008, 0x140021317a0, 0x14008d4de78?)
	external/_main~_repo_rules~typescript_go/internal/checker/checker.go:13892 +0x1f8
github.com/microsoft/typescript-go/internal/checker.(*Checker).getTargetOfImportEqualsDeclaration(0x140012e4008, 0x140021317a0, 0x20?)
	external/_main~_repo_rules~typescript_go/internal/checker/checker.go:13842 +0x1a8
github.com/microsoft/typescript-go/internal/checker.(*Checker).getTargetOfAliasDeclaration(0x140012e48e8?, 0x100e43060?, 0x0?)
	external/_main~_repo_rules~typescript_go/internal/checker/checker.go:15036 +0xb4
github.com/microsoft/typescript-go/internal/checker.(*Checker).resolveAlias(0x140012e4008, 0x140042be000)
	external/_main~_repo_rules~typescript_go/internal/checker/checker.go:15522 +0x12c
github.com/microsoft/typescript-go/internal/checker.(*Checker).resolveSymbolEx(0x100c6f560?, 0x14009365800?, 0x0?)
	external/_main~_repo_rules~typescript_go/internal/checker/checker.go:13824 +0x44
github.com/microsoft/typescript-go/internal/checker.(*Checker).resolveSymbol(...)
	external/_main~_repo_rules~typescript_go/internal/checker/checker.go:13819
github.com/microsoft/typescript-go/internal/checker.(*Checker).getSymbolIfSameReference(0x140012e4008, 0x140042be000, 0x140089348c8)
	external/_main~_repo_rules~typescript_go/internal/checker/checker.go:13767 +0x68
github.com/microsoft/typescript-go/internal/checker.(*Checker).getAliasForSymbolInContainer(0x140012e4008, 0x140066f02a0, 0x140089348c8)
	external/_main~_repo_rules~typescript_go/internal/checker/symbolaccessibility.go:364 +0x190
github.com/microsoft/typescript-go/internal/checker.(*Checker).getAlternativeContainingModules(0x140012e4008, 0x140089348c8, 0x140066f1dc0?)
	external/_main~_repo_rules~typescript_go/internal/checker/symbolaccessibility.go:218 +0x260
github.com/microsoft/typescript-go/internal/checker.(*Checker).getWithAlternativeContainers(0x140012e4008, 0x140066f1dc0, 0x140089348c8, 0x14009c82000, 0xc09e8)
	external/_main~_repo_rules~typescript_go/internal/checker/symbolaccessibility.go:125 +0x18c
github.com/microsoft/typescript-go/internal/checker.(*Checker).getContainersOfSymbol(0x140012e4008, 0x140089348c8, 0x14009c82000, 0xc09e8)
	external/_main~_repo_rules~typescript_go/internal/checker/symbolaccessibility.go:334 +0x550
github.com/microsoft/typescript-go/internal/checker.(*Checker).IsAnySymbolAccessible(0x140012e4008, {0x14008d4e550, 0x1, 0x10022b398?}, 0x14009c82000, 0x140089348c8, 0xc09e8, 0x0, 0x1)
	external/_main~_repo_rules~typescript_go/internal/checker/symbolaccessibility.go:76 +0x13c
github.com/microsoft/typescript-go/internal/checker.(*Checker).isSymbolAccessibleWorker(0x140012e4008, 0x140089348c8, 0x14009c82000, 0xc09e8, 0x1?, 0x0?)
	external/_main~_repo_rules~typescript_go/internal/checker/symbolaccessibility.go:728 +0x70
github.com/microsoft/typescript-go/internal/checker.(*Checker).IsTypeSymbolAccessible(...)
	external/_main~_repo_rules~typescript_go/internal/checker/symbolaccessibility.go:14
github.com/microsoft/typescript-go/internal/checker.(*nodeBuilderImpl).typeToTypeNode(0x140088fe1c0, 0x4?)
	external/_main~_repo_rules~typescript_go/internal/checker/nodebuilderimpl.go:2930 +0x1d0
github.com/microsoft/typescript-go/internal/checker.(*nodeBuilderImpl).mapToTypeNodes(0x140088fe1c0, {0x140007405f8, 0x1, 0x199?}, 0xa9?)
	external/_main~_repo_rules~typescript_go/internal/checker/nodebuilderimpl.go:274 +0x428
github.com/microsoft/typescript-go/internal/checker.(*nodeBuilderImpl).typeReferenceToTypeNode(0x140088fe1c0, 0x140083e1880)
	external/_main~_repo_rules~typescript_go/internal/checker/nodebuilderimpl.go:2687 +0xc58
github.com/microsoft/typescript-go/internal/checker.(*nodeBuilderImpl).typeToTypeNode(0x140088fe1c0, 0x1005e0264?)
	external/_main~_repo_rules~typescript_go/internal/checker/nodebuilderimpl.go:2949 +0x75c
github.com/microsoft/typescript-go/internal/checker.(*nodeBuilderImpl).serializeTypeForDeclaration(0x140088fe1c0, 0x1400066e0e0, 0x140001c8008?, 0x140004026a8?)
	external/_main~_repo_rules~typescript_go/internal/checker/nodebuilderimpl.go:2011 +0x2b0
github.com/microsoft/typescript-go/internal/checker.(*nodeBuilderImpl).symbolToParameterDeclaration(0x140088fe1c0, 0x14008725c08, 0x0)
	external/_main~_repo_rules~typescript_go/internal/checker/nodebuilderimpl.go:1552 +0x94
github.com/microsoft/typescript-go/internal/checker.(*nodeBuilderImpl).signatureToSignatureDeclarationHelper.func2(...)
	external/_main~_repo_rules~typescript_go/internal/checker/nodebuilderimpl.go:1713
github.com/microsoft/typescript-go/internal/core.Map[...](...)
	external/_main~_repo_rules~typescript_go/internal/core/core.go:57
github.com/microsoft/typescript-go/internal/checker.(*nodeBuilderImpl).signatureToSignatureDeclarationHelper(0x140088fe1c0, 0x14003ea0700, 0xb8, 0x0)
	external/_main~_repo_rules~typescript_go/internal/checker/nodebuilderimpl.go:1710 +0x8f8
github.com/microsoft/typescript-go/internal/checker.(*nodeBuilderImpl).createTypeNodeFromObjectType(0x140088fe1c0, 0x14006728d80)
	external/_main~_repo_rules~typescript_go/internal/checker/nodebuilderimpl.go:2353 +0x160
github.com/microsoft/typescript-go/internal/checker.(*nodeBuilderImpl).visitAndTransformType(0x140088fe1c0, 0x14006728d80, 0x100e33b78)
	external/_main~_repo_rules~typescript_go/internal/checker/nodebuilderimpl.go:2747 +0x50c
github.com/microsoft/typescript-go/internal/checker.(*nodeBuilderImpl).createAnonymousTypeNode(0x140088fe1c0, 0x14006728d80)
	external/_main~_repo_rules~typescript_go/internal/checker/nodebuilderimpl.go:2473 +0x2ec
github.com/microsoft/typescript-go/internal/checker.(*nodeBuilderImpl).typeToTypeNode(0x140088fe1c0, 0x14007d87980?)
	external/_main~_repo_rules~typescript_go/internal/checker/nodebuilderimpl.go:3018 +0x5fc
github.com/microsoft/typescript-go/internal/checker.(*nodeBuilderImpl).serializeTypeForDeclaration(0x140088fe1c0, 0x140004b0410, 0x800081c0d?, 0x100e441e0?)
	external/_main~_repo_rules~typescript_go/internal/checker/nodebuilderimpl.go:2011 +0x2b0
github.com/microsoft/typescript-go/internal/checker.(*NodeBuilder).SerializeTypeForDeclaration(0x14008d4f5e0, 0x140004b0410, 0x1400805f0a0, 0x14009606540?, 0x805f0a0?, 0x140?, {0x100e441e0?, 0x14007d87980?})
	external/_main~_repo_rules~typescript_go/internal/checker/nodebuilder.go:108 +0x5c
github.com/microsoft/typescript-go/internal/checker.(*emitResolver).CreateTypeOfDeclaration(0x14009c2c360, 0x14004778be0, 0x140004b0410, 0x14000678308, 0x81c0d, 0x8, {0x100e441e0, 0x14007d87980})
	external/_main~_repo_rules~typescript_go/internal/checker/emitresolver.go:914 +0x378
github.com/microsoft/typescript-go/internal/transformers/declarations.(*DeclarationTransformer).ensureType(0x1400889a8c0, 0x140004b0410, 0xf8?)
	external/_main~_repo_rules~typescript_go/internal/transformers/declarations/transform.go:1030 +0x284
github.com/microsoft/typescript-go/internal/transformers/declarations.(*DeclarationTransformer).transformVariableDeclaration(0x1400889a8c0, 0x140004b0410)
	external/_main~_repo_rules~typescript_go/internal/transformers/declarations/transform.go:659 +0x84
github.com/microsoft/typescript-go/internal/transformers/declarations.(*DeclarationTransformer).visitDeclarationSubtree(0x1400889a8c0, 0x140004b0410)
	external/_main~_repo_rules~typescript_go/internal/transformers/declarations/transform.go:463 +0xa30
github.com/microsoft/typescript-go/internal/transformers/declarations.(*DeclarationTransformer).visit(0x14001d7b7d8?, 0x1005a2a34?)
	external/_main~_repo_rules~typescript_go/internal/transformers/declarations/transform.go:146 +0x110
github.com/microsoft/typescript-go/internal/ast.(*NodeVisitor).VisitSlice(0x140097240c0, {0x140006400f8, 0x1, 0x1})
	external/_main~_repo_rules~typescript_go/internal/ast/visitor.go:148 +0xa0
github.com/microsoft/typescript-go/internal/ast.(*NodeVisitor).VisitNodes(0x140097240c0, 0x140006482a0)
	external/_main~_repo_rules~typescript_go/internal/ast/visitor.go:99 +0x3c
github.com/microsoft/typescript-go/internal/transformers/declarations.(*DeclarationTransformer).transformVariableStatement(0x1400889a8c0, 0x14000802140)
	external/_main~_repo_rules~typescript_go/internal/transformers/declarations/transform.go:1421 +0xcc
github.com/microsoft/typescript-go/internal/transformers/declarations.(*DeclarationTransformer).transformTopLevelDeclaration(0x1400889a8c0, 0x14000802140)
	external/_main~_repo_rules~typescript_go/internal/transformers/declarations/transform.go:1113 +0x308
github.com/microsoft/typescript-go/internal/transformers/declarations.(*DeclarationTransformer).visitDeclarationStatements(0x1400889a8c0, 0x14000802140)
	external/_main~_repo_rules~typescript_go/internal/transformers/declarations/transform.go:953 +0x4c
github.com/microsoft/typescript-go/internal/transformers/declarations.(*DeclarationTransformer).visit(0x14009c2c360?, 0x140008020a0?)
	external/_main~_repo_rules~typescript_go/internal/transformers/declarations/transform.go:121 +0xe8
github.com/microsoft/typescript-go/internal/ast.(*NodeVisitor).VisitSlice(0x140097240c0, {0x14000644500, 0x2, 0x2})
	external/_main~_repo_rules~typescript_go/internal/ast/visitor.go:148 +0xa0
github.com/microsoft/typescript-go/internal/ast.(*NodeVisitor).VisitNodes(0x140097240c0, 0x140006482c0)
	external/_main~_repo_rules~typescript_go/internal/ast/visitor.go:99 +0x3c
github.com/microsoft/typescript-go/internal/transformers/declarations.(*DeclarationTransformer).transformSourceFile(0x1400889a8c0, 0x14000678308)
	external/_main~_repo_rules~typescript_go/internal/transformers/declarations/transform.go:188 +0x30
github.com/microsoft/typescript-go/internal/transformers/declarations.(*DeclarationTransformer).visitSourceFile(0x1400889a8c0, 0x14000678308)
	external/_main~_repo_rules~typescript_go/internal/transformers/declarations/transform.go:175 +0x15c
github.com/microsoft/typescript-go/internal/transformers/declarations.(*DeclarationTransformer).visit(0x140029a77a0?, 0xd1?)
	external/_main~_repo_rules~typescript_go/internal/transformers/declarations/transform.go:105 +0xbc
github.com/microsoft/typescript-go/internal/ast.(*NodeVisitor).VisitNode(0x14001b353f0?, 0x14004778be0?)
	external/_main~_repo_rules~typescript_go/internal/ast/visitor.go:51 +0x30
github.com/microsoft/typescript-go/internal/ast.(*NodeVisitor).VisitSourceFile(...)
	external/_main~_repo_rules~typescript_go/internal/ast/visitor.go:36
github.com/microsoft/typescript-go/internal/transformers.(*Transformer).TransformSourceFile(...)
	external/_main~_repo_rules~typescript_go/internal/transformers/transformer.go:40
github.com/microsoft/typescript-go/internal/compiler.(*emitter).emitDeclarationFile(0x14001b353f0, 0x14000678308, {0x140029a77a0, 0xd1}, {0x0, 0x0})
	external/_main~_repo_rules~typescript_go/internal/compiler/emitter.go:190 +0x1a8
github.com/microsoft/typescript-go/internal/compiler.(*emitter).emit(0x14001b353f0)
	external/_main~_repo_rules~typescript_go/internal/compiler/emitter.go:48 +0x48
github.com/microsoft/typescript-go/internal/compiler.(*Program).Emit.func2()
	external/_main~_repo_rules~typescript_go/internal/compiler/program.go:1401 +0x194
github.com/microsoft/typescript-go/internal/core.(*parallelWorkGroup).Queue.func1()
	external/_main~_repo_rules~typescript_go/internal/core/workgroup.go:42 +0x50
created by github.com/microsoft/typescript-go/internal/core.(*parallelWorkGroup).Queue in goroutine 1
	external/_main~_repo_rules~typescript_go/internal/core/workgroup.go:40 +0x7c

Steps to reproduce

The below steps were not correct, updated reproduction instructions in #1731 (comment)

Minimal repro:

import {type DocsContainerProps} from '@storybook/addon-docs';

export const MyComponent = (
    props: DocsContainerProps,
) => {
    return null;
};

There's something about this DocsContainerProps that is tickling some bad behaviour. On the fairly large codebase I was testing tsgo on, this was the only observed segmentation fault. This is coming from "@storybook/addon-docs": "7.6.20",. Appears to work fine in legacy tsserver

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions