Skip to content

Added MainActor annotations to the example group closures - #1300

Open
CraigSiemens wants to merge 2 commits into
Quick:mainfrom
CraigSiemens:more-main-actor
Open

Added MainActor annotations to the example group closures#1300
CraigSiemens wants to merge 2 commits into
Quick:mainfrom
CraigSiemens:more-main-actor

Conversation

@CraigSiemens

@CraigSiemens CraigSiemens commented Sep 9, 2024

Copy link
Copy Markdown
Contributor

Resolves #1298

This adds @MainActor annotations to the describe and context closures as well as QuickSpec.spec().

This helps resolve a warning when using Swift 6 with complete concurrency checking enabled when a variable is defined in spec() or an example group (describe/context) and used in a test. The compiler would warn when accessing a non-isolated variable from an isolated context (it). Now everything has the same isolation.

@CraigSiemens

Copy link
Copy Markdown
Contributor Author

It looks like the builds are failing because of the call to MainActor.assumeIsolated which was introduced in Swift 5.9.

Some of those workflows would need to be updated to use newer versions of Xcode and Swift. I'm no sure if that's something that should be done in this PR or another one.

@Noobish1

Copy link
Copy Markdown
Contributor

Any updates on this PR?

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

Successfully merging this pull request may close these issues.

Strict Concurrency - Unable to access properties defined outside of various ExampleClosures.

2 participants