diff --git a/Protos/SwiftProtobufTests/generated_swift_names_enum_cases.proto b/Protos/SwiftProtobufTests/generated_swift_names_enum_cases.proto index d57d0e3a2..496efbeb5 100644 --- a/Protos/SwiftProtobufTests/generated_swift_names_enum_cases.proto +++ b/Protos/SwiftProtobufTests/generated_swift_names_enum_cases.proto @@ -172,14 +172,14 @@ enum GeneratedSwiftReservedEnum { Collection = 165; com = 166; comma = 167; - CommonMessageConformances = 168; - consumedBytes = 169; - contentsOf = 170; - count = 171; - countVarintsInBuffer = 172; - csharpNamespace = 173; - ctype = 174; - customCodable = 175; + consumedBytes = 168; + contentsOf = 169; + count = 170; + countVarintsInBuffer = 171; + csharpNamespace = 172; + ctype = 173; + customCodable = 174; + CustomDebugStringConvertible = 175; d = 176; Data = 177; dataResult = 178; diff --git a/Protos/SwiftProtobufTests/generated_swift_names_enums.proto b/Protos/SwiftProtobufTests/generated_swift_names_enums.proto index 9e3a08b65..34f234f23 100644 --- a/Protos/SwiftProtobufTests/generated_swift_names_enums.proto +++ b/Protos/SwiftProtobufTests/generated_swift_names_enums.proto @@ -171,7 +171,6 @@ message GeneratedSwiftReservedEnums { enum Collection { NONE_Collection = 0; } enum com { NONE_com = 0; } enum comma { NONE_comma = 0; } - enum CommonMessageConformances { NONE_CommonMessageConformances = 0; } enum consumedBytes { NONE_consumedBytes = 0; } enum contentsOf { NONE_contentsOf = 0; } enum count { NONE_count = 0; } @@ -179,6 +178,7 @@ message GeneratedSwiftReservedEnums { enum csharpNamespace { NONE_csharpNamespace = 0; } enum ctype { NONE_ctype = 0; } enum customCodable { NONE_customCodable = 0; } + enum CustomDebugStringConvertible { NONE_CustomDebugStringConvertible = 0; } enum d { NONE_d = 0; } enum Data { NONE_Data = 0; } enum dataResult { NONE_dataResult = 0; } diff --git a/Protos/SwiftProtobufTests/generated_swift_names_fields.proto b/Protos/SwiftProtobufTests/generated_swift_names_fields.proto index 945b042e4..001aaaf69 100644 --- a/Protos/SwiftProtobufTests/generated_swift_names_fields.proto +++ b/Protos/SwiftProtobufTests/generated_swift_names_fields.proto @@ -171,14 +171,14 @@ message GeneratedSwiftReservedFields { int32 Collection = 165; int32 com = 166; int32 comma = 167; - int32 CommonMessageConformances = 168; - int32 consumedBytes = 169; - int32 contentsOf = 170; - int32 count = 171; - int32 countVarintsInBuffer = 172; - int32 csharpNamespace = 173; - int32 ctype = 174; - int32 customCodable = 175; + int32 consumedBytes = 168; + int32 contentsOf = 169; + int32 count = 170; + int32 countVarintsInBuffer = 171; + int32 csharpNamespace = 172; + int32 ctype = 173; + int32 customCodable = 174; + int32 CustomDebugStringConvertible = 175; int32 d = 176; int32 Data = 177; int32 dataResult = 178; diff --git a/Protos/SwiftProtobufTests/generated_swift_names_messages.proto b/Protos/SwiftProtobufTests/generated_swift_names_messages.proto index c49718ebe..a489bda21 100644 --- a/Protos/SwiftProtobufTests/generated_swift_names_messages.proto +++ b/Protos/SwiftProtobufTests/generated_swift_names_messages.proto @@ -171,7 +171,6 @@ message GeneratedSwiftReservedMessages { message Collection { int32 Collection = 1; } message com { int32 com = 1; } message comma { int32 comma = 1; } - message CommonMessageConformances { int32 CommonMessageConformances = 1; } message consumedBytes { int32 consumedBytes = 1; } message contentsOf { int32 contentsOf = 1; } message count { int32 count = 1; } @@ -179,6 +178,7 @@ message GeneratedSwiftReservedMessages { message csharpNamespace { int32 csharpNamespace = 1; } message ctype { int32 ctype = 1; } message customCodable { int32 customCodable = 1; } + message CustomDebugStringConvertible { int32 CustomDebugStringConvertible = 1; } message d { int32 d = 1; } message Data { int32 Data = 1; } message dataResult { int32 dataResult = 1; } diff --git a/Reference/SwiftProtobufTests/generated_swift_names_enum_cases.pb.swift b/Reference/SwiftProtobufTests/generated_swift_names_enum_cases.pb.swift index 2802c75e7..de3f35a45 100644 --- a/Reference/SwiftProtobufTests/generated_swift_names_enum_cases.pb.swift +++ b/Reference/SwiftProtobufTests/generated_swift_names_enum_cases.pb.swift @@ -194,14 +194,14 @@ enum SwiftProtoTesting_Generated_GeneratedSwiftReservedEnum: SwiftProtobuf.Enum, case collection // = 165 case com // = 166 case comma // = 167 - case commonMessageConformances // = 168 - case consumedBytes // = 169 - case contentsOf // = 170 - case count // = 171 - case countVarintsInBuffer // = 172 - case csharpNamespace // = 173 - case ctype // = 174 - case customCodable // = 175 + case consumedBytes // = 168 + case contentsOf // = 169 + case count // = 170 + case countVarintsInBuffer // = 171 + case csharpNamespace // = 172 + case ctype // = 173 + case customCodable // = 174 + case customDebugStringConvertible // = 175 case d // = 176 case data // = 177 case dataResult // = 178 @@ -1178,14 +1178,14 @@ enum SwiftProtoTesting_Generated_GeneratedSwiftReservedEnum: SwiftProtobuf.Enum, case 165: self = .collection case 166: self = .com case 167: self = .comma - case 168: self = .commonMessageConformances - case 169: self = .consumedBytes - case 170: self = .contentsOf - case 171: self = .count - case 172: self = .countVarintsInBuffer - case 173: self = .csharpNamespace - case 174: self = .ctype - case 175: self = .customCodable + case 168: self = .consumedBytes + case 169: self = .contentsOf + case 170: self = .count + case 171: self = .countVarintsInBuffer + case 172: self = .csharpNamespace + case 173: self = .ctype + case 174: self = .customCodable + case 175: self = .customDebugStringConvertible case 176: self = .d case 177: self = .data case 178: self = .dataResult @@ -2160,14 +2160,14 @@ enum SwiftProtoTesting_Generated_GeneratedSwiftReservedEnum: SwiftProtobuf.Enum, case .collection: return 165 case .com: return 166 case .comma: return 167 - case .commonMessageConformances: return 168 - case .consumedBytes: return 169 - case .contentsOf: return 170 - case .count: return 171 - case .countVarintsInBuffer: return 172 - case .csharpNamespace: return 173 - case .ctype: return 174 - case .customCodable: return 175 + case .consumedBytes: return 168 + case .contentsOf: return 169 + case .count: return 170 + case .countVarintsInBuffer: return 171 + case .csharpNamespace: return 172 + case .ctype: return 173 + case .customCodable: return 174 + case .customDebugStringConvertible: return 175 case .d: return 176 case .data: return 177 case .dataResult: return 178 @@ -3150,7 +3150,6 @@ enum SwiftProtoTesting_Generated_GeneratedSwiftReservedEnum: SwiftProtobuf.Enum, .collection, .com, .comma, - .commonMessageConformances, .consumedBytes, .contentsOf, .count, @@ -3158,6 +3157,7 @@ enum SwiftProtoTesting_Generated_GeneratedSwiftReservedEnum: SwiftProtobuf.Enum, .csharpNamespace, .ctype, .customCodable, + .customDebugStringConvertible, .d, .data, .dataResult, @@ -4134,14 +4134,14 @@ extension SwiftProtoTesting_Generated_GeneratedSwiftReservedEnum: SwiftProtobuf. 165: .same(proto: "Collection"), 166: .same(proto: "com"), 167: .same(proto: "comma"), - 168: .same(proto: "CommonMessageConformances"), - 169: .same(proto: "consumedBytes"), - 170: .same(proto: "contentsOf"), - 171: .same(proto: "count"), - 172: .same(proto: "countVarintsInBuffer"), - 173: .same(proto: "csharpNamespace"), - 174: .same(proto: "ctype"), - 175: .same(proto: "customCodable"), + 168: .same(proto: "consumedBytes"), + 169: .same(proto: "contentsOf"), + 170: .same(proto: "count"), + 171: .same(proto: "countVarintsInBuffer"), + 172: .same(proto: "csharpNamespace"), + 173: .same(proto: "ctype"), + 174: .same(proto: "customCodable"), + 175: .same(proto: "CustomDebugStringConvertible"), 176: .same(proto: "d"), 177: .same(proto: "Data"), 178: .same(proto: "dataResult"), diff --git a/Reference/SwiftProtobufTests/generated_swift_names_enums.pb.swift b/Reference/SwiftProtobufTests/generated_swift_names_enums.pb.swift index 3f8655637..0151470b2 100644 --- a/Reference/SwiftProtobufTests/generated_swift_names_enums.pb.swift +++ b/Reference/SwiftProtobufTests/generated_swift_names_enums.pb.swift @@ -5041,36 +5041,6 @@ struct SwiftProtoTesting_Generated_GeneratedSwiftReservedEnums: Sendable { } - enum CommonMessageConformances: SwiftProtobuf.Enum, Swift.CaseIterable { - typealias RawValue = Int - case noneCommonMessageConformances // = 0 - case UNRECOGNIZED(Int) - - init() { - self = .noneCommonMessageConformances - } - - init?(rawValue: Int) { - switch rawValue { - case 0: self = .noneCommonMessageConformances - default: self = .UNRECOGNIZED(rawValue) - } - } - - var rawValue: Int { - switch self { - case .noneCommonMessageConformances: return 0 - case .UNRECOGNIZED(let i): return i - } - } - - // The compiler won't synthesize support with the UNRECOGNIZED case. - static let allCases: [SwiftProtoTesting_Generated_GeneratedSwiftReservedEnums.CommonMessageConformances] = [ - .noneCommonMessageConformances, - ] - - } - enum consumedBytes: SwiftProtobuf.Enum, Swift.CaseIterable { typealias RawValue = Int case noneConsumedBytes // = 0 @@ -5281,6 +5251,36 @@ struct SwiftProtoTesting_Generated_GeneratedSwiftReservedEnums: Sendable { } + enum CustomDebugStringConvertible: SwiftProtobuf.Enum, Swift.CaseIterable { + typealias RawValue = Int + case noneCustomDebugStringConvertible // = 0 + case UNRECOGNIZED(Int) + + init() { + self = .noneCustomDebugStringConvertible + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .noneCustomDebugStringConvertible + default: self = .UNRECOGNIZED(rawValue) + } + } + + var rawValue: Int { + switch self { + case .noneCustomDebugStringConvertible: return 0 + case .UNRECOGNIZED(let i): return i + } + } + + // The compiler won't synthesize support with the UNRECOGNIZED case. + static let allCases: [SwiftProtoTesting_Generated_GeneratedSwiftReservedEnums.CustomDebugStringConvertible] = [ + .noneCustomDebugStringConvertible, + ] + + } + enum d: SwiftProtobuf.Enum, Swift.CaseIterable { typealias RawValue = Int case noneD // = 0 @@ -30309,12 +30309,6 @@ extension SwiftProtoTesting_Generated_GeneratedSwiftReservedEnums.comma: SwiftPr ] } -extension SwiftProtoTesting_Generated_GeneratedSwiftReservedEnums.CommonMessageConformances: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 0: .same(proto: "NONE_CommonMessageConformances"), - ] -} - extension SwiftProtoTesting_Generated_GeneratedSwiftReservedEnums.consumedBytes: SwiftProtobuf._ProtoNameProviding { static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 0: .same(proto: "NONE_consumedBytes"), @@ -30357,6 +30351,12 @@ extension SwiftProtoTesting_Generated_GeneratedSwiftReservedEnums.customCodable: ] } +extension SwiftProtoTesting_Generated_GeneratedSwiftReservedEnums.CustomDebugStringConvertible: SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "NONE_CustomDebugStringConvertible"), + ] +} + extension SwiftProtoTesting_Generated_GeneratedSwiftReservedEnums.d: SwiftProtobuf._ProtoNameProviding { static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 0: .same(proto: "NONE_d"), diff --git a/Reference/SwiftProtobufTests/generated_swift_names_fields.pb.swift b/Reference/SwiftProtobufTests/generated_swift_names_fields.pb.swift index d80d3fdcc..8605f9e4d 100644 --- a/Reference/SwiftProtobufTests/generated_swift_names_fields.pb.swift +++ b/Reference/SwiftProtobufTests/generated_swift_names_fields.pb.swift @@ -864,11 +864,6 @@ struct SwiftProtoTesting_Generated_GeneratedSwiftReservedFields: @unchecked Send set {_uniqueStorage()._comma = newValue} } - var commonMessageConformances: Int32 { - get {return _storage._commonMessageConformances} - set {_uniqueStorage()._commonMessageConformances = newValue} - } - var consumedBytes: Int32 { get {return _storage._consumedBytes} set {_uniqueStorage()._consumedBytes = newValue} @@ -904,6 +899,11 @@ struct SwiftProtoTesting_Generated_GeneratedSwiftReservedFields: @unchecked Send set {_uniqueStorage()._customCodable = newValue} } + var customDebugStringConvertible: Int32 { + get {return _storage._customDebugStringConvertible} + set {_uniqueStorage()._customDebugStringConvertible = newValue} + } + var d: Int32 { get {return _storage._d} set {_uniqueStorage()._d = newValue} @@ -5085,14 +5085,14 @@ extension SwiftProtoTesting_Generated_GeneratedSwiftReservedFields: SwiftProtobu 165: .same(proto: "Collection"), 166: .same(proto: "com"), 167: .same(proto: "comma"), - 168: .same(proto: "CommonMessageConformances"), - 169: .same(proto: "consumedBytes"), - 170: .same(proto: "contentsOf"), - 171: .same(proto: "count"), - 172: .same(proto: "countVarintsInBuffer"), - 173: .same(proto: "csharpNamespace"), - 174: .same(proto: "ctype"), - 175: .same(proto: "customCodable"), + 168: .same(proto: "consumedBytes"), + 169: .same(proto: "contentsOf"), + 170: .same(proto: "count"), + 171: .same(proto: "countVarintsInBuffer"), + 172: .same(proto: "csharpNamespace"), + 173: .same(proto: "ctype"), + 174: .same(proto: "customCodable"), + 175: .same(proto: "CustomDebugStringConvertible"), 176: .same(proto: "d"), 177: .same(proto: "Data"), 178: .same(proto: "dataResult"), @@ -6063,7 +6063,6 @@ extension SwiftProtoTesting_Generated_GeneratedSwiftReservedFields: SwiftProtobu var _collection: Int32 = 0 var _com: Int32 = 0 var _comma: Int32 = 0 - var _commonMessageConformances: Int32 = 0 var _consumedBytes: Int32 = 0 var _contentsOf: Int32 = 0 var _count: Int32 = 0 @@ -6071,6 +6070,7 @@ extension SwiftProtoTesting_Generated_GeneratedSwiftReservedFields: SwiftProtobu var _csharpNamespace: Int32 = 0 var _ctype: Int32 = 0 var _customCodable: Int32 = 0 + var _customDebugStringConvertible: Int32 = 0 var _d: Int32 = 0 var _data: Int32 = 0 var _dataResult: Int32 = 0 @@ -7052,7 +7052,6 @@ extension SwiftProtoTesting_Generated_GeneratedSwiftReservedFields: SwiftProtobu _collection = source._collection _com = source._com _comma = source._comma - _commonMessageConformances = source._commonMessageConformances _consumedBytes = source._consumedBytes _contentsOf = source._contentsOf _count = source._count @@ -7060,6 +7059,7 @@ extension SwiftProtoTesting_Generated_GeneratedSwiftReservedFields: SwiftProtobu _csharpNamespace = source._csharpNamespace _ctype = source._ctype _customCodable = source._customCodable + _customDebugStringConvertible = source._customDebugStringConvertible _d = source._d _data = source._data _dataResult = source._dataResult @@ -8045,14 +8045,14 @@ extension SwiftProtoTesting_Generated_GeneratedSwiftReservedFields: SwiftProtobu case 165: try { try decoder.decodeSingularInt32Field(value: &_storage._collection) }() case 166: try { try decoder.decodeSingularInt32Field(value: &_storage._com) }() case 167: try { try decoder.decodeSingularInt32Field(value: &_storage._comma) }() - case 168: try { try decoder.decodeSingularInt32Field(value: &_storage._commonMessageConformances) }() - case 169: try { try decoder.decodeSingularInt32Field(value: &_storage._consumedBytes) }() - case 170: try { try decoder.decodeSingularInt32Field(value: &_storage._contentsOf) }() - case 171: try { try decoder.decodeSingularInt32Field(value: &_storage._count) }() - case 172: try { try decoder.decodeSingularInt32Field(value: &_storage._countVarintsInBuffer) }() - case 173: try { try decoder.decodeSingularInt32Field(value: &_storage._csharpNamespace) }() - case 174: try { try decoder.decodeSingularInt32Field(value: &_storage._ctype) }() - case 175: try { try decoder.decodeSingularInt32Field(value: &_storage._customCodable) }() + case 168: try { try decoder.decodeSingularInt32Field(value: &_storage._consumedBytes) }() + case 169: try { try decoder.decodeSingularInt32Field(value: &_storage._contentsOf) }() + case 170: try { try decoder.decodeSingularInt32Field(value: &_storage._count) }() + case 171: try { try decoder.decodeSingularInt32Field(value: &_storage._countVarintsInBuffer) }() + case 172: try { try decoder.decodeSingularInt32Field(value: &_storage._csharpNamespace) }() + case 173: try { try decoder.decodeSingularInt32Field(value: &_storage._ctype) }() + case 174: try { try decoder.decodeSingularInt32Field(value: &_storage._customCodable) }() + case 175: try { try decoder.decodeSingularInt32Field(value: &_storage._customDebugStringConvertible) }() case 176: try { try decoder.decodeSingularInt32Field(value: &_storage._d) }() case 177: try { try decoder.decodeSingularInt32Field(value: &_storage._data) }() case 178: try { try decoder.decodeSingularInt32Field(value: &_storage._dataResult) }() @@ -9362,29 +9362,29 @@ extension SwiftProtoTesting_Generated_GeneratedSwiftReservedFields: SwiftProtobu if _storage._comma != 0 { try visitor.visitSingularInt32Field(value: _storage._comma, fieldNumber: 167) } - if _storage._commonMessageConformances != 0 { - try visitor.visitSingularInt32Field(value: _storage._commonMessageConformances, fieldNumber: 168) - } if _storage._consumedBytes != 0 { - try visitor.visitSingularInt32Field(value: _storage._consumedBytes, fieldNumber: 169) + try visitor.visitSingularInt32Field(value: _storage._consumedBytes, fieldNumber: 168) } if _storage._contentsOf != 0 { - try visitor.visitSingularInt32Field(value: _storage._contentsOf, fieldNumber: 170) + try visitor.visitSingularInt32Field(value: _storage._contentsOf, fieldNumber: 169) } if _storage._count != 0 { - try visitor.visitSingularInt32Field(value: _storage._count, fieldNumber: 171) + try visitor.visitSingularInt32Field(value: _storage._count, fieldNumber: 170) } if _storage._countVarintsInBuffer != 0 { - try visitor.visitSingularInt32Field(value: _storage._countVarintsInBuffer, fieldNumber: 172) + try visitor.visitSingularInt32Field(value: _storage._countVarintsInBuffer, fieldNumber: 171) } if _storage._csharpNamespace != 0 { - try visitor.visitSingularInt32Field(value: _storage._csharpNamespace, fieldNumber: 173) + try visitor.visitSingularInt32Field(value: _storage._csharpNamespace, fieldNumber: 172) } if _storage._ctype != 0 { - try visitor.visitSingularInt32Field(value: _storage._ctype, fieldNumber: 174) + try visitor.visitSingularInt32Field(value: _storage._ctype, fieldNumber: 173) } if _storage._customCodable != 0 { - try visitor.visitSingularInt32Field(value: _storage._customCodable, fieldNumber: 175) + try visitor.visitSingularInt32Field(value: _storage._customCodable, fieldNumber: 174) + } + if _storage._customDebugStringConvertible != 0 { + try visitor.visitSingularInt32Field(value: _storage._customDebugStringConvertible, fieldNumber: 175) } if _storage._d != 0 { try visitor.visitSingularInt32Field(value: _storage._d, fieldNumber: 176) @@ -11962,7 +11962,6 @@ extension SwiftProtoTesting_Generated_GeneratedSwiftReservedFields: SwiftProtobu if _storage._collection != rhs_storage._collection {return false} if _storage._com != rhs_storage._com {return false} if _storage._comma != rhs_storage._comma {return false} - if _storage._commonMessageConformances != rhs_storage._commonMessageConformances {return false} if _storage._consumedBytes != rhs_storage._consumedBytes {return false} if _storage._contentsOf != rhs_storage._contentsOf {return false} if _storage._count != rhs_storage._count {return false} @@ -11970,6 +11969,7 @@ extension SwiftProtoTesting_Generated_GeneratedSwiftReservedFields: SwiftProtobu if _storage._csharpNamespace != rhs_storage._csharpNamespace {return false} if _storage._ctype != rhs_storage._ctype {return false} if _storage._customCodable != rhs_storage._customCodable {return false} + if _storage._customDebugStringConvertible != rhs_storage._customDebugStringConvertible {return false} if _storage._d != rhs_storage._d {return false} if _storage._data != rhs_storage._data {return false} if _storage._dataResult != rhs_storage._dataResult {return false} diff --git a/Reference/SwiftProtobufTests/generated_swift_names_messages.pb.swift b/Reference/SwiftProtobufTests/generated_swift_names_messages.pb.swift index cdd17bb4f..7e77d6f19 100644 --- a/Reference/SwiftProtobufTests/generated_swift_names_messages.pb.swift +++ b/Reference/SwiftProtobufTests/generated_swift_names_messages.pb.swift @@ -2035,18 +2035,6 @@ struct SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages: Sendable { init() {} } - struct CommonMessageConformances: Sendable { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - var commonMessageConformances: Int32 = 0 - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} - } - struct consumedBytes: Sendable { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for @@ -2131,6 +2119,18 @@ struct SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages: Sendable { init() {} } + struct CustomDebugStringConvertible: Sendable { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var customDebugStringConvertible: Int32 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + } + struct d: Sendable { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for @@ -17101,38 +17101,6 @@ extension SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages.comma: Swif } } -extension SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages.CommonMessageConformances: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages.protoMessageName + ".CommonMessageConformances" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "CommonMessageConformances"), - ] - - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 1: try { try decoder.decodeSingularInt32Field(value: &self.commonMessageConformances) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if self.commonMessageConformances != 0 { - try visitor.visitSingularInt32Field(value: self.commonMessageConformances, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages.CommonMessageConformances, rhs: SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages.CommonMessageConformances) -> Bool { - if lhs.commonMessageConformances != rhs.commonMessageConformances {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - extension SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages.consumedBytes: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages.protoMessageName + ".consumedBytes" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ @@ -17357,6 +17325,38 @@ extension SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages.customCodab } } +extension SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages.CustomDebugStringConvertible: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages.protoMessageName + ".CustomDebugStringConvertible" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "CustomDebugStringConvertible"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularInt32Field(value: &self.customDebugStringConvertible) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.customDebugStringConvertible != 0 { + try visitor.visitSingularInt32Field(value: self.customDebugStringConvertible, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages.CustomDebugStringConvertible, rhs: SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages.CustomDebugStringConvertible) -> Bool { + if lhs.customDebugStringConvertible != rhs.customDebugStringConvertible {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + extension SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages.d: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages.protoMessageName + ".d" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ diff --git a/Sources/SwiftProtobuf/ExtensionFields.swift b/Sources/SwiftProtobuf/ExtensionFields.swift index 435fc210e..c1696041a 100644 --- a/Sources/SwiftProtobuf/ExtensionFields.swift +++ b/Sources/SwiftProtobuf/ExtensionFields.swift @@ -23,7 +23,7 @@ // so you can't actually access the contained value itself. // @preconcurrency -public protocol AnyExtensionField: Sendable { +public protocol AnyExtensionField: Sendable, CustomDebugStringConvertible { func hash(into hasher: inout Hasher) var protobufExtension: any AnyMessageExtension { get } func isEqual(other: any AnyExtensionField) -> Bool @@ -73,6 +73,14 @@ public struct OptionalExtensionField: ExtensionField { self.protobufExtension = protobufExtension self.value = value } + + public var debugDescription: String { + #if DEBUG + return String(reflecting: value) + #else + return String(reflecting: type(of: self)) + #endif + } public func hash(into hasher: inout Hasher) { hasher.combine(value) @@ -106,16 +114,6 @@ public struct OptionalExtensionField: ExtensionField { } } -#if DEBUG -extension OptionalExtensionField: CustomDebugStringConvertible { - public var debugDescription: String { - get { - return String(reflecting: value) - } - } -} -#endif - /// /// Repeated fields /// @@ -134,6 +132,14 @@ public struct RepeatedExtensionField: ExtensionField { self.protobufExtension = protobufExtension self.value = value } + + public var debugDescription: String { + #if DEBUG + return "[" + value.map{String(reflecting: $0)}.joined(separator: ",") + "]" + #else + return String(reflecting: type(of: self)) + #endif + } public func hash(into hasher: inout Hasher) { hasher.combine(value) @@ -161,14 +167,6 @@ public struct RepeatedExtensionField: ExtensionField { } } -#if DEBUG -extension RepeatedExtensionField: CustomDebugStringConvertible { - public var debugDescription: String { - return "[" + value.map{String(reflecting: $0)}.joined(separator: ",") + "]" - } -} -#endif - /// /// Packed Repeated fields /// @@ -190,6 +188,14 @@ public struct PackedExtensionField: ExtensionField { self.protobufExtension = protobufExtension self.value = value } + + public var debugDescription: String { + #if DEBUG + return "[" + value.map{String(reflecting: $0)}.joined(separator: ",") + "]" + #else + return String(reflecting: type(of: self)) + #endif + } public func hash(into hasher: inout Hasher) { hasher.combine(value) @@ -217,14 +223,6 @@ public struct PackedExtensionField: ExtensionField { } } -#if DEBUG -extension PackedExtensionField: CustomDebugStringConvertible { - public var debugDescription: String { - return "[" + value.map{String(reflecting: $0)}.joined(separator: ",") + "]" - } -} -#endif - /// /// Enum extensions /// @@ -243,6 +241,14 @@ public struct OptionalEnumExtensionField: ExtensionField where E.RawVal self.protobufExtension = protobufExtension self.value = value } + + public var debugDescription: String { + #if DEBUG + return String(reflecting: value) + #else + return String(reflecting: type(of: self)) + #endif + } public func hash(into hasher: inout Hasher) { hasher.combine(value) @@ -278,16 +284,6 @@ public struct OptionalEnumExtensionField: ExtensionField where E.RawVal } } -#if DEBUG -extension OptionalEnumExtensionField: CustomDebugStringConvertible { - public var debugDescription: String { - get { - return String(reflecting: value) - } - } -} -#endif - /// /// Repeated Enum fields /// @@ -306,6 +302,14 @@ public struct RepeatedEnumExtensionField: ExtensionField where E.RawVal self.protobufExtension = protobufExtension self.value = value } + + public var debugDescription: String { + #if DEBUG + return "[" + value.map{String(reflecting: $0)}.joined(separator: ",") + "]" + #else + return String(reflecting: type(of: self)) + #endif + } public func hash(into hasher: inout Hasher) { hasher.combine(value) @@ -335,14 +339,6 @@ public struct RepeatedEnumExtensionField: ExtensionField where E.RawVal } } -#if DEBUG -extension RepeatedEnumExtensionField: CustomDebugStringConvertible { - public var debugDescription: String { - return "[" + value.map{String(reflecting: $0)}.joined(separator: ",") + "]" - } -} -#endif - /// /// Packed Repeated Enum fields /// @@ -364,6 +360,14 @@ public struct PackedEnumExtensionField: ExtensionField where E.RawValue self.protobufExtension = protobufExtension self.value = value } + + public var debugDescription: String { + #if DEBUG + return "[" + value.map{String(reflecting: $0)}.joined(separator: ",") + "]" + #else + return String(reflecting: type(of: self)) + #endif + } public func hash(into hasher: inout Hasher) { hasher.combine(value) @@ -393,14 +397,6 @@ public struct PackedEnumExtensionField: ExtensionField where E.RawValue } } -#if DEBUG -extension PackedEnumExtensionField: CustomDebugStringConvertible { - public var debugDescription: String { - return "[" + value.map{String(reflecting: $0)}.joined(separator: ",") + "]" - } -} -#endif - // // ========== Message ========== // @@ -420,6 +416,14 @@ public struct OptionalMessageExtensionField: self.protobufExtension = protobufExtension self.value = value } + + public var debugDescription: String { + #if DEBUG + return String(reflecting: value) + #else + return String(reflecting: type(of: self)) + #endif + } public func hash(into hasher: inout Hasher) { value.hash(into: &hasher) @@ -458,16 +462,6 @@ public struct OptionalMessageExtensionField: } } -#if DEBUG -extension OptionalMessageExtensionField: CustomDebugStringConvertible { - public var debugDescription: String { - get { - return String(reflecting: value) - } - } -} -#endif - public struct RepeatedMessageExtensionField: ExtensionField { public typealias BaseType = M @@ -484,6 +478,14 @@ public struct RepeatedMessageExtensionField: self.protobufExtension = protobufExtension self.value = value } + + public var debugDescription: String { + #if DEBUG + return "[" + value.map{String(reflecting: $0)}.joined(separator: ",") + "]" + #else + return String(reflecting: type(of: self)) + #endif + } public func hash(into hasher: inout Hasher) { for e in value { @@ -518,14 +520,6 @@ public struct RepeatedMessageExtensionField: } } -#if DEBUG -extension RepeatedMessageExtensionField: CustomDebugStringConvertible { - public var debugDescription: String { - return "[" + value.map{String(reflecting: $0)}.joined(separator: ",") + "]" - } -} -#endif - // // ======== Groups within Messages ======== // @@ -548,6 +542,14 @@ public struct OptionalGroupExtensionField: self.protobufExtension = protobufExtension self.value = value } + + public var debugDescription: String { + #if DEBUG + return value.debugDescription + #else + return String(reflecting: type(of: self)) + #endif + } public func hash(into hasher: inout Hasher) { hasher.combine(value) @@ -586,16 +588,6 @@ public struct OptionalGroupExtensionField: } } -#if DEBUG -extension OptionalGroupExtensionField: CustomDebugStringConvertible { - public var debugDescription: String { - get { - return value.debugDescription - } - } -} -#endif - public struct RepeatedGroupExtensionField: ExtensionField { public typealias BaseType = G @@ -612,6 +604,14 @@ public struct RepeatedGroupExtensionField: self.protobufExtension = protobufExtension self.value = value } + + public var debugDescription: String { + #if DEBUG + return "[" + value.map{$0.debugDescription}.joined(separator: ",") + "]" + #else + return String(reflecting: type(of: self)) + #endif + } public func hash(into hasher: inout Hasher) { hasher.combine(value) @@ -643,11 +643,3 @@ public struct RepeatedGroupExtensionField: return Internal.areAllInitialized(value) } } - -#if DEBUG -extension RepeatedGroupExtensionField: CustomDebugStringConvertible { - public var debugDescription: String { - return "[" + value.map{$0.debugDescription}.joined(separator: ",") + "]" - } -} -#endif diff --git a/Sources/SwiftProtobuf/Message.swift b/Sources/SwiftProtobuf/Message.swift index 047f8d0c4..4405dd270 100644 --- a/Sources/SwiftProtobuf/Message.swift +++ b/Sources/SwiftProtobuf/Message.swift @@ -32,7 +32,7 @@ /// The actual functionality is implemented either in the generated code or in /// default implementations of the below methods and properties. @preconcurrency -public protocol Message: _CommonMessageConformances { +public protocol Message: Sendable, CustomDebugStringConvertible { /// Creates a new message with all of its fields initialized to their default /// values. init() @@ -113,13 +113,6 @@ public protocol Message: _CommonMessageConformances { func isEqualTo(message: any Message) -> Bool } -#if DEBUG -public typealias _CommonMessageConformances = - Sendable & CustomDebugStringConvertible -#else -public typealias _CommonMessageConformances = Sendable -#endif - extension Message { /// Generated proto2 messages that contain required fields, nested messages /// that contain required fields, and/or extensions will provide their own @@ -137,10 +130,10 @@ extension Message { hasher = visitor.hasher } - #if DEBUG /// A description generated by recursively visiting all fields in the message, /// including messages. public var debugDescription: String { + #if DEBUG // TODO Ideally there would be something like serializeText() that can // take a prefix so we could do something like: // [class name]( @@ -149,8 +142,10 @@ extension Message { let className = String(reflecting: type(of: self)) let header = "\(className):\n" return header + textFormatString() + #else + return String(reflecting: type(of: self)) + #endif } - #endif /// Creates an instance of the message type on which this method is called, /// executes the given block passing the message in as its sole `inout` diff --git a/Sources/SwiftProtobuf/SimpleExtensionMap.swift b/Sources/SwiftProtobuf/SimpleExtensionMap.swift index 5c7da6015..7c83bc5b5 100644 --- a/Sources/SwiftProtobuf/SimpleExtensionMap.swift +++ b/Sources/SwiftProtobuf/SimpleExtensionMap.swift @@ -100,9 +100,9 @@ public struct SimpleExtensionMap: ExtensionMap, ExpressibleByArrayLiteral { } -#if DEBUG extension SimpleExtensionMap: CustomDebugStringConvertible { public var debugDescription: String { + #if DEBUG var names = [String]() for (_, list) in fields { for e in list { @@ -111,6 +111,8 @@ extension SimpleExtensionMap: CustomDebugStringConvertible { } let d = names.joined(separator: ",") return "SimpleExtensionMap(\(d))" + #else + return String(reflecting: type(of: self)) + #endif } } -#endif diff --git a/Tests/SwiftProtobufTests/generated_swift_names_enum_cases.pb.swift b/Tests/SwiftProtobufTests/generated_swift_names_enum_cases.pb.swift index 2802c75e7..de3f35a45 100644 --- a/Tests/SwiftProtobufTests/generated_swift_names_enum_cases.pb.swift +++ b/Tests/SwiftProtobufTests/generated_swift_names_enum_cases.pb.swift @@ -194,14 +194,14 @@ enum SwiftProtoTesting_Generated_GeneratedSwiftReservedEnum: SwiftProtobuf.Enum, case collection // = 165 case com // = 166 case comma // = 167 - case commonMessageConformances // = 168 - case consumedBytes // = 169 - case contentsOf // = 170 - case count // = 171 - case countVarintsInBuffer // = 172 - case csharpNamespace // = 173 - case ctype // = 174 - case customCodable // = 175 + case consumedBytes // = 168 + case contentsOf // = 169 + case count // = 170 + case countVarintsInBuffer // = 171 + case csharpNamespace // = 172 + case ctype // = 173 + case customCodable // = 174 + case customDebugStringConvertible // = 175 case d // = 176 case data // = 177 case dataResult // = 178 @@ -1178,14 +1178,14 @@ enum SwiftProtoTesting_Generated_GeneratedSwiftReservedEnum: SwiftProtobuf.Enum, case 165: self = .collection case 166: self = .com case 167: self = .comma - case 168: self = .commonMessageConformances - case 169: self = .consumedBytes - case 170: self = .contentsOf - case 171: self = .count - case 172: self = .countVarintsInBuffer - case 173: self = .csharpNamespace - case 174: self = .ctype - case 175: self = .customCodable + case 168: self = .consumedBytes + case 169: self = .contentsOf + case 170: self = .count + case 171: self = .countVarintsInBuffer + case 172: self = .csharpNamespace + case 173: self = .ctype + case 174: self = .customCodable + case 175: self = .customDebugStringConvertible case 176: self = .d case 177: self = .data case 178: self = .dataResult @@ -2160,14 +2160,14 @@ enum SwiftProtoTesting_Generated_GeneratedSwiftReservedEnum: SwiftProtobuf.Enum, case .collection: return 165 case .com: return 166 case .comma: return 167 - case .commonMessageConformances: return 168 - case .consumedBytes: return 169 - case .contentsOf: return 170 - case .count: return 171 - case .countVarintsInBuffer: return 172 - case .csharpNamespace: return 173 - case .ctype: return 174 - case .customCodable: return 175 + case .consumedBytes: return 168 + case .contentsOf: return 169 + case .count: return 170 + case .countVarintsInBuffer: return 171 + case .csharpNamespace: return 172 + case .ctype: return 173 + case .customCodable: return 174 + case .customDebugStringConvertible: return 175 case .d: return 176 case .data: return 177 case .dataResult: return 178 @@ -3150,7 +3150,6 @@ enum SwiftProtoTesting_Generated_GeneratedSwiftReservedEnum: SwiftProtobuf.Enum, .collection, .com, .comma, - .commonMessageConformances, .consumedBytes, .contentsOf, .count, @@ -3158,6 +3157,7 @@ enum SwiftProtoTesting_Generated_GeneratedSwiftReservedEnum: SwiftProtobuf.Enum, .csharpNamespace, .ctype, .customCodable, + .customDebugStringConvertible, .d, .data, .dataResult, @@ -4134,14 +4134,14 @@ extension SwiftProtoTesting_Generated_GeneratedSwiftReservedEnum: SwiftProtobuf. 165: .same(proto: "Collection"), 166: .same(proto: "com"), 167: .same(proto: "comma"), - 168: .same(proto: "CommonMessageConformances"), - 169: .same(proto: "consumedBytes"), - 170: .same(proto: "contentsOf"), - 171: .same(proto: "count"), - 172: .same(proto: "countVarintsInBuffer"), - 173: .same(proto: "csharpNamespace"), - 174: .same(proto: "ctype"), - 175: .same(proto: "customCodable"), + 168: .same(proto: "consumedBytes"), + 169: .same(proto: "contentsOf"), + 170: .same(proto: "count"), + 171: .same(proto: "countVarintsInBuffer"), + 172: .same(proto: "csharpNamespace"), + 173: .same(proto: "ctype"), + 174: .same(proto: "customCodable"), + 175: .same(proto: "CustomDebugStringConvertible"), 176: .same(proto: "d"), 177: .same(proto: "Data"), 178: .same(proto: "dataResult"), diff --git a/Tests/SwiftProtobufTests/generated_swift_names_enums.pb.swift b/Tests/SwiftProtobufTests/generated_swift_names_enums.pb.swift index 3f8655637..0151470b2 100644 --- a/Tests/SwiftProtobufTests/generated_swift_names_enums.pb.swift +++ b/Tests/SwiftProtobufTests/generated_swift_names_enums.pb.swift @@ -5041,36 +5041,6 @@ struct SwiftProtoTesting_Generated_GeneratedSwiftReservedEnums: Sendable { } - enum CommonMessageConformances: SwiftProtobuf.Enum, Swift.CaseIterable { - typealias RawValue = Int - case noneCommonMessageConformances // = 0 - case UNRECOGNIZED(Int) - - init() { - self = .noneCommonMessageConformances - } - - init?(rawValue: Int) { - switch rawValue { - case 0: self = .noneCommonMessageConformances - default: self = .UNRECOGNIZED(rawValue) - } - } - - var rawValue: Int { - switch self { - case .noneCommonMessageConformances: return 0 - case .UNRECOGNIZED(let i): return i - } - } - - // The compiler won't synthesize support with the UNRECOGNIZED case. - static let allCases: [SwiftProtoTesting_Generated_GeneratedSwiftReservedEnums.CommonMessageConformances] = [ - .noneCommonMessageConformances, - ] - - } - enum consumedBytes: SwiftProtobuf.Enum, Swift.CaseIterable { typealias RawValue = Int case noneConsumedBytes // = 0 @@ -5281,6 +5251,36 @@ struct SwiftProtoTesting_Generated_GeneratedSwiftReservedEnums: Sendable { } + enum CustomDebugStringConvertible: SwiftProtobuf.Enum, Swift.CaseIterable { + typealias RawValue = Int + case noneCustomDebugStringConvertible // = 0 + case UNRECOGNIZED(Int) + + init() { + self = .noneCustomDebugStringConvertible + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .noneCustomDebugStringConvertible + default: self = .UNRECOGNIZED(rawValue) + } + } + + var rawValue: Int { + switch self { + case .noneCustomDebugStringConvertible: return 0 + case .UNRECOGNIZED(let i): return i + } + } + + // The compiler won't synthesize support with the UNRECOGNIZED case. + static let allCases: [SwiftProtoTesting_Generated_GeneratedSwiftReservedEnums.CustomDebugStringConvertible] = [ + .noneCustomDebugStringConvertible, + ] + + } + enum d: SwiftProtobuf.Enum, Swift.CaseIterable { typealias RawValue = Int case noneD // = 0 @@ -30309,12 +30309,6 @@ extension SwiftProtoTesting_Generated_GeneratedSwiftReservedEnums.comma: SwiftPr ] } -extension SwiftProtoTesting_Generated_GeneratedSwiftReservedEnums.CommonMessageConformances: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 0: .same(proto: "NONE_CommonMessageConformances"), - ] -} - extension SwiftProtoTesting_Generated_GeneratedSwiftReservedEnums.consumedBytes: SwiftProtobuf._ProtoNameProviding { static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 0: .same(proto: "NONE_consumedBytes"), @@ -30357,6 +30351,12 @@ extension SwiftProtoTesting_Generated_GeneratedSwiftReservedEnums.customCodable: ] } +extension SwiftProtoTesting_Generated_GeneratedSwiftReservedEnums.CustomDebugStringConvertible: SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "NONE_CustomDebugStringConvertible"), + ] +} + extension SwiftProtoTesting_Generated_GeneratedSwiftReservedEnums.d: SwiftProtobuf._ProtoNameProviding { static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 0: .same(proto: "NONE_d"), diff --git a/Tests/SwiftProtobufTests/generated_swift_names_fields.pb.swift b/Tests/SwiftProtobufTests/generated_swift_names_fields.pb.swift index d80d3fdcc..8605f9e4d 100644 --- a/Tests/SwiftProtobufTests/generated_swift_names_fields.pb.swift +++ b/Tests/SwiftProtobufTests/generated_swift_names_fields.pb.swift @@ -864,11 +864,6 @@ struct SwiftProtoTesting_Generated_GeneratedSwiftReservedFields: @unchecked Send set {_uniqueStorage()._comma = newValue} } - var commonMessageConformances: Int32 { - get {return _storage._commonMessageConformances} - set {_uniqueStorage()._commonMessageConformances = newValue} - } - var consumedBytes: Int32 { get {return _storage._consumedBytes} set {_uniqueStorage()._consumedBytes = newValue} @@ -904,6 +899,11 @@ struct SwiftProtoTesting_Generated_GeneratedSwiftReservedFields: @unchecked Send set {_uniqueStorage()._customCodable = newValue} } + var customDebugStringConvertible: Int32 { + get {return _storage._customDebugStringConvertible} + set {_uniqueStorage()._customDebugStringConvertible = newValue} + } + var d: Int32 { get {return _storage._d} set {_uniqueStorage()._d = newValue} @@ -5085,14 +5085,14 @@ extension SwiftProtoTesting_Generated_GeneratedSwiftReservedFields: SwiftProtobu 165: .same(proto: "Collection"), 166: .same(proto: "com"), 167: .same(proto: "comma"), - 168: .same(proto: "CommonMessageConformances"), - 169: .same(proto: "consumedBytes"), - 170: .same(proto: "contentsOf"), - 171: .same(proto: "count"), - 172: .same(proto: "countVarintsInBuffer"), - 173: .same(proto: "csharpNamespace"), - 174: .same(proto: "ctype"), - 175: .same(proto: "customCodable"), + 168: .same(proto: "consumedBytes"), + 169: .same(proto: "contentsOf"), + 170: .same(proto: "count"), + 171: .same(proto: "countVarintsInBuffer"), + 172: .same(proto: "csharpNamespace"), + 173: .same(proto: "ctype"), + 174: .same(proto: "customCodable"), + 175: .same(proto: "CustomDebugStringConvertible"), 176: .same(proto: "d"), 177: .same(proto: "Data"), 178: .same(proto: "dataResult"), @@ -6063,7 +6063,6 @@ extension SwiftProtoTesting_Generated_GeneratedSwiftReservedFields: SwiftProtobu var _collection: Int32 = 0 var _com: Int32 = 0 var _comma: Int32 = 0 - var _commonMessageConformances: Int32 = 0 var _consumedBytes: Int32 = 0 var _contentsOf: Int32 = 0 var _count: Int32 = 0 @@ -6071,6 +6070,7 @@ extension SwiftProtoTesting_Generated_GeneratedSwiftReservedFields: SwiftProtobu var _csharpNamespace: Int32 = 0 var _ctype: Int32 = 0 var _customCodable: Int32 = 0 + var _customDebugStringConvertible: Int32 = 0 var _d: Int32 = 0 var _data: Int32 = 0 var _dataResult: Int32 = 0 @@ -7052,7 +7052,6 @@ extension SwiftProtoTesting_Generated_GeneratedSwiftReservedFields: SwiftProtobu _collection = source._collection _com = source._com _comma = source._comma - _commonMessageConformances = source._commonMessageConformances _consumedBytes = source._consumedBytes _contentsOf = source._contentsOf _count = source._count @@ -7060,6 +7059,7 @@ extension SwiftProtoTesting_Generated_GeneratedSwiftReservedFields: SwiftProtobu _csharpNamespace = source._csharpNamespace _ctype = source._ctype _customCodable = source._customCodable + _customDebugStringConvertible = source._customDebugStringConvertible _d = source._d _data = source._data _dataResult = source._dataResult @@ -8045,14 +8045,14 @@ extension SwiftProtoTesting_Generated_GeneratedSwiftReservedFields: SwiftProtobu case 165: try { try decoder.decodeSingularInt32Field(value: &_storage._collection) }() case 166: try { try decoder.decodeSingularInt32Field(value: &_storage._com) }() case 167: try { try decoder.decodeSingularInt32Field(value: &_storage._comma) }() - case 168: try { try decoder.decodeSingularInt32Field(value: &_storage._commonMessageConformances) }() - case 169: try { try decoder.decodeSingularInt32Field(value: &_storage._consumedBytes) }() - case 170: try { try decoder.decodeSingularInt32Field(value: &_storage._contentsOf) }() - case 171: try { try decoder.decodeSingularInt32Field(value: &_storage._count) }() - case 172: try { try decoder.decodeSingularInt32Field(value: &_storage._countVarintsInBuffer) }() - case 173: try { try decoder.decodeSingularInt32Field(value: &_storage._csharpNamespace) }() - case 174: try { try decoder.decodeSingularInt32Field(value: &_storage._ctype) }() - case 175: try { try decoder.decodeSingularInt32Field(value: &_storage._customCodable) }() + case 168: try { try decoder.decodeSingularInt32Field(value: &_storage._consumedBytes) }() + case 169: try { try decoder.decodeSingularInt32Field(value: &_storage._contentsOf) }() + case 170: try { try decoder.decodeSingularInt32Field(value: &_storage._count) }() + case 171: try { try decoder.decodeSingularInt32Field(value: &_storage._countVarintsInBuffer) }() + case 172: try { try decoder.decodeSingularInt32Field(value: &_storage._csharpNamespace) }() + case 173: try { try decoder.decodeSingularInt32Field(value: &_storage._ctype) }() + case 174: try { try decoder.decodeSingularInt32Field(value: &_storage._customCodable) }() + case 175: try { try decoder.decodeSingularInt32Field(value: &_storage._customDebugStringConvertible) }() case 176: try { try decoder.decodeSingularInt32Field(value: &_storage._d) }() case 177: try { try decoder.decodeSingularInt32Field(value: &_storage._data) }() case 178: try { try decoder.decodeSingularInt32Field(value: &_storage._dataResult) }() @@ -9362,29 +9362,29 @@ extension SwiftProtoTesting_Generated_GeneratedSwiftReservedFields: SwiftProtobu if _storage._comma != 0 { try visitor.visitSingularInt32Field(value: _storage._comma, fieldNumber: 167) } - if _storage._commonMessageConformances != 0 { - try visitor.visitSingularInt32Field(value: _storage._commonMessageConformances, fieldNumber: 168) - } if _storage._consumedBytes != 0 { - try visitor.visitSingularInt32Field(value: _storage._consumedBytes, fieldNumber: 169) + try visitor.visitSingularInt32Field(value: _storage._consumedBytes, fieldNumber: 168) } if _storage._contentsOf != 0 { - try visitor.visitSingularInt32Field(value: _storage._contentsOf, fieldNumber: 170) + try visitor.visitSingularInt32Field(value: _storage._contentsOf, fieldNumber: 169) } if _storage._count != 0 { - try visitor.visitSingularInt32Field(value: _storage._count, fieldNumber: 171) + try visitor.visitSingularInt32Field(value: _storage._count, fieldNumber: 170) } if _storage._countVarintsInBuffer != 0 { - try visitor.visitSingularInt32Field(value: _storage._countVarintsInBuffer, fieldNumber: 172) + try visitor.visitSingularInt32Field(value: _storage._countVarintsInBuffer, fieldNumber: 171) } if _storage._csharpNamespace != 0 { - try visitor.visitSingularInt32Field(value: _storage._csharpNamespace, fieldNumber: 173) + try visitor.visitSingularInt32Field(value: _storage._csharpNamespace, fieldNumber: 172) } if _storage._ctype != 0 { - try visitor.visitSingularInt32Field(value: _storage._ctype, fieldNumber: 174) + try visitor.visitSingularInt32Field(value: _storage._ctype, fieldNumber: 173) } if _storage._customCodable != 0 { - try visitor.visitSingularInt32Field(value: _storage._customCodable, fieldNumber: 175) + try visitor.visitSingularInt32Field(value: _storage._customCodable, fieldNumber: 174) + } + if _storage._customDebugStringConvertible != 0 { + try visitor.visitSingularInt32Field(value: _storage._customDebugStringConvertible, fieldNumber: 175) } if _storage._d != 0 { try visitor.visitSingularInt32Field(value: _storage._d, fieldNumber: 176) @@ -11962,7 +11962,6 @@ extension SwiftProtoTesting_Generated_GeneratedSwiftReservedFields: SwiftProtobu if _storage._collection != rhs_storage._collection {return false} if _storage._com != rhs_storage._com {return false} if _storage._comma != rhs_storage._comma {return false} - if _storage._commonMessageConformances != rhs_storage._commonMessageConformances {return false} if _storage._consumedBytes != rhs_storage._consumedBytes {return false} if _storage._contentsOf != rhs_storage._contentsOf {return false} if _storage._count != rhs_storage._count {return false} @@ -11970,6 +11969,7 @@ extension SwiftProtoTesting_Generated_GeneratedSwiftReservedFields: SwiftProtobu if _storage._csharpNamespace != rhs_storage._csharpNamespace {return false} if _storage._ctype != rhs_storage._ctype {return false} if _storage._customCodable != rhs_storage._customCodable {return false} + if _storage._customDebugStringConvertible != rhs_storage._customDebugStringConvertible {return false} if _storage._d != rhs_storage._d {return false} if _storage._data != rhs_storage._data {return false} if _storage._dataResult != rhs_storage._dataResult {return false} diff --git a/Tests/SwiftProtobufTests/generated_swift_names_messages.pb.swift b/Tests/SwiftProtobufTests/generated_swift_names_messages.pb.swift index cdd17bb4f..7e77d6f19 100644 --- a/Tests/SwiftProtobufTests/generated_swift_names_messages.pb.swift +++ b/Tests/SwiftProtobufTests/generated_swift_names_messages.pb.swift @@ -2035,18 +2035,6 @@ struct SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages: Sendable { init() {} } - struct CommonMessageConformances: Sendable { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - var commonMessageConformances: Int32 = 0 - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} - } - struct consumedBytes: Sendable { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for @@ -2131,6 +2119,18 @@ struct SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages: Sendable { init() {} } + struct CustomDebugStringConvertible: Sendable { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var customDebugStringConvertible: Int32 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + } + struct d: Sendable { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for @@ -17101,38 +17101,6 @@ extension SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages.comma: Swif } } -extension SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages.CommonMessageConformances: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages.protoMessageName + ".CommonMessageConformances" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "CommonMessageConformances"), - ] - - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 1: try { try decoder.decodeSingularInt32Field(value: &self.commonMessageConformances) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if self.commonMessageConformances != 0 { - try visitor.visitSingularInt32Field(value: self.commonMessageConformances, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages.CommonMessageConformances, rhs: SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages.CommonMessageConformances) -> Bool { - if lhs.commonMessageConformances != rhs.commonMessageConformances {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - extension SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages.consumedBytes: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages.protoMessageName + ".consumedBytes" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ @@ -17357,6 +17325,38 @@ extension SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages.customCodab } } +extension SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages.CustomDebugStringConvertible: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages.protoMessageName + ".CustomDebugStringConvertible" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "CustomDebugStringConvertible"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularInt32Field(value: &self.customDebugStringConvertible) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.customDebugStringConvertible != 0 { + try visitor.visitSingularInt32Field(value: self.customDebugStringConvertible, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages.CustomDebugStringConvertible, rhs: SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages.CustomDebugStringConvertible) -> Bool { + if lhs.customDebugStringConvertible != rhs.customDebugStringConvertible {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + extension SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages.d: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages.protoMessageName + ".d" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [