cue/parser: attach attributes to correct field
Right now they are attached to the first label
in a label sequence, but it should be the last.
To avoid any doubt, make the formatter insert
curly braces for such cases.
This also fixes a bug where attributes at the end
of a multi-label field were attached to the
wrong field and discarded when formatting.
Change-Id: If19e2b95dd7c5c69a3523ce46e8a30a47609d70c
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/2706
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
diff --git a/encoding/protobuf/testdata/client_config.proto.out.cue b/encoding/protobuf/testdata/client_config.proto.out.cue
index fc7f747..a3db5df 100644
--- a/encoding/protobuf/testdata/client_config.proto.out.cue
+++ b/encoding/protobuf/testdata/client_config.proto.out.cue
@@ -144,7 +144,9 @@
// Map of control configuration indexed by destination.service. This
// is used to support per-service configuration for cases where a
// mixerclient serves multiple services.
- serviceConfigs <_>: ServiceConfig
+ serviceConfigs: {
+ <_>: ServiceConfig
+ } @protobuf(2,type=map<string,ServiceConfig>,service_configs)
// Default destination service name if none was specified in the
// client request.