test: variables of undefined packages #13465
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
At the moment we have two kinds of undefined package variable.
We raise the same error on both of these at the moment, but these two cases are actually distinct. The second should really be an error, but according to opam semantics the first should evaluate to the empty string, at least in string interpolation.
An example of where this comes up in the wild is here:
https://github.com/dra27/opam-repository/blob/b4c092154b06471b3ed5886716ff45e4e8f58c17/packages/ocaml/ocaml.5.5.0/opam#L38
The
%{dkml-base-compiler:version}%variable's package doesn't exist unless the correct opam repository is available. Therefore in most cases opam evaluates this to the empty string.This test demonstrates that we error on this behaviour and a future fix should make it evaluate to the empty string.
Part of the work on