This PR introduces a new MapField type, which can be used to set and access map field values by key.
Without this PR I get a panic in toStarlark1 where x.Message() is called on a map field value. (Perhaps because my proto has some map<string, Message> fields):
panic: type mismatch: cannot convert map to message
I've also updated the nascent proto.star unit tests to use their own proto file, to test repeated and map fields.
Separately from the main change, I've included a commit that adds a list-like append method to RepeatedField. I can break that out into a separate PR if you'd prefer.
Fixes https://github.com/google/starlark-go/issues/381
This PR introduces a new
MapField
type, which can be used to set and access map field values by key.Without this PR I get a panic in
toStarlark1
wherex.Message()
is called on a map field value. (Perhaps because my proto has somemap<string, Message>
fields):I've also updated the nascent
proto.star
unit tests to use their own proto file, to test repeated and map fields.Separately from the main change, I've included a commit that adds a list-like
append
method toRepeatedField
. I can break that out into a separate PR if you'd prefer.