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

Parse error raised if rule body is an object comprehension #306

Closed
anakrish opened this issue Aug 31, 2024 · 0 comments · Fixed by #309
Closed

Parse error raised if rule body is an object comprehension #306

anakrish opened this issue Aug 31, 2024 · 0 comments · Fixed by #309
Labels
bug Something isn't working opa compatibility parser

Comments

@anakrish
Copy link
Collaborator

package test
import future.keywords
x if { 1:2 | some p in [1,2] }
y := 2 if { 1 | some p in [1,2] }

raises

Error: 
--> rule.rego:3:9
  |
3 | x if { 1:2 | some p in [1,2] }
  |         ^
error: expecting `}` while parsing query

@anakrish anakrish added bug Something isn't working opa compatibility parser labels Aug 31, 2024
anakrish added a commit that referenced this issue Sep 4, 2024
A block with a single or expression needs to be treated as a comprehension instead of a
set/array with 1 item. e.g.: {1 | 1 }, [2 | foo]

Allow successfully parsing object comprehensions as rule body
x if { 1:2 | 1 }

fixes #306, fixes #307

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
bug Something isn't working opa compatibility parser
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant