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

Don't warn on undefined opam variables when solving #8275

Merged
merged 2 commits into from Jul 26, 2023

Conversation

gridbugs
Copy link
Collaborator

Undefined variables don't indicate a problem and packages expect comparisons with undefined variables to resolve to false.

Undefined variables don't indicate a problem and packages expect
comparisons with undefined variables to resolve to false.

Signed-off-by: Stephen Sherratt <stephen@sherra.tt>
Signed-off-by: Stephen Sherratt <stephen@sherra.tt>
try Ok (OpamFilter.eval_to_bool (Fun.const None) filter)
with Invalid_argument msg -> Error (`Not_a_bool msg)))
try Ok (OpamFilter.eval_to_bool ~default:false (Fun.const None) filter)
with Invalid_argument msg -> Error (`Not_a_bool msg)
Copy link
Member

Choose a reason for hiding this comment

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

Just a note: it's pretty undesirable to have to rely on catching this exception. It can be thrown by just about any function in the Stdlib so it's not reliable to use it a signal for anything in particular.

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 agree. This is a limitation of the opam api. We can obviously change the api of our vendored copy of opam but I try to keep such changes to a minimum to simplify the eventual backporting effort.

@rgrinberg rgrinberg merged commit d5c81fc into ocaml:main Jul 26, 2023
22 checks passed
pmwhite pushed a commit to pmwhite/dune that referenced this pull request Aug 10, 2023
Undefined variables don't indicate a problem and packages expect
comparisons with undefined variables to resolve to false.

Signed-off-by: Stephen Sherratt <stephen@sherra.tt>
@gridbugs gridbugs deleted the dont-warn-on-unset-variables branch October 11, 2023 03:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants