🍒 [6.1.2] Fully-qualify reference to Swift's Actor protocol in macro expansion code for synchronous test functions#1072
Merged
stmontgomery merged 1 commit intoApr 11, 2025
Conversation
…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.
Contributor
Author
|
@swift-ci please test |
Actor protocol in macro expansion code for synchronous test functionsActor protocol in macro expansion code for synchronous test functions
briancroom
approved these changes
Apr 11, 2025
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
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.
@Testmacro when it's attached to a synchronous (i.e. non-async) test function in a context where there is a concrete type namedActor.Actor.Actorprotocol in macro expansion code for synchronous test functions #1067