FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Panic in `TupleNormalizer.normalize` (nil `currentNode`) when declaration emit resolves an oversized tuple type under `--noCheck` · Issue #64384 · microsoft/TypeScript · GitHub

Panic in TupleNormalizer.normalize (nil currentNode) when declaration emit resolves an oversized tuple type under --noCheck #64384

Description

🔎 Search Terms

"ast.IsPartOfTypeNode"

🕗 Version & Regression Information

nightly

⏯ Playground Link

No response

💻 Code

type BuildTuple<L extends number, T extends any[] = [any]> =
    T['length'] extends L ? T : BuildTuple<L, [...T, ...T]>;
type A = BuildTuple<3>;

export class C {
    p? = null! as A | string;
}

To reproduce: tsgo --strict --declaration --emitDeclarationOnly --noCheck --target es2015 min.ts

🙁 Actual behavior

panic: runtime error: invalid memory address or nil pointer dereference [recovered, repanicked]
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x6675f2]

goroutine 146 [running]:
sync.(*WaitGroup).Go.func1.1()
	/usr/local/go/src/sync/waitgroup.go:251 +0x45
panic({0xe3d900?, 0x1fbbd00?})
	/usr/local/go/src/runtime/panic.go:860 +0x13a
github.com/microsoft/TypeScript/tsc/internal/ast.IsPartOfTypeNode(0x6e07920f908?)
	/home/fuzz/WorkSpace/fusion-fuzz/projects/typescript/typescript-src/tsc/internal/ast/utilities.go:2059 +0x12
github.com/microsoft/TypeScript/tsc/internal/checker.(*TupleNormalizer).normalize(0x6e079b9d9d0, 0x6e07920f908, {0x6e078780650, 0x2, 0x6e079b9d9d8?}, {0x6e079a792e0, 0x2, 0x992a3a?})
	/home/fuzz/WorkSpace/fusion-fuzz/projects/typescript/typescript-src/tsc/internal/checker/checker.go:23721 +0x365
github.com/microsoft/TypeScript/tsc/internal/checker.(*Checker).createNormalizedTupleTypeEx(0x6e07920f908, 0x6e078b248c0?, {0x6e078780650, 0x2, 0x2?}, 0x0)
	/home/fuzz/WorkSpace/fusion-fuzz/projects/typescript/typescript-src/tsc/internal/checker/checker.go:23676 +0xea
github.com/microsoft/TypeScript/tsc/internal/checker.(*Checker).createNormalizedTupleType(...)
	/home/fuzz/WorkSpace/fusion-fuzz/projects/typescript/typescript-src/tsc/internal/checker/checker.go:23693
github.com/microsoft/TypeScript/tsc/internal/checker.(*Checker).createNormalizedTypeReference(0x15d9da0?, 0x6e07920f908?, {0x6e078780650?, 0x2?, 0x2?})
	/home/fuzz/WorkSpace/fusion-fuzz/projects/typescript/typescript-src/tsc/internal/checker/checker.go:23639 +0x25
github.com/microsoft/TypeScript/tsc/internal/checker.(*Checker).instantiateTypeWorker(0x6e07920f908, 0x6e078b82a80, 0x6e0788a2ac0, 0x0)
	/home/fuzz/WorkSpace/fusion-fuzz/projects/typescript/typescript-src/tsc/internal/checker/checker.go:22575 +0x197
github.com/microsoft/TypeScript/tsc/internal/checker.(*Checker).instantiateTypeWithAlias(0x6e07920f908, 0x6e078b82a80, 0x6e0788a2ac0, 0x0)
	/home/fuzz/WorkSpace/fusion-fuzz/projects/typescript/typescript-src/tsc/internal/checker/checker.go:22477 +0x6c5
github.com/microsoft/TypeScript/tsc/internal/checker.(*Checker).instantiateType(...)
	/home/fuzz/WorkSpace/fusion-fuzz/projects/typescript/typescript-src/tsc/internal/checker/checker.go:22442
