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

Referencing non-existing property of empty object passes type check, while non-empty object does not #7275

Open
anderseknert opened this issue Jan 16, 2025 · 0 comments

Comments

@anderseknert
Copy link
Member

As reported by @disaverio (thanks!) in the OPA Slack.

This is a type checker error

obj := {"foo": "bar}
obj.bar
1 error occurred: policy.rego:5: rego_type_error: undefined ref: obj.bar
	obj.bar
	    ^
	    have: "bar"
	    want (one of): ["foo"]

But this isn't

obj := {"foo": "bar}
obj.bar

I believe the expected behavior would be that both examples fails.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant