@@ -238,9 +238,9 @@ struct PackageContainerConstraintSet<C: PackageContainer>: Collection {
238
238
return AnySequence < C . Identifier > ( constraints. keys)
239
239
}
240
240
241
- /// Get the version set associated with the given package `identifier`.
242
- subscript( identifier: Identifier ) -> VersionSetSpecifier ? {
243
- return constraints [ identifier]
241
+ /// Get the version set specifier associated with the given package `identifier`.
242
+ subscript( identifier: Identifier ) -> VersionSetSpecifier {
243
+ return constraints [ identifier] ?? . any
244
244
}
245
245
246
246
/// Merge the given version requirement for the container `identifier`.
@@ -424,15 +424,11 @@ struct VersionAssignmentSet<C: PackageContainer>: Sequence {
424
424
// A package can be excluded if there are no constraints on the
425
425
// package (it has not been requested by any other package in the
426
426
// assignment).
427
- return constraints [ container. identifier] == nil
427
+ return constraints [ container. identifier] == . any
428
428
429
429
case . version( let version) :
430
- // A version is valid if it is contained in the constraints, or there are no constraints.
431
- if let versionSet = constraints [ container. identifier] {
432
- return versionSet. contains ( version)
433
- } else {
434
- return true
435
- }
430
+ // A version is valid if it is contained in the constraints.
431
+ return constraints [ container. identifier] . contains ( version)
436
432
}
437
433
}
438
434
@@ -604,7 +600,7 @@ public class DependencyResolver<
604
600
excluding allExclusions: [ Identifier : Set < Version > ]
605
601
) throws -> AssignmentSet ? {
606
602
func validVersions( _ container: Container ) -> AnyIterator < Version > {
607
- let constraints = allConstraints [ container. identifier] ?? . any
603
+ let constraints = allConstraints [ container. identifier]
608
604
let exclusions = allExclusions [ container. identifier] ?? Set ( )
609
605
var it = container. versions. reversed ( ) . makeIterator ( )
610
606
return AnyIterator { ( ) -> Version ? in
0 commit comments