Compile dependents again when a module's .cmj changes
Why
Dependents read a module's .cmj: the values they copy in (true, false, null and undefined always, more with -bs-cross-module-opt), the arities they call with, and whether the module has side effects, which decides whether they import it. The build system only compared .cmi files, so a change the interface doesn't show left their JavaScript stale. Without a .resi this was mostly hidden, because the .cmi holds declaration locations; with one, every such change went unnoticed. This is the build-system part of #8689, and PR 2 of the plan in #8733. #9470 keeps line shifts from changing a .cmj that stores bodies.
modifiedRepresentation publishing a compile
mapping
modifiedJS dependent of a module with an interface
// A.resilet flag: bool// A.res, after the first build: was `let flag = true`let flag = falseConsole.log("effect")// B.reslet f = A.flag
js
Review
- Does watch mode compile more? Only when a .cmj changes. With default flags it holds no bodies, so it changes only when an exported value's arity, one of the four copied constants or the module's purity changes, and each of those changes the dependents' JavaScript.
- Why move the .cmi's modification time? A later build decides from .cmi times whether dependents are current, so it sees the .cmj change too without reading every .cmj.