Internal changes

PiperOrigin-RevId: 696936254
pull/19273/head
Mike Kruskal 4 weeks ago committed by Copybara-Service
parent 7dfcfd7cc6
commit 6bcb699b55
  1. 17
      csharp/src/Google.Protobuf/Reflection/FeatureSetDescriptor.g.cs
  2. 3
      src/google/protobuf/descriptor.cc
  3. 16
      src/google/protobuf/descriptor_unittest.cc

@ -1,17 +0,0 @@
#region Copyright notice and license
// Protocol Buffers - Google's data interchange format
// Copyright 2008 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
#endregion
namespace Google.Protobuf.Reflection;
internal sealed partial class FeatureSetDescriptor
{
// Canonical serialized form of the edition defaults, generated by embed_edition_defaults.
private const string DefaultsBase64 =
"ChMYhAciACoMCAEQAhgCIAMoATACChMY5wciACoMCAIQARgBIAIoATABChMY6AciDAgBEAEYASACKAEwASoAIOYHKOgH";
}

@ -9877,7 +9877,8 @@ bool IsStringFieldWithPrivatizedAccessors(const FieldDescriptor& field) {
.GetExtension(pb::cpp)
.string_type() == pb::CppFeatures::CORD &&
(field.type() != FieldDescriptor::TYPE_BYTES || field.is_repeated() ||
field.is_extension())) {
field.is_extension())
) {
return true;
}

@ -10117,6 +10117,19 @@ TEST_F(FeaturesTest, FieldCppStringType) {
}
}
} $0
extension_range { start: 100 end: 200 }
}
extension {
name: "cord_ext"
number: 100
label: LABEL_OPTIONAL
type: TYPE_STRING
options {
features {
[pb.cpp] { string_type: CORD }
}
}
extendee: "Foo"
}
)pb",
""
@ -10127,12 +10140,15 @@ TEST_F(FeaturesTest, FieldCppStringType) {
const FieldDescriptor* str = message->field(1);
const FieldDescriptor* cord = message->field(2);
const FieldDescriptor* cord_bytes = message->field(3);
const FieldDescriptor* cord_ext = file->extension(0);
EXPECT_EQ(view->cpp_string_type(), FieldDescriptor::CppStringType::kView);
EXPECT_EQ(str->cpp_string_type(), FieldDescriptor::CppStringType::kString);
EXPECT_EQ(cord_bytes->cpp_string_type(),
FieldDescriptor::CppStringType::kCord);
EXPECT_EQ(cord->cpp_string_type(), FieldDescriptor::CppStringType::kString);
EXPECT_EQ(cord_ext->cpp_string_type(),
FieldDescriptor::CppStringType::kString);
}

Loading…
Cancel
Save