aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Pierre-Marie Pédrot <pierre-marie.pedrot@inria.fr>2018-03-29 14:39:11 +0200
committerGravatar Pierre-Marie Pédrot <pierre-marie.pedrot@inria.fr>2018-03-29 14:46:02 +0200
commit820442433915e4176861e558b95413e4b832b3fa (patch)
treef3120908679ef2231f1b0e200887bd890afbd738
parentc0eedb5bdcb815132f404e19d6bf59730ae6e2df (diff)
Fix #6631: Derive Plugin gives "Anomaly: more than one statement".
We use a lower level function that accesses the proof without raising an anomaly. This is a direct candidate for backport, so I used a V82 API but eventually this API should be cleaned up.
-rw-r--r--tactics/tactics.ml16
-rw-r--r--test-suite/bugs/closed/6631.v7
2 files changed, 15 insertions, 8 deletions
diff --git a/tactics/tactics.ml b/tactics/tactics.ml
index 834d73bdd..0d9f3d821 100644
--- a/tactics/tactics.ml
+++ b/tactics/tactics.ml
@@ -4987,15 +4987,15 @@ let anon_id = Id.of_string "anonymous"
let name_op_to_name name_op object_kind suffix =
let open Proof_global in
let default_gk = (Global, false, object_kind) in
+ let name, gk = match Proof_global.V82.get_current_initial_conclusions () with
+ | (id, (_, gk)) -> Some id, gk
+ | exception NoCurrentProof -> None, default_gk
+ in
match name_op with
- | Some s ->
- (try let _, gk, _ = Pfedit.current_proof_statement () in s, gk
- with NoCurrentProof -> s, default_gk)
- | None ->
- let name, gk =
- try let name, gk, _ = Pfedit.current_proof_statement () in name, gk
- with NoCurrentProof -> anon_id, default_gk in
- add_suffix name suffix, gk
+ | Some s -> s, gk
+ | None ->
+ let name = Option.default anon_id name in
+ add_suffix name suffix, gk
let tclABSTRACT ?(opaque=true) name_op tac =
let s, gk = if opaque
diff --git a/test-suite/bugs/closed/6631.v b/test-suite/bugs/closed/6631.v
new file mode 100644
index 000000000..100dc13fc
--- /dev/null
+++ b/test-suite/bugs/closed/6631.v
@@ -0,0 +1,7 @@
+Require Import Coq.derive.Derive.
+
+Derive f SuchThat (f = 1 + 1) As feq.
+Proof.
+ transitivity 2; [refine (eq_refl 2)|].
+ transitivity 2.
+ 2:abstract exact (eq_refl 2).