From 88bdc70aeec4b838517931dd5882a1a26277be1d Mon Sep 17 00:00:00 2001 From: Claudio Sacerdoti Coen Date: Mon, 23 Oct 2006 22:20:16 +0000 Subject: [PATCH] Better (and more localized) error message for sort_of_prod. --- .../components/cic_unification/cicRefine.ml | 32 ++++++++++++------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/helm/software/components/cic_unification/cicRefine.ml b/helm/software/components/cic_unification/cicRefine.ml index 21af1f9c7..be4014507 100644 --- a/helm/software/components/cic_unification/cicRefine.ml +++ b/helm/software/components/cic_unification/cicRefine.ml @@ -505,8 +505,8 @@ and type_of_aux' ?(localization_tbl = Cic.CicHash.create 1) metasenv context t t' sort2 subst'' context_for_t metasenv'' ugraph2 in let sop,subst''',metasenv''',ugraph3 = - sort_of_prod subst'' metasenv'' - context (name,s') (sort1,sort2) ugraph2 + sort_of_prod localization_tbl subst'' metasenv'' + context (name,s') t' (sort1,sort2) ugraph2 in C.Prod (name,s',t'),sop,subst''',metasenv''',ugraph3 | C.Lambda (n,s,t) -> @@ -1136,7 +1136,9 @@ prerr_endline ("poco geniale: nel caso di IRL basterebbe sapere che questo e' il check_exp_named_subst_aux metasubst metasenv [] tl ugraph - and sort_of_prod subst metasenv context (name,s) (t1, t2) ugraph = + and sort_of_prod localization_tbl subst metasenv context (name,s) t (t1, t2) + ugraph + = let module C = Cic in let context_for_t2 = (Some (name,C.Decl s))::context in let t1'' = CicReduction.whd ~subst context t1 in @@ -1172,15 +1174,23 @@ prerr_endline ("poco geniale: nel caso di IRL basterebbe sapere che questo e' il with _ -> assert false (* unification against a metavariable *) in t2'',subst,metasenv,ugraph1 + | (C.Sort _,_) + | (C.Meta _,_) -> + enrich localization_tbl s + (RefineFailure + (lazy + (sprintf + "%s is supposed to be a type, but its type is %s" + (CicMetaSubst.ppterm_in_context subst t context) + (CicMetaSubst.ppterm_in_context subst t2 context)))) | _,_ -> - raise - (RefineFailure - (lazy - (sprintf - ("Two sorts were expected, found %s " ^^ - "(that reduces to %s) and %s (that reduces to %s)") - (CicPp.ppterm t1) (CicPp.ppterm t1'') (CicPp.ppterm t2) - (CicPp.ppterm t2'')))) + enrich localization_tbl t + (RefineFailure + (lazy + (sprintf + "%s is supposed to be a type, but its type is %s" + (CicMetaSubst.ppterm_in_context subst s context) + (CicMetaSubst.ppterm_in_context subst t1 context)))) and avoid_double_coercion context subst metasenv ugraph t ty = if not !pack_coercions then -- 2.39.2