Skip to content

Commit

Permalink
Mitigate issue ocaml#1561 by ignoring failure of env_of_only_summary
Browse files Browse the repository at this point in the history
  • Loading branch information
voodoos committed Jan 20, 2023
1 parent 478d99b commit 15ba6e7
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/analysis/locate.ml
Original file line number Diff line number Diff line change
Expand Up @@ -889,6 +889,13 @@ let doc_from_uid ~config ~comp_unit uid =
Tast_iterator.default_iterator.value_binding sub vb)
}
in
let try_rebuild_env env =
try Envaux.env_of_only_summary env
with Envaux.Error err ->
log ~title:"doc_from_uid" "Error while rebuilding the environment: %a"
Logger.fmt (fun fmt -> Envaux.report_error fmt err);
env
in
let parse_attributes attrs =
let open Parsetree in
try Some (List.find_map attrs ~f:(fun attr ->
Expand All @@ -905,9 +912,9 @@ let doc_from_uid ~config ~comp_unit uid =
log ~title:"doc_from_uid" "Cmt loaded, itering on the typedtree";
begin match cmt_infos.cmt_annots with
| Interface s -> Some (`Interface { s with
sig_final_env = Envaux.env_of_only_summary s.sig_final_env})
sig_final_env = try_rebuild_env s.sig_final_env})
| Implementation str -> Some (`Implementation { str with
str_final_env = Envaux.env_of_only_summary str.str_final_env})
str_final_env = try_rebuild_env str.str_final_env})
| _ -> None
end
| Error _ -> None
Expand Down

0 comments on commit 15ba6e7

Please sign in to comment.