Open
Conversation
9bf7a99 to
8973ac8
Compare
… mismatch)
This test demonstrates that odoc crashes with Invalid_argument("List.fold_left2")
when a signature has a destructive type substitution followed by an include that
re-introduces a type with the same name but different arity.
The next commit will fix this crash.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…ferent arities The fix applies inline TypeSubstitution items during include expansion. When a module type containing a TypeSubstitution (like `type 'a t := unit`) is included elsewhere, the substitution is now applied at that point rather than being preserved as-is. Key changes: - Add `apply_inner_substs` function in tools.ml that processes TypeSubstitution, ModuleSubstitution, and ModuleTypeSubstitution items during include expansion - Add `is_elidable_with_u` optimization to skip recompilation for pure signatures - Add assertion for arity mismatch in type substitution to aid debugging - Add `Subst.pp` for debugging substitution maps This matches OCaml's behavior where destructive substitutions are applied to produce a simplified signature when included. Fixes ocaml#930, ocaml#1385 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The fix for ocaml#930 has revealed another pre-existing issue. The problem is again that we've got more valid way to specify an item that ends up with the same Identifier. In particular, when we `include` an explicit `sig`, these items have the same parent as the sibling items of the include. See the test for an example of the problem.
8973ac8 to
252b33a
Compare
As well as during loading, we also have to handle `includes` with potentially duplicate identifiers during `lang_of.ml`. This commit moves the 'synthetic parent' functions into path.ml and uses them both in cmti.ml and lang_of.ml
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.
See write-up of the problem here: https://jon.recoil.org/blog/2025/09/odoc-bugs.html
Claude's involvement in this fix was mostly in fleshing out the testing - in particular the 'edge_case' tests.