Skip to content

Fix a few sendable warnings #2981

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

Closed
wants to merge 29 commits into from
Closed

Conversation

mbrandonw
Copy link
Member

The majority of sendability problems in TCA right now is in APIs that will be deleted in 2.0, but there are a few very simple warnings we can fix right now just to be a little proactive.

@mbrandonw mbrandonw requested a review from stephencelis April 11, 2024 20:16
@@ -87,7 +96,6 @@ let package = Package(
// .unsafeFlags([
// "-c", "release",
// "-emit-module-interface", "-enable-library-evolution",
// "-Xfrontend", "-warn-concurrency",
// "-Xfrontend", "-enable-actor-data-race-checks",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// "-Xfrontend", "-enable-actor-data-race-checks",

Comment on lines 220 to 222
nonisolated(unsafe)
public var _cancellationCancellables = CancellablesCollection()
private let _cancellablesLock = NSRecursiveLock()
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since we do our own synchronization of these variables we can turn off isolation checking. of course that means the responsibility is on us to make sure everything is correct, but luckily all of this goes away somewhat soon!

Comment on lines 1 to 8
@MainActor(unsafe)
func assumeMainActorIsolated<T>(
_ operation: @MainActor () throws -> T,
file: StaticString = #fileID,
line: UInt = #line
) rethrows -> T {
try operation()
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Actor.assumeIsolated function is supposed to be back deployed to iOS 13, and that does seem to be the case locally, but CI says iOS 17+. If we can figure out CI we can get rid of this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was back deployed only in the Xcode 15.3 toolchain with Swift 5.10 AFAICT, not in 5.9 yet.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahhh ok, so I can work around that with some #ifs. Thanks @pyrtsa!

@mbrandonw mbrandonw force-pushed the fix-a-few-sendable-warnings branch from e2bd262 to f2ca611 Compare June 21, 2024 18:57
@mbrandonw mbrandonw marked this pull request as draft June 24, 2024 19:04
@stephencelis
Copy link
Member

Going to reopen this in smaller steps.

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.

3 participants