diff --git a/Package.swift b/Package.swift index 469ed01..db7caeb 100644 --- a/Package.swift +++ b/Package.swift @@ -20,18 +20,12 @@ let package = Package( dependencies: [], targets: [ .target( - name: "AsyncAlgorithms", - swiftSettings: [ - .unsafeFlags([ - "-Xfrontend", "-disable-availability-checking" - ]) - ]), + name: "AsyncAlgorithms"), .target( name: "AsyncSequenceValidation", dependencies: ["_CAsyncSequenceValidationSupport"], swiftSettings: [ .unsafeFlags([ - "-Xfrontend", "-disable-availability-checking", "-Xfrontend", "-enable-experimental-pairwise-build-block" ]) ]), diff --git a/Sources/AsyncAlgorithms/AsyncChunksOfCountOrSignalSequence.swift b/Sources/AsyncAlgorithms/AsyncChunksOfCountOrSignalSequence.swift index 36981f0..f5bd53f 100644 --- a/Sources/AsyncAlgorithms/AsyncChunksOfCountOrSignalSequence.swift +++ b/Sources/AsyncAlgorithms/AsyncChunksOfCountOrSignalSequence.swift @@ -26,18 +26,22 @@ extension AsyncSequence { chunked(by: signal, into: [Element].self) } + @available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *) public func chunks(ofCount count: Int, or timer: AsyncTimerSequence, into: Collected.Type) -> AsyncChunksOfCountOrSignalSequence> where Collected.Element == Element { AsyncChunksOfCountOrSignalSequence(self, count: count, signal: timer) } + @available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *) public func chunks(ofCount count: Int, or timer: AsyncTimerSequence) -> AsyncChunksOfCountOrSignalSequence> { chunks(ofCount: count, or: timer, into: [Element].self) } + @available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *) public func chunked(by timer: AsyncTimerSequence, into: Collected.Type) -> AsyncChunksOfCountOrSignalSequence> where Collected.Element == Element { AsyncChunksOfCountOrSignalSequence(self, count: nil, signal: timer) } + @available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *) public func chunked(by timer: AsyncTimerSequence) -> AsyncChunksOfCountOrSignalSequence> { chunked(by: timer, into: [Element].self) } diff --git a/Sources/AsyncAlgorithms/AsyncDebounceSequence.swift b/Sources/AsyncAlgorithms/AsyncDebounceSequence.swift index 7560b50..27e32d4 100644 --- a/Sources/AsyncAlgorithms/AsyncDebounceSequence.swift +++ b/Sources/AsyncAlgorithms/AsyncDebounceSequence.swift @@ -10,15 +10,18 @@ //===----------------------------------------------------------------------===// extension AsyncSequence { + @available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *) public func debounce(for interval: C.Instant.Duration, tolerance: C.Instant.Duration? = nil, clock: C) -> AsyncDebounceSequence { AsyncDebounceSequence(self, interval: interval, tolerance: tolerance, clock: clock) } + @available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *) public func debounce(for interval: Duration, tolerance: Duration? = nil) -> AsyncDebounceSequence { debounce(for: interval, tolerance: tolerance, clock: .continuous) } } +@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *) public struct AsyncDebounceSequence: Sendable where Base.AsyncIterator: Sendable, Base.Element: Sendable, Base: Sendable { let base: Base @@ -34,6 +37,7 @@ public struct AsyncDebounceSequence: Sendable } } +@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *) extension AsyncDebounceSequence: AsyncSequence { public typealias Element = Base.Element diff --git a/Sources/AsyncAlgorithms/AsyncThrottleSequence.swift b/Sources/AsyncAlgorithms/AsyncThrottleSequence.swift index cce5324..1746e01 100644 --- a/Sources/AsyncAlgorithms/AsyncThrottleSequence.swift +++ b/Sources/AsyncAlgorithms/AsyncThrottleSequence.swift @@ -10,14 +10,17 @@ //===----------------------------------------------------------------------===// extension AsyncSequence { + @available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *) public func throttle(for interval: C.Instant.Duration, clock: C, reducing: @Sendable @escaping (Reduced?, Element) async -> Reduced) -> AsyncThrottleSequence { AsyncThrottleSequence(self, interval: interval, clock: clock, reducing: reducing) } + @available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *) public func throttle(for interval: Duration, reducing: @Sendable @escaping (Reduced?, Element) async -> Reduced) -> AsyncThrottleSequence { throttle(for: interval, clock: .continuous, reducing: reducing) } + @available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *) public func throttle(for interval: C.Instant.Duration, clock: C, latest: Bool = true) -> AsyncThrottleSequence { throttle(for: interval, clock: clock) { previous, element in if latest { @@ -28,11 +31,13 @@ extension AsyncSequence { } } + @available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *) public func throttle(for interval: Duration, latest: Bool = true) -> AsyncThrottleSequence { throttle(for: interval, clock: .continuous, latest: latest) } } +@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *) public struct AsyncThrottleSequence { let base: Base let interval: C.Instant.Duration @@ -47,6 +52,7 @@ public struct AsyncThrottleSequence { } } +@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *) extension AsyncThrottleSequence: AsyncSequence { public typealias Element = Reduced @@ -85,5 +91,8 @@ extension AsyncThrottleSequence: AsyncSequence { } } +@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *) extension AsyncThrottleSequence: Sendable where Base: Sendable, Element: Sendable { } + +@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *) extension AsyncThrottleSequence.Iterator: Sendable where Base.AsyncIterator: Sendable { } diff --git a/Sources/AsyncAlgorithms/AsyncTimerSequence.swift b/Sources/AsyncAlgorithms/AsyncTimerSequence.swift index f2c725b..e012b96 100644 --- a/Sources/AsyncAlgorithms/AsyncTimerSequence.swift +++ b/Sources/AsyncAlgorithms/AsyncTimerSequence.swift @@ -9,6 +9,7 @@ // //===----------------------------------------------------------------------===// +@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *) public struct AsyncTimerSequence: AsyncSequence { public typealias Element = C.Instant @@ -67,18 +68,22 @@ public struct AsyncTimerSequence: AsyncSequence { } } +@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *) extension AsyncTimerSequence { public static func repeating(every interval: C.Instant.Duration, tolerance: C.Instant.Duration? = nil, clock: C) -> AsyncTimerSequence { return AsyncTimerSequence(interval: interval, tolerance: tolerance, clock: clock) } } - +@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *) extension AsyncTimerSequence where C == SuspendingClock { public static func repeating(every interval: Duration, tolerance: Duration? = nil) -> AsyncTimerSequence { return AsyncTimerSequence(interval: interval, tolerance: tolerance, clock: SuspendingClock()) } } +@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *) extension AsyncTimerSequence: Sendable { } + +@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *) extension AsyncTimerSequence.Iterator: Sendable { } diff --git a/Sources/AsyncSequenceValidation/AsyncSequenceValidationDiagram.swift b/Sources/AsyncSequenceValidation/AsyncSequenceValidationDiagram.swift index b88f43f..ce7f1a7 100644 --- a/Sources/AsyncSequenceValidation/AsyncSequenceValidationDiagram.swift +++ b/Sources/AsyncSequenceValidation/AsyncSequenceValidationDiagram.swift @@ -11,6 +11,7 @@ import _CAsyncSequenceValidationSupport +@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *) @resultBuilder public struct AsyncSequenceValidationDiagram : Sendable { public struct Component { diff --git a/Sources/AsyncSequenceValidation/Clock.swift b/Sources/AsyncSequenceValidation/Clock.swift index e7a660d..20847f0 100644 --- a/Sources/AsyncSequenceValidation/Clock.swift +++ b/Sources/AsyncSequenceValidation/Clock.swift @@ -9,6 +9,7 @@ // //===----------------------------------------------------------------------===// +@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *) extension AsyncSequenceValidationDiagram { public struct Clock { let queue: WorkQueue @@ -19,6 +20,7 @@ extension AsyncSequenceValidationDiagram { } } +@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *) extension AsyncSequenceValidationDiagram.Clock: Clock { public struct Step: DurationProtocol, Hashable, CustomStringConvertible { internal var rawValue: Int diff --git a/Sources/AsyncSequenceValidation/Event.swift b/Sources/AsyncSequenceValidation/Event.swift index 7010147..9c60847 100644 --- a/Sources/AsyncSequenceValidation/Event.swift +++ b/Sources/AsyncSequenceValidation/Event.swift @@ -9,6 +9,7 @@ // //===----------------------------------------------------------------------===// +@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *) extension AsyncSequenceValidationDiagram { struct Failure: Error, Equatable { } diff --git a/Sources/AsyncSequenceValidation/Expectation.swift b/Sources/AsyncSequenceValidation/Expectation.swift index 0f45ac5..804b224 100644 --- a/Sources/AsyncSequenceValidation/Expectation.swift +++ b/Sources/AsyncSequenceValidation/Expectation.swift @@ -9,6 +9,7 @@ // //===----------------------------------------------------------------------===// +@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *) extension AsyncSequenceValidationDiagram { public struct ExpectationResult: Sendable { public struct Event: Sendable { diff --git a/Sources/AsyncSequenceValidation/Input.swift b/Sources/AsyncSequenceValidation/Input.swift index 35ede26..c97dbcd 100644 --- a/Sources/AsyncSequenceValidation/Input.swift +++ b/Sources/AsyncSequenceValidation/Input.swift @@ -9,6 +9,7 @@ // //===----------------------------------------------------------------------===// +@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *) extension AsyncSequenceValidationDiagram { public struct Specification: Sendable { public let specification: String diff --git a/Sources/AsyncSequenceValidation/Job.swift b/Sources/AsyncSequenceValidation/Job.swift index 44dedbc..0b0e44c 100644 --- a/Sources/AsyncSequenceValidation/Job.swift +++ b/Sources/AsyncSequenceValidation/Job.swift @@ -11,6 +11,7 @@ import _CAsyncSequenceValidationSupport +@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *) struct Job: Hashable, @unchecked Sendable { let job: JobRef diff --git a/Sources/AsyncSequenceValidation/TaskDriver.swift b/Sources/AsyncSequenceValidation/TaskDriver.swift index eb3c14d..05acf53 100644 --- a/Sources/AsyncSequenceValidation/TaskDriver.swift +++ b/Sources/AsyncSequenceValidation/TaskDriver.swift @@ -19,11 +19,13 @@ import _CAsyncSequenceValidationSupport #error("TODO: Port TaskDriver threading to windows") #endif +@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *) func start_thread(_ raw: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer? { Unmanaged.fromOpaque(raw).takeRetainedValue().run() return nil } +@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *) final class TaskDriver { let work: (TaskDriver) -> Void let queue: WorkQueue diff --git a/Sources/AsyncSequenceValidation/Test.swift b/Sources/AsyncSequenceValidation/Test.swift index 95bd43e..2058727 100644 --- a/Sources/AsyncSequenceValidation/Test.swift +++ b/Sources/AsyncSequenceValidation/Test.swift @@ -18,6 +18,7 @@ internal func _swiftJobRun( _ executor: UnownedSerialExecutor ) -> () +@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *) public protocol AsyncSequenceValidationTest: Sendable { var inputs: [AsyncSequenceValidationDiagram.Specification] { get } var output: AsyncSequenceValidationDiagram.Specification { get } @@ -25,6 +26,7 @@ public protocol AsyncSequenceValidationTest: Sendable { func test(with clock: C, activeTicks: [C.Instant], output: AsyncSequenceValidationDiagram.Specification, _ event: (String) -> Void) async throws } +@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *) extension AsyncSequenceValidationDiagram { struct Test: AsyncSequenceValidationTest, @unchecked Sendable where Operation.Element == String { let inputs: [Specification] diff --git a/Sources/AsyncSequenceValidation/Theme.swift b/Sources/AsyncSequenceValidation/Theme.swift index 19e8041..d82229e 100644 --- a/Sources/AsyncSequenceValidation/Theme.swift +++ b/Sources/AsyncSequenceValidation/Theme.swift @@ -9,18 +9,21 @@ // //===----------------------------------------------------------------------===// +@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *) public protocol AsyncSequenceValidationTheme { func token(_ character: Character, inValue: Bool) -> AsyncSequenceValidationDiagram.Token func description(for token: AsyncSequenceValidationDiagram.Token) -> String } +@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *) extension AsyncSequenceValidationTheme where Self == AsyncSequenceValidationDiagram.ASCIITheme { public static var ascii: AsyncSequenceValidationDiagram.ASCIITheme { return AsyncSequenceValidationDiagram.ASCIITheme() } } +@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *) extension AsyncSequenceValidationDiagram { public enum Token: Sendable { case step diff --git a/Sources/AsyncSequenceValidation/WorkQueue.swift b/Sources/AsyncSequenceValidation/WorkQueue.swift index 044a1ef..66722c3 100644 --- a/Sources/AsyncSequenceValidation/WorkQueue.swift +++ b/Sources/AsyncSequenceValidation/WorkQueue.swift @@ -9,6 +9,7 @@ // //===----------------------------------------------------------------------===// +@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *) struct WorkQueue: Sendable { enum Item: CustomStringConvertible, Comparable { case blocked(Token, AsyncSequenceValidationDiagram.Clock.Instant, UnsafeContinuation)