exception Error of string lazy_t * exn option
let fail ?exn msg = raise (Error (msg,exn))
-let wrap f x =
+let wrap f x =
try f x
with
| MultiPassDisambiguator.DisambiguationError _
;;
let unify a b c d = wrap (unify a b c) d;;
+let fix_sorts (name,ctx,t) =
+ let f () =
+ let t = NCicUnification.fix_sorts t in
+ name,ctx,t
+ in
+ wrap f ()
+;;
+
let refine status ctx term expty =
let status, (nt,_,term) = relocate status ctx term in
let status, ne, expty =
(* we could lift wanted step-by-step *)
try true, unify status ctx (None, ctx, t) wanted
with
- | NCicUnification.UnificationFailure _
- | NCicUnification.Uncertain _ -> false, status
+ | Error (_, Some (NCicUnification.UnificationFailure _))
+ | Error (_, Some (NCicUnification.Uncertain _)) -> false, status
in
let match_term status ctx (wanted : cic_term) t =
let rec aux ctx (status,already_found) t =