SIGN IN SIGN UP

topdown: use function arity to determine captured output (#3683)

Before, we had been passing `len(e.terms)` to `saveCall`, thereby
sidestepping the checks that would get the output variable into the
save set.

In the problematic policy,

    y = f(1)
    count(y)

with

    f(x) = [] { _ = input }

the call to `count(y)` would be mishandled: it would be evaluated,
since its arguments aren't in the saveset. Eval would fail because
its argument was a variable (see also
https://github.com/open-policy-agent/opa/issues/3680)

Fixes #3681.

Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
S
Stephan Renatus committed
9e890c4240a067c37fad2d1482dc888ba8a35041
Parent: 073d490
Committed by GitHub <noreply@github.com> on 8/12/2021, 9:00:32 PM