aboutsummaryrefslogtreecommitdiff
path: root/vernac/egramcoq.ml
diff options
context:
space:
mode:
authorPierre-Marie Pédrot2019-12-19 18:03:34 +0100
committerPierre-Marie Pédrot2019-12-22 14:04:01 +0100
commitfcd903c299db00d5c8d3e2fa797404eb880b61ac (patch)
treed1d339cb530d2f8e0c4afd11f49fb810383eb5ec /vernac/egramcoq.ml
parent9c75b6a6582620e2fb9a39c1ea1aa46a321af6a7 (diff)
Ensure that a custom entry cannot be defined twice.
This highlights the fact that diamond inheritance of a custom entry is a tricky problem, as well as merely importing two custom entries with the same name from two different modules. The only sane way to give a semantics to that is to stick to module-scoped objects, i.e. give those entries a kernel name. In the meantime, I went for a warning when overriding entries.
Diffstat (limited to 'vernac/egramcoq.ml')
-rw-r--r--vernac/egramcoq.ml4
1 files changed, 4 insertions, 0 deletions
diff --git a/vernac/egramcoq.ml b/vernac/egramcoq.ml
index b65a126f55..07656f9715 100644
--- a/vernac/egramcoq.ml
+++ b/vernac/egramcoq.ml
@@ -278,6 +278,10 @@ let find_custom_entry s =
try (find_custom_entry constr_custom_entry sc, find_custom_entry pattern_custom_entry sp)
with Not_found -> user_err Pp.(str "Undeclared custom entry: " ++ str s ++ str ".")
+let exists_custom_entry s = match find_custom_entry s with
+| _ -> true
+| exception _ -> false
+
let locality_of_custom_entry s = String.Set.mem s !custom_entry_locality
(* This computes the name of the level where to add a new rule *)