aboutsummaryrefslogtreecommitdiffhomepage
path: root/kernel/inductive.ml
diff options
context:
space:
mode:
authorGravatar Matthieu Sozeau <mattam@eduroam-prg-sg-1-46-137.net.univ-paris-diderot.fr>2017-01-24 17:24:39 +0100
committerGravatar Matthieu Sozeau <mattam@mattam.org>2018-03-08 07:56:59 -0300
commit7ceed3c76e5ac752321827300f80ee974acbb54c (patch)
tree3c9198c9405c3d2d0df474a0a1c79722414b3841 /kernel/inductive.ml
parente3124e098ef8170dac2b348b91757a7034bc4999 (diff)
Fix SR breakage due to allowing fixpoints on non-rec values
We limit fixpoints to Finite inductive types, so that BiFinite inductives (non-recursive records) are excluded from fixpoint construction. This is a regression in the sense that e.g. fixpoints on unit records were allowed before. Primitive records with eta-conversion are included in the BiFinite types. Fix deprecation Fix error message, the inductive type needs to be recursive for fix to work
Diffstat (limited to 'kernel/inductive.ml')
-rw-r--r--kernel/inductive.ml3
1 files changed, 3 insertions, 0 deletions
diff --git a/kernel/inductive.ml b/kernel/inductive.ml
index 722705bd7..a2ce3dd4a 100644
--- a/kernel/inductive.ml
+++ b/kernel/inductive.ml
@@ -1067,6 +1067,9 @@ let inductive_of_mutfix env ((nvect,bodynum),(names,types,bodies as recdef)) =
try find_inductive env a
with Not_found ->
raise_err env i (RecursionNotOnInductiveType a) in
+ let mib,_ = lookup_mind_specif env (out_punivs mind) in
+ if mib.mind_finite != Finite then
+ raise_err env i (RecursionNotOnInductiveType a);
(mind, (env', b))
else check_occur env' (n+1) b
else anomaly ~label:"check_one_fix" (Pp.str "Bad occurrence of recursive call.")