Skip to content

Warn about sending on Sendable type in function parameters (#74616) #74849

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Androp0v
Copy link

@Androp0v Androp0v commented Jun 29, 2024

When a function parameter is Sendable, adding 'sending' annotation does nothing, as the value is safe to be sent across isolation boundaries. SE-0430 seems to imply that 'sending' is intended to be used for non-Sendable types only.

Includes fix-it to remove 'sending' from parameter.

Addresses #74616 .

@Androp0v Androp0v marked this pull request as ready for review June 30, 2024 00:32
@Androp0v
Copy link
Author

I'll address your comments and update the PR, thanks @hborla

@Androp0v Androp0v force-pushed the feat/warn-about-sending-on-sendable branch 2 times, most recently from 34c0961 to 9c01b64 Compare July 23, 2024 17:34
@Androp0v Androp0v requested a review from hborla July 23, 2024 17:35
@Androp0v
Copy link
Author

FYI: I didn't add tests for:

func testSendingOnSendableResult() -> sending some Sendable { ... }

Due to #74846

…#74616)

When a function parameter is Sendable, adding 'sending' annotation does nothing, as the value is safe to be sent across isolation boundaries. SE-0430 seems to imply that 'sending' is intended to be used for non-Sendable types only.
@Androp0v Androp0v force-pushed the feat/warn-about-sending-on-sendable branch from 9c01b64 to f200dae Compare September 2, 2024 18:55
…Sendable type

Follow PR review comments and extend the warnings about sending on sendable types to cover types with a type parameter, and use generic signature instead of ASTContext to check conformance to Sendable. Additionally, use different warning messages based on whether the sending on Sendable is used on a function parameter or function result.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants