Repository navigation
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #8689 +/- ##
==========================================
+ Coverage 81.42% 81.44% +0.02%
==========================================
Files 459 459
Lines 64547 64554 +7
==========================================
+ Hits 52559 52578 +19
+ Misses 11988 11976 -12
🚀 New features to boost your workflow:
|
rescript
@rescript/belt
@rescript/darwin-arm64
@rescript/linux-arm64
@rescript/linux-x64
@rescript/runtime
@rescript/win32-x64
commit: |
|
Developer playground preview: https://rescript-lang.github.io/rescript/dev-playground/?version=pr-8689 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 24646c5cb8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| else if not (Lam_closure.is_closed lambda) then | ||
| Location.raise_errorf ~loc | ||
| "@inline(crossModule) requires a function without captured local \ | ||
| values" |
There was a problem hiding this comment.
Treat catch binders as local during inline validation
For an exported @inline(crossModule) function containing a try ... catch whose handler inspects the exception, this check incorrectly rejects the function as capturing a local value. Lam_closure.is_closed delegates to free_variables, but its Ltrywith branch ignores _exn instead of adding that binder to the local set (compiler/core/lam_closure.ml:118-120), so ordinary references to the caught exception are reported as free. Register the catch binder during closure traversal or use validation that handles all Lambda binders.
AGENTS.md reference: AGENTS.md:L51-L54
Useful? React with 👍 / 👎.
Signed-off-by: Christoph Knittel <ck@cca.io>
Signed-off-by: Christoph Knittel <ck@cca.io>
Signed-off-by: Christoph Knittel <ck@cca.io>
Signed-off-by: Christoph Knittel <ck@cca.io>
Signed-off-by: Christoph Knittel <ck@cca.io>
Signed-off-by: Christoph Knittel <ck@cca.io>
Why:
The OCaml build system, now the default `rescript`, recompiled
dependents only when a module's CMI changed. An `@inline(crossModule)`
body lives in the CMJ and can change while the CMI stays the same, so
callers kept the old inlined code, during a build and on the next build
after the dependency was compiled separately. Rust rewatch already
compares CMJ digests since the previous commits.
Publishing a byte-different CMJ now marks dependents dirty like a changed
CMI, and the startup freshness check compares a dependent's CMT with the
later of its dependency's CMI and CMJ.
Review: Does every implementation change now recompile dependents? Only
those whose CMJ bytes change, matching the Rust implementation.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kbf3gKsWykY6KH4QSJ9Wrs
Signed-off-by: Christoph Knittel <ck@cca.io>
24646c5 to
08056a9
Compare
Changelog🚀 New Feature
Semantic Diff7 commits · Full page Enable selective cross-module inlining for Option helpers✨ Recompile dependents of a changed CMJ in the OCaml build system08056a9 · cknitt + Claude · Oct 27, 2026, 07:15 UTC · new
Publishing a byte-different CMJ now marks dependents dirty like a changed CMI, and the startup freshness check compares a dependent's CMT with the later of its dependency's CMI and CMJ. Review
|
Add
@inline(crossModule)to opt individual functions into cross-module inlining, and use it for selectedOptionhelpers.Inlining copies a function’s body into its callers. If that body changes but its type does not, the caller must still be rebuilt; checking only the
.cmitype signature would leave the old body in the generated JavaScript.The compiler stores exported inline bodies in the existing
.cmjfile, alongside other JavaScript compilation metadata. Rewatch now compares the digest already stored in that file’s header before and after compiling a module. If it changes, Rewatch rebuilds dependents. This keeps implementation details out of.cmiand requires no new artifact. A.cmjchange unrelated to inlining may also cause a dependent rebuild.