accessors_test.rs is getting a bit unwieldy, approaching 1K LOC. This CL breaks out the repeated tests into their own file (accessors_repeated_test.rs), as we expect the tests here to grow. This follows the precedent of `accessors_map_test.rs`.
PiperOrigin-RevId: 588554476
Before this CL, we weren't generating view accessors for messages with depth > 1.
We weren't getting to message::GetterForViewOrMut because we were detecting FieldDescriptor::TYPE_MESSAGE and bailing out.
That check has now been expunged, and we now properly emit the right view, even for messages embedded within messages.
Added tests for:
- another level of submsg access depth
- accessing a message declared outside of the current message (that is, not a direct nested message within the same message)
- accessing the accessor of the accessor of the accessor of a recursively defined message
PiperOrigin-RevId: 588460599
Collect all static initializers in a single expression at the end of the file.
This reduces code bloat, and provides a way to customize the
registration for weak descriptor messages.
PiperOrigin-RevId: 588127128
This will allow us to support editions without adding support for proto2 concepts such as closed enums, required fields, and groups. The generator will now only ban unsupported features, meaning that some types of proto2 files will be allowed. The PHP runtime does not yet support editions.
PiperOrigin-RevId: 588091790
These methods were deprecated as of 3.0.0 and were originally added for compatibility with gencode from old major versions (v2.x.x.) which are long out of our Cross Version Runtime Guarantees: https://protobuf.dev/support/cross-version-runtime-guarantee/
PiperOrigin-RevId: 587099512
This feature allows for tree shaking within a single .proto file, dropping
unused types while still allowing reflection to work for them via the generated
DescriptorPool.
PiperOrigin-RevId: 587066283
When unknown fields are discarded using reflection in reflection_ops.cc, unnecessary switching of the internal map representation is triggered.
A map<int,int> field cannot have unknown fields. However, in the current code the check used is
if (field->IsMap() && IsMapValueMessageTyped(field)) {
// Discard map field
} else {
// Discard repeated message field
}
This means that the code proceeds discarding unknown fields for each mapentry using the RepeatedPtrField of MapEntry representation of the map. Causing unnecessary work and unnecessary, potentially big, memory allocation. This PR fixes this.
See also issue https://github.com/protocolbuffers/protobuf/issues/13222
This is also a bug fix. When a map<int, MyProto> is in a dirty state, previously it would be skipped. After this change it will correctly use the repeated path to clean the MyProto sub-entries
Closes#14879
COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/14879 from gerben-stavenga:patch_discardunknown fb0749ab8d
PiperOrigin-RevId: 586820137