aboutsummaryrefslogtreecommitdiffhomepage
path: root/kernel/typeops.ml
diff options
context:
space:
mode:
authorGravatar Matthieu Sozeau <mattam@mattam.org>2015-10-12 15:39:20 +0200
committerGravatar Matthieu Sozeau <mattam@mattam.org>2015-10-12 15:39:20 +0200
commit50183ce7200d6059b4146c0cc4933aa524178c02 (patch)
treeef81d73765af835dc3c90bbb20b12b98f4a5bc17 /kernel/typeops.ml
parentb9a3925288af0cf3023c9a0073dc1eb295270de8 (diff)
Univs: be more restrictive for template polymorphic constants: only
direct aliases are ok, and indices should not be made polymorphic. Fixes NFix.
Diffstat (limited to 'kernel/typeops.ml')
-rw-r--r--kernel/typeops.ml14
1 files changed, 10 insertions, 4 deletions
diff --git a/kernel/typeops.ml b/kernel/typeops.ml
index fe82d85d5..8895bae5d 100644
--- a/kernel/typeops.ml
+++ b/kernel/typeops.ml
@@ -134,10 +134,16 @@ let extract_context_levels env l =
let make_polymorphic_if_constant_for_ind env {uj_val = c; uj_type = t} =
let params, ccl = dest_prod_assum env t in
match kind_of_term ccl with
- | Sort (Type u) when isInd (fst (decompose_app (whd_betadeltaiota env c))) ->
- let param_ccls = extract_context_levels env params in
- let s = { template_param_levels = param_ccls; template_level = u} in
- TemplateArity (params,s)
+ | Sort (Type u) ->
+ let ind, l = decompose_app (whd_betadeltaiota env c) in
+ if isInd ind && List.is_empty l then
+ let mis = lookup_mind_specif env (fst (destInd ind)) in
+ let nparams = Inductive.inductive_params mis in
+ let paramsl = CList.lastn nparams params in
+ let param_ccls = extract_context_levels env paramsl in
+ let s = { template_param_levels = param_ccls; template_level = u} in
+ TemplateArity (params,s)
+ else RegularArity t
| _ ->
RegularArity t