aboutsummaryrefslogtreecommitdiffhomepage
path: root/pretyping/vnorm.ml
diff options
context:
space:
mode:
authorGravatar Matthieu Sozeau <matthieu.sozeau@inria.fr>2015-01-15 18:45:27 +0530
committerGravatar Matthieu Sozeau <matthieu.sozeau@inria.fr>2015-01-15 18:59:00 +0530
commit8309a98096facfba448c9d8d298ba3903145831a (patch)
tree38a09851cb687921193b4368a93eed34ccd55a58 /pretyping/vnorm.ml
parent58153a5bc59bbde6534425d66a2fe5d9943eb44b (diff)
Correct restriction of vm_compute when handling universe polymorphic
definitions. Instead of failing with an anomaly when trying to do conversion or computation with the vm's, consider polymorphic constants as being opaque and keep instances around. This way the code is still correct but (obviously) incomplete for polymorphic definitions and we avoid introducing an anomaly. The patch does nothing clever, it only keeps around instances with constants/inductives and compile constant bodies only for non-polymorphic definitions.
Diffstat (limited to 'pretyping/vnorm.ml')
-rw-r--r--pretyping/vnorm.ml11
1 files changed, 5 insertions, 6 deletions
diff --git a/pretyping/vnorm.ml b/pretyping/vnorm.ml
index 1d97aef27..3f1e6e5d6 100644
--- a/pretyping/vnorm.ml
+++ b/pretyping/vnorm.ml
@@ -93,12 +93,11 @@ let construct_of_constr_const env tag typ =
let construct_of_constr_block = construct_of_constr false
-(* FIXME: treatment of universes *)
let constr_type_of_idkey env idkey =
match idkey with
| ConstKey cst ->
- let const_type = (Environ.lookup_constant cst env).const_type in
- mkConst cst, Typeops.type_of_constant_type env const_type
+ let const_type = Typeops.type_of_constant_in env cst in
+ mkConstU cst, const_type
| VarKey id ->
let (_,_,ty) = lookup_named id env in
mkVar id, ty
@@ -107,7 +106,7 @@ let constr_type_of_idkey env idkey =
let (_,_,ty) = lookup_rel n env in
mkRel n, lift n ty
-let type_of_ind env ind u =
+let type_of_ind env (ind, u) =
type_of_inductive env (Inductive.lookup_mind_specif env ind, u)
let build_branches_type env (mind,_ as _ind) mib mip u params dep p =
@@ -176,7 +175,7 @@ and nf_whd env whd typ =
| Vatom_stk(Aiddef(idkey,v), stk) ->
nf_whd env (whd_stack v stk) typ
| Vatom_stk(Aind ind, stk) ->
- nf_stk env (mkInd ind) (type_of_ind env ind Univ.Instance.empty (*FIXME*)) stk
+ nf_stk env (mkIndU ind) (type_of_ind env ind) stk
and nf_stk env c t stk =
match stk with
@@ -194,7 +193,7 @@ and nf_stk env c t stk =
let nparams = mib.mind_nparams in
let params,realargs = Util.Array.chop nparams allargs in
let pT =
- hnf_prod_applist env (type_of_ind env ind u) (Array.to_list params) in
+ hnf_prod_applist env (type_of_ind env (ind,u)) (Array.to_list params) in
let pT = whd_betadeltaiota env pT in
let dep, p = nf_predicate env ind mip params (type_of_switch sw) pT in
(* Calcul du type des branches *)