Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ocaml] Fix compilation with 4.09.0 #2342

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/watermarks.ml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ let make_watermark_map ~name ~version ~commit =
match Opam_file.get_field opam_file name with
| None -> Error (sprintf "variable %S not found in opam file" name)
| Some value ->
let err = Error (sprintf "invalid value for variable %S in opam file" name) in
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about let err () = ...? That would avoid the duplication

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can do that, but likely we should drop this PR and see if this is fixed upstream.

PR for trunk testing coming soon.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, waiting a little bit to see how it plays out upstream seems good

match value with
| String (_, s) -> Ok s
| List (_, l) -> begin
Expand All @@ -39,12 +38,14 @@ let make_watermark_map ~name ~version ~commit =
| Ok l ->
match v with
| OpamParserTypes.String (_, s) -> Ok (s :: l)
| _ -> err)
| _ ->
Error (sprintf "invalid value for variable %S in opam file" name))
with
| Error _ as e -> e
| Ok l -> Ok (String.concat ~sep (List.rev l))
end
| _ -> err
| _ ->
Error (sprintf "invalid value for variable %S in opam file" name)
in
String.Map.of_list_exn
[ "NAME" , Ok name
Expand Down