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

getSpecifierForModuleSymbol failing in 5.5 rc #58819

Closed
turadg opened this issue Jun 10, 2024 · 3 comments Β· Fixed by #58872
Closed

getSpecifierForModuleSymbol failing in 5.5 rc #58819

turadg opened this issue Jun 10, 2024 · 3 comments Β· Fixed by #58872
Assignees
Labels
Bug A bug in TypeScript Fix Available A PR has been opened for this issue

Comments

@turadg
Copy link

turadg commented Jun 10, 2024

πŸ”Ž Search Terms

getSpecifierForModuleSymbol, Debug Failure, False expression,

πŸ•— Version & Regression Information

  • This is a crash
  • This changed between versions 5.5 beta and 5.5 rc

⏯ Playground Link

https://github.com/Agoric/agoric-sdk/actions/runs/9440222557/job/25999288161?pr=9476

πŸ’» Code

My only repro is half-way through the build of a large repo, so I don't think I can isolate it to a code snippet.

Agoric/agoric-sdk#9476 changed the typescript from,

- typescript@^5.5.0-beta
-   version "5.5.0-dev.20240426"
-  resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.5.0-dev.20240426.tgz#e9ba7d0b3cdaa54021faca61d1bc399e4766c93b"
-  integrity sha512-96cu+y3DrjSNhNSgB3t3nRiesCwBVjZpbjJ6DcQoCgt0crXXPrOMmJQH/E8TZ41U4JzaULD+cB1Z2owh5HANew==
+ typescript@^5.5.1-rc:
+   version "5.5.1-rc"
+   resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.5.1-rc.tgz#4be420f1ecb5e66c52a7cb11444f06f02294c977"
+   integrity sha512-7cbqBhh2QH0RaI7AD0ElJ2Ww/iRdW1w2wH/S2dv6EbdNQQlv39fx+V5VOepxLgfUvRkU5D5pxzgPuvHSAQOdpQ==

A CI job builds each package topologically.

πŸ™ Actual behavior

The job started failing with:

Error: Debug Failure. False expression.
    at first (/home/runner/work/agoric-sdk/agoric-sdk/node_modules/typescript/lib/tsc.js:605:9)
    at getSpecifierForModuleSymbol (/home/runner/work/agoric-sdk/agoric-sdk/node_modules/typescript/lib/tsc.js:50904:21)
    at rewriteModuleSpecifier (/home/runner/work/agoric-sdk/agoric-sdk/node_modules/typescript/lib/tsc.js:51977:22)
    at visitExistingNodeTreeSymbolsWorker (/home/runner/work/agoric-sdk/agoric-sdk/node_modules/typescript/lib/tsc.js:51827:58)
    at visitExistingNodeTreeSymbols (/home/runner/work/agoric-sdk/agoric-sdk/node_modules/typescript/lib/tsc.js:51535:24)
    at visitArrayWorker (/home/runner/work/agoric-sdk/agoric-sdk/node_modules/typescript/lib/tsc.js:87695:49)
    at visitNodes2 (/home/runner/work/agoric-sdk/agoric-sdk/node_modules/typescript/lib/tsc.js:87666:19)
    at tryVisitTypeReference (/home/runner/work/agoric-sdk/agoric-sdk/node_modules/typescript/lib/tsc.js:51672:33)
    at visitExistingNodeTreeSymbolsWorker (/home/runner/work/agoric-sdk/agoric-sdk/node_modules/typescript/lib/tsc.js:51811:26)
    at visitExistingNodeTreeSymbols (/home/runner/work/agoric-sdk/agoric-sdk/node_modules/typescript/lib/tsc.js:51535:24)

In the debugger I see that it happens while looking for escapedName: 'globalThis' in the context of this file.

πŸ™‚ Expected behavior

Continues to build like the beta and past releases.

Additional information about the issue

Our repo makes use of a hack to make types available both ambiently and by explicit imports.
https://github.com/Agoric/agoric-sdk/blob/e7b0cebd17f093793e93f4f236921cb4a3f595b8/packages/internal/exported.d.ts#L17-L29

The motivation for this is in transitioning from ambient types to define exportable types and retain backwards compatibility with consumers expecting ambients.

@RyanCavanaugh RyanCavanaugh added the Bug A bug in TypeScript label Jun 13, 2024
@RyanCavanaugh RyanCavanaugh added this to the TypeScript 5.5.2 milestone Jun 13, 2024
@andrewbranch
Copy link
Member

@turadg are you able to reproduce this locally? I’m hitting something else first when I try. Here’s what I’ve got:

gh pr checkout 9476
yarn
yarn lerna run --reject-cycles --concurrency 1 prepack

...

lerna ERR! npm run prepack exited 1 in '@agoric/zoe'
lerna ERR! npm run prepack stdout:

> @agoric/[email protected] prepack
> tsc --build tsconfig.build.json

tools/fakeVatAdmin.js(13,23): error TS2307: Cannot find module '../bundles/bundle-contractFacet.js' or its corresponding type declarations.
lerna ERR! npm run prepack stderr:
npm ERR! Lifecycle script `prepack` failed with error:
npm ERR! Error: command failed
npm ERR!   in workspace: @agoric/[email protected]
npm ERR!   at location: /Users/andrew/Developer/microsoft/eg/agoric-sdk/packages/zoe
lerna ERR! npm run prepack exited 1 in '@agoric/zoe'

@turadg
Copy link
Author

turadg commented Jun 13, 2024

@andrewbranch a yarn build makes the bundles.

I just slimmed Agoric/agoric-sdk#9476 to one commit adopting TS 5.5 rc1 then rebased on master. Here's my local repro,

git checkout ta/typescript-5.5
git clean -dfx
yarn install
yarn build
yarn lerna run --reject-cycles --concurrency 1 prepack

ends with,

> @agoric/[email protected] prepack
> tsc --build tsconfig.build.json

lerna ERR! npm run prepack stderr:
/opt/agoric/agoric-sdk/node_modules/typescript/lib/tsc.js:120157
      throw e;
      ^

Error: Debug Failure. False expression.
    at first (/opt/agoric/agoric-sdk/node_modules/typescript/lib/tsc.js:605:9)
    at getSpecifierForModuleSymbol (/opt/agoric/agoric-sdk/node_modules/typescript/lib/tsc.js:50904:21)
    at rewriteModuleSpecifier (/opt/agoric/agoric-sdk/node_modules/typescript/lib/tsc.js:51977:22)
    at visitExistingNodeTreeSymbolsWorker (/opt/agoric/agoric-sdk/node_modules/typescript/lib/tsc.js:51827:58)
    at visitExistingNodeTreeSymbols (/opt/agoric/agoric-sdk/node_modules/typescript/lib/tsc.js:51535:24)
    at visitArrayWorker (/opt/agoric/agoric-sdk/node_modules/typescript/lib/tsc.js:87695:49)
    at visitNodes2 (/opt/agoric/agoric-sdk/node_modules/typescript/lib/tsc.js:87666:19)
    at tryVisitTypeReference (/opt/agoric/agoric-sdk/node_modules/typescript/lib/tsc.js:51672:33)
    at visitExistingNodeTreeSymbolsWorker (/opt/agoric/agoric-sdk/node_modules/typescript/lib/tsc.js:51811:26)
    at visitExistingNodeTreeSymbols (/opt/agoric/agoric-sdk/node_modules/typescript/lib/tsc.js:51535:24)

@typescript-bot typescript-bot added the Fix Available A PR has been opened for this issue label Jun 14, 2024
@hossain666
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Fix Available A PR has been opened for this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants