Skip to content

Type checker quirk when rule incorrectly called as a function #7463

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

Open
anderseknert opened this issue Mar 25, 2025 · 0 comments
Open

Type checker quirk when rule incorrectly called as a function #7463

anderseknert opened this issue Mar 25, 2025 · 0 comments
Labels

Comments

@anderseknert
Copy link
Member

package p

f := 1
r := f()
1 error occurred: policy.rego:5: rego_type_error: undefined function data.p.f

Which is correct, as f is not a function. Adding a default non-numeric value for f however makes the type checker somehow recognize f as one.

package p

default f := ""

f := 1
r := f()

I encountered this in a policy I reviewed.

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

No branches or pull requests

1 participant