aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGaëtan Gilbert2018-10-30 20:18:26 +0100
committerGaëtan Gilbert2018-10-30 21:47:16 +0100
commita492288930a3f804ad05def938dd572ccf680a66 (patch)
tree692236fbec1dbf820fb806978516042ebe89f42b
parent25df997df4b5b6882f8bf316c5cfb8145ba5f08d (diff)
Fix evar leak in induction tactic.
Detected when making Typing check universe instances.
-rw-r--r--tactics/tactics.ml17
1 files changed, 10 insertions, 7 deletions
diff --git a/tactics/tactics.ml b/tactics/tactics.ml
index a6a104ccca..4ae4afc017 100644
--- a/tactics/tactics.ml
+++ b/tactics/tactics.ml
@@ -4100,12 +4100,15 @@ let compute_elim_signature (evd,(elimc,elimt),ind_type_guess) names_info =
let guess_elim isrec dep s hyp0 gl =
let tmptyp0 = Tacmach.New.pf_get_hyp_typ hyp0 gl in
let (mind, u), _ = Tacmach.New.pf_reduce_to_quantified_ind gl tmptyp0 in
- let evd, elimc =
- if isrec && not (is_nonrec mind) then find_ind_eliminator mind s gl
+ let env = Tacmach.New.pf_env gl in
+ let sigma = Tacmach.New.project gl in
+ let sigma, elimc =
+ if isrec && not (is_nonrec mind)
+ then
+ let gr = lookup_eliminator mind s in
+ Evd.fresh_global env sigma gr
else
- let env = Tacmach.New.pf_env gl in
- let sigma = Tacmach.New.project gl in
- let u = EInstance.kind (Tacmach.New.project gl) u in
+ let u = EInstance.kind sigma u in
if dep then
let (sigma, ind) = build_case_analysis_scheme env sigma (mind, u) true s in
let ind = EConstr.of_constr ind in
@@ -4115,8 +4118,8 @@ let guess_elim isrec dep s hyp0 gl =
let ind = EConstr.of_constr ind in
(sigma, ind)
in
- let elimt = Tacmach.New.pf_unsafe_type_of gl elimc in
- evd, ((elimc, NoBindings), elimt), mkIndU (mind, u)
+ let elimt = Typing.unsafe_type_of env sigma elimc in
+ sigma, ((elimc, NoBindings), elimt), mkIndU (mind, u)
let given_elim hyp0 (elimc,lbind as e) gl =
let sigma = Tacmach.New.project gl in