github.com/microsoft/TypeScript/tsc/internal/checker.(*CompositeTypeMapper).Map(0x6e079a81d70, 0x6e078b81490)
	/home/fuzz/WorkSpace/fusion-fuzz/projects/typescript/typescript-src/tsc/internal/checker/mapper.go:289 +0x4d
github.com/microsoft/TypeScript/tsc/internal/checker.(*TypeMapper).Map(...)
	/home/fuzz/WorkSpace/fusion-fuzz/projects/typescript/typescript-src/tsc/internal/checker/mapper.go:26
github.com/microsoft/TypeScript/tsc/internal/checker.(*Checker).getTailRecursionRoot.func1(...)
	/home/fuzz/WorkSpace/fusion-fuzz/projects/typescript/typescript-src/tsc/internal/checker/checker.go:24805
github.com/microsoft/TypeScript/tsc/internal/core.Map[...](...)
	/home/fuzz/WorkSpace/fusion-fuzz/projects/typescript/typescript-src/tsc/internal/core/core.go:86
github.com/microsoft/TypeScript/tsc/internal/checker.(*Checker).getTailRecursionRoot(0x6e07920f908?, 0x6e07883e000?, 0x6e0788a2ac0?)
	/home/fuzz/WorkSpace/fusion-fuzz/projects/typescript/typescript-src/tsc/internal/checker/checker.go:24805 +0x2fd
github.com/microsoft/TypeScript/tsc/internal/checker.(*Checker).getConditionalType(0x6e07920f908, 0x6e079b85ad0?, 0x6e078546128?, 0x0, 0x6e078546100?)
	/home/fuzz/WorkSpace/fusion-fuzz/projects/typescript/typescript-src/tsc/internal/checker/checker.go:24747 +0x885
github.com/microsoft/TypeScript/tsc/internal/checker.(*Checker).getConditionalTypeInstantiation(0x6e07920f908, 0x10000008bf9e6?, 0x7fb34809fe08?, 0x0, 0x6e079a79160)
	/home/fuzz/WorkSpace/fusion-fuzz/projects/typescript/typescript-src/tsc/internal/checker/checker.go:22850 +0x372
github.com/microsoft/TypeScript/tsc/internal/checker.(*Checker).instantiateTypeWorker(0x6e07920f908, 0x6e078c2a900, 0x6e078c255c0, 0x6e079a79160)
	/home/fuzz/WorkSpace/fusion-fuzz/projects/typescript/typescript-src/tsc/internal/checker/checker.go:22616 +0x607
github.com/microsoft/TypeScript/tsc/internal/checker.(*Checker).instantiateTypeWithAlias(0x6e07920f908, 0x6e078c2a900, 0x6e078c255c0, 0x6e079a79160)
	/home/fuzz/WorkSpace/fusion-fuzz/projects/typescript/typescript-src/tsc/internal/checker/checker.go:22477 +0x6c5
github.com/microsoft/TypeScript/tsc/internal/checker.(*Checker).getTypeAliasInstantiation(0x6e07920f908, 0x6e0787ce4e0, {0x6e078881040, 0x1, 0x1}, 0x6e079a79160)
	/home/fuzz/WorkSpace/fusion-fuzz/projects/typescript/typescript-src/tsc/internal/checker/checker.go:24000 +0x39d
github.com/microsoft/TypeScript/tsc/internal/checker.(*Checker).getTypeFromTypeAliasReference(0x6e07920f908, 0x6e07883e040, 0x6e0787ce4e0)
	/home/fuzz/WorkSpace/fusion-fuzz/projects/typescript/typescript-src/tsc/internal/checker/checker.go:23974 +0x4c5
github.com/microsoft/TypeScript/tsc/internal/checker.(*Checker).getTypeReferenceType(0x6e07920f908?, 0x6e07883e040?, 0x6e07883e040?)
	/home/fuzz/WorkSpace/fusion-fuzz/projects/typescript/typescript-src/tsc/internal/checker/checker.go:23495 +0x95
github.com/microsoft/TypeScript/tsc/internal/checker.(*Checker).getTypeFromTypeReference(0x6e07920f908, 0x6e07883e040)
	/home/fuzz/WorkSpace/fusion-fuzz/projects/typescript/typescript-src/tsc/internal/checker/checker.go:23355 +0x117
