diff --git a/crates/pep508-rs/src/marker.rs b/crates/pep508-rs/src/marker.rs index 232cdd79429d..99716f3ae0bb 100644 --- a/crates/pep508-rs/src/marker.rs +++ b/crates/pep508-rs/src/marker.rs @@ -1345,7 +1345,7 @@ impl MarkerExpression { operator: ExtraOperator::NotEqual, name, } => !extras.contains(name), - MarkerExpression::Arbitrary { .. } => true, + MarkerExpression::Arbitrary { .. } => false, } } diff --git a/crates/uv-resolver/src/marker.rs b/crates/uv-resolver/src/marker.rs index 58cade99d024..27c1fa74b013 100644 --- a/crates/uv-resolver/src/marker.rs +++ b/crates/uv-resolver/src/marker.rs @@ -27,15 +27,18 @@ 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), - MarkerExpression::Arbitrary { .. } => false, + (MarkerExpression::Extra { operator, name }, expr2) => { + extra_is_disjoint(operator, name, expr2) + } } } @@ -240,8 +243,8 @@ mod tests { } #[test] - fn invalid() { - assert!(!is_disjoint( + fn arbitrary() { + assert!(is_disjoint( "python_version == 'Linux'", "python_version == '3.7.1'" ));