-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
We have a few warnings, mostly in the test suite, that have cropped up with deprecations and Xcode 16 strict concurrency, so let's address them.
- Loading branch information
1 parent
8541597
commit e1f07fa
Showing
12 changed files
with
107 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
Sources/ComposableArchitecture/Internal/AssumeIsolated.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import Foundation | ||
|
||
extension MainActor { | ||
// NB: This functionality was not back-deployed in Swift 5.9 | ||
static func _assumeIsolated<T : Sendable>( | ||
_ operation: @MainActor () throws -> T, | ||
file: StaticString = #fileID, | ||
line: UInt = #line | ||
) rethrows -> T { | ||
#if swift(<5.10) | ||
typealias YesActor = @MainActor () throws -> T | ||
typealias NoActor = () throws -> T | ||
|
||
guard Thread.isMainThread else { | ||
fatalError( | ||
"Incorrect actor executor assumption; Expected same executor as \(self).", | ||
file: file, | ||
line: line | ||
) | ||
} | ||
|
||
return try withoutActuallyEscaping(operation) { (_ fn: @escaping YesActor) throws -> T in | ||
let rawFn = unsafeBitCast(fn, to: NoActor.self) | ||
return try rawFn() | ||
} | ||
#else | ||
return try assumeIsolated(operation, file: file, line: line) | ||
#endif | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.