···300300301301(* Extract [Typedtree_traverse] occurrence information and turn them into proper
302302 source infos *)
303303-let process_occurrences env poses loc_to_id local_ident_to_loc =
303303+let rec read_module_path_fallback ~root p =
304304+ let open Odoc_model.Names in
305305+ match (p : Path.t) with
306306+ | Pident id -> `Dot (`Root (ModuleName.make_std root), ModuleName.make_std (Ident.name id))
307307+ | Pdot (p, s) -> `Dot (read_module_path_fallback ~root p, ModuleName.make_std s)
308308+ | Papply (p, arg) -> `Apply (read_module_path_fallback ~root p, read_module_path_fallback ~root arg)
309309+#if OCAML_VERSION >= (5,1,0)
310310+ | Pextra_ty _ -> assert false
311311+#endif
312312+313313+let process_occurrences ~module_name env poses loc_to_id local_ident_to_loc =
304314 let open Odoc_model.Lang.Source_info in
305315 (* Ensure source infos are not repeated by putting them in a Set (a unit hashtbl) *)
306316 let occ_tbl = AnnotHashtbl.create 100 in
307307- let process p find_in_env =
317317+ let fallback_read_value p =
318318+ let open Odoc_model.Names in
319319+ match (p : Path.t) with
320320+ | Pdot (parent, s) -> Some (`DotV (read_module_path_fallback ~root:module_name parent, ValueName.make_std s))
321321+ | _ -> None
322322+ in
323323+ let fallback_read_module p =
324324+ Some (read_module_path_fallback ~root:module_name p)
325325+ in
326326+ let fallback_read_module_type p =
327327+ let open Odoc_model.Names in
328328+ match (p : Path.t) with
329329+ | Pdot (parent, s) -> Some (`DotMT (read_module_path_fallback ~root:module_name parent, ModuleTypeName.make_std s))
330330+ | _ -> None
331331+ in
332332+ let fallback_read_type p =
333333+ let open Odoc_model.Names in
334334+ match (p : Path.t) with
335335+ | Pdot (parent, s) -> Some (`DotT (read_module_path_fallback ~root:module_name parent, TypeName.make_std s))
336336+ | _ -> None
337337+ in
338338+ let process p find_in_env fallback =
308339 match p with
309340 | Path.Pident id when IdentHashtbl.mem local_ident_to_loc id -> (
310341 match
···321352 let documentation = if is_persistent p then Some path else None
322353 and implementation = Some (Unresolved path) in
323354 Some { documentation; implementation }
324324- | exception _ -> None)
355355+ | exception _ ->
356356+ if not (is_persistent p) then
357357+ match fallback p with
358358+ | Some path ->
359359+ let documentation = None
360360+ and implementation = Some (Unresolved path) in
361361+ Some { documentation; implementation }
362362+ | None -> None
363363+ else None)
325364 in
326365 List.iter
327366 (function
328367 | Typedtree_traverse.Analysis.Value p, loc ->
329329- process p Ident_env.Path.read_value
368368+ process p Ident_env.Path.read_value fallback_read_value
330369 |> Option.iter @@ fun l ->
331370 AnnotHashtbl.replace occ_tbl (Value l, pos_of_loc loc) ()
332371 | Module p, loc ->
333333- process p Ident_env.Path.read_module
372372+ process p Ident_env.Path.read_module fallback_read_module
334373 |> Option.iter @@ fun l ->
335374 AnnotHashtbl.replace occ_tbl (Module l, pos_of_loc loc) ()
336375 | ModuleType p, loc ->
337337- process p Ident_env.Path.read_module_type
376376+ process p Ident_env.Path.read_module_type fallback_read_module_type
338377 |> Option.iter @@ fun l ->
339378 AnnotHashtbl.replace occ_tbl (ModuleType l, pos_of_loc loc) ()
340379 | Type p, loc ->
341341- process p Ident_env.Path.read_type
380380+ process p Ident_env.Path.read_type fallback_read_type
342381 |> Option.iter @@ fun l ->
343382 AnnotHashtbl.replace occ_tbl (Type l, pos_of_loc loc) ()
344383 | LocalDefinition _, _ -> ())
···378417 local_ident_to_loc;
379418 populate_global_defs env source_id loc_to_id uid_to_loc uid_to_id
380419 in
420420+ let module_name =
421421+ Odoc_model.Root.Odoc_file.name root.Odoc_model.Root.file
422422+ in
381423 let source_infos =
382382- process_occurrences env traverse_infos loc_to_id local_ident_to_loc
424424+ process_occurrences ~module_name env traverse_infos loc_to_id
425425+ local_ident_to_loc
383426 |> add_definitions loc_to_id
384427 in
385428 let shape_info = Some (shape, Shape.Uid.Tbl.to_map uid_to_id) in
+1-1
odoc/src/odoc/resolver.ml
···563563 lookup_unit ~important_digests ~imports_map extended_ap ~libs ~hierarchy
564564 and lookup_page = lookup_page ap ~pages ~hierarchy
565565 and lookup_asset = lookup_asset ~pages ~hierarchy
566566- and lookup_impl = lookup_impl ap in
566566+ and lookup_impl = lookup_impl extended_ap in
567567 { Env.open_units; lookup_unit; lookup_page; lookup_impl; lookup_asset }
568568569569let build_compile_env_for_impl t i =