match List.nth context (n - 1) with
| (_,C.Decl ty) -> S.lift n ty
| (_,C.Def (_,ty)) -> S.lift n ty
- with Failure _ -> raise (TypeCheckerFailure (lazy "unbound variable")))
+ with Failure _ ->
+ raise (TypeCheckerFailure (lazy ("unbound variable " ^ string_of_int n
+ ^" under: " ^ NCicPp.ppcontext ~metasenv ~subst context))))
| C.Sort (C.Type [false,u]) -> C.Sort (C.Type [true, u])
| C.Sort (C.Type _) ->
raise (AssertFailure (lazy ("Cannot type an inferred type: "^
raise
(TypeCheckerFailure
(lazy (Printf.sprintf
- ("Appl: wrong application of %s: the parameter %s has type"^^
+ ("Appl: wrong application of %s: the argument %s has type"^^
"\n%s\nbut it should have type \n%s\nContext:\n%s\n")
(PP.ppterm ~subst ~metasenv ~context he)
(PP.ppterm ~subst ~metasenv ~context arg)
| (_,h1,_,_,C.Constant (_,_,_,ty,_)), Ref.Ref (_,Ref.Def h2) ->
if h1 <> h2 then error ();
ty
- | _ -> raise (AssertFailure (lazy "type_of_constant: environment/reference"))
+ | _ ->
+ raise (AssertFailure
+ (lazy ("type_of_constant: environment/reference: " ^
+ Ref.string_of_reference ref)))
and get_relevance ~metasenv ~subst context t args =
let ty = typeof ~subst ~metasenv context t in
let _ = NCicReduction.set_get_relevance get_relevance;;
+
+let indent = ref 0;;
+let debug = true;;
+let logger =
+ let do_indent () = String.make !indent ' ' in
+ (function
+ | `Start_type_checking s ->
+ if debug then
+ prerr_endline (do_indent () ^ "Start: " ^ NUri.string_of_uri s);
+ incr indent
+ | `Type_checking_completed s ->
+ decr indent;
+ if debug then
+ prerr_endline (do_indent () ^ "End: " ^ NUri.string_of_uri s)
+ | `Type_checking_interrupted s ->
+ decr indent;
+ if debug then
+ prerr_endline (do_indent () ^ "Break: " ^ NUri.string_of_uri s)
+ | `Type_checking_failed s ->
+ decr indent;
+ if debug then
+ prerr_endline (do_indent () ^ "Fail: " ^ NUri.string_of_uri s)
+ | `Trust_obj s ->
+ if debug then
+ prerr_endline (do_indent () ^ "Trust: " ^ NUri.string_of_uri s))
+;;
+(* let _ = set_logger logger ;; *)
(* EOF *)