Browse Source

Enable ExistentialAny for v2 (#1967)

Motivation:

The use of existentials can be made more obvious by enabling
the upcoming 'ExistentialAny' feature.

Modifications:

Enable 'ExistentialAny' and fix warnings.

Result:

Use of existentials is more obvious
George Barnett 1 year ago
parent
commit
e28f11752a
27 changed files with 141 additions and 141 deletions
  1. 15 15
      Package@swift-6.swift
  2. 7 7
      Sources/GRPCCore/Call/Client/Internal/ClientRPCExecutor+HedgingExecutor.swift
  3. 3 3
      Sources/GRPCCore/Call/Client/Internal/ClientRPCExecutor+OneShotExecutor.swift
  4. 5 5
      Sources/GRPCCore/Call/Client/Internal/ClientRPCExecutor+RetryExecutor.swift
  5. 1 1
      Sources/GRPCCore/Call/Client/Internal/ClientStreamExecutor.swift
  6. 1 1
      Sources/GRPCCore/Call/Server/Internal/ServerRPCExecutor.swift
  7. 3 3
      Sources/GRPCCore/Configuration/MethodConfig.swift
  8. 6 6
      Sources/GRPCCore/Configuration/ServiceConfig.swift
  9. 2 2
      Sources/GRPCCore/RPCError.swift
  10. 2 2
      Sources/GRPCCore/RuntimeError.swift
  11. 22 22
      Sources/GRPCCore/Streaming/Internal/BroadcastAsyncSequence.swift
  12. 50 50
      Sources/GRPCCore/Streaming/Internal/BufferedStream.swift
  13. 1 1
      Sources/GRPCCore/Streaming/RPCWriter+Closable.swift
  14. 1 1
      Sources/GRPCCore/Streaming/RPCWriterProtocol.swift
  15. 4 4
      Sources/GRPCHTTP2Core/Client/Connection/ClientConnectionHandler.swift
  16. 1 1
      Sources/GRPCHTTP2Core/Client/Connection/Connection.swift
  17. 6 6
      Sources/GRPCHTTP2Core/Client/Connection/GRPCChannel.swift
  18. 1 1
      Sources/GRPCHTTP2Core/Client/Connection/RequestQueue.swift
  19. 1 1
      Sources/GRPCHTTP2Core/Internal/NIOChannelPipeline+GRPC.swift
  20. 1 1
      Sources/GRPCHTTP2Core/Internal/Timer.swift
  21. 2 2
      Sources/GRPCHTTP2Core/Server/Connection/ServerConnectionManagementHandler.swift
  22. 1 1
      Sources/GRPCHTTP2TransportNIOPosix/HTTP2ServerTransport+Posix.swift
  23. 1 1
      Sources/GRPCHTTP2TransportNIOPosix/NIOClientBootstrap+SocketAddress.swift
  24. 1 1
      Sources/GRPCHTTP2TransportNIOTransportServices/HTTP2ServerTransport+TransportServices.swift
  25. 1 1
      Sources/InteroperabilityTests/InteroperabilityTestCase.swift
  26. 1 1
      Sources/performance-worker/WorkerService.swift
  27. 1 1
      Tests/GRPCProtobufTests/ProtobufCodingTests.swift

+ 15 - 15
Package@swift-6.swift

@@ -193,7 +193,7 @@ extension Target {
         .atomics
       ],
       path: "Sources/GRPCCore",
-      swiftSettings: [.swiftLanguageVersion(.v5)]
+      swiftSettings: [.swiftLanguageVersion(.v5), .enableUpcomingFeature("ExistentialAny")]
     )
   }
 
@@ -203,7 +203,7 @@ extension Target {
       dependencies: [
         .grpcCore
       ],
-      swiftSettings: [.swiftLanguageVersion(.v6)]
+      swiftSettings: [.swiftLanguageVersion(.v6), .enableUpcomingFeature("ExistentialAny")]
     )
   }
 
@@ -214,7 +214,7 @@ extension Target {
         .grpcCore,
         .tracing
       ],
-      swiftSettings: [.swiftLanguageVersion(.v6)]
+      swiftSettings: [.swiftLanguageVersion(.v6), .enableUpcomingFeature("ExistentialAny")]
     )
   }
 
@@ -229,7 +229,7 @@ extension Target {
         .dequeModule,
         .atomics
       ],
-      swiftSettings: [.swiftLanguageVersion(.v6)]
+      swiftSettings: [.swiftLanguageVersion(.v6), .enableUpcomingFeature("ExistentialAny")]
     )
   }
 
@@ -242,7 +242,7 @@ extension Target {
         .nioPosix,
         .nioExtras
       ],
-      swiftSettings: [.swiftLanguageVersion(.v6)]
+      swiftSettings: [.swiftLanguageVersion(.v6), .enableUpcomingFeature("ExistentialAny")]
     )
   }
 
@@ -256,7 +256,7 @@ extension Target {
         .nioExtras,
         .nioTransportServices
       ],
-      swiftSettings: [.swiftLanguageVersion(.v6)]
+      swiftSettings: [.swiftLanguageVersion(.v6), .enableUpcomingFeature("ExistentialAny")]
     )
   }
 
@@ -298,7 +298,7 @@ extension Target {
         .nioFileSystem,
         .argumentParser
       ],
-      swiftSettings: [.swiftLanguageVersion(.v6)]
+      swiftSettings: [.swiftLanguageVersion(.v6), .enableUpcomingFeature("ExistentialAny")]
     )
   }
 
@@ -426,7 +426,7 @@ extension Target {
         .grpcCore,
         .protobuf
       ],
-      swiftSettings: [.swiftLanguageVersion(.v6)]
+      swiftSettings: [.swiftLanguageVersion(.v6), .enableUpcomingFeature("ExistentialAny")]
     )
   }
 
@@ -439,7 +439,7 @@ extension Target {
         .protobuf,
         .protobufPluginLibrary
       ],
-      swiftSettings: [.swiftLanguageVersion(.v6)]
+      swiftSettings: [.swiftLanguageVersion(.v6), .enableUpcomingFeature("ExistentialAny")]
     )
   }
 
@@ -451,7 +451,7 @@ extension Target {
         .interoperabilityTests,
         .grpcCore
       ],
-      swiftSettings: [.swiftLanguageVersion(.v5)]
+      swiftSettings: [.swiftLanguageVersion(.v5), .enableUpcomingFeature("ExistentialAny")]
     )
   }
 
