test: cross-library .cmi baseline for dotted -open path#15056
Conversation
A fifth sibling to the cross-library `.cmi` regression baselines (ocaml#14584), covering `(flags (-open Prelude.Color))` where the intermediate library opens a *dotted* module path naming a submodule of a wrapped dependency, rather than a bare top-level module. As in `cross-lib-open-flag-barrier.t`, the intermediate's source never names `Prelude` (the open hides it) and the consumer never names it either, so `ocamldep` sees no syntactic chain to `prelude`. The fixture asserts build success under `--sandbox=copy`, pinning that the consumer's compile tracks `prelude`'s `.cmi`s. The forthcoming per-module narrowing work (ocaml#14492) must key its effective-`-open` detection on the head component of the path (`Prelude` from `Prelude.Color`), since only top-level module names map to libraries; without that, the dotted open would be dropped from the cross-library frontier and the sandboxed build would regress. Signed-off-by: Robin Bate Boerop <me@robinbb.com>
c499fab to
c419eaf
Compare
There was a problem hiding this comment.
Pull request overview
Adds a new blackbox regression fixture to the per-module-lib-deps test suite to pin cross-library .cmi dependency behavior when an intermediate library is compiled with a dotted -open module path (Prelude.Color). This specifically safeguards the per-module dependency narrowing work by ensuring Dune attributes -open Prelude.Color to the dependency library keyed by the head component (Prelude).
Changes:
- Add a new cross-library
.cmibaseline fixture covering(flags (:standard -open Prelude.Color))in an intermediate library. - Assert the build succeeds under
--sandbox=copyfor a consumer whose compilation implicitly requires the dependency library’s.cmis via the-openeffect.
|
Here is another complication that OCaml gives us: Is also the same as: but this means that args to |
|
You're right that The detection doesn't rely on the arguments being compilation units, though — it's a conservative over-approximation of which libraries an For your exact example: (Small pointer: |
Alizter
left a comment
There was a problem hiding this comment.
Thanks for the explanation.
A sibling to the cross-library `.cmi` regression baselines (ocaml#14584), covering two chained opens `(flags (-open Prelude -open Color))` where the second argument resolves through the first: `Color` is the `Color` submodule of the wrapped dependency `prelude`, brought into scope by `-open Prelude`, not a top-level module. As in `cross-lib-open-flag-barrier.t`, the intermediate's source names neither `Prelude` nor `Color`, so `ocamldep` sees no syntactic chain to `prelude`. The fixture asserts build success under `--sandbox=copy`, pinning that the consumer's compile tracks `prelude`'s `.cmi`s. Per-module narrowing (ocaml#14492) must stay sound when an `-open` argument is not a compilation unit: here `-open Prelude` already reaches `prelude`, covering `Color`'s contents. Signed-off-by: Robin Bate Boerop <me@robinbb.com>
|
@Alizter I'll add some testing for that, here, too. |
Summary
A fifth sibling to the cross-library
.cmiregression baselines from #14584, covering an intermediate library compiled with(flags (-open Prelude.Color))— a dotted module path naming a submodule of a wrapped dependency, rather than a bare top-level module.The fixture asserts build success under
--sandbox=copy. It builds onmaintoday (no per-module narrowing) and pins behaviour that the per-module narrowing work in #14492 must preserve: the effective--opendetection has to key on the head component of the path (PreludefromPrelude.Color), since only top-level module names map to libraries. Without that, the dotted open is dropped from the cross-library frontier and the sandboxed build regresses.Test-only; no changelog.