aboutsummaryrefslogtreecommitdiffhomepage
path: root/pretyping
diff options
context:
space:
mode:
authorGravatar Emilio Jesus Gallego Arias <e+git@x80.org>2018-02-25 22:43:42 +0100
committerGravatar Emilio Jesus Gallego Arias <e+git@x80.org>2018-03-09 23:28:09 +0100
commitb1d749e59444f86e40f897c41739168bb1b1b9b3 (patch)
treeade1ab73a9c2066302145bb3781a39b5d46b4513 /pretyping
parent4af41a12a0e7e6b17d25a71568641bd03d5e1f94 (diff)
[located] Push inner locations in `reference` to a CAst.t node.
The `reference` type contains some ad-hoc locations in its constructors, but there is no reason not to handle them with the standard attribute container provided by `CAst.t`. An orthogonal topic to this commit is whether the `reference` type should contain a location or not at all. It seems that many places would become a bit clearer by splitting `reference` into non-located `reference` and `lreference`, however some other places become messier so we maintain the current status-quo for now.
Diffstat (limited to 'pretyping')
-rw-r--r--pretyping/detyping.ml8
-rw-r--r--pretyping/pretyping.ml12
2 files changed, 10 insertions, 10 deletions
diff --git a/pretyping/detyping.ml b/pretyping/detyping.ml
index 8fab92779..587892141 100644
--- a/pretyping/detyping.ml
+++ b/pretyping/detyping.ml
@@ -71,17 +71,17 @@ let has_two_constructors lc =
let isomorphic_to_tuple lc = Int.equal (Array.length lc) 1
-let encode_bool r =
+let encode_bool ({CAst.loc} as r) =
let (x,lc) = encode_inductive r in
if not (has_two_constructors lc) then
- user_err ?loc:(loc_of_reference r) ~hdr:"encode_if"
+ user_err ?loc ~hdr:"encode_if"
(str "This type has not exactly two constructors.");
x
-let encode_tuple r =
+let encode_tuple ({CAst.loc} as r) =
let (x,lc) = encode_inductive r in
if not (isomorphic_to_tuple lc) then
- user_err ?loc:(loc_of_reference r) ~hdr:"encode_tuple"
+ user_err ?loc ~hdr:"encode_tuple"
(str "This type cannot be seen as a tuple type.");
x
diff --git a/pretyping/pretyping.ml b/pretyping/pretyping.ml
index 4bcb7e459..4962b89a0 100644
--- a/pretyping/pretyping.ml
+++ b/pretyping/pretyping.ml
@@ -180,20 +180,20 @@ let _ =
(** Miscellaneous interpretation functions *)
let interp_known_universe_level evd r =
- let loc, qid = Libnames.qualid_of_reference r in
+ let qid = Libnames.qualid_of_reference r in
try
- match r with
- | Libnames.Ident (loc, id) -> Evd.universe_of_name evd id
+ match r.CAst.v with
+ | Libnames.Ident id -> Evd.universe_of_name evd id
| Libnames.Qualid _ -> raise Not_found
with Not_found ->
- let univ, k = Nametab.locate_universe qid in
+ let univ, k = Nametab.locate_universe qid.CAst.v in
Univ.Level.make univ k
let interp_universe_level_name ~anon_rigidity evd r =
try evd, interp_known_universe_level evd r
with Not_found ->
match r with (* Qualified generated name *)
- | Libnames.Qualid (loc, qid) ->
+ | {CAst.loc; v=Libnames.Qualid qid} ->
let dp, i = Libnames.repr_qualid qid in
let num =
try int_of_string (Id.to_string i)
@@ -206,7 +206,7 @@ let interp_universe_level_name ~anon_rigidity evd r =
try Evd.add_global_univ evd level
with UGraph.AlreadyDeclared -> evd
in evd, level
- | Libnames.Ident (loc, id) -> (* Undeclared *)
+ | {CAst.loc; v=Libnames.Ident id} -> (* Undeclared *)
if not (is_strict_universe_declarations ()) then
new_univ_level_variable ?loc ~name:id univ_rigid evd
else user_err ?loc ~hdr:"interp_universe_level_name"