Skip to content

Commit f8b6eb1

Browse files
jmschonfeldbnbarham
authored andcommitted
Add support for swift-collections 1.1 (#7607)
This PR makes a necessary update to the source in order to support building against swift-collections 1.1 ### Motivation: swift-collections added a new API in v1.1: ```swift extension OrderedSet { @inlinable public func filter( _ isIncluded: (Element) throws -> Bool ) rethrows -> Self } ``` swift-package-manager was previously calling `filter` on an `OrderedSet` and expecting to get back an `Array` (via the extension on `Sequence`) however with this new swift-collections change, the returned value of `filter` became an `OrderedSet`. This caused build failures when the `+=` operator (which exists for `Array` but not `OrderedSet` operands) was used on the return value. We should update this code to support swift-collections 1.1 so that we can begin using swift-collections 1.1 in toolchain builds. ### Modifications: The code is updated to convert the return type of `filter` to an `Array` ### Result: The same source will now successfully compile against both swift-collections 1.0.x and 1.1.x
1 parent 54d135f commit f8b6eb1

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,7 @@ if ProcessInfo.processInfo.environment["SWIFTCI_USE_LOCAL_DEPS"] == nil {
739739
.package(url: "https://github.com/apple/swift-driver.git", branch: relatedDependenciesBranch),
740740
.package(url: "https://github.com/apple/swift-crypto.git", .upToNextMinor(from: "3.0.0")),
741741
.package(url: "https://github.com/apple/swift-system.git", .upToNextMinor(from: "1.1.1")),
742-
.package(url: "https://github.com/apple/swift-collections.git", .upToNextMinor(from: "1.0.1")),
742+
.package(url: "https://github.com/apple/swift-collections.git", "1.0.1" ..< "1.2.0"),
743743
.package(url: "https://github.com/apple/swift-certificates.git", .upToNextMinor(from: "1.0.1")),
744744
]
745745
} else {

Sources/PackageGraph/PubGrub/PubGrubDependencyResolver.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ public struct PubGrubDependencyResolver {
581581

582582
let priorCause = _mostRecentSatisfier.cause!
583583

584-
var newTerms = incompatibility.terms.filter { $0 != mostRecentTerm }
584+
var newTerms = Array(incompatibility.terms.filter { $0 != mostRecentTerm })
585585
newTerms += priorCause.terms.filter { $0.node != _mostRecentSatisfier.term.node }
586586

587587
if let _difference = difference {

0 commit comments

Comments
 (0)