Skip to content

Commit a5ecf8c

Browse files
authored
Merge pull request swiftlang#36702 from mikeash/concurrency-availability
[Concurrency] Add availability to Concurrency APIs.
2 parents 8bb3ab0 + 6d2fc9e commit a5ecf8c

File tree

75 files changed

+416
-24
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+416
-24
lines changed

include/swift/AST/ASTContext.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -738,6 +738,10 @@ class ASTContext final {
738738
/// compiler for the target platform.
739739
AvailabilityContext getSwift54Availability();
740740

741+
/// Get the runtime availability of features introduced in the Swift 5.5
742+
/// compiler for the target platform.
743+
AvailabilityContext getSwift55Availability();
744+
741745
/// Get the runtime availability of features that have been introduced in the
742746
/// Swift compiler for future versions of the target platform.
743747
AvailabilityContext getSwiftFutureAvailability();

lib/AST/Availability.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ ASTContext::getIntermodulePrespecializedGenericMetadataAvailability() {
324324
}
325325

326326
AvailabilityContext ASTContext::getConcurrencyAvailability() {
327-
return getSwiftFutureAvailability();
327+
return getSwift55Availability();
328328
}
329329

330330
AvailabilityContext ASTContext::getDifferentiationAvailability() {
@@ -409,6 +409,11 @@ AvailabilityContext ASTContext::getSwift54Availability() {
409409
}
410410
}
411411

412+
AvailabilityContext ASTContext::getSwift55Availability() {
413+
return getSwiftFutureAvailability();
414+
}
415+
416+
412417
AvailabilityContext ASTContext::getSwiftFutureAvailability() {
413418
auto target = LangOpts.Target;
414419

stdlib/public/Concurrency/Actor.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,30 @@ import Swift
1717
///
1818
/// The \c Actor protocol generalizes over all actor types. Actor types
1919
/// implicitly conform to this protocol.
20+
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
2021
public protocol Actor: AnyObject, Sendable {
2122
}
2223

2324
/// Called to initialize the default actor instance in an actor.
2425
/// The implementation will call this within the actor's initializer.
26+
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
2527
@_silgen_name("swift_defaultActor_initialize")
2628
public func _defaultActorInitialize(_ actor: AnyObject)
2729

2830
/// Called to destroy the default actor instance in an actor.
2931
/// The implementation will call this within the actor's deinit.
32+
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
3033
@_silgen_name("swift_defaultActor_destroy")
3134
public func _defaultActorDestroy(_ actor: AnyObject)
3235

3336
/// FIXME: only exists for the quick-and-dirty MainActor implementation.
37+
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
3438
@_silgen_name("swift_MainActor_register")
3539
fileprivate func _registerMainActor(actor: AnyObject)
3640

3741
/// A singleton actor whose executor is equivalent to
3842
/// \c DispatchQueue.main, which is the main dispatch queue.
43+
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
3944
@globalActor public actor MainActor {
4045
public static let shared = MainActor()
4146

@@ -44,6 +49,7 @@ fileprivate func _registerMainActor(actor: AnyObject)
4449
}
4550
}
4651

52+
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
4753
extension MainActor {
4854
/// Execute the given body closure on the main actor.
4955
public static func run<T>(

stdlib/public/Concurrency/AsyncCompactMapSequence.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
import Swift
1414

15+
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
1516
extension AsyncSequence {
1617
@inlinable
1718
public __consuming func compactMap<ElementOfResult>(
@@ -21,6 +22,7 @@ extension AsyncSequence {
2122
}
2223
}
2324

25+
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
2426
public struct AsyncCompactMapSequence<Base: AsyncSequence, ElementOfResult> {
2527
@usableFromInline
2628
let base: Base
@@ -38,6 +40,7 @@ public struct AsyncCompactMapSequence<Base: AsyncSequence, ElementOfResult> {
3840
}
3941
}
4042

43+
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
4144
extension AsyncCompactMapSequence: AsyncSequence {
4245
public typealias Element = ElementOfResult
4346
public typealias AsyncIterator = Iterator

stdlib/public/Concurrency/AsyncDropFirstSequence.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
import Swift
1414

15+
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
1516
extension AsyncSequence {
1617
@inlinable
1718
public __consuming func dropFirst(
@@ -23,6 +24,7 @@ extension AsyncSequence {
2324
}
2425
}
2526

27+
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
2628
public struct AsyncDropFirstSequence<Base: AsyncSequence> {
2729
@usableFromInline
2830
let base: Base
@@ -37,6 +39,7 @@ public struct AsyncDropFirstSequence<Base: AsyncSequence> {
3739
}
3840
}
3941

42+
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
4043
extension AsyncDropFirstSequence: AsyncSequence {
4144
public typealias Element = Base.Element
4245
public typealias AsyncIterator = Iterator
@@ -75,6 +78,7 @@ extension AsyncDropFirstSequence: AsyncSequence {
7578
}
7679
}
7780

81+
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
7882
extension AsyncDropFirstSequence {
7983
@inlinable
8084
public __consuming func dropFirst(

stdlib/public/Concurrency/AsyncDropWhileSequence.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
import Swift
1414

15+
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
1516
extension AsyncSequence {
1617
@inlinable
1718
public __consuming func drop(
@@ -21,6 +22,7 @@ extension AsyncSequence {
2122
}
2223
}
2324

25+
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
2426
public struct AsyncDropWhileSequence<Base: AsyncSequence> {
2527
@usableFromInline
2628
let base: Base
@@ -38,6 +40,7 @@ public struct AsyncDropWhileSequence<Base: AsyncSequence> {
3840
}
3941
}
4042

43+
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
4144
extension AsyncDropWhileSequence: AsyncSequence {
4245
public typealias Element = Base.Element
4346
public typealias AsyncIterator = Iterator

stdlib/public/Concurrency/AsyncFilterSequence.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
import Swift
1414

15+
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
1516
extension AsyncSequence {
1617
@inlinable
1718
public __consuming func filter(
@@ -21,6 +22,7 @@ extension AsyncSequence {
2122
}
2223
}
2324

25+
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
2426
public struct AsyncFilterSequence<Base: AsyncSequence> {
2527
@usableFromInline
2628
let base: Base
@@ -38,6 +40,7 @@ public struct AsyncFilterSequence<Base: AsyncSequence> {
3840
}
3941
}
4042

43+
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
4144
extension AsyncFilterSequence: AsyncSequence {
4245
public typealias Element = Base.Element
4346
public typealias AsyncIterator = Iterator

stdlib/public/Concurrency/AsyncFlatMapSequence.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
import Swift
1414

15+
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
1516
extension AsyncSequence {
1617
@inlinable
1718
public __consuming func flatMap<SegmentOfResult: AsyncSequence>(
@@ -21,6 +22,7 @@ extension AsyncSequence {
2122
}
2223
}
2324

25+
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
2426
public struct AsyncFlatMapSequence<Base: AsyncSequence, SegmentOfResult: AsyncSequence> {
2527
@usableFromInline
2628
let base: Base
@@ -38,6 +40,7 @@ public struct AsyncFlatMapSequence<Base: AsyncSequence, SegmentOfResult: AsyncSe
3840
}
3941
}
4042

43+
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
4144
extension AsyncFlatMapSequence: AsyncSequence {
4245
public typealias Element = SegmentOfResult.Element
4346
public typealias AsyncIterator = Iterator

stdlib/public/Concurrency/AsyncIteratorProtocol.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
import Swift
1414

15+
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
1516
@rethrows
1617
public protocol AsyncIteratorProtocol {
1718
associatedtype Element

stdlib/public/Concurrency/AsyncMapSequence.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
import Swift
1414

15+
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
1516
extension AsyncSequence {
1617
@inlinable
1718
public __consuming func map<Transformed>(
@@ -21,6 +22,7 @@ extension AsyncSequence {
2122
}
2223
}
2324

25+
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
2426
public struct AsyncMapSequence<Base: AsyncSequence, Transformed> {
2527
@usableFromInline
2628
let base: Base
@@ -38,6 +40,7 @@ public struct AsyncMapSequence<Base: AsyncSequence, Transformed> {
3840
}
3941
}
4042

43+
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
4144
extension AsyncMapSequence: AsyncSequence {
4245
public typealias Element = Transformed
4346
public typealias AsyncIterator = Iterator

0 commit comments

Comments
 (0)