Repository navigation
test: regression guard for menhir grammars referencing library deps - #14391
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new blackbox regression test to ensure Menhir’s --infer type-inference step can resolve library dependencies declared via a parent library’s (libraries ...) field, by exercising a minimal setup where a grammar semantic action references Dep.value.
Changes:
- Introduce a new Menhir blackbox test case covering semantic actions that reference a parent library dependency.
- Create a minimal two-library project in the test (
dep+parser) and assertdune build @checksucceeds.
|
@rgrinberg I think this is probably safe to merge, but I wonder if you think a review is merited from someone who understands the (using menhir) and (menhir ...) directives better than I? |
|
Looks ok. Maybe you can add some trace events to demonstrate that we run |
Adds [test-cases/menhir/with-library-deps.t]. A menhir grammar's semantic actions can reference values from libraries declared in the parent library's [(libraries ...)] field; menhir's [--infer] pass invokes [ocamlc -i] on a generated mock module to infer types, and dune must wire the parent library's library deps onto that mock compile's [-I] search path for the inference to succeed. The test exercises the smallest such shape: a library with [(libraries dep)] whose grammar's semantic action references [Dep.value]. The existing tests under [test-cases/menhir/] cover [(menhir ...)] inside libraries with no [(libraries ...)] deps, or with deps unused by the grammar. None exercises this exact combination, so a regression in the menhir [--infer] / library-deps wiring would not be caught. Signed-off-by: Robin Bate Boerop <[email protected]>
1391306 to
9b0f223
Compare
|
Done in 9b0f223. The test now adds two
|
Summary
Adds a regression guard for menhir grammars whose semantic actions reference values from libraries declared in the parent library's
(libraries ...)field. Menhir's--inferpass invokesocamlc -ion a generated mock module to infer types, and dune must wire the parent library's library deps onto that mock compile's-Isearch path for the inference to succeed. The new test exercises the smallest such shape: a library with(libraries dep)whose grammar's semantic action referencesDep.value.Coverage gap
Of 61 files under
test/blackbox-tests/test-cases/menhir/onmain, none combines(menhir ...),(library ...), and a non-empty(libraries some_dep)whose grammar references the dep from a semantic action. The closest existing tests are:library-interface.t—(library (name foo))with(menhir ...), butM.xis referenced from a sibling module of the same library, not from a library dep.menhir-include-subdirs.t/bar/dune,general.t/src/dune—(menhir ...)inside a library or executable with no(libraries ...).menhir-dynamic-modules.t,include-subdirs-menhir-github1372.t—(library (name foo))+(menhir ...)with no library-dep reference in the grammar.A regression in dune's wiring of
(libraries ...)onto the menhir--inferocamlc -irule would not be caught by any existing test.