Semantic Diff

#9517 Put arguments read once into inlined bodies directly

1 commit

7968a9655e59fb940a4ab1f0e419888b6eaed7ad..pr-9517

516009a2f · cknitt + Claude · Dec 03, 2026, 19:19 UTC

Put arguments read once into inlined bodies directly

Why

Calls to other modules' functions are inlined in two places. When an argument is a parameter of the caller, inlining waits until the JavaScript is generated, and a pure argument the body reads once takes the parameter's place. Otherwise lam_pass_remove_alias inlines the call early and bound every argument to a variable first; it did the same when applying a function directly. Both now substitute like the late path.

modifiedJS literal and function arguments

let called = []Ok(3)->Result.forEach(i => called->Array.push(i))let merged = Array.concatAll([[1], arr])
js
Before
After
let called = [];let called = [];let f = i => { called.push(i);};f(3);called.push(3); function merge(arr) {function merge(arr) { let arrays = [ [1], arr ]; return [].concat(...arrays); return [].concat([1], arr); }}