topdown: Fix for unsafe negated query in partial results
In copy propagation we ran into issues where an expression was negated and required a variable in it to show up in a non-negated expression to be safe. What we do now is expose some of the safety helpers from the ast package and check if any of the removed expressions provided safety to any vars left in the result (that are otherwise unsafe). If they do we will re-add the expression. This isn't done until after computing the initial result to ensure that we get the minimal set of expressions. If we attempt to check eagerly, before we kill/remove any, we might let one remain only to later add an expression to the result that makes it no longer used. The current pattern of removing as aggressively as possible and then taking another pass over the removed expressions to re-add seems to be the most optimal approach. Fixes: #2045 Signed-off-by: Patrick East <east.patrick@gmail.com>
P
Patrick East committed
1365a38ae5516f4789ca5a031fa29e0275a2d14a
Parent: 43cbc8b
Committed by Torin Sandall <torinsandall@gmail.com>
on 4/24/2020, 11:14:27 AM