Semantic Diff

#9470 Leave source locations out of bodies stored in .cmj files

1 commit

6b9bc077dc2592dd6b21bc9239bdd70465244595..pr-9470

fafe0ccc3 · cknitt + Claude · Nov 28, 2026, 20:48 UTC

Leave source locations out of bodies stored in .cmj files

Why

A function body stored in a .cmj for other modules to inline kept the locations of its applications, primitives and functions, and -no-keep-locs does not cover them. So with -bs-cross-module-opt a line shift changed the .cmj, and the runtime's published .cmj files held the absolute paths of the machine that built them. Rebuilding dependents when a .cmj changes (#8733, PR 2) would then rebuild them on every line shift. Nothing reads these locations once the body is inlined elsewhere.

modifiedCmj stored body

// A.res, compiled with -bs-cross-module-opt, then again with a blank// line added at the top@inline let g = x => x + 1let h = x => x * 2let flag = true
text
Before
After
A.cmj: 200 bytes, names /…/A.resafter the line shift: A.cmj changesA.cmj: 170 bytes, names no fileafter the line shift: A.cmj is byte for byte the same

Review

  • Does inlining change? No. A dependent's JS is the same, and so is the runtime's and Belt's.
  • Why build through Lambda's constructors? The rest of Lambda_traverse does, so a stored body is normalized like any other term.