prerr_endline ("GB: " ^ NCicPp.ppterm ~metasenv ~subst ~context t
^ " " ^ String.concat "," (List.map (fun i -> NCicPp.ppterm ~metasenv ~subst ~context (C.Rel i)) safes));
*)
- match R.whd ~subst context t with (* TODO: use ~delta:false as mush as poss*)
+ let t = R.whd ~delta:max_int ~subst context t in
+ try
+ match t with
| C.Rel m as t when List.mem_assoc m recfuns ->
raise (NotGuarded (lazy
(NCicPp.ppterm ~subst ~metasenv ~context t ^ " passed around")))
pl cl
| _ -> recursor aux k t)
| t -> recursor aux k t
+ with
+ NotGuarded _ as exc ->
+ let t' = R.whd ~delta:0 ~subst context t in
+ if t = t' then
+ raise exc
+ else
+ aux k t'
in
try aux (context, recfuns, 1, []) t
with NotGuarded s -> raise (TypeCheckerFailure s)