topdown: only amend comprehensions with used bindings (#3608)
Before, all the available bindings had been added to the comprehension in
package pkg
p[x] { q[x] }
q[x] {
y := {1 | input} # <---
x := "foo"
}
So after partial eval, the support rule was
p["foo"] {
__local0__2 = {1 |
input
__local1__2 = x12
}
}
Now, only variables that are used in the comprehension in question are
added. The partial eval result becomes
package partial.pkg
p["foo"] {
__local0__2 = {1 | input}
}
An extra round of the process was added when both lhs and rhs are
comprehensions.
Fixes #3557.
Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com> S
Stephan Renatus committed
1e4057775c08bda82c6690d13f7a39dbb8c2634f
Parent: 94c4ad6
Committed by GitHub <noreply@github.com>
on 7/8/2021, 8:05:23 PM