Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update proto files from upstream. #1650

Merged
merged 2 commits into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2024 Google Inc. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd

edition = "2023";

package protobuf_test_messages.editions;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2024 Google Inc. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd

edition = "2023";

package protobuf_test_messages.editions;
Expand Down
1 change: 1 addition & 0 deletions Protos/upstream/google/protobuf/unittest.proto
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ enum ForeignEnum {
FOREIGN_BAR = 5;
FOREIGN_BAZ = 6;
FOREIGN_BAX = 32; // (1 << 32) to generate a 64b bitmask would be incorrect.
FOREIGN_LARGE = 123456; // Large enough to escape the Boxed Integer cache.
}

message TestReservedFields {
Expand Down
20 changes: 20 additions & 0 deletions Protos/upstream/google/protobuf/unittest_custom_options.proto
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,26 @@ message SettingRealsFromNegativeInts {
option (double_opt) = -154;
}

message SettingRealsFromInf {
option (float_opt) = inf;
option (double_opt) = inf;
}

message SettingRealsFromNegativeInf {
option (float_opt) = -inf;
option (double_opt) = -inf;
}

message SettingRealsFromNan {
option (float_opt) = nan;
option (double_opt) = nan;
}

message SettingRealsFromNegativeNan {
option (float_opt) = -nan;
option (double_opt) = -nan;
}

// Options of complex message types, themselves combined and extended in
// various ways.

Expand Down
3 changes: 2 additions & 1 deletion Protos/upstream/google/protobuf/unittest_proto3.proto
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ message TestAllTypes {
repeated string repeated_string_piece = 54 [ctype = STRING_PIECE];
repeated string repeated_cord = 55 [ctype = CORD];

repeated NestedMessage repeated_lazy_message = 57 ;
repeated NestedMessage repeated_lazy_message = 57;

oneof oneof_field {
uint32 oneof_uint32 = 111;
Expand Down Expand Up @@ -178,6 +178,7 @@ enum ForeignEnum {
FOREIGN_FOO = 4;
FOREIGN_BAR = 5;
FOREIGN_BAZ = 6;
FOREIGN_LARGE = 123456; // Large enough to escape the Boxed Integer cache.
}

// TestEmptyMessage is used to test behavior of unknown fields.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ enum ForeignEnum {
FOREIGN_FOO = 4;
FOREIGN_BAR = 5;
FOREIGN_BAZ = 6;
FOREIGN_LARGE = 123456; // Large enough to escape the Boxed Integer cache.
}

// TestEmptyMessage is used to test behavior of unknown fields.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@
// For information on using the generated types, please see the documentation:
// https://github.com/apple/swift-protobuf/

// Protocol Buffers - Google's data interchange format
// Copyright 2024 Google Inc. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd

import Foundation
import SwiftProtobuf

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@
// For information on using the generated types, please see the documentation:
// https://github.com/apple/swift-protobuf/

// Protocol Buffers - Google's data interchange format
// Copyright 2024 Google Inc. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd

import Foundation
import SwiftProtobuf

Expand Down
6 changes: 6 additions & 0 deletions Reference/upstream/google/protobuf/unittest.pb.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ enum ProtobufUnittest_ForeignEnum: SwiftProtobuf.Enum, Swift.CaseIterable {
/// (1 << 32) to generate a 64b bitmask would be incorrect.
case foreignBax // = 32

/// Large enough to escape the Boxed Integer cache.
case foreignLarge // = 123456

init() {
self = .foreignFoo
}
Expand All @@ -54,6 +57,7 @@ enum ProtobufUnittest_ForeignEnum: SwiftProtobuf.Enum, Swift.CaseIterable {
case 5: self = .foreignBar
case 6: self = .foreignBaz
case 32: self = .foreignBax
case 123456: self = .foreignLarge
default: return nil
}
}
Expand All @@ -64,6 +68,7 @@ enum ProtobufUnittest_ForeignEnum: SwiftProtobuf.Enum, Swift.CaseIterable {
case .foreignBar: return 5
case .foreignBaz: return 6
case .foreignBax: return 32
case .foreignLarge: return 123456
}
}

Expand Down Expand Up @@ -10527,6 +10532,7 @@ extension ProtobufUnittest_ForeignEnum: SwiftProtobuf._ProtoNameProviding {
5: .same(proto: "FOREIGN_BAR"),
6: .same(proto: "FOREIGN_BAZ"),
32: .same(proto: "FOREIGN_BAX"),
123456: .same(proto: "FOREIGN_LARGE"),
]
}

Expand Down
116 changes: 116 additions & 0 deletions Reference/upstream/google/protobuf/unittest_custom_options.pb.swift
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,46 @@ struct ProtobufUnittest_SettingRealsFromNegativeInts: Sendable {
init() {}
}

struct ProtobufUnittest_SettingRealsFromInf: 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 unknownFields = SwiftProtobuf.UnknownStorage()

init() {}
}

struct ProtobufUnittest_SettingRealsFromNegativeInf: 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 unknownFields = SwiftProtobuf.UnknownStorage()

init() {}
}

struct ProtobufUnittest_SettingRealsFromNan: 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 unknownFields = SwiftProtobuf.UnknownStorage()

init() {}
}

struct ProtobufUnittest_SettingRealsFromNegativeNan: 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 unknownFields = SwiftProtobuf.UnknownStorage()

init() {}
}

struct ProtobufUnittest_ComplexOptionType1: SwiftProtobuf.ExtensibleMessage, Sendable {
// SwiftProtobuf.Message conformance is added in an extension below. See the
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
Expand Down Expand Up @@ -2101,6 +2141,82 @@ extension ProtobufUnittest_SettingRealsFromNegativeInts: SwiftProtobuf.Message,
}
}

extension ProtobufUnittest_SettingRealsFromInf: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
static let protoMessageName: String = _protobuf_package + ".SettingRealsFromInf"
static let _protobuf_nameMap = SwiftProtobuf._NameMap()

mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
// Load everything into unknown fields
while try decoder.nextFieldNumber() != nil {}
}

func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
try unknownFields.traverse(visitor: &visitor)
}

static func ==(lhs: ProtobufUnittest_SettingRealsFromInf, rhs: ProtobufUnittest_SettingRealsFromInf) -> Bool {
if lhs.unknownFields != rhs.unknownFields {return false}
return true
}
}

extension ProtobufUnittest_SettingRealsFromNegativeInf: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
static let protoMessageName: String = _protobuf_package + ".SettingRealsFromNegativeInf"
static let _protobuf_nameMap = SwiftProtobuf._NameMap()

mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
// Load everything into unknown fields
while try decoder.nextFieldNumber() != nil {}
}

func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
try unknownFields.traverse(visitor: &visitor)
}

static func ==(lhs: ProtobufUnittest_SettingRealsFromNegativeInf, rhs: ProtobufUnittest_SettingRealsFromNegativeInf) -> Bool {
if lhs.unknownFields != rhs.unknownFields {return false}
return true
}
}

extension ProtobufUnittest_SettingRealsFromNan: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
static let protoMessageName: String = _protobuf_package + ".SettingRealsFromNan"
static let _protobuf_nameMap = SwiftProtobuf._NameMap()

mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
// Load everything into unknown fields
while try decoder.nextFieldNumber() != nil {}
}

func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
try unknownFields.traverse(visitor: &visitor)
}

static func ==(lhs: ProtobufUnittest_SettingRealsFromNan, rhs: ProtobufUnittest_SettingRealsFromNan) -> Bool {
if lhs.unknownFields != rhs.unknownFields {return false}
return true
}
}

extension ProtobufUnittest_SettingRealsFromNegativeNan: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
static let protoMessageName: String = _protobuf_package + ".SettingRealsFromNegativeNan"
static let _protobuf_nameMap = SwiftProtobuf._NameMap()

mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
// Load everything into unknown fields
while try decoder.nextFieldNumber() != nil {}
}

func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
try unknownFields.traverse(visitor: &visitor)
}

static func ==(lhs: ProtobufUnittest_SettingRealsFromNegativeNan, rhs: ProtobufUnittest_SettingRealsFromNegativeNan) -> Bool {
if lhs.unknownFields != rhs.unknownFields {return false}
return true
}
}

