[Concurrency][Stdlib] Add SwiftStdlibCurrentOS availability, use it.

If you use SwiftStdlibCurrentOS availability, you will be able to
use new types and functions from within the implementation. This
works by, when appropriate, building with the CurrentOS availability
set to the current deployment target.

rdar://150944675
This commit is contained in:
Alastair Houghton
2025-05-09 16:53:19 +01:00
parent 0e6f3a8d54
commit 28f96e64ab
41 changed files with 416 additions and 266 deletions

View File

@@ -26,10 +26,12 @@ final class OldExecutorOldStdlib: SerialExecutor {
/// availability, since in this case the UnownedJob version needs to exist.
@available(SwiftStdlib 5.1, *)
final class BothExecutorOldStdlib: SerialExecutor {
func enqueue(_ job: UnownedJob) {} // expected-note{{'enqueue' declared here}}
func enqueue(_ job: UnownedJob) {}
// This no longer warns, because of the use of SwiftStdlibCurrentOS in the
// runtime.
@available(SwiftStdlib 5.9, *)
func enqueue(_ job: __owned ExecutorJob) {} // expected-warning{{'Executor.enqueue(ExecutorJob)' will never be used, due to the presence of 'enqueue(UnownedJob)'}}
func enqueue(_ job: __owned ExecutorJob) {}
func asUnownedSerialExecutor() -> UnownedSerialExecutor {
UnownedSerialExecutor(ordinary: self)