Fix issue #930: Crash when substituting for the same name at different 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 #930, #1385
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
150ce0
-
Jan 30 00:13 +00:00