extension ProtobufUnittest_ComplexOptionType1: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
static let protoMessageName: String = _protobuf_package + ".ComplexOptionType1"
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
Expand Down
7 changes: 7 additions & 0 deletions Reference/upstream/google/protobuf/unittest_proto3.pb.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ enum Proto3Unittest_ForeignEnum: SwiftProtobuf.Enum, Swift.CaseIterable {
case foreignFoo // = 4
case foreignBar // = 5
case foreignBaz // = 6

/// Large enough to escape the Boxed Integer cache.
case foreignLarge // = 123456
case UNRECOGNIZED(Int)

init() {
Expand All @@ -45,6 +48,7 @@ enum Proto3Unittest_ForeignEnum: SwiftProtobuf.Enum, Swift.CaseIterable {
case 4: self = .foreignFoo
case 5: self = .foreignBar
case 6: self = .foreignBaz
case 123456: self = .foreignLarge
default: self = .UNRECOGNIZED(rawValue)
}
}
Expand All @@ -55,6 +59,7 @@ enum Proto3Unittest_ForeignEnum: SwiftProtobuf.Enum, Swift.CaseIterable {
case .foreignFoo: return 4
case .foreignBar: return 5
case .foreignBaz: return 6
case .foreignLarge: return 123456
case .UNRECOGNIZED(let i): return i
}
}
Expand All @@ -65,6 +70,7 @@ enum Proto3Unittest_ForeignEnum: SwiftProtobuf.Enum, Swift.CaseIterable {
.foreignFoo,
.foreignBar,
.foreignBaz,
.foreignLarge,
]

}
Expand Down Expand Up @@ -694,6 +700,7 @@ extension Proto3Unittest_ForeignEnum: SwiftProtobuf._ProtoNameProviding {
4: .same(proto: "FOREIGN_FOO"),
5: .same(proto: "FOREIGN_BAR"),
6: .same(proto: "FOREIGN_BAZ"),
123456: .same(proto: "FOREIGN_LARGE"),
]
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ enum Proto3ArenaUnittest_ForeignEnum: SwiftProtobuf.Enum, Swift.CaseIterable {
case foreignFoo // = 4
case foreignBar // = 5
case foreignBaz // = 6

/// Large enough to escape the Boxed Integer cache.
case foreignLarge // = 123456
case UNRECOGNIZED(Int)

init() {
Expand All @@ -45,6 +48,7 @@ enum Proto3ArenaUnittest_ForeignEnum: SwiftProtobuf.Enum, Swift.CaseIterable {
case 4: self = .foreignFoo
case 5: self = .foreignBar
case 6: self = .foreignBaz
case 123456: self = .foreignLarge
default: self = .UNRECOGNIZED(rawValue)
}
}
Expand All @@ -55,6 +59,7 @@ enum Proto3ArenaUnittest_ForeignEnum: SwiftProtobuf.Enum, Swift.CaseIterable {
case .foreignFoo: return 4
case .foreignBar: return 5
case .foreignBaz: return 6
case .foreignLarge: return 123456
case .UNRECOGNIZED(let i): return i
}
}
Expand All @@ -65,6 +70,7 @@ enum Proto3ArenaUnittest_ForeignEnum: SwiftProtobuf.Enum, Swift.CaseIterable {
.foreignFoo,
.foreignBar,
.foreignBaz,
.foreignLarge,
]

}
Expand Down Expand Up @@ -795,6 +801,7 @@ extension Proto3ArenaUnittest_ForeignEnum: SwiftProtobuf._ProtoNameProviding {
4: .same(proto: "FOREIGN_FOO"),
5: .same(proto: "FOREIGN_BAR"),
6: .same(proto: "FOREIGN_BAZ"),
123456: .same(proto: "FOREIGN_LARGE"),
]
}

Expand Down
7 changes: 7 additions & 0 deletions Sources/Conformance/test_messages_edition2023.pb.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@
// For information on using the generated types, please see the documentation:
// https://github.com/apple/swift-protobuf/

// Protocol Buffers - Google's data interchange format
// Copyright 2024 Google Inc. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd

import Foundation
import SwiftProtobuf

Expand Down