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.
This does pretty much what you might expect: it takes an existing
MarkerTree
and returns a new one that evaluates to the opposite of themarker given for all possible marker environments. For the most part.
There are two main hitches here.
The first is that some
MarkerTree
values are nonsense. For example,"foo" == "bar"
andsys_platform ~= "linux"
. Both such expressionsalways return false today. Technically, a logical negation would imply
that they would always return true in the result. But this would imply
that negation turns nonsense into sense. We shouldn't do that. So the
negation of nonsense remains nonsense.
The second is that negating compatible version constraints like
python_version ~= "3.6"
cannot be done in a single marker expression.Instead, the negation is itself a disjunction of negations. In this
case,
python_version < 3.6 or python_version != 3.6.*
.I've added some basic tests to cover this new operation.
The main motivation for adding a negation operation is in service of
fixing bugs #4732, #4687, #4640 and #4992.