-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Conversation
[email protected]
Outdated
@@ -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", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// "-Xfrontend", "-enable-actor-data-race-checks", |
nonisolated(unsafe) | ||
public var _cancellationCancellables = CancellablesCollection() | ||
private let _cancellablesLock = NSRecursiveLock() |
There was a problem hiding this comment.
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!
@MainActor(unsafe) | ||
func assumeMainActorIsolated<T>( | ||
_ operation: @MainActor () throws -> T, | ||
file: StaticString = #fileID, | ||
line: UInt = #line | ||
) rethrows -> T { | ||
try operation() | ||
} |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 #if
s. Thanks @pyrtsa!
e2bd262
to
f2ca611
Compare
Going to reopen this in smaller steps. |
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.