TypeScript icon indicating copy to clipboard operation
TypeScript copied to clipboard

Exception while resolving base type from JSDoc for `references` request

Open amcasey opened this issue 3 years ago • 1 comments

odoo/odoo getDefinitionFromOverriddenMember computes the error type (type id 4) for the base type and that type has no associated symbol. The node in question is from jsdoc.

Originally posted by @amcasey in https://github.com/microsoft/TypeScript/issues/50836#issuecomment-1254072749

amcasey avatar Sep 21 '22 23:09 amcasey

odoo/odoo

Req #41020 - references
    at getTypeOfSymbolAtLocation (/typescript-4.9.0-dev.20220918/lib/tsserver.js:72678:29)
    at Object.getTypeOfSymbolAtLocation (/typescript-4.9.0-dev.20220918/lib/tsserver.js:49246:35)
    at getDefinitionFromOverriddenMember (/typescript-4.9.0-dev.20220918/lib/tsserver.js:142535:61)
    at Object.getDefinitionAtPosition (/typescript-4.9.0-dev.20220918/lib/tsserver.js:142388:24)
    at Object.getDefinitionAtPosition (/typescript-4.9.0-dev.20220918/lib/tsserver.js:168502:38)
    at getDefinitionLocation (/typescript-4.9.0-dev.20220918/lib/tsserver.js:178704:61)
    at getPerProjectReferences (/typescript-4.9.0-dev.20220918/lib/tsserver.js:178860:37)
    at getReferencesWorker (/typescript-4.9.0-dev.20220918/lib/tsserver.js:178712:37)
    at IOSession.Session.getReferences (/typescript-4.9.0-dev.20220918/lib/tsserver.js:180315:34)
    at Session.handlers.ts.Map.ts.getEntries._a.<computed> (/typescript-4.9.0-dev.20220918/lib/tsserver.js:179152:61)
    at /typescript-4.9.0-dev.20220918/lib/tsserver.js:181286:96
    at IOSession.Session.executeWithRequestId (/typescript-4.9.0-dev.20220918/lib/tsserver.js:181277:28)
    at IOSession.Session.executeCommand (/typescript-4.9.0-dev.20220918/lib/tsserver.js:181286:41)
    at IOSession.Session.onMessage (/typescript-4.9.0-dev.20220918/lib/tsserver.js:181314:35)
    at Interface.<anonymous> (/typescript-4.9.0-dev.20220918/lib/tsserver.js:185436:31)

Last few requests

{"seq":41017,"type":"request","command":"completionInfo","arguments":{"file":"@PROJECT_ROOT@/addons/web/static/src/legacy/js/control_panel/control_panel_model_extension.js","line":1626,"offset":12,"includeExternalModuleExports":false,"includeInsertTextCompletions":true,"triggerKind":1}}
{"seq":41018,"type":"request","command":"completionEntryDetails","arguments":{"file":"@PROJECT_ROOT@/addons/web/static/src/legacy/js/control_panel/control_panel_model_extension.js","line":1626,"offset":12,"entryNames":["@abstract"]}}
{"seq":41019,"type":"request","command":"definitionAndBoundSpan","arguments":{"file":"@PROJECT_ROOT@/addons/web/static/src/legacy/js/control_panel/control_panel_model_extension.js","line":1642,"offset":12}}
{"seq":41020,"type":"request","command":"references","arguments":{"file":"@PROJECT_ROOT@/addons/web/static/src/legacy/js/control_panel/control_panel_model_extension.js","line":1643,"offset":12}}

Repro Steps

  1. git clone https://github.com/odoo/odoo --recurse-submodules
  2. In dir odoo, run git reset --hard 6bf6ce062aa4cfbb7efb96806cbfcfa13868337f
  3. In dir odoo/addons/pad/static/plugin/ep_disable_init_focus, run npm install --prefer-offline --no-audit --no-progress --legacy-peer-deps --ignore-scripts -q
  4. Download RepoResults3/odoo.odoo.replay.txt from the artifact folder
  5. npm install --no-save @typescript/server-replay
  6. npx tsreplay ./odoo ./odoo.odoo.replay.txt path/to/tsserver.js

Unfortunately, cloning this repo takes forever because it's enormous. 😢

amcasey avatar Sep 21 '22 23:09 amcasey

Note: I couldn't get step (6) to work until I changed it to (a) cd odoo (b) tsreplay ./ ./odoo.odoo.replay.txt path/ts/tsserver.js (and I put odoo.odoo.replay.txt in the odoo directory)

sandersn avatar Sep 30 '22 00:09 sandersn

Note: I couldn't get step (6) to work until I changed it to (a) cd odoo (b) tsreplay ./ ./odoo.odoo.replay.txt path/ts/tsserver.js (and I put odoo.odoo.replay.txt in the odoo directory)

That's not expected and I'd like to know more. tsreplay should be more or less indifferent to its working directory.

amcasey avatar Sep 30 '22 00:09 amcasey

Also, the link you give is to line 139, which is an @extends jsdoc, but the "last few requests" section gives seq #41020 at line 1643/offset 12, which is a @returns jsdoc (though it is on a method inside the class which starts just after line 139). Am I reading the tsreplay output wrong?

sandersn avatar Sep 30 '22 00:09 sandersn

Also, the link you give is to line 139, which is an @extends jsdoc, but the "last few requests" section gives seq #41020 at line 1643/offset 12, which is a @returns jsdoc (though it is on a method inside the class which starts just after line 139). Am I reading the tsreplay output wrong?

The link in my comment is based on my own subsequent debugging.

amcasey avatar Sep 30 '22 00:09 amcasey