diff --git a/src/analysis/locate.ml b/src/analysis/locate.ml index b28029f66b..a90e54b8bd 100644 --- a/src/analysis/locate.ml +++ b/src/analysis/locate.ml @@ -366,7 +366,7 @@ let uid_of_path ~config ~env ~ml_or_mli ~decl_uid path namespace = Logger.fmt (fun fmt -> Shape.Uid.print fmt decl_uid); log ~title:"uid_of_path" "Alias scrapped: %a" Logger.fmt (fun fmt -> Shape.Uid.print fmt uid); - Some uid + uid | `ML -> let shape = Env.shape_of_path ~namespace env path in log ~title:"shape_of_path" "initial: %a" @@ -374,7 +374,12 @@ let uid_of_path ~config ~env ~ml_or_mli ~decl_uid path namespace = let r = Shape_reduce.weak_reduce env shape in log ~title:"shape_of_path" "reduced: %a" Logger.fmt (fun fmt -> Shape.print fmt r); - r.uid + match r.uid with + | Some uid -> uid + | None -> + log ~title:"shape_of_path" "no uid; fallback to Declaration uid: %a" + Logger.fmt (fun fmt -> Shape.Uid.print fmt decl_uid); + decl_uid let from_uid ~config ~ml_or_mli uid loc path = let loc_of_comp_unit comp_unit = @@ -387,7 +392,7 @@ let from_uid ~config ~ml_or_mli uid loc path = in let title = "from_uid" in match uid with - | Some (Shape.Uid.Item { comp_unit; _ } as uid) -> + | Shape.Uid.Item { comp_unit; _ } as uid -> let locopt = if Env.get_unit_name () = comp_unit then begin log ~title "We look for %a in the current compilation unit." @@ -430,7 +435,7 @@ let from_uid ~config ~ml_or_mli uid loc path = | Some (uid, loc) -> `Found (Some uid, loc) | None -> `Not_found (Path.name path, None) end - | Some (Compilation_unit comp_unit as uid) -> + | Compilation_unit comp_unit as uid -> begin log ~title "Got the uid of a compilation unit: %a" Logger.fmt (fun fmt -> Shape.Uid.print fmt uid); @@ -439,9 +444,7 @@ let from_uid ~config ~ml_or_mli uid loc path = | _ -> log ~title "Failed to load the shapes"; `Not_found (Path.name path, None) end - | Some (Predef _ | Internal) -> assert false - | None -> log ~title "No UID found, fallbacking to lookup location."; - `Found (None, loc) + | Predef _ | Internal -> assert false let locate ~config ~env ~ml_or_mli decl_uid loc path ns = let uid = uid_of_path ~config ~env ~ml_or_mli ~decl_uid path ns in