Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scanner crash in services (TypeScript 5.5) #59115

Open
andrewbranch opened this issue Jul 2, 2024 · 0 comments · May be fixed by #59137, #59130 or #59135
Open

Scanner crash in services (TypeScript 5.5) #59115

andrewbranch opened this issue Jul 2, 2024 · 0 comments · May be fixed by #59137, #59130 or #59135
Assignees
Labels
Bug A bug in TypeScript Crash For flagging bugs which are compiler or service crashes or unclean exits, rather than bad output Domain: Organize Imports Issues with the organize imports feature Fix Available A PR has been opened for this issue

Comments

@andrewbranch
Copy link
Member

andrewbranch commented Jul 2, 2024

Additional repros can be found in #59085


Error: Debug Failure. False expression.

Req #3028 - organizeImports
    at Object.resetTokenState (/typescript-5.6.0-dev.20240630/lib/typescript.js:14395:11)
    at addSyntheticNodes (/typescript-5.6.0-dev.20240630/lib/typescript.js:148143:11)
    at createSyntaxList (/typescript-5.6.0-dev.20240630/lib/typescript.js:148171:3)
    at processNodes (/typescript-5.6.0-dev.20240630/lib/typescript.js:148132:19)
    at visitNodes (/typescript-5.6.0-dev.20240630/lib/typescript.js:31622:14)
    at forEachChildInMappedType (/typescript-5.6.0-dev.20240630/lib/typescript.js:31760:208)
    at forEachChild (/typescript-5.6.0-dev.20240630/lib/typescript.js:32138:35)
    at NodeObject.forEachChild (/typescript-5.6.0-dev.20240630/lib/typescript.js:148112:12)
    at createChildren (/typescript-5.6.0-dev.20240630/lib/typescript.js:148137:8)
    at NodeObject.getChildren (/typescript-5.6.0-dev.20240630/lib/typescript.js:148091:59)
    at getTokenAtPositionWorker (/typescript-5.6.0-dev.20240630/lib/typescript.js:136484:32)
    at getTouchingToken (/typescript-5.6.0-dev.20240630/lib/typescript.js:136457:10)
    at getTouchingPropertyName (/typescript-5.6.0-dev.20240630/lib/typescript.js:136454:10)
    at /typescript-5.6.0-dev.20240630/lib/typescript.js:169040:33
    at mapDefined (/typescript-5.6.0-dev.20240630/lib/typescript.js:2571:22)
    at getPossibleSymbolReferenceNodes (/typescript-5.6.0-dev.20240630/lib/typescript.js:169039:12)
    at eachSymbolReferenceInFile (/typescript-5.6.0-dev.20240630/lib/typescript.js:168986:25)
    at Object.isSymbolReferencedInFile (/typescript-5.6.0-dev.20240630/lib/typescript.js:168980:12)
    at isDeclarationUsed (/typescript-5.6.0-dev.20240630/lib/typescript.js:171956:221)
    at /typescript-5.6.0-dev.20240630/lib/typescript.js:171931:66
    at removeUnusedImports (/typescript-5.6.0-dev.20240630/lib/typescript.js:171931:52)
    at processImportsOfSameModuleSpecifier (/typescript-5.6.0-dev.20240630/lib/typescript.js:171819:39)
    at /typescript-5.6.0-dev.20240630/lib/typescript.js:171787:175
    at flatMap (/typescript-5.6.0-dev.20240630/lib/typescript.js:2501:17)
    at organizeDeclsWorker (/typescript-5.6.0-dev.20240630/lib/typescript.js:171787:28)
    at organizeImportsWorker (/typescript-5.6.0-dev.20240630/lib/typescript.js:171824:5)
    at /typescript-5.6.0-dev.20240630/lib/typescript.js:171766:57
    at Object.organizeImports (/typescript-5.6.0-dev.20240630/lib/typescript.js:171766:28)
    at Object.organizeImports2 [as organizeImports] (/typescript-5.6.0-dev.20240630/lib/typescript.js:149686:39)
    at IOSession.organizeImports (/typescript-5.6.0-dev.20240630/lib/typescript.js:191237:50)
    at organizeImports (/typescript-5.6.0-dev.20240630/lib/typescript.js:189388:43)
    at /typescript-5.6.0-dev.20240630/lib/typescript.js:191603:15
    at IOSession.executeWithRequestId (/typescript-5.6.0-dev.20240630/lib/typescript.js:191592:14)
    at IOSession.executeCommand (/typescript-5.6.0-dev.20240630/lib/typescript.js:191601:29)
    at IOSession.onMessage (/typescript-5.6.0-dev.20240630/lib/typescript.js:191649:68)
    at Interface.<anonymous> (/typescript-5.6.0-dev.20240630/lib/tsserver.js:501:14)

Affected repos

tldraw/tldraw Raw error text: RepoResults2/tldraw.tldraw.rawError.txt in the artifact folder
Replay commands: RepoResults2/tldraw.tldraw.replay.txt in the artifact folder

Last few requests

{"seq":3025,"type":"request","command":"definitionAndBoundSpan","arguments":{"file":"@PROJECT_ROOT@/packages/tlschema/src/shapes/TLArrowShape.ts","line":208,"offset":1}}
{"seq":3026,"type":"request","command":"updateOpen","arguments":{"changedFiles":[],"closedFiles":["@PROJECT_ROOT@/packages/tlschema/src/shapes/TLEmbedShape.ts"],"openFiles":[]}}
{"seq":3027,"type":"request","command":"updateOpen","arguments":{"changedFiles":[],"closedFiles":[],"openFiles":[{"file":"@PROJECT_ROOT@/packages/tlschema/src/records/TLShape.ts","projectRootPath":"@PROJECT_ROOT@"}]}}
{"seq":3028,"type":"request","command":"organizeImports","arguments":{"scope":{"type":"file","args":{"file":"@PROJECT_ROOT@/packages/tlschema/src/records/TLShape.ts"}},"skipDestructiveCodeActions":false}}

Repro steps

#!/bin/bash

git clone https://github.com/tldraw/tldraw --recurse-submodules
git -C "./tldraw" reset --hard 4fff8a89afc03c91ad928b708caa677887f12226
downloadUrl=$(curl -s "https://typescript.visualstudio.com/TypeScript/_apis/build/builds/162530/artifacts?artifactName=RepoResults2&api-version=7.0" | jq -r ".resource.downloadUrl")
wget -O RepoResults2.zip "$downloadUrl"
unzip -p RepoResults2.zip RepoResults2/tldraw.tldraw.replay.txt > tldraw.tldraw.replay.txt
npm install --no-save @typescript/server-replay

To run the repro:

# `npx tsreplay --help` to learn about helpful switches for debugging, logging, etc.
npx tsreplay ./tldraw ./tldraw.tldraw.replay.txt <PATH_TO_tsserver.js>

Originally posted by @typescript-bot in #59085 (comment)

@andrewbranch andrewbranch added Bug A bug in TypeScript Domain: Organize Imports Issues with the organize imports feature Crash For flagging bugs which are compiler or service crashes or unclean exits, rather than bad output labels Jul 2, 2024
@andrewbranch andrewbranch added this to the TypeScript 5.6.0 milestone Jul 2, 2024
@andrewbranch andrewbranch changed the title OrganizeImports crash (TypeScript 5.5) Scanner crash in services (TypeScript 5.5) Jul 3, 2024
@andrewbranch andrewbranch linked a pull request Jul 3, 2024 that will close this issue
@typescript-bot typescript-bot added Fix Available A PR has been opened for this issue labels Jul 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Crash For flagging bugs which are compiler or service crashes or unclean exits, rather than bad output Domain: Organize Imports Issues with the organize imports feature Fix Available A PR has been opened for this issue
Projects
None yet
3 participants