Skip to content

prototype(menhir): infer types through anonymous opens - #195

Closed
anmonteiro wants to merge 2 commits into
mainfrom
prototype/menhir-anonymous-opens
Closed

anmonteiro wants to merge 2 commits into
mainfrom
prototype/menhir-anonymous-opens

Conversation

@anmonteiro

@anmonteiro anmonteiro commented Sep 19, 2026 •

Copy link
Copy Markdown
Owner

Prototype anonymous-open Menhir inference for ocaml#8989, using the dependency tracking from ocaml#16447 and regressions from ocaml#16450 and ocaml#16451. Leaves ocaml#16427 untouched.

Inline generated aliases in the inference query and use ocamldep -as-map to retain real dependencies without unused-alias cycles. Dependency discovery and inference preprocess the same query; final parser compilation is unchanged.

@anmonteiro
anmonteiro force-pushed the prototype/menhir-anonymous-opens branch from a199a97 to 6d3f6ba Compare September 19, 2026 06:37
@anmonteiro
anmonteiro force-pushed the test/menhir-inference-edge-cases branch from 281eb4a to 751486f Compare September 19, 2026 18:58
@anmonteiro
anmonteiro changed the base branch from test/menhir-inference-edge-cases to test/menhir-inference-split-base September 19, 2026 19:00
@anmonteiro
anmonteiro force-pushed the prototype/menhir-anonymous-opens branch 6 times, most recently from bd9d225 to 3d9a154 Compare September 20, 2026 00:24
@anmonteiro
anmonteiro force-pushed the test/menhir-inference-split-base branch from 3bc7e33 to 6bb5425 Compare September 20, 2026 00:24
@anmonteiro
anmonteiro force-pushed the prototype/menhir-anonymous-opens branch from 3d9a154 to ca32f32 Compare September 20, 2026 05:13
@anmonteiro
anmonteiro changed the base branch from test/menhir-inference-split-base to fix/menhir-inference-dependencies September 20, 2026 05:13
@anmonteiro
anmonteiro force-pushed the fix/menhir-inference-dependencies branch from 58c418a to 0018751 Compare September 20, 2026 05:23
@anmonteiro
anmonteiro force-pushed the prototype/menhir-anonymous-opens branch from ca32f32 to f36933d Compare September 20, 2026 05:23
@anmonteiro
anmonteiro force-pushed the fix/menhir-inference-dependencies branch from 75dac17 to d9819e3 Compare September 20, 2026 08:01
@anmonteiro
anmonteiro force-pushed the prototype/menhir-anonymous-opens branch from f36933d to 3271831 Compare September 20, 2026 08:26
@anmonteiro
anmonteiro changed the base branch from fix/menhir-inference-dependencies to main September 20, 2026 08:26
anmonteiro added a commit to ocaml/dune that referenced this pull request Sep 20, 2026
Strengthen the qualified-sibling test to cover a module sharing the
generated library alias name. Passes on main and exposes the regression
in anmonteiro#195.

Checks: @check, @fmt, and the Menhir suite pass. Full @runtest has the
same macOS signing and fsevents failures on unchanged main.

Signed-off-by: Antonio Nuno Monteiro <[email protected]>
@anmonteiro
anmonteiro force-pushed the prototype/menhir-anonymous-opens branch from 3271831 to 9d82504 Compare September 20, 2026 23:22
@anmonteiro
anmonteiro changed the base branch from main to test/menhir-inference-full-diagnostics September 20, 2026 23:23
@anmonteiro
anmonteiro force-pushed the test/menhir-inference-full-diagnostics branch from b2b6528 to 6010303 Compare September 20, 2026 23:27
@anmonteiro
anmonteiro force-pushed the prototype/menhir-anonymous-opens branch from 9d82504 to 2f30cfe Compare September 20, 2026 23:27
anmonteiro added a commit to ocaml/dune that referenced this pull request Sep 20, 2026
Capture the full warning and syntax error for #8989 instead of filtering
stderr. Test-first follow-up for anmonteiro#195.

@check, @fmt, and the Menhir suite pass. Full @runtest retains the known
baseline macOS signing and fsevents failures.

Signed-off-by: Antonio Nuno Monteiro <[email protected]>
@anmonteiro
anmonteiro force-pushed the prototype/menhir-anonymous-opens branch from 1b76aae to 301511e Compare September 21, 2026 03:23
@anmonteiro
anmonteiro changed the base branch from test/menhir-inference-full-diagnostics to main September 21, 2026 03:23
Inline generated alias sources in anonymous opens for inference. Use ocamldep -as-map and ocamlc -no-alias-deps, preserving subgroup dependencies, virtual-library visibility, shadowing guards, and normal parser compilation.

