forked from open-policy-agent/opa
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ast/compile: fix print rewriting for arrays in unification
outputVarsForExprEq, which is used in the rewriting of `print()` calls, wasn't able to find `x` in [_, x, _] = f(1) and thus certain print expressions failed during the rewriting stage of print() calls in the compiler. Now, the "collection (array/object) = func call" is handled. Furthermore, this adds calls to isRefSafe in a few places: as it turned out, the test cases {"array/ref", "[1,2,x] = a[_]", "[a]", "[x]"}, {"object/ref", `{"x": x} = a[_]`, "[a]", "[x]"}, would have, without the check, passed without "a" in "safe" (3rd field). The fact that these cases are including "a" is evidence for this being the correct behaviour. Fixes open-policy-agent#4078. Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
- Loading branch information
Showing
3 changed files
with
117 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters