aboutsummaryrefslogtreecommitdiff
path: root/kernel/inductive.ml
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/inductive.ml')
-rw-r--r--kernel/inductive.ml16
1 files changed, 10 insertions, 6 deletions
diff --git a/kernel/inductive.ml b/kernel/inductive.ml
index c6035f78ff..6325779675 100644
--- a/kernel/inductive.ml
+++ b/kernel/inductive.ml
@@ -185,8 +185,8 @@ let make_subst =
exception SingletonInductiveBecomesProp of Id.t
-let instantiate_universes ctx ar args =
- let subst = make_subst (ctx,ar.template_param_levels,args) in
+let instantiate_universes ctx (templ, ar) args =
+ let subst = make_subst (ctx,templ.template_param_levels,args) in
let level = Univ.subst_univs_universe (Univ.make_subst subst) ar.template_level in
let ty =
(* Singleton type not containing types are interpretable in Prop *)
@@ -215,8 +215,12 @@ let type_of_inductive_gen ?(polyprop=true) ((mib,mip),u) paramtyps =
match mip.mind_arity with
| RegularArity a -> subst_instance_constr u a.mind_user_arity
| TemplateArity ar ->
+ let templ = match mib.mind_template with
+ | None -> assert false
+ | Some t -> t
+ in
let ctx = List.rev mip.mind_arity_ctxt in
- let ctx,s = instantiate_universes ctx ar paramtyps in
+ let ctx,s = instantiate_universes ctx (templ, ar) paramtyps in
(* The Ocaml extraction cannot handle (yet?) "Prop-polymorphism", i.e.
the situation where a non-Prop singleton inductive becomes Prop
when applied to Prop params *)
@@ -962,7 +966,7 @@ let check_one_fix renv recpos trees def =
let stack_br = push_stack_args case_spec.(k) stack' in
check_rec_call renv stack_br br')
with (FixGuardError _ as exn) ->
- let exn = CErrors.push exn in
+ let exn = Exninfo.capture exn in
(* we try hard to reduce the match away by looking for a
constructor in c_0 (we unfold definitions too) *)
let c_0 = whd_all renv.env c_0 in
@@ -1007,7 +1011,7 @@ let check_one_fix renv recpos trees def =
check_nested_fix_body illformed renv' (decrArg+1) arg_sp body
else check_rec_call renv' [] body)
with (FixGuardError _ as exn) ->
- let exn = CErrors.push exn in
+ let exn = Exninfo.capture exn in
(* we try hard to reduce the fix away by looking for a
constructor in l[decrArg] (we unfold definitions too) *)
if List.length l <= decrArg then Exninfo.iraise exn;
@@ -1055,7 +1059,7 @@ let check_one_fix renv recpos trees def =
List.iter (check_rec_call renv []) l;
check_rec_call renv [] c
with (FixGuardError _ as exn) ->
- let exn = CErrors.push exn in
+ let exn = Exninfo.capture exn in
(* we try hard to reduce the proj away by looking for a
constructor in c (we unfold definitions too) *)
let c = whd_all renv.env c in