tstellar / rpms / ocaml

Forked from rpms/ocaml 3 years ago
Clone
Blob Blame History Raw
From 1204abd71a4ef585dbb70ba68a5879856d24c1a9 Mon Sep 17 00:00:00 2001
From: Gabriel Scherer <gabriel.scherer@gmail.com>
Date: Fri, 20 Sep 2019 10:58:09 +0200
Subject: [PATCH 03/13] Merge pull request #8954 from
 Armael/fix-toplevel-submsg-locs

Fix error submessages in the toplevel: do not display dummy locations

(cherry picked from commit 8f7708a0fbc3e1199ccf04a6b9e1ba8e0f0d5254)
---
 Changes             | 4 ++++
 parsing/location.ml | 3 ++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/Changes b/Changes
index e95ae5e49..355cb1a94 100644
--- a/Changes
+++ b/Changes
@@ -1,6 +1,10 @@
 OCaml 4.09 maintenance branch:
 ------------------------------
 
+- #8953, #8954: Fix error submessages in the toplevel: do not display
+  dummy locations
+  (Armaël Guéneau, review by Gabriel Scherer)
+
 OCaml 4.09.0 (19 September 2019):
 ---------------------------------
 
diff --git a/parsing/location.ml b/parsing/location.ml
index 25cba42c7..ab823d36f 100644
--- a/parsing/location.ml
+++ b/parsing/location.ml
@@ -752,7 +752,8 @@ let terminfo_toplevel_printer (lb: lexbuf): report_printer =
   in
   let pp_main_loc _ _ _ _ = () in
   let pp_submsg_loc _ _ ppf loc =
-    Format.fprintf ppf "%a:@ " print_loc loc in
+    if not loc.loc_ghost then
+      Format.fprintf ppf "%a:@ " print_loc loc in
   { batch_mode_printer with pp; pp_main_loc; pp_submsg_loc }
 
 let best_toplevel_printer () =
-- 
2.23.0