github.com/microsoft/TypeScript/tsc/internal/checker.(*Checker).getTypeFromTypeNodeWorker(0x6e079b85a70?, 0x6e078b02cc0?)
	/home/fuzz/WorkSpace/fusion-fuzz/projects/typescript/typescript-src/tsc/internal/checker/checker.go:23198 +0x37f
github.com/microsoft/TypeScript/tsc/internal/checker.(*Checker).getTypeFromTypeNode(0x6e07920f908, 0x6e07883e040)
	/home/fuzz/WorkSpace/fusion-fuzz/projects/typescript/typescript-src/tsc/internal/checker/checker.go:23149 +0x1d
github.com/microsoft/TypeScript/tsc/internal/checker.(*Checker).getDeclaredTypeOfTypeAlias(0x6e07920f908, 0x6e078b02cc0)
	/home/fuzz/WorkSpace/fusion-fuzz/projects/typescript/typescript-src/tsc/internal/checker/checker.go:24197 +0xea
github.com/microsoft/TypeScript/tsc/internal/checker.(*Checker).tryGetDeclaredTypeOfSymbol(0x0?, 0x423945?)
	/home/fuzz/WorkSpace/fusion-fuzz/projects/typescript/typescript-src/tsc/internal/checker/checker.go:24026 +0x66
github.com/microsoft/TypeScript/tsc/internal/checker.(*Checker).getDeclaredTypeOfSymbol(...)
	/home/fuzz/WorkSpace/fusion-fuzz/projects/typescript/typescript-src/tsc/internal/checker/checker.go:24012
github.com/microsoft/TypeScript/tsc/internal/checker.(*Checker).getTypeFromTypeAliasReference(0x6e07920f908, 0x6e07883e080, 0x6e078b02cc0)
	/home/fuzz/WorkSpace/fusion-fuzz/projects/typescript/typescript-src/tsc/internal/checker/checker.go:23934 +0xcc
github.com/microsoft/TypeScript/tsc/internal/checker.(*Checker).getTypeReferenceType(0x6e07920f908?, 0x6e07883e080?, 0x6e07883e080?)
	/home/fuzz/WorkSpace/fusion-fuzz/projects/typescript/typescript-src/tsc/internal/checker/checker.go:23495 +0x95
github.com/microsoft/TypeScript/tsc/internal/checker.(*Checker).getTypeFromTypeReference(0x6e07920f908, 0x6e07883e080)
	/home/fuzz/WorkSpace/fusion-fuzz/projects/typescript/typescript-src/tsc/internal/checker/checker.go:23355 +0x117
github.com/microsoft/TypeScript/tsc/internal/checker.(*Checker).getTypeFromTypeNodeWorker(0xec8b40?, 0x6e079a50b28?)
	/home/fuzz/WorkSpace/fusion-fuzz/projects/typescript/typescript-src/tsc/internal/checker/checker.go:23198 +0x37f
github.com/microsoft/TypeScript/tsc/internal/checker.(*Checker).getTypeFromTypeNode(0x6e07920f908, 0x6e07883e080)
	/home/fuzz/WorkSpace/fusion-fuzz/projects/typescript/typescript-src/tsc/internal/checker/checker.go:23149 +0x1d
github.com/microsoft/TypeScript/tsc/internal/core.Map[...](...)
	/home/fuzz/WorkSpace/fusion-fuzz/projects/typescript/typescript-src/tsc/internal/core/core.go:86
github.com/microsoft/TypeScript/tsc/internal/checker.(*Checker).getTypeFromUnionTypeNode(0x6e07920f908, 0x6e07882c150)
	/home/fuzz/WorkSpace/fusion-fuzz/projects/typescript/typescript-src/tsc/internal/checker/checker.go:24563 +0x1b7
github.com/microsoft/TypeScript/tsc/internal/checker.(*Checker).getTypeFromTypeNodeWorker(0x6e07920f908, 0x895885?)
	/home/fuzz/WorkSpace/fusion-fuzz/projects/typescript/typescript-src/tsc/internal/checker/checker.go:23211 +0x289
