From 13713a4ffdee8abd929f92568ee9462a46ae26e0 Mon Sep 17 00:00:00 2001 From: Francesco Paolo Severino <96546612+fpseverino@users.noreply.github.com> Date: Tue, 29 Sep 2026 13:33:55 +0200 Subject: [PATCH] Fix compilation errors in AsyncStreaming (#459) * Fix compilation errors * Enable traits in CI --- .github/workflows/pull_request.yml | 2 + .../AsyncReader/AsyncReader+collect.swift | 2 +- .../AsyncReader/AsyncReader+forEach.swift | 4 +- .../AsyncReader/AsyncReader+pipe.swift | 2 +- .../AsyncReader/AsyncReader.swift | 2 +- .../AsyncWriter/AsyncWriter.swift | 4 +- .../AsyncWriterCallerAsyncWriterAdapter.swift | 4 +- .../CallerAsyncReader+pipe.swift | 2 +- .../CallerAsyncReader/CallerAsyncReader.swift | 2 +- .../CallerAsyncWriter/CallerAsyncWriter.swift | 4 +- .../CallerAsyncWriterAsyncWriterAdapter.swift | 4 +- .../DuplexChannel/DuplexAsyncChannel.swift | 12 +++--- ...rSingleConsumerAsyncChannel+Internal.swift | 12 +++--- ...tiProducerSingleConsumerAsyncChannel.swift | 12 +++--- .../AsyncReader+collectTests.swift | 11 +++++ .../AsyncReader+forEachTests.swift | 8 ++++ .../AsyncReader/AsyncReader+pipe.swift | 24 +++++------ ...cWriterCallerAsyncWriterAdapterTests.swift | 8 ++-- .../AsyncWriter/AsyncWriterTests.swift | 7 ++++ .../CallerAsyncReader+pipe.swift | 12 +++--- .../CallerAsyncReaderTests.swift | 4 ++ ...erAsyncWriterAsyncWriterAdapterTests.swift | 8 ++-- .../CallerAsyncWriterTests.swift | 3 ++ .../DuplexAsyncChannelTests.swift | 40 +++++++++---------- .../Helpers/Array+Span.swift | 1 + .../Helpers/UniqueArrayAsyncWriter.swift | 1 + .../UniqueArrayCallerAsyncReader.swift | 1 + .../UniqueArrayCallerAsyncWriter.swift | 1 + ...ducerSingleConsumerAsyncChannelTests.swift | 38 +++++++++--------- 29 files changed, 137 insertions(+), 98 deletions(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 1d0f335..adcd3ef 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -15,6 +15,8 @@ jobs: linux_exclude_swift_versions: "[{\"swift_version\": \"5.9\"}, {\"swift_version\": \"5.10\"}]]" windows_exclude_swift_versions: "[{\"swift_version\": \"5.9\"}]" enable_wasm_sdk_build: true + swift_flags: "--enable-all-traits" + swift_nightly_flags: "--enable-all-traits" soundness: name: Soundness diff --git a/Sources/AsyncStreaming/AsyncReader/AsyncReader+collect.swift b/Sources/AsyncStreaming/AsyncReader/AsyncReader+collect.swift index 885eb90..4d6f247 100644 --- a/Sources/AsyncStreaming/AsyncReader/AsyncReader+collect.swift +++ b/Sources/AsyncStreaming/AsyncReader/AsyncReader+collect.swift @@ -25,7 +25,7 @@ public struct AsyncReaderInsufficientElementsError: Error, Hashable { public init() {} } -@available(macOS 10.14.4, iOS 12.2, watchOS 5.2, tvOS 12.2, *) +@available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) extension AsyncReader where Self: ~Copyable, Self: ~Escapable, ReadElement: ~Copyable { /// Collects elements from the reader into the provided container, up to the /// container's available space. diff --git a/Sources/AsyncStreaming/AsyncReader/AsyncReader+forEach.swift b/Sources/AsyncStreaming/AsyncReader/AsyncReader+forEach.swift index 297b7b8..dcf873b 100644 --- a/Sources/AsyncStreaming/AsyncReader/AsyncReader+forEach.swift +++ b/Sources/AsyncStreaming/AsyncReader/AsyncReader+forEach.swift @@ -11,10 +11,10 @@ #if UnstableAsyncStreaming && compiler(>=6.4) -public import ContainersPreview +import ContainersPreview // swift-format-ignore: AmbiguousTrailingClosureOverload -@available(macOS 10.14.4, iOS 12.2, watchOS 5.2, tvOS 12.2, *) +@available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) extension AsyncReader where Self: ~Copyable, Self: ~Escapable { /// Iterates over all chunks from the reader, executing the provided body for /// each buffer until the stream signals end-of-stream. diff --git a/Sources/AsyncStreaming/AsyncReader/AsyncReader+pipe.swift b/Sources/AsyncStreaming/AsyncReader/AsyncReader+pipe.swift index 3b283d6..ac0d45c 100644 --- a/Sources/AsyncStreaming/AsyncReader/AsyncReader+pipe.swift +++ b/Sources/AsyncStreaming/AsyncReader/AsyncReader+pipe.swift @@ -25,7 +25,7 @@ import ContainersPreview // writer across the read closure boundary) the constraint should be added // back so `pipe` works for `~Escapable` writers too. -@available(macOS 10.14.4, iOS 12.2, watchOS 5.2, tvOS 12.2, *) +@available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) extension AsyncReader where Self: ~Copyable, Self: ~Escapable, Self.ReadElement: ~Copyable { /// Pipes all elements from this reader into the given writer, fusing the /// terminal chunk with a `finish` on the writer. diff --git a/Sources/AsyncStreaming/AsyncReader/AsyncReader.swift b/Sources/AsyncStreaming/AsyncReader/AsyncReader.swift index ceabc60..cae817d 100644 --- a/Sources/AsyncStreaming/AsyncReader/AsyncReader.swift +++ b/Sources/AsyncStreaming/AsyncReader/AsyncReader.swift @@ -33,7 +33,7 @@ public import ContainersPreview /// /// After the reader has emitted a non-`nil` `finalElement`, calling /// ``read(body:)`` again is a programmer error. -@available(macOS 10.14.4, iOS 12.2, watchOS 5.2, tvOS 12.2, *) +@available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) public protocol AsyncReader: ~Copyable, ~Escapable { /// The type of elements this reader reads. // TODO: Check if we should support ~Escapable elements diff --git a/Sources/AsyncStreaming/AsyncWriter/AsyncWriter.swift b/Sources/AsyncStreaming/AsyncWriter/AsyncWriter.swift index b4cf366..11b9d46 100644 --- a/Sources/AsyncStreaming/AsyncWriter/AsyncWriter.swift +++ b/Sources/AsyncStreaming/AsyncWriter/AsyncWriter.swift @@ -29,7 +29,7 @@ public import ContainersPreview /// type to carry data along with the end signal, or `Never` for endless /// streams. When ``FinalElement`` is `Never`, ``finish(finalElement:)`` cannot /// be called and the writer can be written to indefinitely. -@available(macOS 10.14.4, iOS 12.2, watchOS 5.2, tvOS 12.2, *) +@available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) public protocol AsyncWriter: ~Copyable, ~Escapable { /// The type of elements this writer writes. // TODO: Check if we should support ~Escapable elements @@ -91,7 +91,7 @@ public protocol AsyncWriter: ~Copyable ) async throws(WriteFailure) } -@available(macOS 10.14.4, iOS 12.2, watchOS 5.2, tvOS 12.2, *) +@available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) extension AsyncWriter where Self: ~Copyable, Self: ~Escapable, FinalElement == Void { /// Concludes the writer with no payload. /// diff --git a/Sources/AsyncStreaming/AsyncWriter/AsyncWriterCallerAsyncWriterAdapter.swift b/Sources/AsyncStreaming/AsyncWriter/AsyncWriterCallerAsyncWriterAdapter.swift index 4ec9408..43136bc 100644 --- a/Sources/AsyncStreaming/AsyncWriter/AsyncWriterCallerAsyncWriterAdapter.swift +++ b/Sources/AsyncStreaming/AsyncWriter/AsyncWriterCallerAsyncWriterAdapter.swift @@ -24,7 +24,7 @@ public import ContainersPreview /// from the caller-supplied buffer into the underlying writer's /// closure-supplied buffer. The underlying writer's deferred-flush /// behavior, if any, is preserved. -@available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) +@available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) public struct AsyncWriterCallerAsyncWriterAdapter< Underlying: AsyncWriter & ~Copyable >: ~Copyable, CallerAsyncWriter { @@ -77,7 +77,7 @@ public struct AsyncWriterCallerAsyncWriterAdapter< } } -@available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) +@available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) extension AsyncWriter where Self: ~Copyable { /// Adapts this ``AsyncWriter`` to a ``CallerAsyncWriter``. /// diff --git a/Sources/AsyncStreaming/CallerAsyncReader/CallerAsyncReader+pipe.swift b/Sources/AsyncStreaming/CallerAsyncReader/CallerAsyncReader+pipe.swift index 6bc17a6..d150db7 100644 --- a/Sources/AsyncStreaming/CallerAsyncReader/CallerAsyncReader+pipe.swift +++ b/Sources/AsyncStreaming/CallerAsyncReader/CallerAsyncReader+pipe.swift @@ -26,7 +26,7 @@ import BasicContainers // capturing the writer across the closure boundary) the constraint should be // added back so `pipe` works for `~Escapable` writers too. -@available(macOS 10.14.4, iOS 12.2, watchOS 5.2, tvOS 12.2, *) +@available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) extension CallerAsyncReader where Self: ~Copyable, Self: ~Escapable, Self.ReadElement: ~Copyable { /// Pipes all elements from this reader into the given writer, then signals /// end-of-stream with a `finish` call on the writer. diff --git a/Sources/AsyncStreaming/CallerAsyncReader/CallerAsyncReader.swift b/Sources/AsyncStreaming/CallerAsyncReader/CallerAsyncReader.swift index 51b3aa6..d43914d 100644 --- a/Sources/AsyncStreaming/CallerAsyncReader/CallerAsyncReader.swift +++ b/Sources/AsyncStreaming/CallerAsyncReader/CallerAsyncReader.swift @@ -32,7 +32,7 @@ public import ContainersPreview /// /// After the reader has returned a non-`nil` `FinalElement`, calling /// ``read(into:)`` again is a programmer error. -@available(macOS 10.14.4, iOS 12.2, watchOS 5.2, tvOS 12.2, *) +@available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) public protocol CallerAsyncReader: ~Copyable, ~Escapable { /// The type of elements this reader reads. // TODO: Check if we should support ~Escapable elements diff --git a/Sources/AsyncStreaming/CallerAsyncWriter/CallerAsyncWriter.swift b/Sources/AsyncStreaming/CallerAsyncWriter/CallerAsyncWriter.swift index 9b4ec26..96c1f78 100644 --- a/Sources/AsyncStreaming/CallerAsyncWriter/CallerAsyncWriter.swift +++ b/Sources/AsyncStreaming/CallerAsyncWriter/CallerAsyncWriter.swift @@ -35,7 +35,7 @@ import BasicContainers /// Conformers must accept zero, one, or many `write(buffer:)` calls, optionally /// followed by a single `finish(buffer:finalElement:)` call. After `finish` /// returns, the writer is consumed and no further calls are valid. -@available(macOS 10.14.4, iOS 12.2, watchOS 5.2, tvOS 12.2, *) +@available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) public protocol CallerAsyncWriter: ~Copyable, ~Escapable { /// The type of elements this writer writes. // TODO: Check if we should support ~Escapable elements @@ -90,7 +90,7 @@ public protocol CallerAsyncWriter: ~Co ) async throws(WriteFailure) where Buffer.Element: ~Copyable } -@available(macOS 26.2, iOS 26.2, watchOS 26.2, tvOS 26.2, visionOS 26.2, *) +@available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) extension CallerAsyncWriter where Self: ~Copyable, Self: ~Escapable, FinalElement == Void { /// Concludes the writer with no final buffer and no extra payload. /// diff --git a/Sources/AsyncStreaming/CallerAsyncWriter/CallerAsyncWriterAsyncWriterAdapter.swift b/Sources/AsyncStreaming/CallerAsyncWriter/CallerAsyncWriterAsyncWriterAdapter.swift index 18d3400..1b5293c 100644 --- a/Sources/AsyncStreaming/CallerAsyncWriter/CallerAsyncWriterAsyncWriterAdapter.swift +++ b/Sources/AsyncStreaming/CallerAsyncWriter/CallerAsyncWriterAsyncWriterAdapter.swift @@ -27,7 +27,7 @@ public import BasicContainers /// ``CallerAsyncWriter/finish(buffer:finalElement:)`` always receives an /// empty buffer. Conformers that need fused close should implement /// ``AsyncWriter`` directly rather than going through this adapter. -@available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) +@available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) public struct CallerAsyncWriterAsyncWriterAdapter< Underlying: CallerAsyncWriter & ~Copyable, Buffer: DynamicContainer & ~Copyable @@ -76,7 +76,7 @@ public struct CallerAsyncWriterAsyncWriterAdapter< } } -@available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) +@available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) extension CallerAsyncWriter where Self: ~Copyable { /// Adapts this ``CallerAsyncWriter`` to an ``AsyncWriter``, using /// ``UniqueArray`` as the buffer container. diff --git a/Sources/AsyncStreaming/DuplexChannel/DuplexAsyncChannel.swift b/Sources/AsyncStreaming/DuplexChannel/DuplexAsyncChannel.swift index 5c6e330..cccceeb 100644 --- a/Sources/AsyncStreaming/DuplexChannel/DuplexAsyncChannel.swift +++ b/Sources/AsyncStreaming/DuplexChannel/DuplexAsyncChannel.swift @@ -47,7 +47,7 @@ public import ContainersPreview /// Each direction's writer terminates its half of the channel /// independently by calling ``Writer/finish(finalElement:)`` or /// ``Writer/finish(throwing:)``. -@available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) +@available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) public struct DuplexAsyncChannel< Element: Sendable, FinalElement: Sendable, @@ -129,7 +129,7 @@ public struct DuplexAsyncChannel< } } -@available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) +@available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) extension DuplexAsyncChannel where FinalElement == Void { /// Creates a new duplex channel with a `Void` end-of-stream payload and /// runs `body` with all four handles. @@ -164,7 +164,7 @@ extension DuplexAsyncChannel where FinalElement == Void { // MARK: - Backpressure strategy -@available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) +@available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) extension DuplexAsyncChannel { /// A backpressure strategy applied independently to each direction of /// the duplex. @@ -228,7 +228,7 @@ extension DuplexAsyncChannel { // MARK: - Writer -@available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) +@available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) extension DuplexAsyncChannel { /// The writer half of one side of a ``DuplexAsyncChannel``. /// @@ -392,7 +392,7 @@ extension DuplexAsyncChannel { } } -@available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) +@available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) extension DuplexAsyncChannel.Writer where FinalElement == Void { /// Finishes this direction with an empty `Void` end-of-stream payload. /// @@ -407,7 +407,7 @@ extension DuplexAsyncChannel.Writer where FinalElement == Void { // MARK: - Reader -@available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) +@available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) extension DuplexAsyncChannel { /// The reader half of one side of a ``DuplexAsyncChannel``. /// diff --git a/Sources/AsyncStreaming/MultiProducerSingleConsumerChannel/MultiProducerSingleConsumerAsyncChannel+Internal.swift b/Sources/AsyncStreaming/MultiProducerSingleConsumerChannel/MultiProducerSingleConsumerAsyncChannel+Internal.swift index 7dc5510..2efc888 100644 --- a/Sources/AsyncStreaming/MultiProducerSingleConsumerChannel/MultiProducerSingleConsumerAsyncChannel+Internal.swift +++ b/Sources/AsyncStreaming/MultiProducerSingleConsumerChannel/MultiProducerSingleConsumerAsyncChannel+Internal.swift @@ -14,7 +14,7 @@ public import DequeModule public import Synchronization public import ContainersPreview -@available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) +@available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) extension MultiProducerSingleConsumerAsyncChannel { @usableFromInline enum _InternalBackpressureStrategy: Sendable, CustomStringConvertible { @@ -105,7 +105,7 @@ extension MultiProducerSingleConsumerAsyncChannel { } } -@available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) +@available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) extension MultiProducerSingleConsumerAsyncChannel { @usableFromInline final class _Storage: Sendable { @@ -308,7 +308,7 @@ extension MultiProducerSingleConsumerAsyncChannel { } } -@available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) +@available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) extension MultiProducerSingleConsumerAsyncChannel._Storage { @usableFromInline struct _StateMachine: ~Copyable, Sendable { @@ -888,7 +888,7 @@ extension MultiProducerSingleConsumerAsyncChannel._Storage { } } -@available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) +@available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) extension MultiProducerSingleConsumerAsyncChannel._Storage._StateMachine { @usableFromInline enum _State: ~Copyable, Sendable { @@ -1012,7 +1012,7 @@ extension MultiProducerSingleConsumerAsyncChannel._Storage._StateMachine { } /// A producer suspended waiting for backpressure to allow further sends. -@available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) +@available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @usableFromInline enum _MultiProducerSingleConsumerSuspendedProducer: @unchecked Sendable { case closure((Result) -> Void) @@ -1022,7 +1022,7 @@ enum _MultiProducerSingleConsumerSuspendedProducer: @unchecked Sendable { /// Helper to move a non-Sendable value across isolation regions (mirror of /// the helper in AsyncAlgorithms; kept private to AsyncStreaming to avoid /// reaching into another module's internals). -@available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) +@available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @usableFromInline struct _Disconnected: ~Copyable, Sendable { private nonisolated(unsafe) var value: Value diff --git a/Sources/AsyncStreaming/MultiProducerSingleConsumerChannel/MultiProducerSingleConsumerAsyncChannel.swift b/Sources/AsyncStreaming/MultiProducerSingleConsumerChannel/MultiProducerSingleConsumerAsyncChannel.swift index e86e5b4..d46e2a9 100644 --- a/Sources/AsyncStreaming/MultiProducerSingleConsumerChannel/MultiProducerSingleConsumerAsyncChannel.swift +++ b/Sources/AsyncStreaming/MultiProducerSingleConsumerChannel/MultiProducerSingleConsumerAsyncChannel.swift @@ -32,7 +32,7 @@ public import ContainersPreview /// end-of-stream signal. A producer terminates the channel by calling /// either ``Source/finish(finalElement:)`` to signal end-of-stream /// or ``Source/finish(throwing:)`` to terminate with a failure. -@available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) +@available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) public struct MultiProducerSingleConsumerAsyncChannel< Element, FinalElement, @@ -95,7 +95,7 @@ public struct MultiProducerSingleConsumerAsyncChannel< } } -@available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) +@available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) extension MultiProducerSingleConsumerAsyncChannel where FinalElement == Void { /// Creates a new channel with a `Void` end-of-stream payload and runs /// `body` with the channel and its initial source. @@ -125,7 +125,7 @@ extension MultiProducerSingleConsumerAsyncChannel where FinalElement == Void { } } -@available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) +@available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) extension MultiProducerSingleConsumerAsyncChannel { /// A handle for sending elements to the channel. public struct Source: ~Copyable, Sendable { @@ -289,7 +289,7 @@ extension MultiProducerSingleConsumerAsyncChannel { } } -@available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) +@available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) extension MultiProducerSingleConsumerAsyncChannel.Source where FinalElement == Void { /// Finishes the channel with an empty `Void` end-of-stream payload. /// @@ -304,7 +304,7 @@ extension MultiProducerSingleConsumerAsyncChannel.Source where FinalElement == V // MARK: - Reading -@available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) +@available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) extension MultiProducerSingleConsumerAsyncChannel { /// Reads the next chunk of elements from the channel. /// @@ -409,7 +409,7 @@ extension MultiProducerSingleConsumerAsyncChannel { /// An error that ``MultiProducerSingleConsumerAsyncChannel/Source/write(buffer:)`` /// throws when its source has already finished. -@available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) +@available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) public struct MultiProducerSingleConsumerAsyncChannelAlreadyFinishedError: Error { @usableFromInline init() {} diff --git a/Tests/AsyncStreamingTests/AsyncReader/AsyncReader+collectTests.swift b/Tests/AsyncStreamingTests/AsyncReader/AsyncReader+collectTests.swift index 04aebc9..6160b2e 100644 --- a/Tests/AsyncStreamingTests/AsyncReader/AsyncReader+collectTests.swift +++ b/Tests/AsyncStreamingTests/AsyncReader/AsyncReader+collectTests.swift @@ -18,6 +18,7 @@ import Testing @Suite struct AsyncReaderCollectIntoTests { + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func collectFillsTargetWhenReaderHasFewerElements() async throws { let reader = UniqueArrayAsyncReader(storage: UniqueArray(capacity: 3, copying: [1, 2, 3])) @@ -31,6 +32,7 @@ struct AsyncReaderCollectIntoTests { #expect(collected == [1, 2, 3]) } + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func collectFillsTargetWhenReaderHasExactlyFreeCapacityElements() async throws { let reader = UniqueArrayAsyncReader(storage: UniqueArray(capacity: 3, copying: [1, 2, 3])) @@ -41,6 +43,7 @@ struct AsyncReaderCollectIntoTests { #expect(target.count == 3) } + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func collectThrowsWhenReaderProducesMoreThanFreeCapacity() async throws { let reader = UniqueArrayAsyncReader(storage: UniqueArray(capacity: 5, copying: [1, 2, 3, 4, 5])) @@ -55,6 +58,7 @@ struct AsyncReaderCollectIntoTests { } } + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func collectIntoEmptyReader() async throws { let reader = UniqueArrayAsyncReader(storage: UniqueArray(capacity: 0, copying: [])) @@ -68,6 +72,7 @@ struct AsyncReaderCollectIntoTests { @Suite struct AsyncReaderCollectExactlyTests { + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func collectExactlyFillsTargetWhenReaderProducesExactCount() async throws { let reader = UniqueArrayAsyncReader(storage: UniqueArray(capacity: 3, copying: [1, 2, 3])) @@ -81,6 +86,7 @@ struct AsyncReaderCollectExactlyTests { #expect(collected == [1, 2, 3]) } + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func collectExactlyThrowsWhenReaderProducesFewer() async throws { let reader = UniqueArrayAsyncReader(storage: UniqueArray(capacity: 3, copying: [1, 2, 3])) @@ -98,6 +104,7 @@ struct AsyncReaderCollectExactlyTests { } } + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func collectExactlyThrowsWhenReaderProducesMore() async throws { let reader = UniqueArrayAsyncReader(storage: UniqueArray(capacity: 5, copying: [1, 2, 3, 4, 5])) @@ -118,6 +125,7 @@ struct AsyncReaderCollectExactlyTests { @Suite struct AsyncReaderCollectIntoMaximumSizeTests { + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func collectGrowsContainerWhenReaderHasFewerThanMaximum() async throws { let reader = UniqueArrayAsyncReader(storage: UniqueArray(capacity: 3, copying: [1, 2, 3])) @@ -131,6 +139,7 @@ struct AsyncReaderCollectIntoMaximumSizeTests { #expect(collected == [1, 2, 3]) } + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func collectFillsContainerExactlyAtMaximum() async throws { let reader = UniqueArrayAsyncReader(storage: UniqueArray(capacity: 3, copying: [10, 20, 30])) @@ -141,6 +150,7 @@ struct AsyncReaderCollectIntoMaximumSizeTests { #expect(target.count == 3) } + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func collectThrowsWhenReaderProducesMoreThanMaximum() async throws { let reader = UniqueArrayAsyncReader(storage: UniqueArray(capacity: 5, copying: [1, 2, 3, 4, 5])) @@ -155,6 +165,7 @@ struct AsyncReaderCollectIntoMaximumSizeTests { } } + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func collectAppendsToExistingContents() async throws { let reader = UniqueArrayAsyncReader(storage: UniqueArray(capacity: 2, copying: [3, 4])) diff --git a/Tests/AsyncStreamingTests/AsyncReader/AsyncReader+forEachTests.swift b/Tests/AsyncStreamingTests/AsyncReader/AsyncReader+forEachTests.swift index ec62135..3555830 100644 --- a/Tests/AsyncStreamingTests/AsyncReader/AsyncReader+forEachTests.swift +++ b/Tests/AsyncStreamingTests/AsyncReader/AsyncReader+forEachTests.swift @@ -18,6 +18,7 @@ import Testing @Suite struct AsyncReaderforEachBufferTests { + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func forEachBufferIteratesAllSpans() async throws { let reader = UniqueArrayAsyncReader(storage: UniqueArray(capacity: 5, copying: [1, 2, 3, 4, 5])) @@ -30,6 +31,7 @@ struct AsyncReaderforEachBufferTests { #expect(elementCount == 5) } + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func forEachBufferProcessesElements() async throws { let reader = UniqueArrayAsyncReader(storage: UniqueArray(capacity: 3, copying: [10, 20, 30])) @@ -44,6 +46,7 @@ struct AsyncReaderforEachBufferTests { #expect(sum == 60) } + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func forEachBufferWithEmptyReader() async throws { let reader = UniqueArrayAsyncReader(storage: UniqueArray(capacity: 0, copying: [])) @@ -57,6 +60,7 @@ struct AsyncReaderforEachBufferTests { #expect(callCount == 0) } + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func forEachBufferDoesNotInvokeBodyWithEmptyTerminalBuffer() async throws { let reader = UniqueArrayAsyncReader(storage: UniqueArray(capacity: 0, copying: [])) @@ -69,6 +73,7 @@ struct AsyncReaderforEachBufferTests { #expect(observedCounts.allSatisfy { $0 > 0 }) } + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func forEachBufferThrowingDoesNotInvokeBodyWithEmptyTerminalBuffer() async throws { enum TestError: Error {} @@ -83,6 +88,7 @@ struct AsyncReaderforEachBufferTests { #expect(observedCounts.allSatisfy { $0 > 0 }) } + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func forEachBufferWithThrowingBody() async { enum TestError: Error { @@ -101,6 +107,7 @@ struct AsyncReaderforEachBufferTests { } } + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func forEachBufferWithNeverFailingReader() async { enum TestError: Error { @@ -121,6 +128,7 @@ struct AsyncReaderforEachBufferTests { #expect(count == 3) } + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func forEachBufferWithAsyncWork() async throws { let reader = UniqueArrayAsyncReader(storage: UniqueArray(capacity: 3, copying: [1, 2, 3])) diff --git a/Tests/AsyncStreamingTests/AsyncReader/AsyncReader+pipe.swift b/Tests/AsyncStreamingTests/AsyncReader/AsyncReader+pipe.swift index ad80e6a..f501bbb 100644 --- a/Tests/AsyncStreamingTests/AsyncReader/AsyncReader+pipe.swift +++ b/Tests/AsyncStreamingTests/AsyncReader/AsyncReader+pipe.swift @@ -19,7 +19,7 @@ import Testing struct AsyncReaderPipeTests { // MARK: - pipe(into:) — into a CallerAsyncWriter - @available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func pipeIntoCopiesAllElements() async throws { try await DuplexAsyncChannel.withDuplex( @@ -33,7 +33,7 @@ struct AsyncReaderPipeTests { var array = UniqueArray(copying: [1, 2, 3, 4, 5]) try await writerA.write(buffer: &array) - writerA.finish() + try await writerA.finish() try await readerB.pipe(into: writerB) var target = RigidArray(capacity: 5) @@ -42,7 +42,7 @@ struct AsyncReaderPipeTests { } } - @available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func pipeIntoWithEmptyReader() async throws { try await DuplexAsyncChannel.withDuplex( @@ -54,7 +54,7 @@ struct AsyncReaderPipeTests { let writerB = writerB let readerB = readerB - writerA.finish() + try await writerA.finish() try await readerB.pipe(into: writerB) var target = RigidArray(capacity: 5) @@ -63,7 +63,7 @@ struct AsyncReaderPipeTests { } } - @available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func pipeIntoPreservesElementOrder() async throws { try await DuplexAsyncChannel.withDuplex( @@ -78,7 +78,7 @@ struct AsyncReaderPipeTests { let elements = Array(1...50) var array = UniqueArray(copying: elements) try await writerA.write(buffer: &array) - writerA.finish() + try await writerA.finish() try await readerB.pipe(into: writerB) var target = RigidArray(capacity: 50) @@ -89,7 +89,7 @@ struct AsyncReaderPipeTests { // MARK: - pipe(copyingInto:) — into an AsyncWriter via the adapter - @available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func pipeCopyingIntoCopiesAllElements() async throws { try await DuplexAsyncChannel.withDuplex( @@ -103,7 +103,7 @@ struct AsyncReaderPipeTests { var array = UniqueArray(copying: [1, 2, 3, 4, 5]) try await writerA.write(buffer: &array) - writerA.finish() + try await writerA.finish() try await readerB.pipe(copyingInto: writerB.asAsyncWriter()) var target = RigidArray(capacity: 5) @@ -112,7 +112,7 @@ struct AsyncReaderPipeTests { } } - @available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func pipeCopyingIntoWithEmptyReader() async throws { try await DuplexAsyncChannel.withDuplex( @@ -124,7 +124,7 @@ struct AsyncReaderPipeTests { let writerB = writerB let readerB = readerB - writerA.finish() + try await writerA.finish() try await readerB.pipe(copyingInto: writerB.asAsyncWriter()) var target = RigidArray(capacity: 5) @@ -133,7 +133,7 @@ struct AsyncReaderPipeTests { } } - @available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func pipeCopyingIntoChunksTerminalChunkAcrossMultipleWrites() async throws { // 200 elements through a small (16-element) AsyncWriter buffer @@ -150,7 +150,7 @@ struct AsyncReaderPipeTests { let elements = Array(1...200) var array = UniqueArray(copying: elements) try await writerA.write(buffer: &array) - writerA.finish() + try await writerA.finish() try await readerB.pipe(copyingInto: writerB.asAsyncWriter(initialCapacity: 16)) var target = RigidArray(capacity: 200) diff --git a/Tests/AsyncStreamingTests/AsyncWriter/AsyncWriterCallerAsyncWriterAdapterTests.swift b/Tests/AsyncStreamingTests/AsyncWriter/AsyncWriterCallerAsyncWriterAdapterTests.swift index 917959b..f331d85 100644 --- a/Tests/AsyncStreamingTests/AsyncWriter/AsyncWriterCallerAsyncWriterAdapterTests.swift +++ b/Tests/AsyncStreamingTests/AsyncWriter/AsyncWriterCallerAsyncWriterAdapterTests.swift @@ -23,7 +23,7 @@ struct AsyncWriterCallerAsyncWriterAdapterTests { // asAsyncWriter() to get an AsyncWriter, then wrap THAT via // asCallerAsyncWriter() to exercise this adapter end-to-end. - @available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func writeAndFinishRoundTrip() async throws { try await DuplexAsyncChannel.withDuplex( @@ -45,7 +45,7 @@ struct AsyncWriterCallerAsyncWriterAdapterTests { } } - @available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func writeLoopsAcrossMultipleUnderlyingBuffers() async throws { // The CallerAsyncWriterAsyncWriterAdapter underneath uses a @@ -75,7 +75,7 @@ struct AsyncWriterCallerAsyncWriterAdapterTests { } } - @available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func finishWithoutWriteDeliversEmptyTerminator() async throws { try await DuplexAsyncChannel.withDuplex( @@ -95,7 +95,7 @@ struct AsyncWriterCallerAsyncWriterAdapterTests { } } - @available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func finishDeliversTrailingBufferAndPayload() async throws { try await DuplexAsyncChannel.withDuplex( diff --git a/Tests/AsyncStreamingTests/AsyncWriter/AsyncWriterTests.swift b/Tests/AsyncStreamingTests/AsyncWriter/AsyncWriterTests.swift index 0c89577..f1e678c 100644 --- a/Tests/AsyncStreamingTests/AsyncWriter/AsyncWriterTests.swift +++ b/Tests/AsyncStreamingTests/AsyncWriter/AsyncWriterTests.swift @@ -17,6 +17,7 @@ import Testing @Suite struct AsyncWriterTests { + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func writeElements() async { var writer = UniqueArrayAsyncWriter() @@ -33,6 +34,7 @@ struct AsyncWriterTests { #expect(writer.storage[2] == 3) } + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func writeEmptyBuffer() async { var writer = UniqueArrayAsyncWriter() @@ -42,6 +44,7 @@ struct AsyncWriterTests { #expect(writer.storage.count == 0) } + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func writeReturnsValue() async { var writer = UniqueArrayAsyncWriter() @@ -56,6 +59,7 @@ struct AsyncWriterTests { #expect(writer.storage.count == 2) } + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func writeWithThrowingBody() async { enum TestError: Error, Equatable { @@ -74,6 +78,7 @@ struct AsyncWriterTests { } } + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func writeMultipleTimes() async { var writer = UniqueArrayAsyncWriter() @@ -95,12 +100,14 @@ struct AsyncWriterTests { #expect(writer.storage[3] == 4) } + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func finishVoidConvenience() async { let writer = UniqueArrayAsyncWriter() await writer.finish() } + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func finishDeliversFinalElement() async { let writer = UniqueArrayAsyncWriter() diff --git a/Tests/AsyncStreamingTests/CallerAsyncReader/CallerAsyncReader+pipe.swift b/Tests/AsyncStreamingTests/CallerAsyncReader/CallerAsyncReader+pipe.swift index bb014a6..7f9303d 100644 --- a/Tests/AsyncStreamingTests/CallerAsyncReader/CallerAsyncReader+pipe.swift +++ b/Tests/AsyncStreamingTests/CallerAsyncReader/CallerAsyncReader+pipe.swift @@ -19,7 +19,7 @@ import Testing struct CallerAsyncReaderPipeTests { // MARK: - pipe(into:) — into an AsyncWriter via the adapter - @available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func pipeIntoCopiesAllElements() async throws { try await DuplexAsyncChannel.withDuplex( @@ -40,7 +40,7 @@ struct CallerAsyncReaderPipeTests { } } - @available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func pipeIntoWithEmptyReader() async throws { try await DuplexAsyncChannel.withDuplex( @@ -59,7 +59,7 @@ struct CallerAsyncReaderPipeTests { } } - @available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func pipeIntoLoopsAcrossMultipleBuffers() async throws { // 200 elements through a small AsyncWriter buffer forces the pipe @@ -85,7 +85,7 @@ struct CallerAsyncReaderPipeTests { // MARK: - pipe(bufferingInto:) — into a CallerAsyncWriter - @available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func pipeBufferingIntoCopiesAllElements() async throws { try await DuplexAsyncChannel.withDuplex( @@ -106,7 +106,7 @@ struct CallerAsyncReaderPipeTests { } } - @available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func pipeBufferingIntoWithEmptyReader() async throws { try await DuplexAsyncChannel.withDuplex( @@ -125,7 +125,7 @@ struct CallerAsyncReaderPipeTests { } } - @available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func pipeBufferingIntoReusesIntermediateBufferAcrossMultipleIterations() async throws { // 100 elements through a 16-element intermediate buffer forces the diff --git a/Tests/AsyncStreamingTests/CallerAsyncReader/CallerAsyncReaderTests.swift b/Tests/AsyncStreamingTests/CallerAsyncReader/CallerAsyncReaderTests.swift index cc541b5..96e5b94 100644 --- a/Tests/AsyncStreamingTests/CallerAsyncReader/CallerAsyncReaderTests.swift +++ b/Tests/AsyncStreamingTests/CallerAsyncReader/CallerAsyncReaderTests.swift @@ -17,6 +17,7 @@ import Testing @Suite struct CallerAsyncReaderTests { + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func readIntoBuffer() async { var reader = UniqueArrayCallerAsyncReader( @@ -34,6 +35,7 @@ struct CallerAsyncReaderTests { #expect(buffer[4] == 5) } + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func readIntoBufferAtEnd() async { var reader = UniqueArrayCallerAsyncReader( @@ -46,6 +48,7 @@ struct CallerAsyncReaderTests { #expect(buffer.count == 0) } + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func readIntoBufferRespectsCapacity() async { var reader = UniqueArrayCallerAsyncReader( @@ -61,6 +64,7 @@ struct CallerAsyncReaderTests { #expect(buffer[2] == 3) } + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func readMultipleTimes() async { var reader = UniqueArrayCallerAsyncReader( diff --git a/Tests/AsyncStreamingTests/CallerAsyncWriter/CallerAsyncWriterAsyncWriterAdapterTests.swift b/Tests/AsyncStreamingTests/CallerAsyncWriter/CallerAsyncWriterAsyncWriterAdapterTests.swift index 8043c6d..bd167f2 100644 --- a/Tests/AsyncStreamingTests/CallerAsyncWriter/CallerAsyncWriterAsyncWriterAdapterTests.swift +++ b/Tests/AsyncStreamingTests/CallerAsyncWriter/CallerAsyncWriterAsyncWriterAdapterTests.swift @@ -21,7 +21,7 @@ struct CallerAsyncWriterAsyncWriterAdapterTests { // we drive it through the duplex's CallerAsyncWriter side and verify // the elements arrive on the peer reader. - @available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func writeAndFinishRoundTrip() async throws { try await DuplexAsyncChannel.withDuplex( @@ -45,7 +45,7 @@ struct CallerAsyncWriterAsyncWriterAdapterTests { } } - @available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func multipleWritesAreFlushedEagerly() async throws { // The adapter must NOT defer the most recent write — each write call @@ -83,7 +83,7 @@ struct CallerAsyncWriterAsyncWriterAdapterTests { } } - @available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func finishWithoutWriteDeliversEmptyTerminator() async throws { try await DuplexAsyncChannel.withDuplex( @@ -102,7 +102,7 @@ struct CallerAsyncWriterAsyncWriterAdapterTests { } } - @available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func customBufferTypePreservesElements() async throws { try await DuplexAsyncChannel.withDuplex( diff --git a/Tests/AsyncStreamingTests/CallerAsyncWriter/CallerAsyncWriterTests.swift b/Tests/AsyncStreamingTests/CallerAsyncWriter/CallerAsyncWriterTests.swift index 76da780..e7bd419 100644 --- a/Tests/AsyncStreamingTests/CallerAsyncWriter/CallerAsyncWriterTests.swift +++ b/Tests/AsyncStreamingTests/CallerAsyncWriter/CallerAsyncWriterTests.swift @@ -17,6 +17,7 @@ import Testing @Suite struct CallerAsyncWriterTests { + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func writeBuffer() async { var writer = UniqueArrayCallerAsyncWriter() @@ -27,6 +28,7 @@ struct CallerAsyncWriterTests { #expect(writer.storage.count == 5) } + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func writeEmptyBuffer() async { var writer = UniqueArrayCallerAsyncWriter() @@ -37,6 +39,7 @@ struct CallerAsyncWriterTests { #expect(writer.storage.count == 0) } + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func writeLargeBuffer() async { var writer = UniqueArrayCallerAsyncWriter(capacity: 100) diff --git a/Tests/AsyncStreamingTests/DuplexChannel/DuplexAsyncChannelTests.swift b/Tests/AsyncStreamingTests/DuplexChannel/DuplexAsyncChannelTests.swift index 350f44e..9da5143 100644 --- a/Tests/AsyncStreamingTests/DuplexChannel/DuplexAsyncChannelTests.swift +++ b/Tests/AsyncStreamingTests/DuplexChannel/DuplexAsyncChannelTests.swift @@ -21,7 +21,7 @@ import Testing struct DuplexAsyncChannelTests { // MARK: - Round-trip - @available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func roundTripForwardDirection() async throws { try await DuplexAsyncChannel.withDuplex( @@ -45,7 +45,7 @@ struct DuplexAsyncChannelTests { } } - @available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func roundTripReverseDirection() async throws { try await DuplexAsyncChannel.withDuplex( @@ -69,7 +69,7 @@ struct DuplexAsyncChannelTests { } } - @available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func directionsAreIndependent() async throws { // Bytes sent on the forward direction must NOT appear on the side that @@ -107,7 +107,7 @@ struct DuplexAsyncChannelTests { } } - @available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func concurrentReadsOnBothDirections() async throws { try await withThrowingTaskGroup(of: [Int].self) { group in @@ -137,13 +137,13 @@ struct DuplexAsyncChannelTests { var fwd = UniqueArray(minimumCapacity: 10) for i in 0..<10 { fwd.append(i) } try await writerA.write(buffer: &fwd) - writerA.finish() + try await writerA.finish() // Reverse: write 100..<110 from main scope. var rev = UniqueArray(minimumCapacity: 10) for i in 100..<110 { rev.append(i) } try await writerB.write(buffer: &rev) - writerB.finish() + try await writerB.finish() // Drain forward from the main scope. var forwardCollected: [Int] = [] @@ -165,7 +165,7 @@ struct DuplexAsyncChannelTests { // MARK: - Half-close - @available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func finishingOneDirectionLeavesTheOtherOpen() async throws { try await DuplexAsyncChannel.withDuplex( @@ -181,7 +181,7 @@ struct DuplexAsyncChannelTests { var fwdBuf = UniqueArray(minimumCapacity: 1) fwdBuf.append(7) try await writerA.write(buffer: &fwdBuf) - writerA.finish() + try await writerA.finish() // Reverse direction still works. var revBuf = UniqueArray(minimumCapacity: 1) @@ -208,7 +208,7 @@ struct DuplexAsyncChannelTests { // MARK: - Final element - @available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func finalElementDeliveredOnFinish() async throws { try await DuplexAsyncChannel.withDuplex( @@ -244,7 +244,7 @@ struct DuplexAsyncChannelTests { // MARK: - Failure isolation - @available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func failureOnOneDirectionDoesNotPoisonTheOther() async throws { struct TestError: Error, Equatable {} @@ -254,7 +254,7 @@ struct DuplexAsyncChannelTests { throwing: TestError.self, backpressureStrategy: .watermark(low: 2, high: 4) ) { writerA, readerA, writerB, readerB in - var writerA = writerA + let writerA = writerA var readerA = readerA var writerB = writerB var readerB = readerB @@ -263,7 +263,7 @@ struct DuplexAsyncChannelTests { var revBuf = UniqueArray(minimumCapacity: 1) revBuf.append(42) try await writerB.write(buffer: &revBuf) - writerB.finish() + try await writerB.finish() // Fail forward direction. writerA.finish(throwing: TestError()) @@ -293,7 +293,7 @@ struct DuplexAsyncChannelTests { // MARK: - Backpressure isolation - @available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func backpressureOnOneDirectionDoesNotBlockTheOther() async throws { // Forward writer is suspended on backpressure (writes more than the @@ -343,7 +343,7 @@ struct DuplexAsyncChannelTests { // MARK: - Multi-producer per direction - @available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func clonedWriterCanProduceConcurrently() async throws { // Two writes happen sequentially through the original writer and its @@ -371,8 +371,8 @@ struct DuplexAsyncChannelTests { // Either writer can close the direction independently. The other // writer is still alive but the channel is now finishing. - writerA.finish() - clone.finish() + try await writerA.finish() + try await clone.finish() nonisolated(unsafe) var collected = Set() var done = false @@ -389,7 +389,7 @@ struct DuplexAsyncChannelTests { // MARK: - Body-error wrapping - @available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func readBodyErrorsWrappedInSecond() async throws { struct BodyError: Error, Equatable {} @@ -422,7 +422,7 @@ struct DuplexAsyncChannelTests { // MARK: - Scope cleanup - @available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func scopeFinalizesBothDirectionsOnReturn() async throws { nonisolated(unsafe) var aTerminated = false @@ -442,7 +442,7 @@ struct DuplexAsyncChannelTests { // MARK: - Protocol conformance - @available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func writerConformsToCallerAsyncWriter() async throws { // Exercise CallerAsyncWriter.finish(buffer:finalElement:) by calling @@ -486,7 +486,7 @@ struct DuplexAsyncChannelTests { } } - @available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func readerConformsToAsyncReader() async throws { // Exercise AsyncReader.read through a generic function that only diff --git a/Tests/AsyncStreamingTests/Helpers/Array+Span.swift b/Tests/AsyncStreamingTests/Helpers/Array+Span.swift index 3266846..c549504 100644 --- a/Tests/AsyncStreamingTests/Helpers/Array+Span.swift +++ b/Tests/AsyncStreamingTests/Helpers/Array+Span.swift @@ -29,6 +29,7 @@ extension Array { } } + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) init & ~Copyable & ~Escapable>(draining container: inout C) { self.init() var consumer = container.consumeAll() diff --git a/Tests/AsyncStreamingTests/Helpers/UniqueArrayAsyncWriter.swift b/Tests/AsyncStreamingTests/Helpers/UniqueArrayAsyncWriter.swift index b681e9c..35a12d3 100644 --- a/Tests/AsyncStreamingTests/Helpers/UniqueArrayAsyncWriter.swift +++ b/Tests/AsyncStreamingTests/Helpers/UniqueArrayAsyncWriter.swift @@ -14,6 +14,7 @@ import AsyncStreaming import BasicContainers import ContainersPreview +@available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) struct UniqueArrayAsyncWriter: ~Copyable, AsyncWriter { typealias WriteElement = Int typealias Buffer = UniqueArray diff --git a/Tests/AsyncStreamingTests/Helpers/UniqueArrayCallerAsyncReader.swift b/Tests/AsyncStreamingTests/Helpers/UniqueArrayCallerAsyncReader.swift index 3cb7324..d4a92e4 100644 --- a/Tests/AsyncStreamingTests/Helpers/UniqueArrayCallerAsyncReader.swift +++ b/Tests/AsyncStreamingTests/Helpers/UniqueArrayCallerAsyncReader.swift @@ -14,6 +14,7 @@ import AsyncStreaming import BasicContainers import ContainersPreview +@available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) struct UniqueArrayCallerAsyncReader: ~Copyable, CallerAsyncReader { typealias ReadElement = Int typealias ReadFailure = Never diff --git a/Tests/AsyncStreamingTests/Helpers/UniqueArrayCallerAsyncWriter.swift b/Tests/AsyncStreamingTests/Helpers/UniqueArrayCallerAsyncWriter.swift index 37d2484..887dd32 100644 --- a/Tests/AsyncStreamingTests/Helpers/UniqueArrayCallerAsyncWriter.swift +++ b/Tests/AsyncStreamingTests/Helpers/UniqueArrayCallerAsyncWriter.swift @@ -16,6 +16,7 @@ import ContainersPreview struct WriterCapacityError: Error {} +@available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) struct UniqueArrayCallerAsyncWriter: ~Copyable, CallerAsyncWriter { typealias WriteElement = Int typealias WriteFailure = Never diff --git a/Tests/AsyncStreamingTests/MultiProducerSingleConsumerChannel/MultiProducerSingleConsumerAsyncChannelTests.swift b/Tests/AsyncStreamingTests/MultiProducerSingleConsumerChannel/MultiProducerSingleConsumerAsyncChannelTests.swift index 0e381ef..3f323ee 100644 --- a/Tests/AsyncStreamingTests/MultiProducerSingleConsumerChannel/MultiProducerSingleConsumerAsyncChannelTests.swift +++ b/Tests/AsyncStreamingTests/MultiProducerSingleConsumerChannel/MultiProducerSingleConsumerAsyncChannelTests.swift @@ -23,7 +23,7 @@ private struct MultiProducerSingleConsumerAsyncChannelTestError: Error {} struct MultiProducerSingleConsumerAsyncChannelTests { // MARK: - AsyncReader.read - @available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func readReturnsAllBufferedElementsInOrder() async throws { try await MultiProducerSingleConsumerAsyncChannel.withChannel( @@ -47,7 +47,7 @@ struct MultiProducerSingleConsumerAsyncChannelTests { } } - @available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func readSuspendsUntilElementArrives() async throws { try await withThrowingTaskGroup(of: [Int].self) { group in @@ -75,7 +75,7 @@ struct MultiProducerSingleConsumerAsyncChannelTests { } } - @available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func readThrowsCancellationWhenTaskStartsCancelled() async { await withTaskGroup(of: Void.self) { group in @@ -106,7 +106,7 @@ struct MultiProducerSingleConsumerAsyncChannelTests { } } - @available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func readDoesNotThrowCancellationWhenSourceFinishes() async throws { try await MultiProducerSingleConsumerAsyncChannel.withChannel( @@ -126,7 +126,7 @@ struct MultiProducerSingleConsumerAsyncChannelTests { } } - @available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func readAfterCancellationPreconditions() async { await #expect(processExitsWith: .failure) { @@ -149,7 +149,7 @@ struct MultiProducerSingleConsumerAsyncChannelTests { } } - @available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func readAfterFinalElementPreconditions() async { await #expect(processExitsWith: .failure) { @@ -169,7 +169,7 @@ struct MultiProducerSingleConsumerAsyncChannelTests { } } - @available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func readAfterFailurePreconditions() async { await #expect(processExitsWith: .failure) { @@ -188,7 +188,7 @@ struct MultiProducerSingleConsumerAsyncChannelTests { } } - @available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func readReturnsEmptyBufferAndFinalElementOnEOSAfterFinish() async throws { try await MultiProducerSingleConsumerAsyncChannel.withChannel( @@ -216,7 +216,7 @@ struct MultiProducerSingleConsumerAsyncChannelTests { } } - @available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func readThrowsFailureAfterFinishWithError() async throws { struct TestError: Error, Equatable {} @@ -251,7 +251,7 @@ struct MultiProducerSingleConsumerAsyncChannelTests { } } - @available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func readBodyErrorsWrappedInSecond() async throws { struct BodyError: Error, Equatable {} @@ -280,7 +280,7 @@ struct MultiProducerSingleConsumerAsyncChannelTests { } } - @available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func readPartialConsumptionRemainsVisibleOnNextRead() async throws { try await MultiProducerSingleConsumerAsyncChannel.withChannel( @@ -310,7 +310,7 @@ struct MultiProducerSingleConsumerAsyncChannelTests { } } - @available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func readResumesSuspendedProducersWhenWaterLevelDrops() async throws { try await withThrowingTaskGroup(of: Void.self) { group in @@ -350,7 +350,7 @@ struct MultiProducerSingleConsumerAsyncChannelTests { } } - @available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func readWaterLevelForElementCalledPerElementInBatch() async throws { nonisolated(unsafe) var callCount = 0 @@ -383,7 +383,7 @@ struct MultiProducerSingleConsumerAsyncChannelTests { } } - @available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func readBufferIsReusedAcrossReads() async throws { try await MultiProducerSingleConsumerAsyncChannel.withChannel( @@ -435,7 +435,7 @@ struct MultiProducerSingleConsumerAsyncChannelTests { } } - @available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func readDeliversFinalElementOnFinish() async throws { try await MultiProducerSingleConsumerAsyncChannel.withChannel( @@ -470,7 +470,7 @@ struct MultiProducerSingleConsumerAsyncChannelTests { // MARK: - CallerAsyncWriter.write - @available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func writeAppendsAllElementsAndClearsBuffer() async throws { try await MultiProducerSingleConsumerAsyncChannel.withChannel( @@ -498,7 +498,7 @@ struct MultiProducerSingleConsumerAsyncChannelTests { } } - @available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func writeAfterFinishThrows() async throws { await MultiProducerSingleConsumerAsyncChannel.withChannel( @@ -530,7 +530,7 @@ struct MultiProducerSingleConsumerAsyncChannelTests { } } - @available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func writeSuspendsOnBackpressureAndResumesAfterRead() async throws { try await withThrowingTaskGroup(of: Void.self) { group in @@ -562,7 +562,7 @@ struct MultiProducerSingleConsumerAsyncChannelTests { } } - @available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) + @available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) @Test func writeReadRoundtripPreservesOrder() async throws { let total = 100