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

Asserting every domain is an iterable type before evaluation #6763

Merged

Conversation

johanfylling
Copy link
Contributor

Fixes: #6762

Fixes: open-policy-agent#6762
Signed-off-by: Johan Fylling <johan.dev@fylling.se>
Signed-off-by: Johan Fylling <johan.dev@fylling.se>
Copy link
Contributor

@srenatus srenatus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good so far! 👍

ast/term.go Outdated Show resolved Hide resolved
return e.save(iter)
}

domain := e.e.closure(e.generator)
if pd := e.e.bindings.Plug(e.Domain); pd != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💭 When would pd be nil?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably never. Sometimes I'm guilty of writing a tad too defensive code 😄.

Signed-off-by: Johan Fylling <johan.dev@fylling.se>
Adding `IsSetStmt`.

Signed-off-by: Johan Fylling <johan.dev@fylling.se>
Signed-off-by: Johan Fylling <johan.dev@fylling.se>
@johanfylling johanfylling marked this pull request as ready for review May 27, 2024 16:45
Copy link
Contributor

@srenatus srenatus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So if you slept on it and still think it's an OK approach, let's merge it 🥳 Thanks for the quick fix.

@johanfylling
Copy link
Contributor Author

Slept on it. No further epiphanies 😄.

@johanfylling johanfylling merged commit 62834a2 into open-policy-agent:main May 28, 2024
28 checks passed
@johanfylling johanfylling deleted the fix/eval_non-iter_domain branch May 28, 2024 08:19
anakrish added a commit to anakrish/regorus that referenced this pull request May 28, 2024
See open-policy-agent/opa#6763

Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
anakrish added a commit to anakrish/regorus that referenced this pull request May 28, 2024
See open-policy-agent/opa#6763

Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
anakrish added a commit to microsoft/regorus that referenced this pull request May 28, 2024
See open-policy-agent/opa#6763

Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
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 this pull request may close these issues.

Using non-collections with every should fail
2 participants