From 4d08aed5c851a79dd8bdd916659474fe8ae02ad0 Mon Sep 17 00:00:00 2001 From: Charlie Marsh Date: Mon, 20 May 2024 20:28:38 -0400 Subject: [PATCH] Check expr2 --- crates/uv-resolver/src/marker.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/crates/uv-resolver/src/marker.rs b/crates/uv-resolver/src/marker.rs index e9c32c69bc83b..98854663d0051 100644 --- a/crates/uv-resolver/src/marker.rs +++ b/crates/uv-resolver/src/marker.rs @@ -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), } } @@ -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'" ));