Related to ocaml#8989; uses the inference dependency tracking from ocaml#16447.

Signed-off-by: Antonio Nuno Monteiro <[email protected]>
@anmonteiro
anmonteiro force-pushed the prototype/menhir-anonymous-opens branch from 50926cf to d7b08c3 Compare September 21, 2026 04:02
Reuse the parent-group traversal and virtual-library merge instead of scanning every group for a physical dependency. Preserve physical-name checks, dependency closure, and visibility filtering.

Cover root aliases, repeated group names, and merged virtual-library groups.

Signed-off-by: Antonio Nuno Monteiro <[email protected]>
anmonteiro added a commit to ocaml/dune that referenced this pull request Sep 22, 2026
Pass only implementation dependencies through Menhir and interface
inference, removing the unused dictionary plumbing.

Extracted from anmonteiro#195; no behavior change.

---------

Signed-off-by: Antonio Nuno Monteiro <[email protected]>
anmonteiro added a commit to ocaml/dune that referenced this pull request Sep 22, 2026
Extend Menhir inference coverage for sibling dependencies, nested
scopes, subgroup interfaces, warning handling, and PPX name collisions.
Preserve the current failures for #8989.

Extracted from anmonteiro#195.

Signed-off-by: Antonio Nuno Monteiro <[email protected]>
anmonteiro added a commit to ocaml/dune that referenced this pull request Sep 22, 2026
Snapshot the generated Menhir inference query for the qualified
group-interface regression (#8989), preserving current main behavior.

Extracted from anmonteiro#195 so its alias-generation changes are
visible in the test diff.

Signed-off-by: Antonio Nuno Monteiro <[email protected]>
anmonteiro added a commit that referenced this pull request Sep 22, 2026
Compile a private CMI re-exporting enclosing alias scopes, and anonymously open it in the query before preprocessing. Keep ordinary logical dependency lookup and final parser compilation unchanged.

Alternative to #195 for ocaml#8989. Cover helper-name collisions and snapshot the generated interface and logical dependencies.

Signed-off-by: Antonio Nuno Monteiro <[email protected]>
anmonteiro added a commit that referenced this pull request Sep 24, 2026
Compile a private CMI re-exporting enclosing alias scopes, and anonymously open it in the query before preprocessing. Keep ordinary logical dependency lookup and final parser compilation unchanged.

Alternative to #195 for ocaml#8989. Cover helper-name collisions and snapshot the generated interface and logical dependencies.

Signed-off-by: Antonio Nuno Monteiro <[email protected]>
anmonteiro added a commit that referenced this pull request Sep 25, 2026
Compile a private CMI re-exporting enclosing alias scopes, and anonymously open it in the query before preprocessing. Keep ordinary logical dependency lookup and final parser compilation unchanged.

Alternative to #195 for ocaml#8989. Cover helper-name collisions and snapshot the generated interface and logical dependencies.

Signed-off-by: Antonio Nuno Monteiro <[email protected]>
anmonteiro added a commit that referenced this pull request Sep 26, 2026
Compile a private CMI re-exporting enclosing alias scopes, and anonymously open it in the query before preprocessing. Keep ordinary logical dependency lookup and final parser compilation unchanged.

Alternative to #195 for ocaml#8989. Cover helper-name collisions and snapshot the generated interface and logical dependencies.

Signed-off-by: Antonio Nuno Monteiro <[email protected]>
anmonteiro added a commit that referenced this pull request Sep 26, 2026
Compile a private CMI re-exporting enclosing alias scopes, and anonymously open it in the query before preprocessing. Keep ordinary logical dependency lookup and final parser compilation unchanged.

Alternative to #195 for ocaml#8989. Cover helper-name collisions and snapshot the generated interface and logical dependencies.

Signed-off-by: Antonio Nuno Monteiro <[email protected]>
anmonteiro added a commit to ocaml/dune that referenced this pull request Sep 27, 2026
Fix Menhir inference for qualified module group interfaces by opening a
private alias interface, preserving logical dependency lookup.

Fixes #8989. Continues anmonteiro#199; alternative to #16427 and
anmonteiro#195.

---------

Signed-off-by: Antonio Nuno Monteiro <[email protected]>
@anmonteiro

Copy link
Copy Markdown
Owner Author

Superseded by ocaml#16464, now merged upstream. #198 remains open for the older-OCaml compatibility follow-up.

@anmonteiro anmonteiro closed this Sep 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant