aboutsummaryrefslogtreecommitdiffhomepage
path: root/vernac/classes.ml
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 /vernac/classes.ml
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 'vernac/classes.ml')
-rw-r--r--vernac/classes.ml9
1 files changed, 4 insertions, 5 deletions
diff --git a/vernac/classes.ml b/vernac/classes.ml
index e074e44a4..76d427add 100644
--- a/vernac/classes.ml
+++ b/vernac/classes.ml
@@ -72,7 +72,7 @@ let existing_instance glob g info =
let _, r = Term.decompose_prod_assum instance in
match class_of_constr Evd.empty (EConstr.of_constr r) with
| Some (_, ((tc,u), _)) -> add_instance (new_instance tc info glob c)
- | None -> user_err ?loc:(loc_of_reference g)
+ | None -> user_err ?loc:g.CAst.loc
~hdr:"declare_instance"
(Pp.str "Constant does not build instances of a declared type class.")
@@ -227,10 +227,9 @@ let new_instance ?(abstract=false) ?(global=false) ?(refine= !refine_instance)
let sigma, c = interp_casted_constr_evars env' sigma term cty in
Some (Inr (c, subst)), sigma
| Some (Inl props) ->
- let get_id =
- function
- | Ident (loc, id') -> CAst.(make ?loc @@ id')
- | Qualid (loc,id') -> CAst.(make ?loc @@ snd (repr_qualid id'))
+ let get_id = CAst.map (function
+ | Ident id' -> id'
+ | Qualid id' -> snd (repr_qualid id'))
in
let props, rest =
List.fold_left