From fa4970bf1b74f3fa0b2f63cbd461d98c251dc0f0 Mon Sep 17 00:00:00 2001 From: Sébastien Dailly Date: Fri, 20 Nov 2026 18:47:26 +0100 Subject: Updated the model for representing ocaml types in the application type --- lib/configuration/read_conf.ml | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'lib/configuration/read_conf.ml') 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 -- cgit v1.2.3