raise (Try_again (lazy "The type of the term to be matched
is still unknown"))
| _ ->
- raise (Invalid_choice (Some loc, lazy "The type of the term to be matched is not (co)inductive!")))
+ raise (Invalid_choice (lazy (loc,"The type of the term to be matched is not (co)inductive!"))))
| None ->
let rec fst_constructor =
function
(Ast.Pattern (head, _, _), _) :: _ -> head
| (Ast.Wildcard, _) :: tl -> fst_constructor tl
- | [] -> raise (Invalid_choice (Some loc, lazy "The type of the term to be matched cannot be determined because it is an inductive type without constructors or because all patterns use wildcards"))
+ | [] -> raise (Invalid_choice (lazy (loc,"The type of the term to be matched cannot be determined because it is an inductive type without constructors or because all patterns use wildcards")))
in
(match resolve env (Id (fst_constructor branches)) () with
| Cic.MutConstruct (indtype_uri, indtype_no, _, _) ->
raise (Try_again (lazy "The type of the term to be matched
is still unknown"))
| _ ->
- raise (Invalid_choice (Some loc, lazy "The type of the term to be matched is not (co)inductive!")))
+ raise (Invalid_choice (lazy (loc,"The type of the term to be matched is not (co)inductive!"))))
in
let branches =
if create_dummy_ids then
(function
Ast.Wildcard,term -> ("wildcard",None,[]), term
| Ast.Pattern _,_ ->
- raise (Invalid_choice (Some loc, lazy "Syntax error: the left hand side of a branch patterns must be \"_\""))
+ raise (Invalid_choice (lazy (loc, "Syntax error: the left hand side of a branch patterns must be \"_\"")))
) branches
else
match fst(CicEnvironment.get_obj CicUniv.oblivion_ugraph indtype_uri) with
[] ->
if unrecognized != [] then
raise (Invalid_choice
- (Some loc,
- lazy
+ (lazy (loc,
("Unrecognized constructors: " ^
- String.concat " " unrecognized)))
+ String.concat " " unrecognized))))
else if useless > 0 then
raise (Invalid_choice
- (Some loc,
- lazy
+ (lazy (loc,
("The last " ^ string_of_int useless ^
"case" ^ if useless > 1 then "s are" else " is" ^
- " unused")))
+ " unused"))))
else
[]
| (Ast.Wildcard,_)::tl when not unused ->
[] ->
raise
(Invalid_choice
- (Some loc, lazy ("Missing case: " ^ name)))
+ (lazy (loc, ("Missing case: " ^ name))))
| ((Ast.Wildcard, _) as branch :: _) as branches ->
branch, branches
| (Ast.Pattern (name',_,_),_) as branch :: tl
else
raise
(Invalid_choice
- (Some loc,
- lazy ("Wrong number of arguments for " ^ name)))
+ (lazy (loc,"Wrong number of arguments for " ^
+ name)))
| Ast.Wildcard,term ->
let rec mk_lambdas =
function
(try
List.assoc s ids_to_uris, aux ~localize loc context term
with Not_found ->
- raise (Invalid_choice (Some loc, lazy "The provided explicit named substitution is trying to instantiate a named variable the object is not abstracted on"))))
+ raise (Invalid_choice (lazy (loc, "The provided explicit named substitution is trying to instantiate a named variable the object is not abstracted on")))))
subst
| None -> List.map (fun uri -> uri, Cic.Implicit None) uris)
in
*)
t
| _ ->
- raise (Invalid_choice (Some loc, lazy "??? Can this happen?"))
+ raise (Invalid_choice (lazy (loc, "??? Can this happen?")))
with
CicEnvironment.CircularDependency _ ->
- raise (Invalid_choice (None, lazy "Circular dependency in the environment"))))
+ raise (Invalid_choice (lazy (loc,"Circular dependency in the environment")))))
| CicNotationPt.Implicit -> Cic.Implicit None
| CicNotationPt.UserInput -> Cic.Implicit (Some `Hole)
| CicNotationPt.Num (num, i) -> resolve env (Num i) ~num ()
in refine_profiler.HExtlib.profile foo ()
with
| Try_again msg -> Uncertain (lazy (Stdpp.dummy_loc,Lazy.force msg))
- | Invalid_choice (None,msg) -> Ko(lazy (Stdpp.dummy_loc,Lazy.force msg))
- | Invalid_choice (Some loc,msg) -> Ko (lazy (loc,Lazy.force msg))
+ | Invalid_choice loc_msg -> Ko loc_msg
in
(* (4) build all possible interpretations *)
let (@@) (l1,l2,l3) (l1',l2',l3') = l1@l1', l2@l2', l3@l3' in