aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Herbelin2016-06-05 20:41:54 +0200
committerHugo Herbelin2016-06-06 12:26:54 +0200
commit9e9c7ce7ab325a194654c3cbc1e1bf4e276ba5b7 (patch)
tree2fa1e6176d8546906eca844fd58b6170ff5aef45
parente6b0ab5079186b7dba643a04e6222a4260de96ff (diff)
Fixing problems introduced in 8.5 with Ltac trace report. E.g.
Tactic Notation "f" constr(x) := apply x. Ltac g x := f x. Goal False. g I. (* Was printing Top.Top#<>#1 *) idtac; f I. (* Was not properly locating error *) This is a "a minima" fix. This a different fix than in trunk, so the merge will have to take the trunk version.
-rw-r--r--printing/pptactic.ml10
-rw-r--r--printing/pptacticsig.mli2
-rw-r--r--toplevel/himsg.ml10
3 files changed, 17 insertions, 5 deletions
diff --git a/printing/pptactic.ml b/printing/pptactic.ml
index 7e903d2d3d..08f037ca66 100644
--- a/printing/pptactic.ml
+++ b/printing/pptactic.ml
@@ -428,6 +428,16 @@ module Make
in
str "<" ++ name ++ str ">" ++ args
+ let pr_alias_key key =
+ try
+ let _,prods = (KNmap.find key !prnotation_tab).pptac_prods in
+ (* First printing strategy: only the head symbol *)
+ match prods with
+ | Some s :: _ -> str s
+ | _ -> raise Exit
+ with Not_found | Exit ->
+ KerName.print key
+
let pr_alias_gen pr_gen lev key l =
try
let pp = KNmap.find key !prnotation_tab in
diff --git a/printing/pptacticsig.mli b/printing/pptacticsig.mli
index b2323acba1..ecedc7756e 100644
--- a/printing/pptacticsig.mli
+++ b/printing/pptacticsig.mli
@@ -73,6 +73,8 @@ module type Pp = sig
(constr_pattern -> std_ppcmds) -> int ->
ml_tactic_name -> typed_generic_argument list -> std_ppcmds
+ val pr_alias_key : Names.KerName.t -> std_ppcmds
+
val pr_ltac_constant : Nametab.ltac_constant -> std_ppcmds
val pr_raw_tactic : raw_tactic_expr -> std_ppcmds
diff --git a/toplevel/himsg.ml b/toplevel/himsg.ml
index c0a99fe75c..3ff2d3fb18 100644
--- a/toplevel/himsg.ml
+++ b/toplevel/himsg.ml
@@ -1243,10 +1243,9 @@ let explain_reduction_tactic_error = function
let is_defined_ltac trace =
let rec aux = function
- | (_, Proof_type.LtacNameCall f) :: tail ->
- not (Tacenv.is_ltac_for_ml_tactic f)
- | (_, Proof_type.LtacAtomCall _) :: tail ->
- false
+ | (_, Proof_type.LtacNameCall f) :: tail -> not (Tacenv.is_ltac_for_ml_tactic f)
+ | (_, Proof_type.LtacNotationCall f) :: _ -> true
+ | (_, Proof_type.LtacAtomCall _) :: tail -> false
| _ :: tail -> aux tail
| [] -> false in
aux (List.rev trace)
@@ -1254,7 +1253,7 @@ let is_defined_ltac trace =
let explain_ltac_call_trace last trace loc =
let calls = last :: List.rev_map snd trace in
let pr_call ck = match ck with
- | Proof_type.LtacNotationCall kn -> quote (KerName.print kn)
+ | Proof_type.LtacNotationCall kn -> quote (Pptactic.pr_alias_key kn)
| Proof_type.LtacNameCall cst -> quote (Pptactic.pr_ltac_constant cst)
| Proof_type.LtacMLCall t ->
quote (Pptactic.pr_glob_tactic (Global.env()) t)
@@ -1276,6 +1275,7 @@ let explain_ltac_call_trace last trace loc =
in
match calls with
| [] -> mt ()
+ | [a] -> hov 0 (str "Ltac call to " ++ pr_call a ++ str " failed.")
| _ ->
let kind_of_last_call = match List.last calls with
| Proof_type.LtacConstrInterp _ -> ", last term evaluation failed."