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

ast: Fix rewriting vars in rule args #2082

Merged
merged 1 commit into from
Feb 9, 2020

Conversation

tsandall
Copy link
Member

@tsandall tsandall commented Feb 9, 2020

Vars declared as rule args were not being rewritten which lead to
namespace conflicts with built-in functions. For example, definitions
like f(object) { object[x] = 1 } would generate type checking errors
because the checker would treat object[x] = 1 as referring to the
object built-in function namespace.

This change updates the compiler to rewrite rule arguments just like
it does other declared variables.

Fixes #2080

Signed-off-by: Torin Sandall torinsandall@gmail.com

Vars declared as rule args were not being rewritten which lead to
namespace conflicts with built-in functions. For example, definitions
like `f(object) { object[x] = 1 }` would generate type checking errors
because the checker would treat `object[x] = 1` as referring to the
`object` built-in function namespace.

This change updates the compiler to rewrite rule arguments just like
it does other declared variables.

Fixes open-policy-agent#2080

Signed-off-by: Torin Sandall <torinsandall@gmail.com>
@tsandall tsandall merged commit 9deb6a2 into open-policy-agent:master Feb 9, 2020
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.

Function arguments do not shadow built-in function namespace
1 participant