Skip to content

Commit ab87b34

Browse files
committed
doc: list both [cm_kind] match sites in narrowing reference
The Melange paragraph claimed the only mode-aware code was in [Lib_file_deps.deps_of_entry_modules], but [need_impl_deps_of] (inside [Module_compilation.lib_deps_for_module]) also matches on [cm_kind] and explicitly names [Melange _] in the pattern. The behaviour there is "Cmx reads trans-dep impl ocamldep; everything else does not" — [Melange _] is in the same bucket as [Ocaml (Cmi | Cmo)], not its own — but the doc oversimplified to the point of inaccuracy. Rewrite as a numbered list naming both [cm_kind] match sites and clarifying that the second site's distinction is Cmx-vs-rest, not OCaml-vs-Melange. Replies to ocaml#14732 review comment r3304097840 (Copilot). Signed-off-by: Robin Bate Boerop <me@robinbb.com>
1 parent e4e7790 commit ab87b34

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

doc/dev/per-module-narrowing.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -564,10 +564,17 @@ Three categories of fallback to the glob:
564564
silently drop the leaf library's `.cmi` from its compile rule.
565565

566566
`Melange` consumer compiles run the same narrowing pipeline as `Ocaml`.
567-
The `can_filter` check is mode-agnostic; the only mode-specific code
568-
is in `Lib_file_deps.deps_of_entry_modules`, which emits per-module
569-
`.cmj` deps in addition to `.cmi` when `cm_kind = Melange Cmj`,
570-
mirroring the broad-dep path's `groups_for_cm_kind`.
567+
The `can_filter` check is mode-agnostic. Two code paths inside the
568+
pipeline match on `cm_kind`:
569+
570+
1. `Lib_file_deps.deps_of_entry_modules` emits per-module `.cmj` in
571+
addition to `.cmi` when `cm_kind = Melange Cmj`, mirroring the
572+
broad-dep path's `groups_for_cm_kind`.
573+
2. `need_impl_deps_of` (in `lib_deps_for_module`) reads a trans-dep's
574+
`.ml`-side ocamldep only for `cm_kind = Ocaml Cmx` (cross-module
575+
inlining input). `Ocaml (Cmi | Cmo)` and `Melange _` are handled
576+
symmetrically — neither reads impl deps. The distinction is
577+
Cmx-vs-rest, not OCaml-vs-Melange.
571578

572579
## Cost characteristics
573580

0 commit comments

Comments
 (0)