-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
topdown: Fix namespacing to use caller bindings
This change fixes an issue in partial eval where variables in negated expressions were getting plugged with the wrong set of caller bindings. The caller bindings identify the context in which plugging is being performed so that variables can be namespaced and conflicts can be avoided. For example, given the query `p[x]` and the rule `p[y] { y = input; not y = 1; ... }` the first expression in the rule body would eventually be plugged in the context of the calling query whereas the second expression would be plugged using a special set of bindings that ensured namespacing was performed. The problem was that the partial eval negation implementation was incorrectly choosing the special binding set. This change updates partial eval to use the bindings from the top of the evaluator stack in all cases where variables are plugged with namespacing enabled. This lets us remove the special "sentinel" bindings that were used to ensure namespacing was performed and ensures that variables that appear in the original query are not namespaced (which is the desired behaviour.) Fixes #1814 Signed-off-by: Torin Sandall <torinsandall@gmail.com>
- Loading branch information
Showing
4 changed files
with
76 additions
and
32 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
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