Nametab.Easy
Generate a nametab with simple warning support (UserWarn.create_depr_and_user_warnings_qf
).
NAMETAB extended with warnings associated to some of the elements.
module M : sig ... end
include NAMETAB with type elt = M.t
type elt = M.t
The type of the elements of the name table (eg ModPath.t)
val remove : Libnames.full_path -> elt -> unit
Remove an element.
val shortest_qualid_gen : ?loc:Loc.t -> (Names.Id.t -> bool) -> elt -> Libnames.qualid
shortest_qualid_gen avoid v
: given an object v
with full name Mylib.A.B.x, try to find the shortest among x, B.x, A.B.x and Mylib.A.B.x that denotes the same object. If avoid
is true
on x
it is assumed to denote something else (so B.x is the shortest qualid that could be returned).
val shortest_qualid : ?loc:Loc.t -> Names.Id.Set.t -> elt -> Libnames.qualid
Like shortest_qualid_gen
but using an id set instead of a closure.
val locate_all : Libnames.qualid -> elt list
Locate all elements with a given suffix. If the qualid is a valid absolute name, that element is first in the list.
val completion_candidates : Libnames.qualid -> elt list
Return the elements that have the qualid as a prefix. UIs will usually compose with shortest_qualid
. Experimental APIs, please tell us if you use it.
val to_path : elt -> Libnames.full_path
Return the absolute name for the given element.
val of_path : Libnames.full_path -> elt
Return an element bound to an absolute path.
val exists : Libnames.full_path -> bool
Returns whether this absolute path is taken.
val push : ?wdata:M.t UserWarn.with_qf -> visibility -> Libnames.full_path -> elt -> unit
When visibility
is Until
, wdata
may be Some _
in which case the warning data is associated to the element.
val is_warned : elt -> M.t UserWarn.with_qf option
Return the warning data associated to the element.
val warn : ?loc:Loc.t -> elt -> M.t UserWarn.with_qf -> unit
Emit the given warning data for the given element (if the warning is not disabled).
val locate : ?nowarn:bool -> Libnames.qualid -> elt
Unless nowarn:false
is given, if the found element is associated to a warning, that warning is emitted.