aboutsummaryrefslogtreecommitdiffhomepage
path: root/printing/prettyp.ml
diff options
context:
space:
mode:
authorGravatar Emilio Jesus Gallego Arias <e+git@x80.org>2017-01-18 15:46:23 +0100
committerGravatar Emilio Jesus Gallego Arias <e+git@x80.org>2017-04-25 00:28:53 +0200
commite8a6467545c2814c9418889201e8be19c0cef201 (patch)
tree7f513d854b76b02f52f98ee0e87052c376175a0f /printing/prettyp.ml
parent30d3515546cf244837c6340b6b87c5f51e68cbf4 (diff)
[location] Make location optional in Loc.located
This completes the Loc.ghost removal, the idea is to gear the API towards optional, but uniform, location handling. We don't print <unknown> anymore in the case there is no location. This is what the test suite expects. The old printing logic for located items was a bit inconsistent as it sometimes printed <unknown> and other times it printed nothing as the caller checked for `is_ghost` upstream.
Diffstat (limited to 'printing/prettyp.ml')
-rw-r--r--printing/prettyp.ml16
1 files changed, 8 insertions, 8 deletions
diff --git a/printing/prettyp.ml b/printing/prettyp.ml
index 025514902..eb1124e73 100644
--- a/printing/prettyp.ml
+++ b/printing/prettyp.ml
@@ -711,7 +711,7 @@ let read_sec_context r =
let dir =
try Nametab.locate_section qid
with Not_found ->
- user_err ~loc ~hdr:"read_sec_context" (str "Unknown section.") in
+ user_err ?loc ~hdr:"read_sec_context" (str "Unknown section.") in
let rec get_cxt in_cxt = function
| (_,Lib.OpenedSection ((dir',_),_) as hd)::rest ->
if DirPath.equal dir dir' then (hd::in_cxt) else get_cxt (hd::in_cxt) rest
@@ -752,7 +752,7 @@ let print_any_name = function
let print_name = function
| ByNotation (loc,(ntn,sc)) ->
print_any_name
- (Term (Notation.interp_notation_as_global_reference ~loc (fun _ -> true)
+ (Term (Notation.interp_notation_as_global_reference ?loc (fun _ -> true)
ntn sc))
| AN ref ->
print_any_name (locate_any_name ref)
@@ -776,11 +776,11 @@ let print_opaque_name qid =
| VarRef id ->
env |> lookup_named id |> NamedDecl.set_id id |> print_named_decl
-let print_about_any loc k =
+let print_about_any ?loc k =
match k with
| Term ref ->
let rb = Reductionops.ReductionBehaviour.print ref in
- Dumpglob.add_glob loc ref;
+ Dumpglob.add_glob ?loc ref;
pr_infos_list
(print_ref false ref :: blankline ::
print_name_infos ref @
@@ -789,7 +789,7 @@ let print_about_any loc k =
[hov 0 (str "Expands to: " ++ pr_located_qualid k)])
| Syntactic kn ->
let () = match Syntax_def.search_syntactic_definition kn with
- | [],Notation_term.NRef ref -> Dumpglob.add_glob loc ref
+ | [],Notation_term.NRef ref -> Dumpglob.add_glob ?loc ref
| _ -> () in
v 0 (
print_syntactic_def kn ++ fnl () ++
@@ -799,11 +799,11 @@ let print_about_any loc k =
let print_about = function
| ByNotation (loc,(ntn,sc)) ->
- print_about_any loc
- (Term (Notation.interp_notation_as_global_reference ~loc (fun _ -> true)
+ print_about_any ?loc
+ (Term (Notation.interp_notation_as_global_reference ?loc (fun _ -> true)
ntn sc))
| AN ref ->
- print_about_any (loc_of_reference ref) (locate_any_name ref)
+ print_about_any ?loc:(loc_of_reference ref) (locate_any_name ref)
(* for debug *)
let inspect depth =