github.com/microsoft/TypeScript/tsc/internal/checker.(*Checker).getTypeFromTypeNode(0x6e07920f908, 0x6e07882c150)
	/home/fuzz/WorkSpace/fusion-fuzz/projects/typescript/typescript-src/tsc/internal/checker/checker.go:23149 +0x1d
github.com/microsoft/TypeScript/tsc/internal/checker.(*Checker).getQuickTypeOfExpression(0x6e07920f908, 0x6e07882e1c0)
	/home/fuzz/WorkSpace/fusion-fuzz/projects/typescript/typescript-src/tsc/internal/checker/checker.go:7545 +0x145
github.com/microsoft/TypeScript/tsc/internal/checker.(*Checker).checkDeclarationInitializer(0x6e07920f908, 0x6e07882c1c0, 0x0, 0x0)
	/home/fuzz/WorkSpace/fusion-fuzz/projects/typescript/typescript-src/tsc/internal/checker/checker.go:17099 +0x3f
github.com/microsoft/TypeScript/tsc/internal/checker.(*Checker).getTypeForVariableLikeDeclaration(0x6e07920f908, 0x6e07882c1c0, 0x1?, 0x0)
	/home/fuzz/WorkSpace/fusion-fuzz/projects/typescript/typescript-src/tsc/internal/checker/checker.go:17049 +0x767
github.com/microsoft/TypeScript/tsc/internal/checker.(*Checker).getWidenedTypeForVariableLikeDeclaration(0x6e07920f908, 0x6e07882c1c0, 0x1)
	/home/fuzz/WorkSpace/fusion-fuzz/projects/typescript/typescript-src/tsc/internal/checker/checker.go:16948 +0x28
github.com/microsoft/TypeScript/tsc/internal/checker.(*Checker).getTypeOfVariableOrParameterOrPropertyWorker(0x6e07920f908, 0x6e078927cc8)
	/home/fuzz/WorkSpace/fusion-fuzz/projects/typescript/typescript-src/tsc/internal/checker/checker.go:16910 +0x27a
github.com/microsoft/TypeScript/tsc/internal/checker.(*Checker).getTypeOfVariableOrParameterOrProperty(0x6e07920f908, 0x6e078927cc8)
	/home/fuzz/WorkSpace/fusion-fuzz/projects/typescript/typescript-src/tsc/internal/checker/checker.go:16847 +0x4d
github.com/microsoft/TypeScript/tsc/internal/checker.(*Checker).getTypeOfSymbol(0x939d07?, 0x1fbe1d0?)
	/home/fuzz/WorkSpace/fusion-fuzz/projects/typescript/typescript-src/tsc/internal/checker/checker.go:16810 +0x9b
github.com/microsoft/TypeScript/tsc/internal/checker.(*NodeBuilderImpl).serializeTypeForDeclaration(0x6e078b0ee80, 0x6e0788261b0?, 0x800081c0d?, 0x15e75d0?, 0x1)
	/home/fuzz/WorkSpace/fusion-fuzz/projects/typescript/typescript-src/tsc/internal/checker/nodebuilderimpl.go:2274 +0x265
github.com/microsoft/TypeScript/tsc/internal/checker.(*NodeBuilder).SerializeTypeForDeclaration(0x6e078c25500, 0x6e07882c1c0, 0x6e078927cc8, 0x18?, 0xed7560?, 0x0?, {0x15e75d0?, 0x6e07881f860?})
	/home/fuzz/WorkSpace/fusion-fuzz/projects/typescript/typescript-src/tsc/internal/checker/nodebuilder.go:136 +0x59
github.com/microsoft/TypeScript/tsc/internal/checker.(*EmitResolver).CreateTypeOfDeclaration(0x6e078c2a480, 0x6e07889e000, 0x6e07882c1c0, 0x6e0788261b0, 0x81c0d, 0x8, {0x15e75d0, 0x6e07881f860})
	/home/fuzz/WorkSpace/fusion-fuzz/projects/typescript/typescript-src/tsc/internal/checker/emitresolver.go:985 +0x174
