opa
opa copied to clipboard
Unexpected recursion error on dotted rule head containing vars
I expected this policy to compile:
package play
import rego.v1
p[x].foo.bar if {
x := "a"
not p[x].foo.baz
}
p[x].foo.baz if {
x := "a"
false
}
But got the following error:
1 error occurred: policy.rego:5: rego_recursion_error: rule data.play.p[__local0__].foo.bar is recursive: data.play.p[__local0__].foo.bar -> data.play.p[__local0__].foo.bar
It seems the recursion check is being overly conservative.