From 024cf5ae087024399cc894b121437d72cd11b480 Mon Sep 17 00:00:00 2001 From: Pierre-Marie Pédrot Date: Fri, 30 Sep 2016 16:42:54 +0200 Subject: Fix bug #4471: [generalize dependent] permits ill-typed terms in trunk. This bug was introduced by 37ab45726, because the new apply_type function was not checking that the new goal was indeed well-typed. We add this check locally in the generalize dependent tactic. --- tactics/tactics.ml | 2 ++ test-suite/bugs/closed/4471.v | 6 ++++++ 2 files changed, 8 insertions(+) create mode 100644 test-suite/bugs/closed/4471.v diff --git a/tactics/tactics.ml b/tactics/tactics.ml index 2d901c2dbc..2fe8e0bc34 100644 --- a/tactics/tactics.ml +++ b/tactics/tactics.ml @@ -2807,6 +2807,8 @@ let old_generalize_dep ?(with_let=false) c gl = in let cl'',evd = generalize_goal gl 0 ((AllOccurrences,c,body),Anonymous) (cl',project gl) in + (** Check that the generalization is indeed well-typed *) + let (evd, _) = Typing.type_of env evd cl'' in let args = Context.Named.to_instance to_quantify_rev in tclTHENLIST [tclEVARS evd; diff --git a/test-suite/bugs/closed/4471.v b/test-suite/bugs/closed/4471.v new file mode 100644 index 0000000000..36efc42d47 --- /dev/null +++ b/test-suite/bugs/closed/4471.v @@ -0,0 +1,6 @@ +Goal forall (A B : Type) (P : forall _ : prod A B, Type) (a : A) (b : B) (p p0 : forall (x : A) (x' : B), P (@pair A B x x')), + @eq (P (@pair A B a b)) (p (@fst A B (@pair A B a b)) (@snd A B (@pair A B a b))) + (p0 (@fst A B (@pair A B a b)) (@snd A B (@pair A B a b))). +Proof. + intros. + Fail generalize dependent (a, b). -- cgit v1.2.3