Internal changes

PiperOrigin-RevId: 648861628
pull/17317/head
Mike Kruskal 5 months ago committed by Copybara-Service
parent f0d1814d0c
commit 6d0c9d511a
  1. 22
      src/google/protobuf/descriptor.cc
  2. 1
      src/google/protobuf/descriptor_unittest.cc

@ -7394,21 +7394,13 @@ void DescriptorBuilder::CrossLinkField(FieldDescriptor* field,
field->number()); field->number());
if (extension_range == nullptr) { if (extension_range == nullptr) {
// Set of valid extension numbers for MessageSet is different (< 2^32) AddError(field->full_name(), proto,
// from other extendees (< 2^29). If unknown deps are allowed, we may not DescriptorPool::ErrorCollector::NUMBER, [&] {
// have that information, and wrongly deem the extension as invalid. return absl::Substitute(
auto skip_check = get_allow_unknown(pool_) && "\"$0\" does not declare $1 as an "
absl::StripPrefix(proto.extendee(), ".") == "extension number.",
"google.protobuf.bridge.MessageSet"; field->containing_type()->full_name(), field->number());
if (!skip_check) { });
AddError(field->full_name(), proto,
DescriptorPool::ErrorCollector::NUMBER, [&] {
return absl::Substitute(
"\"$0\" does not declare $1 as an "
"extension number.",
field->containing_type()->full_name(), field->number());
});
}
} }
} }

@ -3222,6 +3222,7 @@ TEST_P(AllowUnknownDependenciesTest, UnknownExtendee) {
extendee->extension_range(0)->end_number()); extendee->extension_range(0)->end_number());
} }
TEST_P(AllowUnknownDependenciesTest, CustomOption) { TEST_P(AllowUnknownDependenciesTest, CustomOption) {
// Test that we can use a custom option without having parsed // Test that we can use a custom option without having parsed
// descriptor.proto. // descriptor.proto.

Loading…
Cancel
Save