This should make C++ Jsonnet match the existing behaviour of Go-Jsonnet.
Object comprehensions do not support differing field visibility, that is an object comprehension with a "hidden" or "forced-visible" field such as {[k]::1 for k in ["x"]} is rejected with a syntax error.
Intuitively the {[key_expr]: value_expr for x in ...} syntax should behave similarly to a normal (non-comprehension) object that uses default field visibility. Default field visibility is to 'inherit' visibility when merging objects with the + operator, and this is the existing behaviour of Go-Jsonnet.
Example case:
./jsonnet -e '{"one":: "base"} + {[k]: "derived" for k in ["one"]}'
Before this commit, Go-Jsonnet output:
{ }
Before this commit, C++ Jsonnet output:
{ "one": "derived" }
This should make C++ Jsonnet match the existing behaviour of Go-Jsonnet.
Object comprehensions do not support differing field visibility, that is an object comprehension with a "hidden" or "forced-visible" field such as
{[k]::1 for k in ["x"]}
is rejected with a syntax error.Intuitively the
{[key_expr]: value_expr for x in ...}
syntax should behave similarly to a normal (non-comprehension) object that uses default field visibility. Default field visibility is to 'inherit' visibility when merging objects with the + operator, and this is the existing behaviour of Go-Jsonnet.Example case:
Before this commit, Go-Jsonnet output:
{ }
Before this commit, C++ Jsonnet output:
{ "one": "derived" }
After this commit, both produce
{ }
Fixes #1111