Skip to content

Commit

Permalink
Check expr2
Browse files Browse the repository at this point in the history
  • Loading branch information
charliermarsh committed May 21, 2024
1 parent 94946d2 commit 4d08aed
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions crates/uv-resolver/src/marker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@ pub(crate) fn is_disjoint(first: &MarkerTree, second: &MarkerTree) -> bool {
}
};

match expr1 {
MarkerExpression::Version { .. } | MarkerExpression::VersionInverted { .. } => {
match (expr1, expr2) {
// `Arbitrary` expressions always evaluate to `false`, and are thus always disjoint.
(MarkerExpression::Arbitrary { .. }, _) | (_, MarkerExpression::Arbitrary { .. }) => true,
(MarkerExpression::Version { .. } | MarkerExpression::VersionInverted { .. }, expr2) => {
version_is_disjoint(expr1, expr2)
}
MarkerExpression::String { .. } | MarkerExpression::StringInverted { .. } => {
(MarkerExpression::String { .. } | MarkerExpression::StringInverted { .. }, expr2) => {
string_is_disjoint(expr1, expr2)
}
MarkerExpression::Extra { operator, name } => extra_is_disjoint(operator, name, expr2),
// `Arbitrary` expressions always evaluate to `false`, and are thus always disjoint.
MarkerExpression::Arbitrary { .. } => true,
(MarkerExpression::Extra { operator, name }, expr2) => extra_is_disjoint(operator, name, expr2),
}
}

Expand Down Expand Up @@ -241,8 +241,8 @@ mod tests {
}

#[test]
fn invalid() {
assert!(!is_disjoint(
fn arbitrary() {
assert!(is_disjoint(
"python_version == 'Linux'",
"python_version == '3.7.1'"
));
Expand Down

0 comments on commit 4d08aed

Please sign in to comment.