diff --git a/csharp/src/Google.Protobuf/Reflection/FeatureSetDescriptor.g.cs b/csharp/src/Google.Protobuf/Reflection/FeatureSetDescriptor.g.cs deleted file mode 100644 index 208ce1fcb631..000000000000 --- a/csharp/src/Google.Protobuf/Reflection/FeatureSetDescriptor.g.cs +++ /dev/null @@ -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"; -} diff --git a/src/google/protobuf/descriptor.cc b/src/google/protobuf/descriptor.cc index 4ba913ba58c4..c9f4dc765c2b 100644 --- a/src/google/protobuf/descriptor.cc +++ b/src/google/protobuf/descriptor.cc @@ -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; } diff --git a/src/google/protobuf/descriptor_unittest.cc b/src/google/protobuf/descriptor_unittest.cc index 319c809e50e1..587852416cc4 100644 --- a/src/google/protobuf/descriptor_unittest.cc +++ b/src/google/protobuf/descriptor_unittest.cc @@ -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); }