Skip to content

Remove extraneous @escaping and @Sendable attributes from CustomExecutionTrait.execute(...) SPI #726

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

stmontgomery
Copy link
Contributor

@stmontgomery stmontgomery commented Sep 23, 2024

This refines the CustomExecutionTrait SPI protocol by removing two unnecessary attributes from the signature of its execute(_:for:testCase:) method requirement:

  1. The @escaping attribute on the function parameter was needed originally to avoid a warning, but function should not actually be considered escaping and part of the contract of this interface is that the implementor must call it before returning. The compiler no longer complains about this, so we can enforce this requirement by removing the unnecessary @escaping attribute now.
  2. The outer @Sendable was necessary when this SPI was first written to avoid a Swift concurrency warning, since a reference to the function is taken elsewhere in the codebase, but this is no longer needed in recent Swift compilers.

Checklist:

  • Code and documentation should follow the style of the Style Guide.
  • If public symbols are renamed or modified, DocC references should be updated.

@stmontgomery
Copy link
Contributor Author

@swift-ci please test

@grynspan
Copy link
Contributor

This is technically ABI-breaking, but it's also experimental SPI so it's fine.

@grynspan grynspan added this to the Swift 6.1 milestone Sep 24, 2024
@stmontgomery stmontgomery merged commit f949445 into swiftlang:main Sep 24, 2024
3 checks passed
@stmontgomery stmontgomery deleted the remove-CustomExecutionTrait-attrs branch September 24, 2024 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants