Skip to content

Find all references crash on literal with base constraint contextual type #48963

Closed
@DanielRosenwasser

Description

@DanielRosenwasser

Currently, the crawler/fuzzer has been stuck on TS 20220405 because our single test case crashes on a find-all-references request in dtslint on the string literal "package.json".

https://github.com/microsoft/dtslint/blob/1ccb5736f1e99a81db56df8b59625fd64d8bc061/src/checks.ts#L13

The regression was introduced by #48566, and we would have been able to catch it if we had noUncheckedIndexedAccess.

I'm sure there's a more realistic repro that is actually a problem for users directly, but here's something minimal.

const lol: string = "rofl/**/";

The : string HAS to be there to there in this case.

Request find-all-references in the string at /**/

Errors at

const clearIsDefinition = projectOutputs[0].references[0].isDefinition === undefined;

[Trace  - 01:09:59.664] <semantic> Response received: references (259). Request took 9 ms. Success: false . Message: Error processing request. Cannot read properties of undefined (reading 'isDefinition')
TypeError: Cannot read properties of undefined (reading 'isDefinition')
    at /node_modules/typescript/lib/tsserver.js:174383:77
    at callbackProjectAndLocation (/node_modules/typescript/lib/tsserver.js:174496:13)
    at /node_modules/typescript/lib/tsserver.js:174433:24
    at forEachProjectInProjects (/node_modules/typescript/lib/tsserver.js:174415:17)
    at combineProjectOutputWorker (/node_modules/typescript/lib/tsserver.js:174430:13)
    at combineProjectOutputForReferences (/node_modules/typescript/lib/tsserver.js:174379:13)
    at IpcIOSession.Session.getReferences (/node_modules/typescript/lib/tsserver.js:175886:34)
    at Session.handlers.ts.Map.ts.getEntries._a.<computed> (/node_modules/typescript/lib/tsserver.js:174725:61)
    at /node_modules/typescript/lib/tsserver.js:176856:88
    at IpcIOSession.Session.executeWithRequestId (/node_modules/typescript/lib/tsserver.js:176847:28)
    at IpcIOSession.Session.executeCommand (/node_modules/typescript/lib/tsserver.js:176856:33)
    at IpcIOSession.Session.onMessage (/node_modules/typescript/lib/tsserver.js:176882:35)
    at process.<anonymous> (/node_modules/typescript/lib/tsserver.js:179517:31)
    at process.emit (node:events:390:28)
    at emit (node:internal/child_process:917:12)
    at processTicksAndRejections (node:internal/process/task_queues:84:21)

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptCrashFor flagging bugs which are compiler or service crashes or unclean exits, rather than bad outputDomain: Symbol NavigationRelates to go-to-definition, find-all-references, highlighting/occurrences.Effort: CasualGood issue if you're already used to contributing to the codebase. Harder than "good first issue".Fix AvailableA PR has been opened for this issueHelp WantedYou can do this

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions