summaryrefslogtreecommitdiff
path: root/lib/configuration/read_conf.ml
diff options
context:
space:
mode:
authorSébastien Dailly <sebastien@dailly.me>2026-11-20 18:47:26 +0100
committerSébastien Dailly <sebastien@dailly.me>2026-11-20 18:47:26 +0100
commitfa4970bf1b74f3fa0b2f63cbd461d98c251dc0f0 (patch)
tree577a41415e67510f08f43fc48c794c36a10f6e80 /lib/configuration/read_conf.ml
parentb05e2d2be7be28ee6c577671002797cf9abaf177 (diff)
Updated the model for representing ocaml types in the application type
Diffstat (limited to 'lib/configuration/read_conf.ml')
-rw-r--r--lib/configuration/read_conf.ml24
1 files changed, 16 insertions, 8 deletions
diff --git a/lib/configuration/read_conf.ml b/lib/configuration/read_conf.ml
index 67703da..4c57699 100644
--- a/lib/configuration/read_conf.ml
+++ b/lib/configuration/read_conf.ml
@@ -41,17 +41,16 @@ module Make (S : Decoders.Decode.S) = struct
the error messages). *)
(** Build the reference target for a field. Lists are decoded before the
- contents and registered as soon as they are decoded, so a declared list
- is matched eagerly; a content target is a lazy thunk closing over the
- setting, only forced by [Ast.check] once every content has been
- registered — this is what allows forward and cyclic references between
- contents. The raw value is kept to report broken links.
- *)
+ contents and registered as soon as they are decoded, so a declared list is
+ matched eagerly; a content target is a lazy thunk closing over the
+ setting, only forced by [Ast.check] once every content has been registered
+ — this is what allows forward and cyclic references between contents. The
+ raw value is kept to report broken links. *)
let link (env : env) (value : S.value) (name : Model.Identifier.t) :
Model.target S.decoder =
match Ast.get_list env.settings name with
| Some list -> S.succeed (Model.Reference.List list)
- | None -> (
+ | None ->
if env.allow_content then
S.succeed
(Model.Reference.Content
@@ -63,7 +62,7 @@ module Make (S : Decoders.Decode.S) = struct
else
S.fail_with
(Decoders.Error.make ~context:value
- "References in a list can only target a list declared before it"))
+ "References in a list can only target a list declared before it")
let field_type (env : env) : Model.field_ex S.decoder =
let text_type : Model.field_ex S.decoder =
@@ -187,6 +186,15 @@ module Make (S : Decoders.Decode.S) = struct
("Dependency circle found between:" :: content_name)
in
S.fail_with (Decoders.Error.make message)
+ | Error (Ast.ConflictingFields (owner, name)) ->
+ let message =
+ "Two fields named \""
+ ^ Model.Identifier.to_string name
+ ^ "\" with different types in \""
+ ^ Model.Identifier.to_string owner
+ ^ "\""
+ in
+ S.fail_with (Decoders.Error.make message)
| Error other -> raise other
end