Skip to content
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

Adopt Sendable in ChannelHandlers.swift #2144

Merged
merged 3 commits into from
Jun 1, 2022

Conversation

dnadoba
Copy link
Member

@dnadoba dnadoba commented Jun 1, 2022

Incremental Sendable adoption.

@dnadoba dnadoba added the 🔼 needs-minor-version-bump For PRs that when merged cause a bump of the minor version, ie. 1.x.0 -> 1.(x+1).0 label Jun 1, 2022
@@ -105,6 +105,11 @@ public final class AcceptBackoffHandler: ChannelDuplexHandler, RemovableChannelH
}
}

#if swift(>=5.7)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly a silly question, but why 5.7?

Copy link
Member Author

@dnadoba dnadoba Jun 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually a good question!
In theory this syntax is already available since Swift 5.5. However, if you, for whatever reason, used AcceptBackoffHandler in way that does not pass sendebility checking, you would get an error and not a warning. In Swift 5.6 you will only get a warning in most cases, so we could also replace swift(>=5.7) with swift(>=5.6). Nevertheless I have chosen 5.7 just to be a bit more on the safer side as the sendability rules are in general even a bit more "relaxed" in more complex scenarios.
That being said, I'm still open to already add this in Swift 5.6 as I'm currently failing to create a code snippet that actually produces an error in 5.6.

@Lukasa Lukasa enabled auto-merge (squash) June 1, 2022 13:16
@Lukasa Lukasa merged commit 6f119c2 into apple:main Jun 1, 2022
@dnadoba dnadoba deleted the dn-sendable-channel-handlers branch June 1, 2022 14:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔼 needs-minor-version-bump For PRs that when merged cause a bump of the minor version, ie. 1.x.0 -> 1.(x+1).0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants