From 0a14d955f8a550f388aa3da565bb4a0559f6eb1f Mon Sep 17 00:00:00 2001 From: Thomas Van Lenten Date: Fri, 20 Sep 2024 14:46:29 -0400 Subject: [PATCH] Silence a warning when using Xcode 16/Swift6 toolchain. Without a Package.swift change, the new toolchain is issuing a warning about needing to flag the `Comparable` conformance as `@retroactive`, so do that. --- .../Google_Protobuf_Edition+Extensions.swift | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Sources/SwiftProtobufPluginLibrary/Google_Protobuf_Edition+Extensions.swift b/Sources/SwiftProtobufPluginLibrary/Google_Protobuf_Edition+Extensions.swift index ec4e5194b..9faf1573b 100644 --- a/Sources/SwiftProtobufPluginLibrary/Google_Protobuf_Edition+Extensions.swift +++ b/Sources/SwiftProtobufPluginLibrary/Google_Protobuf_Edition+Extensions.swift @@ -17,8 +17,16 @@ import SwiftProtobuf /// The spec for editions calls out them being ordered and comparable. /// https://github.com/protocolbuffers/protobuf/blob/main/docs/design/editions/edition-naming.md +#if compiler(>=6) +extension Google_Protobuf_Edition: @retroactive Comparable { + public static func < (lhs: Google_Protobuf_Edition, rhs: Google_Protobuf_Edition) -> Bool { + lhs.rawValue < rhs.rawValue + } +} +#else extension Google_Protobuf_Edition: Comparable { public static func < (lhs: Google_Protobuf_Edition, rhs: Google_Protobuf_Edition) -> Bool { lhs.rawValue < rhs.rawValue } } +#endif