Skip to content
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

Convert @MainActor XCTestCase subclasses to have @MainActor on each test method? #695

Open
jshier opened this issue Mar 1, 2024 · 1 comment

Comments

@jshier
Copy link

jshier commented Mar 1, 2024

This is probably a bit much, but...

Xcode 15.3 / Swift 5.10 introduces a new concurrency check in complete mode that ensures subclasses have the same isolation as their superclasses. This is triggered on the following simple case:

@MainActor
final class Test: XCTestCase {}

which prints Main actor-isolated class 'Test' has different actor isolation from nonisolated superclass 'XCTestCase'; this is an error in Swift 6. The solution is to move the annotation to each of the test methods. This is tedious so I wonder if SwiftFormat could help?

@ahoppen
Copy link
Contributor

ahoppen commented Apr 23, 2024

Tracked in Apple’s issue tracker as rdar://126948318

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants