Rename from `Lowered` to `Canonical` (#9447)

By request:
https://github.com/astral-sh/uv/pull/9341#pullrequestreview-2460979421.
This commit is contained in:
Charlie Marsh 2024-11-26 13:34:43 -05:00 committed by GitHub
parent 7a0a5a806d
commit 8aeaf98f59
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 78 additions and 76 deletions

View File

@ -27,8 +27,8 @@ use url::Url;
use cursor::Cursor; use cursor::Cursor;
pub use marker::{ pub use marker::{
ContainsMarkerTree, ExtraMarkerTree, ExtraOperator, InMarkerTree, LoweredMarkerValueExtra, CanonicalMarkerValueExtra, CanonicalMarkerValueString, CanonicalMarkerValueVersion,
LoweredMarkerValueString, LoweredMarkerValueVersion, MarkerEnvironment, ContainsMarkerTree, ExtraMarkerTree, ExtraOperator, InMarkerTree, MarkerEnvironment,
MarkerEnvironmentBuilder, MarkerExpression, MarkerOperator, MarkerTree, MarkerTreeContents, MarkerEnvironmentBuilder, MarkerExpression, MarkerOperator, MarkerTree, MarkerTreeContents,
MarkerTreeKind, MarkerValue, MarkerValueExtra, MarkerValueString, MarkerValueVersion, MarkerTreeKind, MarkerValue, MarkerValueExtra, MarkerValueString, MarkerValueVersion,
MarkerWarningKind, StringMarkerTree, StringVersion, VersionMarkerTree, MarkerWarningKind, StringMarkerTree, StringVersion, VersionMarkerTree,

View File

@ -57,7 +57,7 @@ use uv_pep440::{release_specifier_to_range, Operator, Version, VersionSpecifier}
use version_ranges::Ranges; use version_ranges::Ranges;
use crate::marker::lowering::{ use crate::marker::lowering::{
LoweredMarkerValueExtra, LoweredMarkerValueString, LoweredMarkerValueVersion, CanonicalMarkerValueExtra, CanonicalMarkerValueString, CanonicalMarkerValueVersion,
}; };
use crate::marker::MarkerValueExtra; use crate::marker::MarkerValueExtra;
use crate::ExtraOperator; use crate::ExtraOperator;
@ -162,18 +162,18 @@ impl InternerGuard<'_> {
// to disjoint version ranges. // to disjoint version ranges.
MarkerExpression::Version { key, specifier } => match key { MarkerExpression::Version { key, specifier } => match key {
MarkerValueVersion::ImplementationVersion => ( MarkerValueVersion::ImplementationVersion => (
Variable::Version(LoweredMarkerValueVersion::ImplementationVersion), Variable::Version(CanonicalMarkerValueVersion::ImplementationVersion),
Edges::from_specifier(specifier), Edges::from_specifier(specifier),
), ),
MarkerValueVersion::PythonFullVersion => ( MarkerValueVersion::PythonFullVersion => (
Variable::Version(LoweredMarkerValueVersion::PythonFullVersion), Variable::Version(CanonicalMarkerValueVersion::PythonFullVersion),
Edges::from_specifier(specifier), Edges::from_specifier(specifier),
), ),
// Normalize `python_version` markers to `python_full_version` nodes. // Normalize `python_version` markers to `python_full_version` nodes.
MarkerValueVersion::PythonVersion => { MarkerValueVersion::PythonVersion => {
match python_version_to_full_version(normalize_specifier(specifier)) { match python_version_to_full_version(normalize_specifier(specifier)) {
Ok(specifier) => ( Ok(specifier) => (
Variable::Version(LoweredMarkerValueVersion::PythonFullVersion), Variable::Version(CanonicalMarkerValueVersion::PythonFullVersion),
Edges::from_specifier(specifier), Edges::from_specifier(specifier),
), ),
Err(node) => return node, Err(node) => return node,
@ -188,18 +188,18 @@ impl InternerGuard<'_> {
negated, negated,
} => match key { } => match key {
MarkerValueVersion::ImplementationVersion => ( MarkerValueVersion::ImplementationVersion => (
Variable::Version(LoweredMarkerValueVersion::ImplementationVersion), Variable::Version(CanonicalMarkerValueVersion::ImplementationVersion),
Edges::from_versions(&versions, negated), Edges::from_versions(&versions, negated),
), ),
MarkerValueVersion::PythonFullVersion => ( MarkerValueVersion::PythonFullVersion => (
Variable::Version(LoweredMarkerValueVersion::PythonFullVersion), Variable::Version(CanonicalMarkerValueVersion::PythonFullVersion),
Edges::from_versions(&versions, negated), Edges::from_versions(&versions, negated),
), ),
// Normalize `python_version` markers to `python_full_version` nodes. // Normalize `python_version` markers to `python_full_version` nodes.
MarkerValueVersion::PythonVersion => { MarkerValueVersion::PythonVersion => {
match Edges::from_python_versions(versions, negated) { match Edges::from_python_versions(versions, negated) {
Ok(edges) => ( Ok(edges) => (
Variable::Version(LoweredMarkerValueVersion::PythonFullVersion), Variable::Version(CanonicalMarkerValueVersion::PythonFullVersion),
edges, edges,
), ),
Err(node) => return node, Err(node) => return node,
@ -275,14 +275,14 @@ impl InternerGuard<'_> {
name: MarkerValueExtra::Extra(extra), name: MarkerValueExtra::Extra(extra),
operator: ExtraOperator::Equal, operator: ExtraOperator::Equal,
} => ( } => (
Variable::Extra(LoweredMarkerValueExtra::Extra(extra)), Variable::Extra(CanonicalMarkerValueExtra::Extra(extra)),
Edges::from_bool(true), Edges::from_bool(true),
), ),
MarkerExpression::Extra { MarkerExpression::Extra {
name: MarkerValueExtra::Extra(extra), name: MarkerValueExtra::Extra(extra),
operator: ExtraOperator::NotEqual, operator: ExtraOperator::NotEqual,
} => ( } => (
Variable::Extra(LoweredMarkerValueExtra::Extra(extra)), Variable::Extra(CanonicalMarkerValueExtra::Extra(extra)),
Edges::from_bool(false), Edges::from_bool(false),
), ),
// Invalid extras are always `false`. // Invalid extras are always `false`.
@ -443,7 +443,7 @@ impl InternerGuard<'_> {
// Look for a `python_full_version` expression, otherwise // Look for a `python_full_version` expression, otherwise
// we recursively simplify. // we recursively simplify.
let Node { let Node {
var: Variable::Version(LoweredMarkerValueVersion::PythonFullVersion), var: Variable::Version(CanonicalMarkerValueVersion::PythonFullVersion),
children: Edges::Version { ref edges }, children: Edges::Version { ref edges },
} = node } = node
else { else {
@ -516,7 +516,7 @@ impl InternerGuard<'_> {
return NodeId::FALSE; return NodeId::FALSE;
} }
if matches!(i, NodeId::TRUE) { if matches!(i, NodeId::TRUE) {
let var = Variable::Version(LoweredMarkerValueVersion::PythonFullVersion); let var = Variable::Version(CanonicalMarkerValueVersion::PythonFullVersion);
let edges = Edges::Version { let edges = Edges::Version {
edges: Edges::from_range(&py_range), edges: Edges::from_range(&py_range),
}; };
@ -525,7 +525,7 @@ impl InternerGuard<'_> {
let node = self.shared.node(i); let node = self.shared.node(i);
let Node { let Node {
var: Variable::Version(LoweredMarkerValueVersion::PythonFullVersion), var: Variable::Version(CanonicalMarkerValueVersion::PythonFullVersion),
children: Edges::Version { ref edges }, children: Edges::Version { ref edges },
} = node } = node
else { else {
@ -621,26 +621,26 @@ pub(crate) enum Variable {
/// ///
/// This is the highest order variable as it typically contains the most complex /// This is the highest order variable as it typically contains the most complex
/// ranges, allowing us to merge ranges at the top-level. /// ranges, allowing us to merge ranges at the top-level.
Version(LoweredMarkerValueVersion), Version(CanonicalMarkerValueVersion),
/// A string marker, such as `os_name`. /// A string marker, such as `os_name`.
String(LoweredMarkerValueString), String(CanonicalMarkerValueString),
/// A variable representing a `<key> in <value>` expression for a particular /// A variable representing a `<key> in <value>` expression for a particular
/// string marker and value. /// string marker and value.
In { In {
key: LoweredMarkerValueString, key: CanonicalMarkerValueString,
value: String, value: String,
}, },
/// A variable representing a `<value> in <key>` expression for a particular /// A variable representing a `<value> in <key>` expression for a particular
/// string marker and value. /// string marker and value.
Contains { Contains {
key: LoweredMarkerValueString, key: CanonicalMarkerValueString,
value: String, value: String,
}, },
/// A variable representing the existence or absence of a given extra. /// A variable representing the existence or absence of a given extra.
/// ///
/// We keep extras at the leaves of the tree, so when simplifying extras we can /// We keep extras at the leaves of the tree, so when simplifying extras we can
/// trivially remove the leaves without having to reconstruct the entire tree. /// trivially remove the leaves without having to reconstruct the entire tree.
Extra(LoweredMarkerValueExtra), Extra(CanonicalMarkerValueExtra),
} }
/// A decision node in an Algebraic Decision Diagram. /// A decision node in an Algebraic Decision Diagram.

View File

@ -2,7 +2,7 @@ use std::sync::Arc;
use uv_pep440::{Version, VersionParseError}; use uv_pep440::{Version, VersionParseError};
use crate::{LoweredMarkerValueString, LoweredMarkerValueVersion, StringVersion}; use crate::{CanonicalMarkerValueString, CanonicalMarkerValueVersion, StringVersion};
/// The marker values for a python interpreter, normally the current one /// The marker values for a python interpreter, normally the current one
/// ///
@ -33,28 +33,28 @@ struct MarkerEnvironmentInner {
impl MarkerEnvironment { impl MarkerEnvironment {
/// Returns of the PEP 440 version typed value of the key in the current environment /// Returns of the PEP 440 version typed value of the key in the current environment
pub fn get_version(&self, key: LoweredMarkerValueVersion) -> &Version { pub fn get_version(&self, key: CanonicalMarkerValueVersion) -> &Version {
match key { match key {
LoweredMarkerValueVersion::ImplementationVersion => { CanonicalMarkerValueVersion::ImplementationVersion => {
&self.implementation_version().version &self.implementation_version().version
} }
LoweredMarkerValueVersion::PythonFullVersion => &self.python_full_version().version, CanonicalMarkerValueVersion::PythonFullVersion => &self.python_full_version().version,
} }
} }
/// Returns of the stringly typed value of the key in the current environment /// Returns of the stringly typed value of the key in the current environment
pub fn get_string(&self, key: LoweredMarkerValueString) -> &str { pub fn get_string(&self, key: CanonicalMarkerValueString) -> &str {
match key { match key {
LoweredMarkerValueString::ImplementationName => self.implementation_name(), CanonicalMarkerValueString::ImplementationName => self.implementation_name(),
LoweredMarkerValueString::OsName => self.os_name(), CanonicalMarkerValueString::OsName => self.os_name(),
LoweredMarkerValueString::PlatformMachine => self.platform_machine(), CanonicalMarkerValueString::PlatformMachine => self.platform_machine(),
LoweredMarkerValueString::PlatformPythonImplementation => { CanonicalMarkerValueString::PlatformPythonImplementation => {
self.platform_python_implementation() self.platform_python_implementation()
} }
LoweredMarkerValueString::PlatformRelease => self.platform_release(), CanonicalMarkerValueString::PlatformRelease => self.platform_release(),
LoweredMarkerValueString::PlatformSystem => self.platform_system(), CanonicalMarkerValueString::PlatformSystem => self.platform_system(),
LoweredMarkerValueString::PlatformVersion => self.platform_version(), CanonicalMarkerValueString::PlatformVersion => self.platform_version(),
LoweredMarkerValueString::SysPlatform => self.sys_platform(), CanonicalMarkerValueString::SysPlatform => self.sys_platform(),
} }
} }
} }

View File

@ -7,14 +7,14 @@ use crate::{MarkerValueExtra, MarkerValueString, MarkerValueVersion};
/// Those environment markers with a PEP 440 version as value such as `python_version` /// Those environment markers with a PEP 440 version as value such as `python_version`
#[derive(Copy, Clone, Debug, Eq, Hash, PartialEq, PartialOrd, Ord)] #[derive(Copy, Clone, Debug, Eq, Hash, PartialEq, PartialOrd, Ord)]
#[allow(clippy::enum_variant_names)] #[allow(clippy::enum_variant_names)]
pub enum LoweredMarkerValueVersion { pub enum CanonicalMarkerValueVersion {
/// `implementation_version` /// `implementation_version`
ImplementationVersion, ImplementationVersion,
/// `python_full_version` /// `python_full_version`
PythonFullVersion, PythonFullVersion,
} }
impl Display for LoweredMarkerValueVersion { impl Display for CanonicalMarkerValueVersion {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
match self { match self {
Self::ImplementationVersion => f.write_str("implementation_version"), Self::ImplementationVersion => f.write_str("implementation_version"),
@ -23,18 +23,18 @@ impl Display for LoweredMarkerValueVersion {
} }
} }
impl From<LoweredMarkerValueVersion> for MarkerValueVersion { impl From<CanonicalMarkerValueVersion> for MarkerValueVersion {
fn from(value: LoweredMarkerValueVersion) -> Self { fn from(value: CanonicalMarkerValueVersion) -> Self {
match value { match value {
LoweredMarkerValueVersion::ImplementationVersion => Self::ImplementationVersion, CanonicalMarkerValueVersion::ImplementationVersion => Self::ImplementationVersion,
LoweredMarkerValueVersion::PythonFullVersion => Self::PythonFullVersion, CanonicalMarkerValueVersion::PythonFullVersion => Self::PythonFullVersion,
} }
} }
} }
/// Those environment markers with an arbitrary string as value such as `sys_platform` /// Those environment markers with an arbitrary string as value such as `sys_platform`
#[derive(Copy, Clone, Debug, Eq, Hash, PartialEq, PartialOrd, Ord)] #[derive(Copy, Clone, Debug, Eq, Hash, PartialEq, PartialOrd, Ord)]
pub enum LoweredMarkerValueString { pub enum CanonicalMarkerValueString {
/// `implementation_name` /// `implementation_name`
ImplementationName, ImplementationName,
/// `os_name` /// `os_name`
@ -54,7 +54,7 @@ pub enum LoweredMarkerValueString {
SysPlatform, SysPlatform,
} }
impl From<MarkerValueString> for LoweredMarkerValueString { impl From<MarkerValueString> for CanonicalMarkerValueString {
fn from(value: MarkerValueString) -> Self { fn from(value: MarkerValueString) -> Self {
match value { match value {
MarkerValueString::ImplementationName => Self::ImplementationName, MarkerValueString::ImplementationName => Self::ImplementationName,
@ -77,24 +77,24 @@ impl From<MarkerValueString> for LoweredMarkerValueString {
} }
} }
impl From<LoweredMarkerValueString> for MarkerValueString { impl From<CanonicalMarkerValueString> for MarkerValueString {
fn from(value: LoweredMarkerValueString) -> Self { fn from(value: CanonicalMarkerValueString) -> Self {
match value { match value {
LoweredMarkerValueString::ImplementationName => Self::ImplementationName, CanonicalMarkerValueString::ImplementationName => Self::ImplementationName,
LoweredMarkerValueString::OsName => Self::OsName, CanonicalMarkerValueString::OsName => Self::OsName,
LoweredMarkerValueString::PlatformMachine => Self::PlatformMachine, CanonicalMarkerValueString::PlatformMachine => Self::PlatformMachine,
LoweredMarkerValueString::PlatformPythonImplementation => { CanonicalMarkerValueString::PlatformPythonImplementation => {
Self::PlatformPythonImplementation Self::PlatformPythonImplementation
} }
LoweredMarkerValueString::PlatformRelease => Self::PlatformRelease, CanonicalMarkerValueString::PlatformRelease => Self::PlatformRelease,
LoweredMarkerValueString::PlatformSystem => Self::PlatformSystem, CanonicalMarkerValueString::PlatformSystem => Self::PlatformSystem,
LoweredMarkerValueString::PlatformVersion => Self::PlatformVersion, CanonicalMarkerValueString::PlatformVersion => Self::PlatformVersion,
LoweredMarkerValueString::SysPlatform => Self::SysPlatform, CanonicalMarkerValueString::SysPlatform => Self::SysPlatform,
} }
} }
} }
impl Display for LoweredMarkerValueString { impl Display for CanonicalMarkerValueString {
/// Normalizes deprecated names to the proper ones /// Normalizes deprecated names to the proper ones
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
match self { match self {
@ -112,12 +112,12 @@ impl Display for LoweredMarkerValueString {
/// The [`ExtraName`] value used in `extra` markers. /// The [`ExtraName`] value used in `extra` markers.
#[derive(Clone, Debug, Eq, Hash, PartialEq, PartialOrd, Ord)] #[derive(Clone, Debug, Eq, Hash, PartialEq, PartialOrd, Ord)]
pub enum LoweredMarkerValueExtra { pub enum CanonicalMarkerValueExtra {
/// A valid [`ExtraName`]. /// A valid [`ExtraName`].
Extra(ExtraName), Extra(ExtraName),
} }
impl LoweredMarkerValueExtra { impl CanonicalMarkerValueExtra {
/// Returns the [`ExtraName`] value. /// Returns the [`ExtraName`] value.
pub fn extra(&self) -> &ExtraName { pub fn extra(&self) -> &ExtraName {
match self { match self {
@ -126,15 +126,15 @@ impl LoweredMarkerValueExtra {
} }
} }
impl From<LoweredMarkerValueExtra> for MarkerValueExtra { impl From<CanonicalMarkerValueExtra> for MarkerValueExtra {
fn from(value: LoweredMarkerValueExtra) -> Self { fn from(value: CanonicalMarkerValueExtra) -> Self {
match value { match value {
LoweredMarkerValueExtra::Extra(extra) => Self::Extra(extra), CanonicalMarkerValueExtra::Extra(extra) => Self::Extra(extra),
} }
} }
} }
impl Display for LoweredMarkerValueExtra { impl Display for CanonicalMarkerValueExtra {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
match self { match self {
Self::Extra(extra) => extra.fmt(f), Self::Extra(extra) => extra.fmt(f),

View File

@ -17,7 +17,9 @@ mod simplify;
mod tree; mod tree;
pub use environment::{MarkerEnvironment, MarkerEnvironmentBuilder}; pub use environment::{MarkerEnvironment, MarkerEnvironmentBuilder};
pub use lowering::{LoweredMarkerValueExtra, LoweredMarkerValueString, LoweredMarkerValueVersion}; pub use lowering::{
CanonicalMarkerValueExtra, CanonicalMarkerValueString, CanonicalMarkerValueVersion,
};
pub use tree::{ pub use tree::{
ContainsMarkerTree, ExtraMarkerTree, ExtraOperator, InMarkerTree, MarkerExpression, ContainsMarkerTree, ExtraMarkerTree, ExtraOperator, InMarkerTree, MarkerExpression,
MarkerOperator, MarkerTree, MarkerTreeContents, MarkerTreeDebugGraph, MarkerTreeKind, MarkerOperator, MarkerTree, MarkerTreeContents, MarkerTreeDebugGraph, MarkerTreeKind,

View File

@ -13,7 +13,7 @@ use super::algebra::{Edges, NodeId, Variable, INTERNER};
use super::simplify; use super::simplify;
use crate::cursor::Cursor; use crate::cursor::Cursor;
use crate::marker::lowering::{ use crate::marker::lowering::{
LoweredMarkerValueExtra, LoweredMarkerValueString, LoweredMarkerValueVersion, CanonicalMarkerValueExtra, CanonicalMarkerValueString, CanonicalMarkerValueVersion,
}; };
use crate::marker::parse; use crate::marker::parse;
use crate::{ use crate::{
@ -1270,13 +1270,13 @@ pub enum MarkerTreeKind<'a> {
#[derive(PartialEq, Eq, Clone, Debug)] #[derive(PartialEq, Eq, Clone, Debug)]
pub struct VersionMarkerTree<'a> { pub struct VersionMarkerTree<'a> {
id: NodeId, id: NodeId,
key: LoweredMarkerValueVersion, key: CanonicalMarkerValueVersion,
map: &'a [(Ranges<Version>, NodeId)], map: &'a [(Ranges<Version>, NodeId)],
} }
impl VersionMarkerTree<'_> { impl VersionMarkerTree<'_> {
/// The key for this node. /// The key for this node.
pub fn key(&self) -> LoweredMarkerValueVersion { pub fn key(&self) -> CanonicalMarkerValueVersion {
self.key self.key
} }
@ -1306,13 +1306,13 @@ impl Ord for VersionMarkerTree<'_> {
#[derive(PartialEq, Eq, Clone, Debug)] #[derive(PartialEq, Eq, Clone, Debug)]
pub struct StringMarkerTree<'a> { pub struct StringMarkerTree<'a> {
id: NodeId, id: NodeId,
key: LoweredMarkerValueString, key: CanonicalMarkerValueString,
map: &'a [(Ranges<String>, NodeId)], map: &'a [(Ranges<String>, NodeId)],
} }
impl StringMarkerTree<'_> { impl StringMarkerTree<'_> {
/// The key for this node. /// The key for this node.
pub fn key(&self) -> LoweredMarkerValueString { pub fn key(&self) -> CanonicalMarkerValueString {
self.key self.key
} }
@ -1341,7 +1341,7 @@ impl Ord for StringMarkerTree<'_> {
/// A string marker node with the `in` operator, such as `os_name in 'WindowsLinux'`. /// A string marker node with the `in` operator, such as `os_name in 'WindowsLinux'`.
#[derive(PartialEq, Eq, Clone, Debug)] #[derive(PartialEq, Eq, Clone, Debug)]
pub struct InMarkerTree<'a> { pub struct InMarkerTree<'a> {
key: LoweredMarkerValueString, key: CanonicalMarkerValueString,
value: &'a str, value: &'a str,
high: NodeId, high: NodeId,
low: NodeId, low: NodeId,
@ -1349,7 +1349,7 @@ pub struct InMarkerTree<'a> {
impl InMarkerTree<'_> { impl InMarkerTree<'_> {
/// The key (LHS) for this expression. /// The key (LHS) for this expression.
pub fn key(&self) -> LoweredMarkerValueString { pub fn key(&self) -> CanonicalMarkerValueString {
self.key self.key
} }
@ -1391,7 +1391,7 @@ impl Ord for InMarkerTree<'_> {
/// A string marker node with inverse of the `in` operator, such as `'nux' in os_name`. /// A string marker node with inverse of the `in` operator, such as `'nux' in os_name`.
#[derive(PartialEq, Eq, Clone, Debug)] #[derive(PartialEq, Eq, Clone, Debug)]
pub struct ContainsMarkerTree<'a> { pub struct ContainsMarkerTree<'a> {
key: LoweredMarkerValueString, key: CanonicalMarkerValueString,
value: &'a str, value: &'a str,
high: NodeId, high: NodeId,
low: NodeId, low: NodeId,
@ -1399,7 +1399,7 @@ pub struct ContainsMarkerTree<'a> {
impl ContainsMarkerTree<'_> { impl ContainsMarkerTree<'_> {
/// The key (LHS) for this expression. /// The key (LHS) for this expression.
pub fn key(&self) -> LoweredMarkerValueString { pub fn key(&self) -> CanonicalMarkerValueString {
self.key self.key
} }
@ -1441,14 +1441,14 @@ impl Ord for ContainsMarkerTree<'_> {
/// A node representing the existence or absence of a given extra, such as `extra == 'bar'`. /// A node representing the existence or absence of a given extra, such as `extra == 'bar'`.
#[derive(PartialEq, Eq, Clone, Debug)] #[derive(PartialEq, Eq, Clone, Debug)]
pub struct ExtraMarkerTree<'a> { pub struct ExtraMarkerTree<'a> {
name: &'a LoweredMarkerValueExtra, name: &'a CanonicalMarkerValueExtra,
high: NodeId, high: NodeId,
low: NodeId, low: NodeId,
} }
impl ExtraMarkerTree<'_> { impl ExtraMarkerTree<'_> {
/// Returns the name of the extra in this expression. /// Returns the name of the extra in this expression.
pub fn name(&self) -> &LoweredMarkerValueExtra { pub fn name(&self) -> &CanonicalMarkerValueExtra {
self.name self.name
} }

View File

@ -1,6 +1,6 @@
use pubgrub::Range; use pubgrub::Range;
use uv_pep440::Version; use uv_pep440::Version;
use uv_pep508::{LoweredMarkerValueVersion, MarkerTree, MarkerTreeKind}; use uv_pep508::{CanonicalMarkerValueVersion, MarkerTree, MarkerTreeKind};
use crate::requires_python::{LowerBound, RequiresPythonRange, UpperBound}; use crate::requires_python::{LowerBound, RequiresPythonRange, UpperBound};
@ -10,14 +10,14 @@ pub(crate) fn requires_python(tree: &MarkerTree) -> Option<RequiresPythonRange>
match tree.kind() { match tree.kind() {
MarkerTreeKind::True | MarkerTreeKind::False => {} MarkerTreeKind::True | MarkerTreeKind::False => {}
MarkerTreeKind::Version(marker) => match marker.key() { MarkerTreeKind::Version(marker) => match marker.key() {
LoweredMarkerValueVersion::PythonFullVersion => { CanonicalMarkerValueVersion::PythonFullVersion => {
for (range, tree) in marker.edges() { for (range, tree) in marker.edges() {
if !tree.is_false() { if !tree.is_false() {
markers.push(range.clone()); markers.push(range.clone());
} }
} }
} }
LoweredMarkerValueVersion::ImplementationVersion => { CanonicalMarkerValueVersion::ImplementationVersion => {
for (_, tree) in marker.edges() { for (_, tree) in marker.edges() {
collect_python_markers(&tree, markers); collect_python_markers(&tree, markers);
} }

View File

@ -587,8 +587,8 @@ impl ResolverOutput {
marker_env: &MarkerEnvironment, marker_env: &MarkerEnvironment,
) -> Result<MarkerTree, Box<ParsedUrlError>> { ) -> Result<MarkerTree, Box<ParsedUrlError>> {
use uv_pep508::{ use uv_pep508::{
LoweredMarkerValueString, LoweredMarkerValueVersion, MarkerExpression, MarkerOperator, CanonicalMarkerValueString, CanonicalMarkerValueVersion, MarkerExpression,
MarkerTree, MarkerOperator, MarkerTree,
}; };
/// A subset of the possible marker values. /// A subset of the possible marker values.
@ -598,8 +598,8 @@ impl ResolverOutput {
/// values based on the current marker environment. /// values based on the current marker environment.
#[derive(Debug, Eq, Hash, PartialEq)] #[derive(Debug, Eq, Hash, PartialEq)]
enum MarkerParam { enum MarkerParam {
Version(LoweredMarkerValueVersion), Version(CanonicalMarkerValueVersion),
String(LoweredMarkerValueString), String(CanonicalMarkerValueString),
} }
/// Add all marker parameters from the given tree to the given set. /// Add all marker parameters from the given tree to the given set.