aboutsummaryrefslogtreecommitdiffhomepage
path: root/engine/proofview.ml
diff options
context:
space:
mode:
authorGravatar Enrico Tassi <Enrico.Tassi@inria.fr>2018-01-25 16:21:56 +0100
committerGravatar Enrico Tassi <Enrico.Tassi@inria.fr>2018-01-31 14:09:08 +0100
commit1176d4086b65c79a1d30a55640d3d933fa24a7c1 (patch)
treec3976fa8b5046111fdd2e4348f308f381a7b4f4d /engine/proofview.ml
parent9aa2464375c1515aa64df7dc910e2f324e34c82f (diff)
Proofview: enter_one: add __LOC__ argument to get relevant error msg
The type discipline of the tactic monad does not distinguish between mono-goal and multi-goal tactics. Unfortunately enter_one "asserts false" if called on 0 or > 1 goals. The __LOC__:string argument can be used to make the error message more helpful (since the backtrace is pointless inside the monad). The intended usage is "Goal.enter_one ~__LOC__ (fun gl -> ..". The __LOC__ variable is filled in by the OCaml compiler with the current file name and line number.
Diffstat (limited to 'engine/proofview.ml')
-rw-r--r--engine/proofview.ml5
1 files changed, 3 insertions, 2 deletions
diff --git a/engine/proofview.ml b/engine/proofview.ml
index 0a6435195..47b9b406d 100644
--- a/engine/proofview.ml
+++ b/engine/proofview.ml
@@ -1086,7 +1086,7 @@ module Goal = struct
end
end
- let enter_one f =
+ let enter_one ?(__LOC__=__LOC__) f =
let open Proof in
Comb.get >>= function
| [goal] -> begin
@@ -1097,7 +1097,8 @@ module Goal = struct
let (e, info) = CErrors.push e in
tclZERO ~info e
end
- | _ -> assert false (* unsatisfied not-exactly-one-goal precondition *)
+ | _ ->
+ CErrors.anomaly Pp.(str __LOC__ ++ str " enter_one")
let goals =
Pv.get >>= fun step ->