Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Buggy field visibility handling inobjectHas in Go impl #736

Open
mkmik opened this issue Dec 6, 2023 · 0 comments · May be fixed by #737
Open

Buggy field visibility handling inobjectHas in Go impl #736

mkmik opened this issue Dec 6, 2023 · 0 comments · May be fixed by #737

Comments

@mkmik
Copy link

mkmik commented Dec 6, 2023

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 returnsfalse`.


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

@mkmik mkmik linked a pull request Dec 6, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant