Skip to content

Add support for swift-collections 1.1 #7607

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 30, 2024

Conversation

jmschonfeld
Copy link
Contributor

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:

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

@jmschonfeld
Copy link
Contributor Author

@swift-ci please smoke test

@jmschonfeld
Copy link
Contributor Author

@swift-ci please test

@MaxDesiatov MaxDesiatov added dependencies Changes to dependencies and relevant checks modules graph Modules dependency resolution dependency resolution labels May 30, 2024
@jmschonfeld jmschonfeld merged commit 1c62623 into swiftlang:main May 30, 2024
5 checks passed
jmschonfeld added a commit to jmschonfeld/swift-package-manager that referenced this pull request May 30, 2024
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
jmschonfeld added a commit that referenced this pull request May 31, 2024
Cherry pick of #7607

**Explanation:** SwiftPM fails to build against [email protected],
this change allows SwiftPM to be compatible with both
[email protected] and [email protected]
**Scope:** Isolated to one specific line where the build failure
occurred and initializes the return value to an `Array` explicitly
**Risk:** Low as the change is minimal and has been validated via
testing
**Testing:** Existing SwiftPM testing has passed and I have been able to
build a toolchain locally with the change
**Reviewer:** @MaxDesiatov
finestructure pushed a commit to finestructure/swift-package-manager that referenced this pull request Jun 10, 2024
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
finestructure pushed a commit to finestructure/swift-package-manager that referenced this pull request Jun 12, 2024
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
bnbarham pushed a commit that referenced this pull request Jun 12, 2024
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Changes to dependencies and relevant checks dependency resolution modules graph Modules dependency resolution
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants