You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR ensures the body of _the implementation of_
`#expect(exitsWith:)` inherits isolation from the caller. The actual
body closure passed to the macro cannot inherit isolation as it runs in
a separate process, but the glue code we emit needs to inherit so that
if the caller is actor-isolated, the code compiles cleanly. Without this
change, the following test fails to compile:
```swift
@mainactor@test func f() async {
await #expect(exitsWith: .failure) { /* ... */ }
// 🛑 ^ ^ ^ sending main actor-isolated value of type '() -> [Comment]' with later accesses to nonisolated context risks causing data races
}
```
### 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.
0 commit comments