Przeglądaj źródła

Workaround nightly compiler crash (#68)

Motivation:

Nightly toolchains are crashing when compiling this project. This is
tracked in https://github.com/swiftlang/swift/issues/78112

Modifications:

- Add extra type info as this appears to work around the crash.

Result:

CI green on nightly toolchains.
George Barnett 10 miesięcy temu
rodzic
commit
c0cf6503f4

+ 2 - 1
Sources/GRPCNIOTransportCore/Client/Connection/GRPCChannel.swift

@@ -339,7 +339,8 @@ extension GRPCChannel {
           return
         }
 
-        let (enqueued, loadBalancer) = self.state.withLock { state in
+        // Explicitly adding the types works around: https://github.com/swiftlang/swift/issues/78112
+        let (enqueued, loadBalancer) = self.state.withLock { state -> (Bool, LoadBalancer?) in
           state.enqueue(continuation: continuation, waitForReady: waitForReady, id: id)
         }
 

+ 1 - 0
Tests/GRPCNIOTransportCoreTests/Client/Connection/ClientConnectionHandlerStateMachineTests.swift

@@ -16,6 +16,7 @@
 
 import NIOCore
 import NIOEmbedded
+import NIOHTTP2
 import XCTest
 
 @testable import GRPCNIOTransportCore

+ 3 - 2
Tests/GRPCNIOTransportCoreTests/Client/Connection/GRPCChannelTests.swift

@@ -16,6 +16,7 @@
 
 import GRPCCore
 import GRPCNIOTransportCore
+import NIOCore
 import NIOHTTP2
 import NIOPosix
 import XCTest
@@ -639,7 +640,7 @@ final class GRPCChannelTests: XCTestCase {
       TestServer(eventLoopGroup: .singletonMultiThreadedEventLoopGroup)
     }
 
-    var addresses = [SocketAddress]()
+    var addresses = [GRPCNIOTransportCore.SocketAddress]()
     for server in servers {
       let address = try await server.bind()
       addresses.append(address)
@@ -863,7 +864,7 @@ extension GRPCChannel.Config {
 }
 
 extension Endpoint {
-  init(_ addresses: SocketAddress...) {
+  init(_ addresses: GRPCNIOTransportCore.SocketAddress...) {
     self.init(addresses: addresses)
   }
 }

+ 2 - 0
Tests/GRPCNIOTransportCoreTests/Client/Connection/LoadBalancers/LoadBalancerTest.swift

@@ -14,7 +14,9 @@
  * limitations under the License.
  */
 
+import GRPCCore
 import GRPCNIOTransportCore
+import NIOPosix
 import XCTest
 
 enum LoadBalancerTest {

+ 1 - 0
Tests/GRPCNIOTransportCoreTests/Client/Connection/LoadBalancers/PickFirstLoadBalancerTests.swift

@@ -16,6 +16,7 @@
 
 import GRPCCore
 import GRPCNIOTransportCore
+import NIOCore
 import NIOHTTP2
 import NIOPosix
 import XCTest

+ 1 - 0
Tests/GRPCNIOTransportCoreTests/Client/Connection/LoadBalancers/RoundRobinLoadBalancerTests.swift

@@ -16,6 +16,7 @@
 
 import GRPCCore
 import GRPCNIOTransportCore
+import NIOCore
 import NIOHTTP2
 import NIOPosix
 import XCTest

+ 1 - 0
Tests/GRPCNIOTransportCoreTests/Client/HTTP2ClientTransportConfigTests.swift

@@ -14,6 +14,7 @@
  * limitations under the License.
  */
 
+import GRPCCore
 import GRPCNIOTransportCore
 import XCTest
 

+ 1 - 0
Tests/GRPCNIOTransportCoreTests/Server/HTTP2ServerTransportConfigTests.swift

@@ -14,6 +14,7 @@
  * limitations under the License.
  */
 
+import GRPCCore
 import GRPCNIOTransportCore
 import XCTest
 

+ 3 - 1
Tests/GRPCNIOTransportHTTP2Tests/HTTP2ServerTransport+DebugTests.swift

@@ -16,6 +16,8 @@
 
 import GRPCCore
 import GRPCNIOTransportHTTP2
+import NIOCore
+import Synchronization
 import Testing
 
 @Suite("ChannelDebugCallbacks")
@@ -96,7 +98,7 @@ struct ChannelDebugCallbackTests {
 
   private func makeServerTransport(
     kind: TransportKind,
-    address: SocketAddress,
+    address: GRPCNIOTransportCore.SocketAddress,
     debug: HTTP2ServerTransport.Config.ChannelDebuggingCallbacks
   ) -> NIOServerTransport {
     switch kind {