From 7ee82cd2dfd8cb226c35c3094423e56c75010377 Mon Sep 17 00:00:00 2001 From: Hugo Herbelin Date: Sat, 18 Jun 2016 11:23:12 +0200 Subject: Backporting c064fb933 from 8.5 (another regression with Ltac trace report). Doing it explicitly because it is in another file. --- ltac/tactic_debug.ml | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/ltac/tactic_debug.ml b/ltac/tactic_debug.ml index e657eb9bc2..73d04b810d 100644 --- a/ltac/tactic_debug.ml +++ b/ltac/tactic_debug.ml @@ -395,14 +395,19 @@ let extract_ltac_trace trace eloc = else (* We entered a primitive tactic, we don't display trace but report on the finest location *) + let finer_loc loc1 loc2 = Loc.merge loc1 loc2 = loc2 in let best_loc = - if not (Loc.is_ghost eloc) then eloc else - (* trace is with innermost call coming first *) - let rec aux = function - | (loc,_)::tail when not (Loc.is_ghost loc) -> loc - | _::tail -> aux tail - | [] -> Loc.ghost in - aux trace in + (* trace is with innermost call coming first *) + let rec aux best_loc = function + | (loc,_)::tail -> + if Loc.is_ghost best_loc || + not (Loc.is_ghost loc) && finer_loc loc best_loc + then + aux loc tail + else + aux best_loc tail + | [] -> best_loc in + aux eloc trace in None, best_loc let get_ltac_trace (_, info) = -- cgit v1.2.3