aboutsummaryrefslogtreecommitdiff
path: root/src/Util/Tactics/ConstrFail.v
diff options
context:
space:
mode:
authorGravatar Jason Gross <jgross@mit.edu>2019-03-14 16:14:45 -0400
committerGravatar Jason Gross <jasongross9@gmail.com>2019-03-31 09:31:15 -0400
commita8b4394093e61b050406ca952a6d017ad1c737e4 (patch)
treee75e2c0d33fd5a7fc4c46c3460b04530c30aa260 /src/Util/Tactics/ConstrFail.v
parentb18cfd89e1e8760185d9f50dd777c1c8096cf807 (diff)
Add constr_fail and constr_fail_with
Rather than taking the convention that failures during constr construction emit a type error from `I : I` with the actual error message `idtac`d above them (because Coq has no way to emit multiple things on stderr), we instead factor everything through a new `constr_fail` or `constr_fail_with msg_tac`, which emit more helpful messages instructing the user to look in `*coq*` or to use `Fail`/`try` to see the more informative error message. When we can make our own version that does both `idtac` and `fail` (c.f. https://github.com/coq/coq/issues/3913), then we can do something a bit more sane, hopefully.
Diffstat (limited to 'src/Util/Tactics/ConstrFail.v')
-rw-r--r--src/Util/Tactics/ConstrFail.v9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/Util/Tactics/ConstrFail.v b/src/Util/Tactics/ConstrFail.v
new file mode 100644
index 000000000..fe8a05630
--- /dev/null
+++ b/src/Util/Tactics/ConstrFail.v
@@ -0,0 +1,9 @@
+(** A tactic that executes immediately (during expression evaluation / constr-construction) and fails. Ideally we can eventually give it a nicer error message. COQBUG(3913) *)
+
+Ltac constr_fail :=
+ let __ := match goal with _ => fail 1 "Constr construction failed. Please look at the message log (*coq*, or run your tactic again inside Fail or try) to see more details" end in
+ ().
+
+Ltac constr_fail_with msg_tac :=
+ let __ := match goal with _ => msg_tac () end in
+ constr_fail.