X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Focaml%2Fcic_omdoc%2FdoubleTypeInference.ml;h=5b0cc01fc438ebd695508f635fd6bab8f77c6c86;hb=refs%2Ftags%2FPRE_UNIVERSES;hp=441d7c9a938425a573c15f7236308f189e2be165;hpb=c5d5bf37b1e4c4b9b499ed2cbfe27cf2ec181944;p=helm.git diff --git a/helm/ocaml/cic_omdoc/doubleTypeInference.ml b/helm/ocaml/cic_omdoc/doubleTypeInference.ml index 441d7c9a9..5b0cc01fc 100644 --- a/helm/ocaml/cic_omdoc/doubleTypeInference.ml +++ b/helm/ocaml/cic_omdoc/doubleTypeInference.ml @@ -361,9 +361,7 @@ let rec type_of_aux' subterms_to_types metasenv context t expectedty = CicSubstitution.subst_vars exp_named_subst (type_of_variable uri) | C.Meta (n,l) -> (* Let's visit all the subterms that will not be visited later *) - let (_,canonical_context,_) = - List.find (function (m,_,_) -> n = m) metasenv - in + let (_,canonical_context,_) = CicUtil.lookup_meta n metasenv in let lifted_canonical_context = let rec aux i = function @@ -398,9 +396,7 @@ let rec type_of_aux' subterms_to_types metasenv context t expectedty = | _,_ -> assert false (* the term is not well typed!!! *) ) l lifted_canonical_context in - let (_,canonical_context,ty) = - List.find (function (m,_,_) -> n = m) metasenv - in + let (_,canonical_context,ty) = CicUtil.lookup_meta n metasenv in (* Checks suppressed *) CicSubstitution.lift_meta l ty | C.Sort (C.Type t) -> (* TASSI: CONSTRAINT *) @@ -545,7 +541,12 @@ let rec type_of_aux' subterms_to_types metasenv context t expectedty = (* Checks suppressed *) (* Let's visit all the subterms that will not be visited later *) let (cl,parsno) = - match CicEnvironment.get_cooked_obj uri with + let obj = + try + CicEnvironment.get_cooked_obj uri + with Not_found -> assert false + in + match obj with C.InductiveDefinition (tl,_,parsno) -> let (_,_,_,cl) = List.nth tl i in (cl,parsno) | _ -> @@ -643,14 +644,24 @@ let rec type_of_aux' subterms_to_types metasenv context t expectedty = and visit_exp_named_subst context uri exp_named_subst = let uris_and_types = - match CicEnvironment.get_cooked_obj uri with + let obj = + try + CicEnvironment.get_cooked_obj uri + with Not_found -> assert false + in + match obj with Cic.Constant (_,_,_,params) | Cic.CurrentProof (_,_,_,_,params) | Cic.Variable (_,_,_,params) | Cic.InductiveDefinition (_,params,_) -> List.map (function uri -> - match CicEnvironment.get_cooked_obj uri with + let obj = + try + CicEnvironment.get_cooked_obj uri + with Not_found -> assert false + in + match obj with Cic.Variable (_,None,ty,_) -> uri,ty | _ -> assert false (* the theorem is well-typed *) ) params