Skip to content

Commit 03f5f0d

Browse files
author
Pouya Yarandi
committed
Fix build errors in swift 5.8 and later using any keyword for type-casting to protocols
1 parent d7ba532 commit 03f5f0d

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

Sources/SwiftProtobuf/GetPathDecoder.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ struct GetPathDecoder<T: Message>: Decoder {
299299

300300
mutating func decodeExtensionField(
301301
values: inout ExtensionFieldValueSet,
302-
messageType: Message.Type,
302+
messageType: any Message.Type,
303303
fieldNumber: Int
304304
) throws {
305305
preconditionFailure(

Sources/SwiftProtobuf/Message+FieldMask.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ extension Message where Self: Equatable, Self: _ProtoNameProviding {
109109

110110
private extension Message {
111111
init(removingAllFieldsOf message: Self) {
112-
if let type = Self.self as? ExtensibleMessage.Type,
113-
let extensible = message as? ExtensibleMessage {
112+
if let type = Self.self as? any ExtensibleMessage.Type,
113+
let extensible = message as? any ExtensibleMessage {
114114
self = type.init(extensionsOf: extensible) as? Self ?? .init()
115115
} else {
116116
self = .init()
@@ -120,7 +120,7 @@ private extension Message {
120120
}
121121

122122
private extension Message where Self: ExtensibleMessage {
123-
init(extensionsOf message: ExtensibleMessage) {
123+
init(extensionsOf message: any ExtensibleMessage) {
124124
self.init()
125125
_protobuf_extensionFieldValues = message._protobuf_extensionFieldValues
126126
}

Sources/SwiftProtobuf/SetPathDecoder.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public enum PathDecodingError: Error {
3232

3333
extension Message {
3434
static func number(for field: String) -> Int? {
35-
guard let type = Self.self as? _ProtoNameProviding.Type else {
35+
guard let type = Self.self as? any _ProtoNameProviding.Type else {
3636
return nil
3737
}
3838
return type._protobuf_nameMap.number(forJSONName: field)
@@ -371,7 +371,7 @@ struct SetPathDecoder<T: Message>: Decoder {
371371

372372
mutating func decodeExtensionField(
373373
values: inout ExtensionFieldValueSet,
374-
messageType: Message.Type,
374+
messageType: any Message.Type,
375375
fieldNumber: Int
376376
) throws {
377377
preconditionFailure(

0 commit comments

Comments
 (0)