diff --git a/src/internal/partial_solution.rs b/src/internal/partial_solution.rs index 2c36e256..d4444d51 100644 --- a/src/internal/partial_solution.rs +++ b/src/internal/partial_solution.rs @@ -527,6 +527,18 @@ impl PartialSolution { pub(crate) fn current_decision_level(&self) -> DecisionLevel { self.current_decision_level } + + /// Retrieve the constraints on a package that will not change. + pub fn unchanging_term_for_package(&self, package: Id) -> Option<&Term> { + let pa = self.package_assignments.get(&package)?; + + let idx_newer = pa + .dated_derivations + .as_slice() + .partition_point(|dd| dd.decision_level <= DecisionLevel(1)); + let idx = idx_newer.checked_sub(1)?; + Some(&pa.dated_derivations[idx].accumulated_intersection) + } } impl PackageAssignments {