Fix extended open support - #1482
Open
jonludlam wants to merge 5 commits into
Open
Conversation
An extended open (`open struct ... end`) that follows the top-of-file docstring is silently dropped from the loaded signature, so references to the items it binds fail to resolve. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
extract_tail_alerts dropped open items that followed the top-of-file docstring, so declarations bound by `open struct ... end` were lost from the loaded signature. This caused ~76K failed lookups when linking base on OxCaml, whose container_intf.ml opens a struct of module aliases after its docstring. The previous commit's test now resolves its reference. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
A path into a top-level extended open resolves via Env within the defining unit, but from another unit it is looked up structurally via Find, which does not recurse into Open expansion items. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Give Signature.Open items the same treatment as Include expansions when searching a signature. Only extended opens bind items, so plain `open M` is unaffected. Fixes cross-unit resolution of paths into top-level extended opens (with the previous fix, ~2300 warnings and ~600 pages on OxCaml's core corpus); the previous commit's test now resolves. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
jonludlam
force-pushed
the
upstream-fix-open-struct
branch
from
September 2, 2026 22:41
d03b03e to
1c54c23
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
2 related fixes for the "extended opens", with tests. Tests are committed failing then updated in the commit that fixes the behaviour.