Skip to content

Commit e8b7063

Browse files
committed
When simplifying canonical aliases, don't strip aliases
The logic behind stripping the Alias was that in the vast majority of cases, the canonical path points to a module that's the alias of the actual hidden module. This isn't always a valid assumption - for example in `base.caml`, which creates canonical aliases to stdlib.
1 parent 21c8b4e commit e8b7063

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

src/xref2/tools.ml

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -941,16 +941,7 @@ and reresolve_module : Env.t -> Cpath.Resolved.module_ -> Cpath.Resolved.module_
941941
match
942942
resolve_module ~mark_substituted:true ~add_canonical:false env p2
943943
with
944-
| Ok (`Alias (_, p2'), _) ->
945-
`Canonical
946-
( reresolve_module env p,
947-
`Resolved (simplify_resolved_module_path env p2') )
948-
| Ok (p2', _) ->
949-
(* See, e.g. Base.Sexp for an example of where the canonical path might not be
950-
a simple alias *)
951-
`Canonical
952-
( reresolve_module env p,
953-
`Resolved (simplify_resolved_module_path env p2') )
944+
| Ok (p2', _) -> `Canonical(reresolve_module env p, `Resolved (simplify_resolved_module_path env p2') )
954945
| Error _ -> `Canonical (reresolve_module env p, p2)
955946
| exception _ -> `Canonical (reresolve_module env p, p2))
956947
| `OpaqueModule m -> `OpaqueModule (reresolve_module env m)

0 commit comments

Comments
 (0)