Skip to content

Commit 15ba6e7

Browse files
committed
Mitigate issue ocaml#1561 by ignoring failure of env_of_only_summary
1 parent 478d99b commit 15ba6e7

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/analysis/locate.ml

+9-2
Original file line numberDiff line numberDiff line change
@@ -889,6 +889,13 @@ let doc_from_uid ~config ~comp_unit uid =
889889
Tast_iterator.default_iterator.value_binding sub vb)
890890
}
891891
in
892+
let try_rebuild_env env =
893+
try Envaux.env_of_only_summary env
894+
with Envaux.Error err ->
895+
log ~title:"doc_from_uid" "Error while rebuilding the environment: %a"
896+
Logger.fmt (fun fmt -> Envaux.report_error fmt err);
897+
env
898+
in
892899
let parse_attributes attrs =
893900
let open Parsetree in
894901
try Some (List.find_map attrs ~f:(fun attr ->
@@ -905,9 +912,9 @@ let doc_from_uid ~config ~comp_unit uid =
905912
log ~title:"doc_from_uid" "Cmt loaded, itering on the typedtree";
906913
begin match cmt_infos.cmt_annots with
907914
| Interface s -> Some (`Interface { s with
908-
sig_final_env = Envaux.env_of_only_summary s.sig_final_env})
915+
sig_final_env = try_rebuild_env s.sig_final_env})
909916
| Implementation str -> Some (`Implementation { str with
910-
str_final_env = Envaux.env_of_only_summary str.str_final_env})
917+
str_final_env = try_rebuild_env str.str_final_env})
911918
| _ -> None
912919
end
913920
| Error _ -> None

0 commit comments

Comments
 (0)