Skip to content

Commit 42fe48a

Browse files
committed
Refactor type used for resolvo package names
By using an enum here, the global var handling can use its own enum variant instead of the flawed string prefix approach. Now it is simply not possible for a package name to be confused for a global var. Signed-off-by: J Robert Ray <[email protected]>
1 parent ba3736c commit 42fe48a

File tree

2 files changed

+339
-284
lines changed

2 files changed

+339
-284
lines changed

crates/spk-solve/src/cdcl_solver/pkg_request_version_set.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use std::sync::Arc;
77
use resolvo::utils::VersionSet;
88
use spk_schema::ident::{LocatedBuildIdent, PkgRequest, PreReleasePolicy, RangeIdent, RequestedBy};
99
use spk_schema::ident_component::Component;
10+
use spk_schema::name::OptNameBuf;
1011
use spk_schema::Request;
1112

1213
/// This allows for storing strings of different types but hash and compare by
@@ -74,7 +75,7 @@ impl std::fmt::Display for VarValue {
7475
#[derive(Clone, Debug, Eq, Hash, PartialEq)]
7576
pub(crate) enum RequestVS {
7677
SpkRequest(Request),
77-
GlobalVar { key: String, value: VarValue },
78+
GlobalVar { key: OptNameBuf, value: VarValue },
7879
}
7980

8081
impl std::fmt::Display for RequestVS {
@@ -163,7 +164,7 @@ impl PartialEq<SyntheticComponent> for Component {
163164
#[derive(Clone, Debug, Eq, Hash, PartialEq)]
164165
pub(crate) enum SpkSolvable {
165166
LocatedBuildIdentWithComponent(LocatedBuildIdentWithComponent),
166-
GlobalVar { key: String, value: VarValue },
167+
GlobalVar { key: OptNameBuf, value: VarValue },
167168
}
168169

169170
impl std::fmt::Display for SpkSolvable {

0 commit comments

Comments
 (0)