Skip to content

🍒[5.7] Disallow async IBAction Methods #60392

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

Conversation

etcwilde
Copy link
Member

@etcwilde etcwilde commented Aug 4, 2022

The IBAction signature does not allow completion handlers, so making
IBAction methods async doesn't make sense. Disallowing it statically so
it doesn't just break people when they try.

This adds a note with a possible fix + fix-it for the issue,
recommending removing the async and wrapping the body of the function
in a task.

The end result is that the app crashing at runtime is caught at compile time.

Risk: Low
Review by: @beccadax
Testing: PR testing, additional test cases, local testing
Original PR: #59205
Radar: rdar://83259194

The IBAction signature does not allow completion handlers, so making
IBAction methods async doesn't make sense. Disallowing it statically so
it doesn't just break people when they try.

This adds a note with a possible fix + fix-it for the issue,
recommending removing the `async` and wrapping the body of the function
in a task.
@etcwilde etcwilde added the r5.7 label Aug 4, 2022
@etcwilde etcwilde requested a review from a team as a code owner August 4, 2022 17:18
@etcwilde
Copy link
Member Author

etcwilde commented Aug 4, 2022

@swift-ci please test

@etcwilde
Copy link
Member Author

etcwilde commented Aug 4, 2022

@swift-ci please nominate

@tkremenek tkremenek merged commit d1b5b24 into swiftlang:release/5.7 Aug 5, 2022
@etcwilde etcwilde deleted the ewilde/5.7/no-async-ibactions branch August 8, 2022 16:55
@AnthonyLatsis AnthonyLatsis added 🍒 release cherry pick Flag: Release branch cherry picks swift 5.7 labels Jan 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍒 release cherry pick Flag: Release branch cherry picks swift 5.7
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants