Commit 756316c
authored
Fully-qualify reference to Swift's
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 #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.Actor protocol in macro expansion code for synchronous test functions (#1067)1 parent 6cf0110 commit 756316c
File tree
2 files changed
+6
-1
lines changed- Sources/TestingMacros
- Tests/TestingTests
2 files changed
+6
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
328 | 328 | | |
329 | 329 | | |
330 | 330 | | |
331 | | - | |
| 331 | + | |
332 | 332 | | |
333 | 333 | | |
334 | 334 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
142 | 147 | | |
143 | 148 | | |
144 | 149 | | |
| |||
0 commit comments