aboutsummaryrefslogtreecommitdiff
path: root/library/declare.ml
diff options
context:
space:
mode:
authorEmilio Jesus Gallego Arias2017-01-18 15:46:23 +0100
committerEmilio Jesus Gallego Arias2017-04-25 00:28:53 +0200
commite8a6467545c2814c9418889201e8be19c0cef201 (patch)
tree7f513d854b76b02f52f98ee0e87052c376175a0f /library/declare.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 'library/declare.ml')
-rw-r--r--library/declare.ml8
1 files changed, 4 insertions, 4 deletions
diff --git a/library/declare.ml b/library/declare.ml
index 6b505ac09c..3adb957faa 100644
--- a/library/declare.ml
+++ b/library/declare.ml
@@ -522,7 +522,7 @@ let do_constraint poly l =
let names, _ = Global.global_universe_names () in
try loc, Idmap.find id names
with Not_found ->
- user_err ~loc ~hdr:"Constraint" (str "Undeclared universe " ++ pr_id id)
+ user_err ?loc ~hdr:"Constraint" (str "Undeclared universe " ++ pr_id id)
in
let in_section = Lib.sections_are_opened () in
let () =
@@ -530,18 +530,18 @@ let do_constraint poly l =
user_err ~hdr:"Constraint"
(str"Cannot declare polymorphic constraints outside sections")
in
- let check_poly loc p loc' p' =
+ let check_poly ?loc p loc' p' =
if poly then ()
else if p || p' then
let loc = if p then loc else loc' in
- user_err ~loc ~hdr:"Constraint"
+ user_err ?loc ~hdr:"Constraint"
(str "Cannot declare a global constraint on " ++
str "a polymorphic universe, use "
++ str "Polymorphic Constraint instead")
in
let constraints = List.fold_left (fun acc (l, d, r) ->
let ploc, (p, lu) = u_of_id l and rloc, (p', ru) = u_of_id r in
- check_poly ploc p rloc p';
+ check_poly ?loc:ploc p rloc p';
Univ.Constraint.add (lu, d, ru) acc)
Univ.Constraint.empty l
in