aboutsummaryrefslogtreecommitdiffhomepage
path: root/checker/typeops.ml
diff options
context:
space:
mode:
authorGravatar barras <barras@85f007b7-540e-0410-9357-904b9bb8a0f7>2008-05-06 18:31:25 +0000
committerGravatar barras <barras@85f007b7-540e-0410-9357-904b9bb8a0f7>2008-05-06 18:31:25 +0000
commit376e61185dadea415d6b7d2df45dc7236e901e5b (patch)
tree78b89a99eee6981ee309710500b1b55b030522a3 /checker/typeops.ml
parent8956bfb8dd63d0d76d3f67f313371318b7edc39d (diff)
checker deals with polymorphic constants and module aliases
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@10892 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'checker/typeops.ml')
-rw-r--r--checker/typeops.ml18
1 files changed, 18 insertions, 0 deletions
diff --git a/checker/typeops.ml b/checker/typeops.ml
index 27a3e287d..1af8b2ced 100644
--- a/checker/typeops.ml
+++ b/checker/typeops.ml
@@ -436,3 +436,21 @@ let check_named_ctxt env ctxt =
conv_leq env j1 ty;
push_named d env)
ctxt ~init:env
+
+(* Polymorphic arities utils *)
+
+let check_kind env ar u =
+ if snd (dest_prod env ar) = Sort(Type u) then ()
+ else failwith "not the correct sort"
+
+let check_polymorphic_arity env params par =
+ let pl = par.poly_param_levels in
+ let rec check_p env pl params =
+ match pl, params with
+ Some u::pl, (na,None,ty)::params ->
+ check_kind env ty u;
+ check_p (push_rel (na,None,ty) env) pl params
+ | None::pl,d::params -> check_p (push_rel d env) pl params
+ | [], _ -> ()
+ | _ -> failwith "check_poly: not the right number of params" in
+ check_p env pl (List.rev params)