Buggy field visibility handling in`objectHas` in Go impl
Closed this issue · 0 comments
mkmik commented
The Go jsonnet
implementation of std.objectHas
and std.objectHasEx(...,..., false)
doesn't correctly honour the field visibility if an object is extended. Instead, it only checks whether the field is visible in the "current" object, even if the field is hidden in super
:
How to reproduce:
std.objectHasEx({"x":: null} + {"x": null}, "x", false)
Expected value: false
Actual value: true
The C++ implementation of
std.objectHascorrectly returns
false`.
Since std.get(.... inc_hidden=false)
is implemented in terms of std.objectHas
, that function is also buggy:
std.get(o={a:: 17} + {a: 18}, f="a", default=42, inc_hidden=false)
Expected value: 42
Actual value: 18
The C++ impl of std.get
returns 42