diff --git a/src/ppx/ppx_eliom_client.ml b/src/ppx/ppx_eliom_client.ml index 721f442d7..dfbc0d8bf 100644 --- a/src/ppx/ppx_eliom_client.ml +++ b/src/ppx/ppx_eliom_client.ml @@ -88,9 +88,10 @@ module Pass = struct let find_fragment loc id = if Mli.exists () then Mli.find_fragment id - else if Cmo.exists () - then Cmo.find_fragment loc - else [%type: _] + else + match if Cmo.exists () then Cmo.find_fragment loc else None with + | Some typ -> typ + | None -> [%type: _] let register_client_closures client_value_datas = let registrations = diff --git a/src/ppx/ppx_eliom_utils.ml b/src/ppx/ppx_eliom_utils.ml index c5df7d6dd..2018c29c0 100644 --- a/src/ppx/ppx_eliom_utils.ml +++ b/src/ppx/ppx_eliom_utils.ml @@ -471,9 +471,7 @@ module Cmo = struct let find_injected_ident = find "injected ident" let find_fragment loc = - match Mli.get_fragment_type (find "client value" loc) with - | Some ty -> ty - | None -> assert false + Mli.get_fragment_type (find "client value" loc) end (** Context convenience module. *) diff --git a/src/ppx/ppx_eliom_utils.mli b/src/ppx/ppx_eliom_utils.mli index 224a6c4fc..33fd8f0f0 100644 --- a/src/ppx/ppx_eliom_utils.mli +++ b/src/ppx/ppx_eliom_utils.mli @@ -57,7 +57,7 @@ module Cmo : sig val exists : unit -> bool val find_escaped_ident : Location.t -> core_type val find_injected_ident : Location.t -> core_type - val find_fragment : Location.t -> core_type + val find_fragment : Location.t -> core_type option end (** Signature of specific code of a preprocessor. *)