Repository navigation
Conversation
Changelog🏠 Internal
Semantic Diff1 commit · Full page Inline other modules' functions only in the alias passde87d9a · cknitt + Claude · Dec 05, 2026, 10:00 UTC
JS modified (a call through an alias) let {length: l, add} = module(List)
let r = list{}->add(l(list{1, 2, 3}))
-let r_0 = Stdlib_List.length({hd: 1, tl: {hd: 2, tl: {hd: 3, tl: /* [] */0}}});
-
-let r = {hd: r_0, tl: /* [] */0};
+let r = Stdlib_List.add(/* [] */0, Stdlib_List.length({hd: 1, tl: {hd: 2, tl: {hd: 3, tl: /* [] */0}}}));Review
|
|
@codex review |
|
Codex Review: Didn't find any major issues. You're on a roll. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
865aca6 to
16e3483
Compare
✅ Compiler benchmarksAllocated wordsIn total: 656,848,808 → 656,798,232 (-0.01%). Generated projects: 628,532,363 → 628,525,017 (±0.00%). None of the 265 benchmarks changed by 0.1% or more. InstructionsIn total: 8,976,278,320 → 8,976,466,622 (±0.00%). None of the 33 benchmarks changed by 0.1% or more. Output sizeIn total: 27,604,158 → 27,603,798 (±0.00%). None of the 13 benchmarks changed by 0.1% or more. Pull request de87d9a compared with base 3b52031 in this run. |
rescript
@rescript/belt
@rescript/darwin-arm64
@rescript/linux-arm64
@rescript/linux-x64
@rescript/runtime
@rescript/win32-x64
commit: |
16e3483 to
76c6173
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. You're on a roll. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
Why:
A call to another module's `@inline` function could be inlined in
two places: early by the alias pass, and late while compiling to
JavaScript. The late copy skipped every Lambda pass, so it kept what
those passes remove, and it was inlined into a function whose refs
were already assigned variables. Since the alias pass now inlines
calls with parameters as arguments, the late path only gets calls
through an alias, such as `add` from `let {add} = module(List)`.
These are now compiled as calls, until the alias pass learns to see
through them. The call no longer looks up the other
module's `.cmj`: the late path needed its stored body, and the name it
returned is the field name the call already has. The backend guide gets a section on the Lambda
pipeline, with its single cross-module inlining phase.
JS modified (a call through an alias):
Example:
let {length: l, add} = module(List)
let r = list{}->add(l(list{1, 2, 3}))
Before (js):
let r_0 = Stdlib_List.length({hd: 1, tl: {hd: 2, tl: {hd: 3, tl: /* [] */0}}});
let r = {hd: r_0, tl: /* [] */0};
After (js):
let r = Stdlib_List.add(/* [] */0, Stdlib_List.length({hd: 1, tl: {hd: 2, tl: {hd: 3, tl: /* [] */0}}}));
Review: What do the new tests cover? `inline_late_alias_test` has the
cases that broke when a late body was simplified: functions reading a
let-bound global, a known tuple or an assigned ref, `Some`s of known
values, and refs of the caller assigned by a callback. The alias pass
inlines all of them now.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kbf3gHZYwA1rq7zbk3dhQq
Signed-off-by: Christoph Knittel <ck@cca.io>
76c6173 to
de87d9a
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## inline-no-assigned-body #9537 +/- ##
===========================================================
- Coverage 82.65% 82.65% -0.01%
===========================================================
Files 469 469
Lines 66587 66577 -10
===========================================================
- Hits 55038 55028 -10
Misses 11549 11549
🚀 New features to boost your workflow:
|
With the PR below, the alias pass inlines calls with parameter arguments, so late inlining while compiling to JavaScript only gets calls through an alias, such as
addfromlet {add} = module(List). The late copy skipped every Lambda pass and was inlined into code whose local refs were already assigned variables, which is where the recent inlining bugs lived.This removes late inlining:
compile_external_field_applyalways compiles a call. It no longer looks up the other module's.cmjthere either: only the late path needed the stored body. Calls through an alias are compiled as calls until a later PR in the stack lets the alias pass see through them. In the runtime, Belt and the tests, that affects only two calls inhello_res.res.compiler/backend/README.mdgets a section on the Lambda pipeline: the pass order, whysimplify_aliasruns three times with fresh facts, why sroa runs last, and the single cross-module inlining phase.New tests in
inline_late_alias_testcover the cases that broke when a late body was simplified. The alias pass inlines all of them now.🤖 Generated with Claude Code
https://claude.ai/code/session_01Kbf3gHZYwA1rq7zbk3dhQq