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

topdown: move arg count below ir.Empty() #3502

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions test/cases/testdata/functions/test-functions-unused-arg.yaml
@@ -0,0 +1,12 @@
cases:
- data:
modules:
- |
package p

f(x) {
r = input.that_is_not_there
}
note: basic call
query: data.p.f(1)
want_result: []
4 changes: 2 additions & 2 deletions topdown/eval.go
Expand Up @@ -1506,12 +1506,12 @@ func (e evalFunc) eval(iter unifyIterator) error {
return err
}

argCount := len(ir.Rules[0].Head.Args)

if ir.Empty() {
return nil
}

argCount := len(ir.Rules[0].Head.Args)

if len(ir.Else) > 0 && e.e.unknown(e.e.query[e.e.index], e.e.bindings) {
// Partial evaluation of ordered rules is not supported currently. Save the
// expression and continue. This could be revisited in the future.
Expand Down