diff options
author | herbelin <herbelin@85f007b7-540e-0410-9357-904b9bb8a0f7> | 2006-10-29 20:11:08 +0000 |
---|---|---|
committer | herbelin <herbelin@85f007b7-540e-0410-9357-904b9bb8a0f7> | 2006-10-29 20:11:08 +0000 |
commit | dfe97724fb6034fc06b3ef693f6a3ed94733adbc (patch) | |
tree | 673d36afb27326fe8bd5a5165203a8199405833d /kernel/typeops.ml | |
parent | 631769875f5a7e099cf814ac7b1aaab624f40a9d (diff) |
Compatibilité du polymorphisme de constantes avec les sections.
Amélioration affichage des univers. Réparation de petits oublis du premier
commit. Essai d'une nouvelle stratégie : si le type d'une constante
est mentionné explicitement, la constante est monomorphe dans Type.
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@9314 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'kernel/typeops.ml')
-rw-r--r-- | kernel/typeops.ml | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/kernel/typeops.ml b/kernel/typeops.ml index 3c335d115..9b8735fa7 100644 --- a/kernel/typeops.ml +++ b/kernel/typeops.ml @@ -125,6 +125,26 @@ let check_hyps id env hyps = *) (* Instantiation of terms on real arguments. *) +(* Make a type polymorphic if an arity *) + +let extract_level env p = + let _,c = dest_prod_assum env p in + match kind_of_term c with Sort (Type u) -> Some u | _ -> None + +let extract_context_levels env = + List.fold_left + (fun l (_,b,p) -> if b=None then extract_level env p::l else l) [] + +let make_polymorphic_if_arity env t = + let params, ccl = dest_prod_assum env t in + match kind_of_term ccl with + | Sort (Type u) -> + let param_ccls = extract_context_levels env params in + let s = { poly_param_levels = param_ccls; poly_level = u} in + PolymorphicArity (params,s) + | _ -> + NonPolymorphicType t + (* Type of constants *) let type_of_constant_knowing_parameters env t paramtyps = |