aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGaëtan Gilbert2020-08-28 12:50:05 +0200
committerGaëtan Gilbert2020-08-28 16:31:09 +0200
commit40f8632178d8418f2492f9b19405621ac70ea671 (patch)
tree842912ab1f17574dac8438c887c94c2cde34a40b
parent911f33f0a0ff648082d329841388f59e8cecf231 (diff)
Make abstract compatible with mangle names
Fix #12928 Fix #3146
-rw-r--r--tactics/abstract.ml5
-rw-r--r--test-suite/bugs/closed/bug_12928.v7
-rw-r--r--test-suite/bugs/closed/bug_3146.v5
-rw-r--r--test-suite/success/name_mangling.v8
4 files changed, 19 insertions, 6 deletions
diff --git a/tactics/abstract.ml b/tactics/abstract.ml
index 6b575d0807..f53dc2ed84 100644
--- a/tactics/abstract.ml
+++ b/tactics/abstract.ml
@@ -78,7 +78,10 @@ let cache_term_by_tactic_then ~opaque ~name_op ?(goal_type=None) tac tacK =
| None -> Proofview.Goal.concl gl
| Some ty -> ty in
let concl = it_mkNamedProd_or_LetIn concl sign in
- let solve_tac = tclCOMPLETE (tclTHEN (tclDO (List.length sign) Tactics.intro) tac) in
+ let solve_tac = tclCOMPLETE
+ (Tactics.intros_mustbe_force (List.rev_map NamedDecl.get_id sign) <*>
+ tac)
+ in
let effs, sigma, lem, args, safe =
!declare_abstract ~name ~poly ~sign ~secsign ~kind ~opaque ~solve_tac sigma concl in
let solve =
diff --git a/test-suite/bugs/closed/bug_12928.v b/test-suite/bugs/closed/bug_12928.v
new file mode 100644
index 0000000000..2f4d1dd16d
--- /dev/null
+++ b/test-suite/bugs/closed/bug_12928.v
@@ -0,0 +1,7 @@
+
+Lemma test: forall (x:bool) (x: nat), nat.
+Proof. intros y x; abstract (exact x). Qed.
+
+Set Mangle Names.
+Lemma test': forall x : nat, nat.
+Proof. intros x. abstract exact x. Qed.
diff --git a/test-suite/bugs/closed/bug_3146.v b/test-suite/bugs/closed/bug_3146.v
new file mode 100644
index 0000000000..c42e28818a
--- /dev/null
+++ b/test-suite/bugs/closed/bug_3146.v
@@ -0,0 +1,5 @@
+Axiom x : True.
+Goal nat -> nat.
+ intro x.
+ abstract (exact x).
+Qed.
diff --git a/test-suite/success/name_mangling.v b/test-suite/success/name_mangling.v
index e982414206..e84d221d59 100644
--- a/test-suite/success/name_mangling.v
+++ b/test-suite/success/name_mangling.v
@@ -1,7 +1,6 @@
-(* -*- coq-prog-args: ("-mangle-names" "_") -*- *)
+Set Mangle Names.
(* Check that refine policy of redefining previous names make these names private *)
-(* abstract can change names in the environment! See bug #3146 *)
Goal True -> True.
intro.
@@ -58,7 +57,7 @@ Abort.
Goal False -> False.
intro H.
-Fail abstract exact H.
+abstract exact H.
Abort.
(* Variant *)
@@ -74,8 +73,7 @@ Goal False -> False.
intro H.
(* Name H' is from Ltac here, so it preserves the privacy *)
(* But abstract messes everything up *)
-Fail let H' := H in abstract exact H'.
-let H' := H in exact H'.
+let H' := H in abstract exact H'.
Qed.
(* Variant *)