protobuf-go/cmd/protoc-gen-go
Josh Humphries 3b8611b60b reflect/protoreflect: FieldDescriptor.Kind should never be GroupKind for maps or fields of map entry
Resolves golang/protobuf#1615

The protoc compiler disallows setting the message encoding feature of
map fields to delimited since maps, at least for now (as of edition
2023) should always use normal length-prefixed encoding.

But the field (and a message value field inside the map entry) could
inherit such a feature value if it were set as a file-wide default. At
the point where the code changes the kind from message to group, based
on the field's resolved features, the message type hasn't yet been
resolved.  So this change adds a check after the FieldDescriptor's
message type is resolved, to change the kind back from group to
message if the field is a map field or a field in a map entry message.

Change-Id: I785269a4ecd80d1a17866c08b2afc0b01440e0e3
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/588976
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cassondra Foesch <cfoesch@gmail.com>
Reviewed-by: Mike Kruskal <mkruskal@google.com>
Reviewed-by: Michael Stapelberg <stapelberg@google.com>
2024-06-06 08:04:46 +00:00
..
internal_gengo all: replace interface{} by any now that we are on Go 1.21 2024-05-15 12:42:15 +00:00
testdata reflect/protoreflect: FieldDescriptor.Kind should never be GroupKind for maps or fields of map entry 2024-06-06 08:04:46 +00:00
annotation_test.go all: fix deprecated 2024-04-23 09:50:20 +00:00
main.go
retention_test.go