Browse Source

Update compiler guards for concurrency (#1277)

Motivation:

The 'right' way to check if Swift concurrency is available is to use
`#if compiler(>=5.5) && canImport(_Concurrency)`. We are missing
currently missing the `canImport` check.

Modifications:

Add check for `canImport(_Concurrency)`.

Results:

We more correctly check whether concurrency is available.
George Barnett 4 years ago
parent
commit
929277b9e2
1 changed files with 2 additions and 2 deletions
  1. 2 2
      Sources/protoc-gen-grpc-swift/Generator.swift

+ 2 - 2
Sources/protoc-gen-grpc-swift/Generator.swift

@@ -170,10 +170,10 @@ class Generator {
   }
 
   func printIfCompilerGuardForAsyncAwait() {
-    self.println("#if compiler(>=5.5)")
+    self.println("#if compiler(>=5.5) && canImport(_Concurrency)")
   }
 
   func printEndCompilerGuardForAsyncAwait() {
-    self.println("#endif // compiler(>=5.5)")
+    self.println("#endif // compiler(>=5.5) && canImport(_Concurrency)")
   }
 }