@@ -483,7 +483,7 @@ extension Target {
         .grpcCore,
         .grpcProtobuf
       ],
-      swiftSettings: [.swiftLanguageVersion(.v5)]
+      swiftSettings: [.swiftLanguageVersion(.v5), .enableUpcomingFeature("ExistentialAny")]
     )
   }
 
@@ -497,7 +497,7 @@ extension Target {
         .interoperabilityTests,
         .argumentParser
       ],
-      swiftSettings: [.swiftLanguageVersion(.v6)]
+      swiftSettings: [.swiftLanguageVersion(.v6), .enableUpcomingFeature("ExistentialAny")]
     )
   }
 
@@ -787,7 +787,7 @@ extension Target {
     .target(
       name: "GRPCCodeGen",
       path: "Sources/GRPCCodeGen",
-      swiftSettings: [.swiftLanguageVersion(.v6)]
+      swiftSettings: [.swiftLanguageVersion(.v6), .enableUpcomingFeature("ExistentialAny")]
     )
   }
 
@@ -799,7 +799,7 @@ extension Target {
         .protobuf,
       ],
       path: "Sources/GRPCProtobuf",
-      swiftSettings: [.swiftLanguageVersion(.v6)]
+      swiftSettings: [.swiftLanguageVersion(.v6), .enableUpcomingFeature("ExistentialAny")]
     )
   }
 
@@ -812,7 +812,7 @@ extension Target {
         .grpcCodeGen
       ],
       path: "Sources/GRPCProtobufCodeGen",
-      swiftSettings: [.swiftLanguageVersion(.v6)]
+      swiftSettings: [.swiftLanguageVersion(.v6), .enableUpcomingFeature("ExistentialAny")]
     )
   }
 

+ 7 - 7
Sources/GRPCCore/Call/Client/Internal/ClientRPCExecutor+HedgingExecutor.swift

@@ -158,10 +158,10 @@ extension ClientRPCExecutor.HedgingExecutor {
     method: MethodDescriptor,
     options: CallOptions,
     responseHandler: @Sendable @escaping (ClientResponse.Stream<Output>) async throws -> R
-  ) async -> Result<R, Error> {
+  ) async -> Result<R, any Error> {
     await withTaskGroup(
       of: _HedgingAttemptTaskResult<R, Output>.self,
-      returning: Result<R, Error>.self
+      returning: Result<R, any Error>.self
     ) { group in
       // The strategy here is to have two types of task running in the group:
       // - To execute an RPC attempt.
@@ -508,9 +508,9 @@ extension ClientRPCExecutor.HedgingExecutor {
 @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
 @usableFromInline
 enum _HedgingTaskResult<R> {
-  case rpcHandled(Result<R, Error>)
-  case finishedRequest(Result<Void, Error>)
-  case timedOut(Result<Void, Error>)
+  case rpcHandled(Result<R, any Error>)
+  case finishedRequest(Result<Void, any Error>)
+  case timedOut(Result<Void, any Error>)
 }
 
 @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
@@ -522,8 +522,8 @@ enum _HedgingAttemptTaskResult<R, Output> {
   @usableFromInline
   enum AttemptResult {
     case unusableResponse(ClientResponse.Stream<Output>, Metadata.RetryPushback?)
-    case usableResponse(Result<R, Error>)
-    case noStreamAvailable(Error)
+    case usableResponse(Result<R, any Error>)
+    case noStreamAvailable(any Error)
   }
 
   @usableFromInline

+ 3 - 3
Sources/GRPCCore/Call/Client/Internal/ClientRPCExecutor+OneShotExecutor.swift

@@ -68,7 +68,7 @@ extension ClientRPCExecutor.OneShotExecutor {
   ) async throws -> R {
     let result = await withTaskGroup(
       of: _OneShotExecutorTask<R>.self,
-      returning: Result<R, Error>.self
+      returning: Result<R, any Error>.self
     ) { group in
       do {
         return try await self.transport.withStream(descriptor: method, options: options) { stream in
@@ -146,6 +146,6 @@ extension ClientRPCExecutor.OneShotExecutor {
 @usableFromInline
 enum _OneShotExecutorTask<R> {
   case streamExecutorCompleted
-  case timedOut(Result<Void, Error>)
-  case responseHandled(Result<R, Error>)
+  case timedOut(Result<Void, any Error>)
+  case responseHandled(Result<R, any Error>)
 }

+ 5 - 5
Sources/GRPCCore/Call/Client/Internal/ClientRPCExecutor+RetryExecutor.swift

@@ -91,7 +91,7 @@ extension ClientRPCExecutor.RetryExecutor {
     // retries may be skipped if the throttle is applied.
     let result = await withTaskGroup(
       of: _RetryExecutorTask<R>.self,
-      returning: Result<R, Error>.self
+      returning: Result<R, any Error>.self
     ) { group in
       // Add a task to limit the overall execution time of the RPC.
       if let deadline = self.deadline {
@@ -312,16 +312,16 @@ extension ClientRPCExecutor.RetryExecutor {
 @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
 @usableFromInline
 enum _RetryExecutorTask<R> {
-  case timedOut(Result<Void, Error>)
-  case handledResponse(Result<R, Error>)
+  case timedOut(Result<Void, any Error>)
+  case handledResponse(Result<R, any Error>)
   case retry(Duration?)
-  case outboundFinished(Result<Void, Error>)
+  case outboundFinished(Result<Void, any Error>)
 }
 
 @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
 @usableFromInline
 enum _RetryExecutorSubTask<R> {
   case streamProcessed
-  case handledResponse(Result<R, Error>)
+  case handledResponse(Result<R, any Error>)
   case retry(Duration?)
 }

+ 1 - 1
Sources/GRPCCore/Call/Client/Internal/ClientStreamExecutor.swift

@@ -149,7 +149,7 @@ internal struct ClientStreamExecutor<Transport: ClientTransport> {
     on stream: Transport.Inbound
   ) async -> OnFirstResponsePart {
     var iterator = stream.makeAsyncIterator()
-    let result = await Result<OnFirstResponsePart, Error> {
+    let result = await Result<OnFirstResponsePart, any Error> {
       switch try await iterator.next() {
       case .metadata(let metadata):
         return .metadata(metadata, UnsafeTransfer(iterator))

+ 1 - 1
Sources/GRPCCore/Call/Server/Internal/ServerRPCExecutor.swift

@@ -241,7 +241,7 @@ struct ServerRPCExecutor {
 
   @usableFromInline
   enum ServerExecutorTask {
-    case timedOut(Result<Void, Error>)
+    case timedOut(Result<Void, any Error>)
     case executed
   }
 }

+ 3 - 3
Sources/GRPCCore/Configuration/MethodConfig.swift

@@ -478,7 +478,7 @@ extension MethodConfig.Name: Codable {
     case method
   }
 
-  public init(from decoder: Decoder) throws {
+  public init(from decoder: any Decoder) throws {
     let container = try decoder.container(keyedBy: CodingKeys.self)
 
     let service = try container.decodeIfPresent(String.self, forKey: .service)
@@ -622,7 +622,7 @@ struct GoogleRPCCode: Codable {
     self.code = code
   }
 
-  init(from decoder: Decoder) throws {
+  init(from decoder: any Decoder) throws {
     let container = try decoder.singleValueContainer()
     let code: Status.Code?
 
@@ -641,7 +641,7 @@ struct GoogleRPCCode: Codable {
     }
   }
 
-  func encode(to encoder: Encoder) throws {
+  func encode(to encoder: any Encoder) throws {
     var container = encoder.singleValueContainer()
     try container.encode(self.code.googleRPCCode)
   }

+ 6 - 6
Sources/GRPCCore/Configuration/ServiceConfig.swift

@@ -70,7 +70,7 @@ extension ServiceConfig: Codable {
     case retryThrottling
   }
 
-  public init(from decoder: Decoder) throws {
+  public init(from decoder: any Decoder) throws {
     let container = try decoder.container(keyedBy: CodingKeys.self)
 
     let methodConfig = try container.decodeIfPresent(
@@ -91,7 +91,7 @@ extension ServiceConfig: Codable {
     )
   }
 
-  public func encode(to encoder: Encoder) throws {
+  public func encode(to encoder: any Encoder) throws {
     var container = encoder.container(keyedBy: CodingKeys.self)
     try container.encode(self.methodConfig, forKey: .methodConfig)
     try container.encode(self.loadBalancingConfig, forKey: .loadBalancingConfig)
@@ -179,7 +179,7 @@ extension ServiceConfig.LoadBalancingConfig {
       self.shuffleAddressList = shuffleAddressList
     }
 
-    public init(from decoder: Decoder) throws {
+    public init(from decoder: any Decoder) throws {
       let container = try decoder.container(keyedBy: CodingKeys.self)
       let shuffle = try container.decodeIfPresent(Bool.self, forKey: .shuffleAddressList) ?? false
       self.shuffleAddressList = shuffle
@@ -200,7 +200,7 @@ extension ServiceConfig.LoadBalancingConfig: Codable {
     case pickFirst = "pick_first"
   }
 
-  public init(from decoder: Decoder) throws {
+  public init(from decoder: any Decoder) throws {
     let container = try decoder.container(keyedBy: CodingKeys.self)
     if let value = try container.decodeIfPresent(RoundRobin.self, forKey: .roundRobin) {
       self.value = .roundRobin(value)
@@ -211,7 +211,7 @@ extension ServiceConfig.LoadBalancingConfig: Codable {
     }
   }
 
-  public func encode(to encoder: Encoder) throws {
+  public func encode(to encoder: any Encoder) throws {
     var container = encoder.container(keyedBy: CodingKeys.self)
     switch self.value {
     case .pickFirst(let value):
@@ -254,7 +254,7 @@ extension ServiceConfig {
       try self.validateTokenRatio()
     }
 
-    public init(from decoder: Decoder) throws {
+    public init(from decoder: any Decoder) throws {
       let container = try decoder.container(keyedBy: CodingKeys.self)
       self.maxTokens = try container.decode(Int.self, forKey: .maxTokens)
       self.tokenRatio = try container.decode(Double.self, forKey: .tokenRatio)

+ 2 - 2
Sources/GRPCCore/RPCError.swift

@@ -33,7 +33,7 @@ public struct RPCError: Sendable, Hashable, Error {
   public var metadata: Metadata
 
   /// The original error which led to this error being thrown.
-  public var cause: Error?
+  public var cause: (any Error)?
 
   /// Create a new RPC error.
   ///
@@ -42,7 +42,7 @@ public struct RPCError: Sendable, Hashable, Error {
   ///   - message: A message providing additional context about the code.
   ///   - metadata: Any metadata to attach to the error.
   ///   - cause: An underlying error which led to this error being thrown.
-  public init(code: Code, message: String, metadata: Metadata = [:], cause: Error? = nil) {
+  public init(code: Code, message: String, metadata: Metadata = [:], cause: (any Error)? = nil) {
     self.code = code
     self.message = message
     self.metadata = metadata

+ 2 - 2
Sources/GRPCCore/RuntimeError.swift

@@ -27,7 +27,7 @@ public struct RuntimeError: Error, Hashable, Sendable {
   public var message: String
 
   /// The original error which led to this error being thrown.
-  public var cause: Error?
+  public var cause: (any Error)?
 
   /// Creates a new error.
   ///
@@ -35,7 +35,7 @@ public struct RuntimeError: Error, Hashable, Sendable {
   ///   - code: The error code.
   ///   - message: A description of the error.
   ///   - cause: The original error which led to this error being thrown.
-  public init(code: Code, message: String, cause: Error? = nil) {
+  public init(code: Code, message: String, cause: (any Error)? = nil) {
     self.code = code
     self.message = message
     self.cause = cause

+ 22 - 22
Sources/GRPCCore/Streaming/Internal/BroadcastAsyncSequence.swift

@@ -129,7 +129,7 @@ extension BroadcastAsyncSequence {
     }
 
     @inlinable
-    func finish(with result: Result<Void, Error>) {
+    func finish(with result: Result<Void, any Error>) {
       self._storage.finish(result)
     }
 
@@ -139,7 +139,7 @@ extension BroadcastAsyncSequence {
     }
 
     @inlinable
-    func finish(throwing error: Error) {
+    func finish(throwing error: any Error) {
       self.finish(with: .failure(error))
     }
   }
@@ -232,7 +232,7 @@ final class _BroadcastSequenceStorage<Element: Sendable>: Sendable {
   ///
   /// - Parameter result: Whether the stream is finishing cleanly or because of an error.
   @inlinable
-  func finish(_ result: Result<Void, Error>) {
+  func finish(_ result: Result<Void, any Error>) {
     let action = self._state.withLockedValue { state in state.finish(result: result) }
     switch action {
     case .none:
@@ -334,19 +334,19 @@ final class _BroadcastSequenceStorage<Element: Sendable>: Sendable {
 @usableFromInline
 struct _BroadcastSequenceStateMachine<Element: Sendable>: Sendable {
   @usableFromInline
-  typealias ConsumerContinuation = CheckedContinuation<Element?, Error>
+  typealias ConsumerContinuation = CheckedContinuation<Element?, any Error>
   @usableFromInline
-  typealias ProducerContinuation = CheckedContinuation<Void, Error>
+  typealias ProducerContinuation = CheckedContinuation<Void, any Error>
 
   @usableFromInline
   struct ConsumerContinuations {
     @usableFromInline
     var continuations: _OneOrMany<ConsumerContinuation>
     @usableFromInline
-    var result: Result<Element?, Error>
+    var result: Result<Element?, any Error>
 
     @inlinable
-    init(continuations: _OneOrMany<ConsumerContinuation>, result: Result<Element?, Error>) {
+    init(continuations: _OneOrMany<ConsumerContinuation>, result: Result<Element?, any Error>) {
       self.continuations = continuations
       self.result = result
     }
@@ -369,10 +369,10 @@ struct _BroadcastSequenceStateMachine<Element: Sendable>: Sendable {
     @usableFromInline
     var continuations: [ProducerContinuation]
     @usableFromInline
-    var result: Result<Void, Error>
+    var result: Result<Void, any Error>
 
     @inlinable
-    init(continuations: [ProducerContinuation], result: Result<Void, Error>) {
+    init(continuations: [ProducerContinuation], result: Result<Void, any Error>) {
       self.continuations = continuations
       self.result = result
     }
@@ -435,7 +435,7 @@ struct _BroadcastSequenceStateMachine<Element: Sendable>: Sendable {
       }
 
       @inlinable
-      mutating func finish(result: Result<Void, Error>) -> OnFinish {
+      mutating func finish(result: Result<Void, any Error>) -> OnFinish {
         let continuations = self.subscriptions.removeSubscribersWithContinuations()
         return .resume(
           .init(continuations: continuations, result: result.map { nil }),
@@ -755,7 +755,7 @@ struct _BroadcastSequenceStateMachine<Element: Sendable>: Sendable {
       }
 
       @inlinable
-      mutating func finish(result: Result<Void, Error>) -> OnFinish {
+      mutating func finish(result: Result<Void, any Error>) -> OnFinish {
         let continuations = self.subscriptions.removeSubscribersWithContinuations()
         let producers = self.producers.map { $0.0 }
         self.producers.removeAll()
@@ -824,10 +824,10 @@ struct _BroadcastSequenceStateMachine<Element: Sendable>: Sendable {
 
       /// The terminating result of the sequence.
       @usableFromInline
-      let result: Result<Void, Error>
+      let result: Result<Void, any Error>
 
       @inlinable
-      init(from state: Initial, result: Result<Void, Error>) {
+      init(from state: Initial, result: Result<Void, any Error>) {
         self.elements = Elements()
         self.subscriptions = Subscriptions()
         self.subscriptionsToDrop = []
@@ -835,7 +835,7 @@ struct _BroadcastSequenceStateMachine<Element: Sendable>: Sendable {
       }
 
       @inlinable
-      init(from state: Subscribed, result: Result<Void, Error>) {
+      init(from state: Subscribed, result: Result<Void, any Error>) {
         self.elements = Elements()
         self.subscriptions = state.subscriptions
         self.subscriptionsToDrop = []
@@ -843,7 +843,7 @@ struct _BroadcastSequenceStateMachine<Element: Sendable>: Sendable {
       }
 
       @inlinable
-      init(from state: Streaming, result: Result<Void, Error>) {
+      init(from state: Streaming, result: Result<Void, any Error>) {
         self.elements = state.elements
         self.subscriptions = state.subscriptions
         self.subscriptionsToDrop = state.subscriptionsToDrop
@@ -1063,7 +1063,7 @@ struct _BroadcastSequenceStateMachine<Element: Sendable>: Sendable {
   }
 
   @inlinable
-  mutating func finish(result: Result<Void, Error>) -> OnFinish {
+  mutating func finish(result: Result<Void, any Error>) -> OnFinish {
     let onFinish: OnFinish
 
     switch self._state {
@@ -1098,15 +1098,15 @@ struct _BroadcastSequenceStateMachine<Element: Sendable>: Sendable {
     @usableFromInline
     struct ReturnAndResumeProducers {
       @usableFromInline
-      var nextResult: Result<Element?, Error>
+      var nextResult: Result<Element?, any Error>
       @usableFromInline
       var producers: ProducerContinuations
 
       @inlinable
       init(
-        nextResult: Result<Element?, Error>,
+        nextResult: Result<Element?, any Error>,
         producers: [ProducerContinuation] = [],
-        producerResult: Result<Void, Error> = .success(())
+        producerResult: Result<Void, any Error> = .success(())
       ) {
         self.nextResult = nextResult
         self.producers = ProducerContinuations(continuations: producers, result: producerResult)
@@ -1153,7 +1153,7 @@ struct _BroadcastSequenceStateMachine<Element: Sendable>: Sendable {
   @usableFromInline
   enum OnSetContinuation {
     case none
-    case resume(ConsumerContinuation, Result<Element?, Error>)
+    case resume(ConsumerContinuation, Result<Element?, any Error>)
   }
 
   @inlinable
@@ -1192,7 +1192,7 @@ struct _BroadcastSequenceStateMachine<Element: Sendable>: Sendable {
   @usableFromInline
   enum OnCancelSubscription {
     case none
-    case resume(ConsumerContinuation, Result<Element?, Error>)
+    case resume(ConsumerContinuation, Result<Element?, any Error>)
   }
 
   @inlinable
@@ -1270,7 +1270,7 @@ struct _BroadcastSequenceStateMachine<Element: Sendable>: Sendable {
   @usableFromInline
   enum OnWaitToProduceMore {
     case none
-    case resume(ProducerContinuation, Result<Void, Error>)
+    case resume(ProducerContinuation, Result<Void, any Error>)
   }
 
   @inlinable

+ 50 - 50
Sources/GRPCCore/Streaming/Internal/BufferedStream.swift

@@ -98,7 +98,7 @@ import DequeModule
 /// ```
 /// extension QuakeMonitor {
 ///
-///     static var throwingQuakes: BufferedStream<Quake, Error> {
+///     static var throwingQuakes: BufferedStream<Quake, any Error> {
 ///         BufferedStream { continuation in
 ///             let monitor = QuakeMonitor()
 ///             monitor.quakeHandler = { quake in
@@ -392,7 +392,7 @@ extension BufferedStream {
     @inlinable
     internal func enqueueCallback(
       callbackToken: WriteResult.CallbackToken,
-      onProduceMore: @escaping @Sendable (Result<Void, Error>) -> Void
+      onProduceMore: @escaping @Sendable (Result<Void, any Error>) -> Void
     ) {
       self._backing.storage.enqueueProducer(
         callbackToken: callbackToken,
@@ -426,14 +426,14 @@ extension BufferedStream {
     @inlinable
     internal func write<S>(
       contentsOf sequence: S,
-      onProduceMore: @escaping @Sendable (Result<Void, Error>) -> Void
+      onProduceMore: @escaping @Sendable (Result<Void, any Error>) -> Void
     ) where Element == S.Element, S: Sequence {
       do {
         let writeResult = try self.write(contentsOf: sequence)
 
         switch writeResult {
         case .produceMore:
-          onProduceMore(Result<Void, Error>.success(()))
+          onProduceMore(Result<Void, any Error>.success(()))
 
         case .enqueueCallback(let callbackToken):
           self.enqueueCallback(callbackToken: callbackToken, onProduceMore: onProduceMore)
@@ -456,7 +456,7 @@ extension BufferedStream {
     @inlinable
     internal func write(
       _ element: Element,
-      onProduceMore: @escaping @Sendable (Result<Void, Error>) -> Void
+      onProduceMore: @escaping @Sendable (Result<Void, any Error>) -> Void
     ) {
       self.write(contentsOf: CollectionOfOne(element), onProduceMore: onProduceMore)
     }
@@ -542,7 +542,7 @@ extension BufferedStream {
     /// - Parameters:
     ///   - error: The error to throw, or `nil`, to finish normally.
     @inlinable
-    internal func finish(throwing error: Error?) {
+    internal func finish(throwing error: (any Error)?) {
       self._backing.storage.finish(error)
     }
   }
@@ -558,9 +558,9 @@ extension BufferedStream {
   @inlinable
   internal static func makeStream(
     of elementType: Element.Type = Element.self,
-    throwing failureType: Error.Type = Error.self,
+    throwing failureType: (any Error).Type = (any Error).self,
     backPressureStrategy: Source.BackPressureStrategy
-  ) -> (`Self`, Source) where Error == Error {
+  ) -> (`Self`, Source) where any Error == any Error {
     let storage = _BackPressuredStorage(
       backPressureStrategy: backPressureStrategy._internalBackPressureStrategy
     )
@@ -774,7 +774,7 @@ extension BufferedStream {
     @inlinable
     func enqueueProducer(
       callbackToken: Source.WriteResult.CallbackToken,
-      onProduceMore: @escaping @Sendable (Result<Void, Error>) -> Void
+      onProduceMore: @escaping @Sendable (Result<Void, any Error>) -> Void
     ) {
       let action = self._stateMachine.withCriticalRegion {
         $0.enqueueProducer(callbackToken: callbackToken, onProduceMore: onProduceMore)
@@ -782,10 +782,10 @@ extension BufferedStream {
 
       switch action {
       case .resumeProducer(let onProduceMore):
-        onProduceMore(Result<Void, Error>.success(()))
+        onProduceMore(Result<Void, any Error>.success(()))
 
       case .resumeProducerWithError(let onProduceMore, let error):
-        onProduceMore(Result<Void, Error>.failure(error))
+        onProduceMore(Result<Void, any Error>.failure(error))
 
       case .none:
         break
@@ -800,7 +800,7 @@ extension BufferedStream {
 
       switch action {
       case .resumeProducerWithCancellationError(let onProduceMore):
-        onProduceMore(Result<Void, Error>.failure(CancellationError()))
+        onProduceMore(Result<Void, any Error>.failure(CancellationError()))
 
       case .none:
         break
@@ -808,7 +808,7 @@ extension BufferedStream {
     }
 
     @inlinable
-    func finish(_ failure: Error?) {
+    func finish(_ failure: (any Error)?) {
       let action = self._stateMachine.withCriticalRegion {
         $0.finish(failure)
       }
@@ -853,7 +853,7 @@ extension BufferedStream {
 
       case .returnElementAndResumeProducers(let element, let producerContinuations):
         for producerContinuation in producerContinuations {
-          producerContinuation(Result<Void, Error>.success(()))
+          producerContinuation(Result<Void, any Error>.success(()))
         }
 
         return element
@@ -895,7 +895,7 @@ extension BufferedStream {
           ):
             continuation.resume(returning: element)
             for producerContinuation in producerContinuations {
-              producerContinuation(Result<Void, Error>.success(()))
+              producerContinuation(Result<Void, any Error>.success(()))
             }
 
           case .resumeConsumerWithErrorAndCallOnTermination(
@@ -996,10 +996,10 @@ extension BufferedStream {
         var buffer: Deque<Element>
         /// The optional consumer continuation.
         @usableFromInline
-        var consumerContinuation: CheckedContinuation<Element?, Error>?
+        var consumerContinuation: CheckedContinuation<Element?, any Error>?
         /// The producer continuations.
         @usableFromInline
-        var producerContinuations: Deque<(UInt, (Result<Void, Error>) -> Void)>
+        var producerContinuations: Deque<(UInt, (Result<Void, any Error>) -> Void)>
         /// The producers that have been cancelled.
         @usableFromInline
         var cancelledAsyncProducers: Deque<UInt>
@@ -1013,8 +1013,8 @@ extension BufferedStream {
           iteratorInitialized: Bool,
           onTermination: (@Sendable () -> Void)? = nil,
           buffer: Deque<Element>,
-          consumerContinuation: CheckedContinuation<Element?, Error>? = nil,
-          producerContinuations: Deque<(UInt, (Result<Void, Error>) -> Void)>,
+          consumerContinuation: CheckedContinuation<Element?, any Error>? = nil,
+          producerContinuations: Deque<(UInt, (Result<Void, any Error>) -> Void)>,
           cancelledAsyncProducers: Deque<UInt>,
           hasOutstandingDemand: Bool
         ) {
@@ -1039,7 +1039,7 @@ extension BufferedStream {
         var buffer: Deque<Element>
         /// The failure that should be thrown after the last element has been consumed.
         @usableFromInline
-        var failure: Error?
+        var failure: (any Error)?
         /// The onTermination callback.
         @usableFromInline
         var onTermination: (@Sendable () -> Void)?
@@ -1048,7 +1048,7 @@ extension BufferedStream {
         init(
           iteratorInitialized: Bool,
           buffer: Deque<Element>,
-          failure: Error? = nil,
+          failure: (any Error)? = nil,
           onTermination: (@Sendable () -> Void)?
         ) {
           self.iteratorInitialized = iteratorInitialized
@@ -1157,7 +1157,7 @@ extension BufferedStream {
       case callOnTermination((@Sendable () -> Void)?)
       /// Indicates that  all producers should be failed and `onTermination` should be called.
       case failProducersAndCallOnTermination(
-        [(Result<Void, Error>) -> Void],
+        [(Result<Void, any Error>) -> Void],
         (@Sendable () -> Void)?
       )
     }
@@ -1269,7 +1269,7 @@ extension BufferedStream {
       case callOnTermination((@Sendable () -> Void)?)
       /// Indicates that  all producers should be failed and `onTermination` should be called.
       case failProducersAndCallOnTermination(
-        [(Result<Void, Error>) -> Void],
+        [(Result<Void, any Error>) -> Void],
         (@Sendable () -> Void)?
       )
     }
@@ -1331,12 +1331,12 @@ extension BufferedStream {
       case callOnTermination((() -> Void)?)
       /// Indicates that  all producers should be failed and `onTermination` should be called.
       case failProducersAndCallOnTermination(
-        CheckedContinuation<Element?, Error>?,
-        [(Result<Void, Error>) -> Void],
+        CheckedContinuation<Element?, any Error>?,
+        [(Result<Void, any Error>) -> Void],
         (@Sendable () -> Void)?
       )
       /// Indicates that all producers should be failed.
-      case failProducers([(Result<Void, Error>) -> Void])
+      case failProducers([(Result<Void, any Error>) -> Void])
     }
 
     @inlinable
@@ -1395,12 +1395,12 @@ extension BufferedStream {
       )
       /// Indicates that the consumer should be resumed and the producer should be notified to produce more.
       case resumeConsumerAndReturnProduceMore(
-        continuation: CheckedContinuation<Element?, Error>,
+        continuation: CheckedContinuation<Element?, any Error>,
         element: Element
       )
       /// Indicates that the consumer should be resumed and the producer should be suspended.
       case resumeConsumerAndReturnEnqueue(
-        continuation: CheckedContinuation<Element?, Error>,
+        continuation: CheckedContinuation<Element?, any Error>,
         element: Element,
         callbackToken: Source.WriteResult.CallbackToken
       )
@@ -1410,7 +1410,7 @@ extension BufferedStream {
       @inlinable
       init(
         callbackToken: Source.WriteResult.CallbackToken?,
-        continuationAndElement: (CheckedContinuation<Element?, Error>, Element)? = nil
+        continuationAndElement: (CheckedContinuation<Element?, any Error>, Element)? = nil
       ) {
         switch (callbackToken, continuationAndElement) {
         case (.none, .none):
@@ -1510,15 +1510,15 @@ extension BufferedStream {
     @usableFromInline
     enum EnqueueProducerAction {
       /// Indicates that the producer should be notified to produce more.
-      case resumeProducer((Result<Void, Error>) -> Void)
+      case resumeProducer((Result<Void, any Error>) -> Void)
       /// Indicates that the producer should be notified about an error.
-      case resumeProducerWithError((Result<Void, Error>) -> Void, Error)
+      case resumeProducerWithError((Result<Void, any Error>) -> Void, any Error)
     }
 
     @inlinable
     mutating func enqueueProducer(
       callbackToken: Source.WriteResult.CallbackToken,
-      onProduceMore: @Sendable @escaping (Result<Void, Error>) -> Void
+      onProduceMore: @Sendable @escaping (Result<Void, any Error>) -> Void
     ) -> EnqueueProducerAction? {
       switch self._state {
       case .initial:
@@ -1560,7 +1560,7 @@ extension BufferedStream {
     @usableFromInline
     enum CancelProducerAction {
       /// Indicates that the producer should be notified about cancellation.
-      case resumeProducerWithCancellationError((Result<Void, Error>) -> Void)
+      case resumeProducerWithCancellationError((Result<Void, any Error>) -> Void)
     }
 
     @inlinable
@@ -1610,18 +1610,18 @@ extension BufferedStream {
       /// Indicates that the consumer  should be resumed with the failure, the producers
       /// should be resumed with an error and `onTermination` should be called.
       case resumeConsumerAndCallOnTermination(
-        consumerContinuation: CheckedContinuation<Element?, Error>,
-        failure: Error?,
+        consumerContinuation: CheckedContinuation<Element?, any Error>,
+        failure: (any Error)?,
         onTermination: (() -> Void)?
       )
       /// Indicates that the producers should be resumed with an error.
       case resumeProducers(
-        producerContinuations: [(Result<Void, Error>) -> Void]
+        producerContinuations: [(Result<Void, any Error>) -> Void]
       )
     }
 
     @inlinable
-    mutating func finish(_ failure: Error?) -> FinishAction? {
+    mutating func finish(_ failure: (any Error)?) -> FinishAction? {
       switch self._state {
       case .initial(let initial):
         // Nothing was yielded nor did anybody call next
@@ -1685,9 +1685,9 @@ extension BufferedStream {
       /// Indicates that the element should be returned to the caller.
       case returnElement(Element)
       /// Indicates that the element should be returned to the caller and that all producers should be called.
-      case returnElementAndResumeProducers(Element, [(Result<Void, Error>) -> Void])
+      case returnElementAndResumeProducers(Element, [(Result<Void, any Error>) -> Void])
       /// Indicates that the `Error` should be returned to the caller and that `onTermination` should be called.
-      case returnErrorAndCallOnTermination(Error?, (() -> Void)?)
+      case returnErrorAndCallOnTermination((any Error)?, (() -> Void)?)
       /// Indicates that the `nil` should be returned to the caller.
       case returnNil
       /// Indicates that the `Task` of the caller should be suspended.
@@ -1779,26 +1779,26 @@ extension BufferedStream {
     @usableFromInline
     enum SuspendNextAction {
       /// Indicates that the consumer should be resumed.
-      case resumeConsumerWithElement(CheckedContinuation<Element?, Error>, Element)
+      case resumeConsumerWithElement(CheckedContinuation<Element?, any Error>, Element)
       /// Indicates that the consumer and all producers should be resumed.
       case resumeConsumerWithElementAndProducers(
-        CheckedContinuation<Element?, Error>,
+        CheckedContinuation<Element?, any Error>,
         Element,
-        [(Result<Void, Error>) -> Void]
+        [(Result<Void, any Error>) -> Void]
       )
       /// Indicates that the consumer should be resumed with the failure and that `onTermination` should be called.
       case resumeConsumerWithErrorAndCallOnTermination(
-        CheckedContinuation<Element?, Error>,
-        Error?,
+        CheckedContinuation<Element?, any Error>,
+        (any Error)?,
         (() -> Void)?
       )
       /// Indicates that the consumer should be resumed with `nil`.
-      case resumeConsumerWithNil(CheckedContinuation<Element?, Error>)
+      case resumeConsumerWithNil(CheckedContinuation<Element?, any Error>)
     }
 
     @inlinable
     mutating func suspendNext(
-      continuation: CheckedContinuation<Element?, Error>
+      continuation: CheckedContinuation<Element?, any Error>
     ) -> SuspendNextAction? {
       switch self._state {
       case .initial:
@@ -1879,11 +1879,11 @@ extension BufferedStream {
     enum CancelNextAction {
       /// Indicates that the continuation should be resumed with a cancellation error, the producers should be finished and call onTermination.
       case resumeConsumerWithCancellationErrorAndCallOnTermination(
-        CheckedContinuation<Element?, Error>,
+        CheckedContinuation<Element?, any Error>,
         (() -> Void)?
       )
       /// Indicates that the producers should be finished and call onTermination.
-      case failProducersAndCallOnTermination([(Result<Void, Error>) -> Void], (() -> Void)?)
+      case failProducersAndCallOnTermination([(Result<Void, any Error>) -> Void], (() -> Void)?)
     }
 
     @inlinable
@@ -1930,7 +1930,7 @@ extension BufferedStream.Source: ClosableRPCWriterProtocol {
   }
 
   @inlinable
-  func finish(throwing error: Error) {
-    self.finish(throwing: error as Error?)
+  func finish(throwing error: any Error) {
+    self.finish(throwing: error as (any Error)?)
   }
 }

+ 1 - 1
Sources/GRPCCore/Streaming/RPCWriter+Closable.swift

@@ -64,7 +64,7 @@ extension RPCWriter {
     /// All writes after ``finish(throwing:)`` has been called should result in an error
     /// being thrown.
     @inlinable
-    public func finish(throwing error: Error) {
+    public func finish(throwing error: any Error) {
       self.writer.finish(throwing: error)
     }
   }

+ 1 - 1
Sources/GRPCCore/Streaming/RPCWriterProtocol.swift

@@ -63,5 +63,5 @@ public protocol ClosableRPCWriterProtocol<Element>: RPCWriterProtocol {
   ///
   /// All writes after ``finish(throwing:)`` has been called should result in an error
   /// being thrown.
-  func finish(throwing error: Error)
+  func finish(throwing error: any Error)
 }

+ 4 - 4
Sources/GRPCHTTP2Core/Client/Connection/ClientConnectionHandler.swift

@@ -30,7 +30,7 @@ public enum ClientConnectionEvent: Sendable {
     /// The local peer initiated the close.
     case initiatedLocally
     /// The connection was closed unexpectedly
-    case unexpected(Error?, isIdle: Bool)
+    case unexpected((any Error)?, isIdle: Bool)
   }
 
   /// The connection is now ready.
@@ -62,7 +62,7 @@ final class ClientConnectionHandler: ChannelInboundHandler, ChannelOutboundHandl
   }
 
   /// The `EventLoop` of the `Channel` this handler exists in.
-  private let eventLoop: EventLoop
+  private let eventLoop: any EventLoop
 
   /// The maximum amount of time the connection may be idle for. If the connection remains idle
   /// (i.e. has no open streams) for this period of time then the connection will be gracefully
@@ -104,7 +104,7 @@ final class ClientConnectionHandler: ChannelInboundHandler, ChannelOutboundHandl
   ///   - keepaliveWithoutCalls: Whether the client sends keep-alive pings when there are no calls
   ///       in progress.
   init(
-    eventLoop: EventLoop,
+    eventLoop: any EventLoop,
     maxIdleTime: TimeAmount?,
     keepaliveTime: TimeAmount?,
     keepaliveTimeout: TimeAmount?,
@@ -612,7 +612,7 @@ extension ClientConnectionHandler {
 
     enum OnClosed {
       case succeed(EventLoopPromise<Void>)
-      case unexpectedClose(Error?, isIdle: Bool)
+      case unexpectedClose((any Error)?, isIdle: Bool)
       case none
     }
 

+ 1 - 1
Sources/GRPCHTTP2Core/Client/Connection/Connection.swift

@@ -69,7 +69,7 @@ struct Connection: Sendable {
     /// Closed because the remote peer initiate shutdown (i.e. sent a GOAWAY frame).
     case remote
     /// Closed because the connection encountered an unexpected error.
-    case error(Error, wasIdle: Bool)
+    case error(any Error, wasIdle: Bool)
   }
 
   /// Inputs to the 'run' method.

+ 6 - 6
Sources/GRPCHTTP2Core/Client/Connection/GRPCChannel.swift

@@ -264,9 +264,9 @@ extension GRPCChannel {
     /// A stream was created, use it.
     case created(Connection.Stream)
     /// An error occurred while trying to create a stream, try again if possible.
-    case tryAgain(Error)
+    case tryAgain(any Error)
     /// An unrecoverable error occurred (e.g. the channel is closed), fail the RPC and don't retry.
-    case stopTrying(Error)
+    case stopTrying(any Error)
   }
 
   private func makeStream(
@@ -734,8 +734,8 @@ extension GRPCChannel.StateMachine {
     var finish: Bool = false
 
     struct ResumableContinuations {
-      var continuations: [CheckedContinuation<LoadBalancer, Error>]
-      var result: Result<LoadBalancer, Error>
+      var continuations: [CheckedContinuation<LoadBalancer, any Error>]
+      var result: Result<LoadBalancer, any Error>
     }
   }
 
@@ -878,7 +878,7 @@ extension GRPCChannel.StateMachine {
   }
 
   mutating func enqueue(
-    continuation: CheckedContinuation<LoadBalancer, Error>,
+    continuation: CheckedContinuation<LoadBalancer, any Error>,
     waitForReady: Bool,
     id: QueueEntryID
   ) -> Bool {
@@ -902,7 +902,7 @@ extension GRPCChannel.StateMachine {
 
   mutating func dequeueContinuation(
     id: QueueEntryID
-  ) -> CheckedContinuation<LoadBalancer, Error>? {
+  ) -> CheckedContinuation<LoadBalancer, any Error>? {
     switch self.state {
     case .notRunning(var state):
       self.state = ._modifying

+ 1 - 1
Sources/GRPCHTTP2Core/Client/Connection/RequestQueue.swift

@@ -18,7 +18,7 @@ import DequeModule
 
 @available(macOS 14.0, iOS 17.0, watchOS 10.0, tvOS 17.0, *)
 struct RequestQueue {
-  typealias Continuation = CheckedContinuation<LoadBalancer, Error>
+  typealias Continuation = CheckedContinuation<LoadBalancer, any Error>
 
   private struct QueueEntry {
     var continuation: Continuation

+ 1 - 1
Sources/GRPCHTTP2Core/Internal/NIOChannelPipeline+GRPC.swift

@@ -107,7 +107,7 @@ extension ChannelPipeline.SynchronousOperations {
   @_spi(Package)
   @available(macOS 14.0, iOS 17.0, watchOS 10.0, tvOS 17.0, *)
   public func configureGRPCClientPipeline(
-    channel: Channel,
+    channel: any Channel,
     config: GRPCChannel.Config
   ) throws -> (
     NIOAsyncChannel<ClientConnectionEvent, Void>,

+ 1 - 1
Sources/GRPCHTTP2Core/Internal/Timer.swift

@@ -45,7 +45,7 @@ struct Timer {
   }
 
   /// Schedule a task on the given `EventLoop`.
-  mutating func schedule(on eventLoop: EventLoop, work: @escaping @Sendable () throws -> Void) {
+  mutating func schedule(on eventLoop: any EventLoop, work: @escaping @Sendable () throws -> Void) {
     self.task?.cancel()
 
     if self.repeat {

+ 2 - 2
Sources/GRPCHTTP2Core/Server/Connection/ServerConnectionManagementHandler.swift

@@ -44,7 +44,7 @@ final class ServerConnectionManagementHandler: ChannelDuplexHandler {
   typealias OutboundOut = HTTP2Frame
 
   /// The `EventLoop` of the `Channel` this handler exists in.
-  private let eventLoop: EventLoop
+  private let eventLoop: any EventLoop
 
   /// The maximum amount of time a connection may be idle for. If the connection remains idle
   /// (i.e. has no open streams) for this period of time then the connection will be gracefully
@@ -201,7 +201,7 @@ final class ServerConnectionManagementHandler: ChannelDuplexHandler {
   ///       connection is closed if there are too many strikes.
   ///   - clock: A clock providing the current time.
   init(
-    eventLoop: EventLoop,
+    eventLoop: any EventLoop,
     maxIdleTime: TimeAmount?,
     maxAge: TimeAmount?,
     maxGraceTime: TimeAmount?,

+ 1 - 1
Sources/GRPCHTTP2TransportNIOPosix/HTTP2ServerTransport+Posix.swift

@@ -341,7 +341,7 @@ extension ServerBootstrap {
   @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
   fileprivate func bind<Output: Sendable>(
     to address: GRPCHTTP2Core.SocketAddress,
-    childChannelInitializer: @escaping @Sendable (Channel) -> EventLoopFuture<Output>
+    childChannelInitializer: @escaping @Sendable (any Channel) -> EventLoopFuture<Output>
   ) async throws -> NIOAsyncChannel<Output, Never> {
     if let virtualSocket = address.virtualSocket {
       return try await self.bind(

+ 1 - 1
Sources/GRPCHTTP2TransportNIOPosix/NIOClientBootstrap+SocketAddress.swift

@@ -23,7 +23,7 @@ extension ClientBootstrap {
   @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
   func connect<Result: Sendable>(
     to address: GRPCHTTP2Core.SocketAddress,
-    _ configure: @Sendable @escaping (Channel) -> EventLoopFuture<Result>
+    _ configure: @Sendable @escaping (any Channel) -> EventLoopFuture<Result>
   ) async throws -> Result {
     if let ipv4 = address.ipv4 {
       return try await self.connect(to: NIOCore.SocketAddress(ipv4), channelInitializer: configure)

+ 1 - 1
Sources/GRPCHTTP2TransportNIOTransportServices/HTTP2ServerTransport+TransportServices.swift

@@ -332,7 +332,7 @@ extension NIOCore.SocketAddress {
 extension NIOTSListenerBootstrap {
   fileprivate func bind<Output: Sendable>(
     to address: GRPCHTTP2Core.SocketAddress,
-    childChannelInitializer: @escaping @Sendable (Channel) -> EventLoopFuture<Output>
+    childChannelInitializer: @escaping @Sendable (any Channel) -> EventLoopFuture<Output>
   ) async throws -> NIOAsyncChannel<Output, Never> {
     if address.virtualSocket != nil {
       throw RuntimeError(

+ 1 - 1
Sources/InteroperabilityTests/InteroperabilityTestCase.swift

@@ -72,7 +72,7 @@ public enum InteroperabilityTestCase: String, CaseIterable {
 @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
 extension InteroperabilityTestCase {
   /// Return a new instance of the test case.
-  public func makeTest() -> InteroperabilityTest {
+  public func makeTest() -> any InteroperabilityTest {
     switch self {
     case .emptyUnary:
       return EmptyUnary()

+ 1 - 1
Sources/performance-worker/WorkerService.swift

@@ -266,7 +266,7 @@ extension WorkerService: Grpc_Testing_WorkerService.ServiceProtocol {
           case let .some(.setup(serverConfig)):
             let (server, transport) = try await self.startServer(serverConfig)
             group.addTask {
-              let result: Result<Void, Error>
+              let result: Result<Void, any Error>
 
               do {
                 try await server.run()

+ 1 - 1
Tests/GRPCProtobufTests/ProtobufCodingTests.swift

@@ -92,7 +92,7 @@ struct TestMessage: SwiftProtobuf.Message {
     return true
   }
 
-  func isEqualTo(message: SwiftProtobuf.Message) -> Bool {
+  func isEqualTo(message: any SwiftProtobuf.Message) -> Bool {
     return false
   }
 }