Repository navigation
Run JavaScript promise executors passed by name, and read catch (e: any) bindings dynamically - #1508
Merged
Merged
Conversation
…any)` bindings dynamically
- `new Promise(run)` where `run` is a JavaScript function value whose
parameters are untyped (the retry-helper shape `function run(resolve,
reject) {...}; return new Promise(run)`) gets an adapter executor: it
receives the native resolve/reject pair and calls the original with
both boxed as checked-dynamic function values. This was a deferred
runtime refusal inside such packages.
- A catch binding annotated `any` reads the caught value through its
checked-dynamic face, as an unannotated `unknown` one does: member
reads, expando writes, `delete` and `in` act on the thrown object, and
a rethrow keeps its identity. It was refused (SC1063).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #1503. Two gaps that
any-heavy service code hits after #1503.Named promise executors in JavaScript packages
Retry helpers commonly build their promise from a function declaration:
The executor's parameters are untyped, so its reject parameter was not the native
(reason: Error) => voidclosure. Compilation succeeded, but the package threw at run time ("Promise executors whose reject parameter is not '(reason: Error) => void'"). Such an executor now gets an adapter: it receives the native resolve/reject pair and calls the original with both boxed as checked-dynamic function values, so the JavaScript body calls them like any function. Executors whose parameters are already typed keep their existing path.catch (error: any)A catch binding annotated
anynow reads the caught value through its checked-dynamic face, as anunknownbinding already did. Member reads, expando writes,deleteandinact on the thrown object itself, and a rethrow keeps its identity. Before, every use was refused (SC1063). Deleting a field that a program class declares still throws, because class layouts are fixed.Evidence
new Promise(run), retrying and bailing.anycrossings: destructuring, namespace patterns,anyparameters and async callbacks #1503 but fails at run time there; 6491 is refused there.anycrossings: destructuring, namespace patterns,anyparameters and async callbacks #1503 (37551e4): PASS. 2530 programs are identical.4642-acyclic-contract.tsfails on both sides, as it already does on main. Bench geomean +0.13% and self-hosted compile time -0.21%, both within tolerance.pnpm lintandpnpm format:checkare clean.pnpm test:ts7 --baselines-onlypasses, with the new baselines recorded.diagnostics.test.tsfails onlycontract-acyclic.ts, which fails the same way on main.tests/harness/self-hosting-native-driver.test.tspasses.🤖 Generated with Claude Code