github.com/microsoft/TypeScript/tsc/internal/transformers/declarations.(*DeclarationTransformer).ensureType(0x6e0786b7c80, 0x6e07882c1c0, 0x28?)
	/home/fuzz/WorkSpace/fusion-fuzz/projects/typescript/typescript-src/tsc/internal/transformers/declarations/transform.go:1673 +0x36a
github.com/microsoft/TypeScript/tsc/internal/transformers/declarations.(*DeclarationTransformer).transformPropertyDeclaration(0x6e0786b7c80, 0x6e07882c1c0)
	/home/fuzz/WorkSpace/fusion-fuzz/projects/typescript/typescript-src/tsc/internal/transformers/declarations/transform.go:999 +0x74
github.com/microsoft/TypeScript/tsc/internal/transformers/declarations.(*DeclarationTransformer).visitDeclarationSubtree(0x6e0786b7c80, 0x6e07882c1c0)
	/home/fuzz/WorkSpace/fusion-fuzz/projects/typescript/typescript-src/tsc/internal/transformers/declarations/transform.go:642 +0x805
github.com/microsoft/TypeScript/tsc/internal/transformers/declarations.(*DeclarationTransformer).visit(0x6e078905808?, 0x6e078620150?)
	/home/fuzz/WorkSpace/fusion-fuzz/projects/typescript/typescript-src/tsc/internal/transformers/declarations/transform.go:272 +0xe6
github.com/microsoft/TypeScript/tsc/internal/ast.(*NodeVisitor).VisitSlice(0x6e07881f8c0, {0x6e07882e160, 0x1, 0x1})
	/home/fuzz/WorkSpace/fusion-fuzz/projects/typescript/typescript-src/tsc/internal/ast/visitor.go:148 +0xc2
github.com/microsoft/TypeScript/tsc/internal/ast.(*NodeVisitor).VisitNodes(0x6e07881f8c0, 0x6e078832100)
	/home/fuzz/WorkSpace/fusion-fuzz/projects/typescript/typescript-src/tsc/internal/ast/visitor.go:99 +0x37
github.com/microsoft/TypeScript/tsc/internal/transformers/declarations.(*DeclarationTransformer).buildClassMembers(0x6e0786b7c80, 0x6e0788261b0, {0x0, 0x0, 0xfdbaa0?})
	/home/fuzz/WorkSpace/fusion-fuzz/projects/typescript/typescript-src/tsc/internal/transformers/declarations/transform.go:1972 +0x454
github.com/microsoft/TypeScript/tsc/internal/transformers/declarations.(*DeclarationTransformer).transformClassDeclaration(0x6e0786b7c80, 0x6e0788261b0)
	/home/fuzz/WorkSpace/fusion-fuzz/projects/typescript/typescript-src/tsc/internal/transformers/declarations/transform.go:1997 +0x20c
github.com/microsoft/TypeScript/tsc/internal/transformers/declarations.(*DeclarationTransformer).transformTopLevelDeclaration(0x6e0786b7c80, 0x6e0788261b0)
	/home/fuzz/WorkSpace/fusion-fuzz/projects/typescript/typescript-src/tsc/internal/transformers/declarations/transform.go:1763 +0x4e7
github.com/microsoft/TypeScript/tsc/internal/transformers/declarations.(*DeclarationTransformer).visitDeclarationStatements(0x6e0786b7c80, 0x6e0788261b0)
	/home/fuzz/WorkSpace/fusion-fuzz/projects/typescript/typescript-src/tsc/internal/transformers/declarations/transform.go:1175 +0x485
github.com/microsoft/TypeScript/tsc/internal/transformers/declarations.(*DeclarationTransformer).visit(0xf1c880?, 0x6e078832101?)
	/home/fuzz/WorkSpace/fusion-fuzz/projects/typescript/typescript-src/tsc/internal/transformers/declarations/transform.go:247 +0xcb
github.com/microsoft/TypeScript/tsc/internal/ast.(*NodeVisitor).VisitSlice(0x6e07881f8c0, {0x6e07882e168, 0x3, 0x3})
	/home/fuzz/WorkSpace/fusion-fuzz/projects/typescript/typescript-src/tsc/internal/ast/visitor.go:148 +0xc2
github.com/microsoft/TypeScript/tsc/internal/ast.(*NodeVisitor).VisitNodes(0x6e07881f8c0, 0x6e078832120)
	/home/fuzz/WorkSpace/fusion-fuzz/projects/typescript/typescript-src/tsc/internal/ast/visitor.go:99 +0x37
github.com/microsoft/TypeScript/tsc/internal/transformers/declarations.(*DeclarationTransformer).transformSourceFile(0x6e0786b7c80, 0x6e078846008)
	/home/fuzz/WorkSpace/fusion-fuzz/projects/typescript/typescript-src/tsc/internal/transformers/declarations/transform.go:353 +0x117
github.com/microsoft/TypeScript/tsc/internal/transformers/declarations.(*DeclarationTransformer).visitSourceFile(0x6e0786b7c80, 0x6e078846008)
	/home/fuzz/WorkSpace/fusion-fuzz/projects/typescript/typescript-src/tsc/internal/transformers/declarations/transform.go:305 +0x2f1
github.com/microsoft/TypeScript/tsc/internal/transformers/declarations.(*DeclarationTransformer).visit(0xb7?, 0x0?)
	/home/fuzz/WorkSpace/fusion-fuzz/projects/typescript/typescript-src/tsc/internal/transformers/declarations/transform.go:232 +0xaf
github.com/microsoft/TypeScript/tsc/internal/ast.(*NodeVisitor).VisitNode(0x6e078642008?, 0x7fb340789c00?)
	/home/fuzz/WorkSpace/fusion-fuzz/projects/typescript/typescript-src/tsc/internal/ast/visitor.go:51 +0x27
github.com/microsoft/TypeScript/tsc/internal/ast.(*NodeVisitor).VisitSourceFile(...)
	/home/fuzz/WorkSpace/fusion-fuzz/projects/typescript/typescript-src/tsc/internal/ast/visitor.go:36
github.com/microsoft/TypeScript/tsc/internal/transformers.(*Transformer).TransformSourceFile(...)
	/home/fuzz/WorkSpace/fusion-fuzz/projects/typescript/typescript-src/tsc/internal/transformers/transformer.go:40
github.com/microsoft/TypeScript/tsc/internal/compiler.(*emitter).runDeclarationTransformers(0x0?, 0x0?, 0x6e078846008, {0x6e07853a180?, 0x0?}, {0x0?, 0x7?})
	/home/fuzz/WorkSpace/fusion-fuzz/projects/typescript/typescript-src/tsc/internal/compiler/emitter.go:84 +0x278
github.com/microsoft/TypeScript/tsc/internal/compiler.(*emitter).emitDeclarationFile(0x6e0786540f0, 0x6e078846008, {0x6e07853a180, 0xb7}, {0x0, 0x0})
	/home/fuzz/WorkSpace/fusion-fuzz/projects/typescript/typescript-src/tsc/internal/compiler/emitter.go:236 +0x218
github.com/microsoft/TypeScript/tsc/internal/compiler.(*emitter).emit(0x6e0786540f0)
	/home/fuzz/WorkSpace/fusion-fuzz/projects/typescript/typescript-src/tsc/internal/compiler/emitter.go:51 +0x145
github.com/microsoft/TypeScript/tsc/internal/compiler.(*Program).Emit.func2()
	/home/fuzz/WorkSpace/fusion-fuzz/projects/typescript/typescript-src/tsc/internal/compiler/program.go:1854 +0x1ce
github.com/microsoft/TypeScript/tsc/internal/core.(*parallelWorkGroup).Queue.func1()
	/home/fuzz/WorkSpace/fusion-fuzz/projects/typescript/typescript-src/tsc/internal/core/workgroup.go:40 +0x13
sync.(*WaitGroup).Go.func1()
	/usr/local/go/src/sync/waitgroup.go:258 +0x4a
created by sync.(*WaitGroup).Go in goroutine 1
	/usr/local/go/src/sync/waitgroup.go:238 +0x73

🙂 Expected behavior

no crash

Additional information about the issue

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScript

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL