-
Notifications
You must be signed in to change notification settings - Fork 24
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
More support for Swift 6. #31
Conversation
@@ -79,7 +79,7 @@ extension AsyncStream { | |||
extension AsyncSequence { | |||
/// Erases this async sequence to an async stream that produces elements till this sequence | |||
/// terminates (or fails). | |||
public func eraseToStream() -> AsyncStream<Element> { | |||
public func eraseToStream() -> AsyncStream<Element> where Self: Sendable { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand this, but unfortunately this means that because Combine
is stuck in the past, you can't do this anymore:
publisher.values.eraseToStream()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does a @preconcurrency import
help with that? Or worst case, a @retroactive @unchecked Sendable
conformance for the publisher in question?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does a @preconcurrency import help with that?
Nope
a @retroactive @unchecked Sendable conformance for the publisher in question?
Yeah but that would silence all other issues related to mis-using Publisher
s.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any chance of relaxing this requirement? We'll be stuck on 1.1.0 otherwise to be able to keep supporting Combine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@NachoSoto We recently introduced a conditional conformance to UncheckedSendable
here: #44
Can you use that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes that's perfect thank you!
Ended up doing this (AnyAsyncSequence
is our own type to deal with the Failure
associatedtype
availability):
extension Publisher where Output: Sendable {
public func eraseToAnyAsyncSequence() -> AnyAsyncSequence<Output> {
// Combine does not support Swift concurrency, so we rely on `ConcurrencyExtras`
// allowing this.
UncheckedSendable(values).eraseToAnyAsyncSequence()
}
}
No description provided.