aboutsummaryrefslogtreecommitdiff
path: root/pretyping
diff options
context:
space:
mode:
authorGaëtan Gilbert2018-10-26 16:55:54 +0200
committerGaëtan Gilbert2019-03-30 21:36:54 +0100
commit3fdb62dee9830bb551798ee9c3dd2a3af1493e8d (patch)
treea8e308f8e3caa4f2ef6e57d0391d550a83585c0d /pretyping
parent52feb4769d59f0cb843b32d606357194e60d4fc4 (diff)
Error when [foo.(bar)] is used with nonprojection [bar]
(warn if bar is a nonprimitive projection)
Diffstat (limited to 'pretyping')
-rw-r--r--pretyping/recordops.ml2
-rw-r--r--pretyping/recordops.mli2
2 files changed, 4 insertions, 0 deletions
diff --git a/pretyping/recordops.ml b/pretyping/recordops.ml
index 6d9e3230a4..fc355c2c79 100644
--- a/pretyping/recordops.ml
+++ b/pretyping/recordops.ml
@@ -103,6 +103,8 @@ let find_projection = function
| ConstRef cst -> Cmap.find cst !projection_table
| _ -> raise Not_found
+let is_projection cst = Cmap.mem cst !projection_table
+
let prim_table =
Summary.ref (Cmap_env.empty : Projection.Repr.t Cmap_env.t) ~name:"record-prim-projs"
diff --git a/pretyping/recordops.mli b/pretyping/recordops.mli
index 3e43372b65..76d36c9b62 100644
--- a/pretyping/recordops.mli
+++ b/pretyping/recordops.mli
@@ -44,6 +44,8 @@ val find_projection_nparams : GlobRef.t -> int
(** raise [Not_found] if not a projection *)
val find_projection : GlobRef.t -> struc_typ
+val is_projection : Constant.t -> bool
+
(** Sets up the mapping from constants to primitive projections *)
val declare_primitive_projection : Projection.Repr.t -> Constant.t -> unit