Skip to content

Commit

Permalink
fix: no fallback
Browse files Browse the repository at this point in the history
Signed-off-by: Antonio Nuno Monteiro <anmonteiro@gmail.com>
  • Loading branch information
anmonteiro committed Mar 31, 2024
1 parent f7b3db8 commit e7881c7
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions bin/describe/describe_pp.ml
Original file line number Diff line number Diff line change
Expand Up @@ -158,30 +158,23 @@ let get_pped_file super_context file =
ml_kind
in
let* module_for_file = module_for_file ~sctx:super_context ~ml_kind file_in_build_dir in
let build_fallback =
Memo.lazy_ (fun () ->
Build_system.file_exists file_in_build_dir
>>= function
| false ->
User_error.raise
[ Pp.textf "%s does not exist" (Path.to_string_maybe_quoted file_in_build_dir) ]
| true ->
let+ () = Build_system.build_file file_in_build_dir in
Error file_in_build_dir)
let file_not_found () =
User_error.raise
[ Pp.textf "%s does not exist" (Path.to_string_maybe_quoted file_in_build_dir) ]
in
match module_for_file with
| Some (`Module m) ->
let pp_file =
m |> Dune_rules.Module.source ~ml_kind |> Option.map ~f:Dune_rules.Module.File.path
in
(match pp_file with
| None -> Memo.Lazy.force build_fallback
| None -> file_not_found ()
| Some pp_file ->
let+ () = Build_system.build_file pp_file in
Ok pp_file)
| Some (`Staged_pps loc) ->
User_error.raise ~loc [ Pp.text "staged_pps are not supported." ]
| None -> Memo.Lazy.force build_fallback
| None -> file_not_found ()
;;
let term =
Expand Down

0 comments on commit e7881c7

Please sign in to comment.