-
Notifications
You must be signed in to change notification settings - Fork 112
Fully-qualify reference to Swift's Actor
protocol in macro expansion code for synchronous test functions
#1067
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…n code for synchronous test functions
@swift-ci please test |
grynspan
approved these changes
Apr 9, 2025
stmontgomery
added a commit
to stmontgomery/swift-testing
that referenced
this pull request
Apr 11, 2025
…n code for synchronous test functions (swiftlang#1067) This fixes a compilation error in code expanded from the `@Test` macro when it's attached to a synchronous (i.e. non-`async`) test function in a context where there is a concrete type named `Actor`. For example, the following code reproduces the error: ```swift // In MyApp public class Actor {} // In test code import Testing import MyApp // ❌ 'any' has no effect on concrete type 'Actor' // - 'isolated' parameter type 'Actor?' does not conform to 'Actor' or 'DistributedActor' @test func example() /* No 'async' */ {} ``` The macro code includes an unqualified reference to a type by that name, but it's intended to refer to the protocol in Swift's `_Concurrency` module. The fix is to ensure the macro's reference to this protocol is fully-qualified with a module name. This was first reported on the Swift Forums in https://forums.swift.org/t/error-isolated-parameter-type-actor-does-not-conform-to-actor-or-distributedactor/79190. This bug was introduced in swiftlang#747, which first landed in Swift 6.1 and Xcode 16.3. ### Checklist: - [x] Code and documentation should follow the style of the [Style Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md). - [x] If public symbols are renamed or modified, DocC references should be updated.
stmontgomery
added a commit
to stmontgomery/swift-testing
that referenced
this pull request
Apr 11, 2025
…n code for synchronous test functions (swiftlang#1067) This fixes a compilation error in code expanded from the `@Test` macro when it's attached to a synchronous (i.e. non-`async`) test function in a context where there is a concrete type named `Actor`. For example, the following code reproduces the error: ```swift // In MyApp public class Actor {} // In test code import Testing import MyApp // ❌ 'any' has no effect on concrete type 'Actor' // - 'isolated' parameter type 'Actor?' does not conform to 'Actor' or 'DistributedActor' @test func example() /* No 'async' */ {} ``` The macro code includes an unqualified reference to a type by that name, but it's intended to refer to the protocol in Swift's `_Concurrency` module. The fix is to ensure the macro's reference to this protocol is fully-qualified with a module name. This was first reported on the Swift Forums in https://forums.swift.org/t/error-isolated-parameter-type-actor-does-not-conform-to-actor-or-distributedactor/79190. This bug was introduced in swiftlang#747, which first landed in Swift 6.1 and Xcode 16.3. ### Checklist: - [x] Code and documentation should follow the style of the [Style Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md). - [x] If public symbols are renamed or modified, DocC references should be updated.
stmontgomery
added a commit
that referenced
this pull request
Apr 11, 2025
…o expansion code for synchronous test functions (#1071) - **Explanation**: This fixes a compilation error in code expanded from the `@Test` macro when it's attached to a synchronous (i.e. non-`async`) test function in a context where there is a concrete type named `Actor`. - **Scope**: Affects tests in code which also has a custom type named `Actor`. - **Issues**: n/a - **Original PRs**: #1067 - **Risk**: Low - **Testing**: Modified tests to detect this. - **Reviewers**: @grynspan
stmontgomery
added a commit
that referenced
this pull request
Apr 11, 2025
…o expansion code for synchronous test functions (#1072) - **Explanation**: This fixes a compilation error in code expanded from the `@Test` macro when it's attached to a synchronous (i.e. non-`async`) test function in a context where there is a concrete type named `Actor`. - **Scope**: Affects tests in code which also has a custom type named `Actor`. - **Issues**: n/a - **Original PRs**: #1067 - **Risk**: Low - **Testing**: Modified tests to detect this. - **Reviewers**: @grynspan
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This fixes a compilation error in code expanded from the
@Test
macro when it's attached to a synchronous (i.e. non-async
) test function in a context where there is a concrete type namedActor
. For example, the following code reproduces the error:The macro code includes an unqualified reference to a type by that name, but it's intended to refer to the protocol in Swift's
_Concurrency
module. The fix is to ensure the macro's reference to this protocol is fully-qualified with a module name.This was first reported on the Swift Forums in https://forums.swift.org/t/error-isolated-parameter-type-actor-does-not-conform-to-actor-or-distributedactor/79190. This bug was introduced in #747, which first landed in Swift 6.1 and Xcode 16.3.
Checklist: