(List.fold_right
(fun d context ->
begin
- match snd d with
- C.Decl t -> ignore (typeof ~metasenv ~subst:[] context t)
- | C.Def (te,ty) ->
- ignore (typeof ~metasenv ~subst:[] context te);
+ match d with
+ _,C.Decl t -> ignore (typeof ~metasenv ~subst:[] context t)
+ | name,C.Def (te,ty) ->
ignore (typeof ~metasenv ~subst:[] context ty);
+ let ty' = typeof ~metasenv ~subst:[] context te in
+ if not (R.are_convertible ~subst [] ty' ty) then
+ raise (AssertFailure (lazy (Printf.sprintf (
+ "the type of the definiens for %s in the context is not "^^
+ "convertible with the declared one.\n"^^
+ "inferred type:\n%s\nexpected type:\n%s")
+ name
+ (PP.ppterm ~subst ~metasenv ~context:[] ty')
+ (PP.ppterm ~subst ~metasenv ~context:[] ty))))
end;
d::context
) context [])