SIGN IN SIGN UP

ast: Disqualify indexing if candidate found in nested comprehension

In v0.20. we added support for indexing and caching of comprehensions
in certain cases. There was a bug in the index construction that
allowed for comprehensions to be indexed and cached
incorrectly. Specifically, if any of the candidate keys appear in
nested comprehensions, indexing should not be performed because the
evaluator does not close over variable bindings from the outer scope
when evaluating the comprehension (because this would require cache
invalidation if there were multiple assignments to the variables in
the outer scope).

This fix updates the compiler to check if the candidates appear inside
of any nested comprehensions. If a match is found, no indexing is
performed.

Fixes #2497

Signed-off-by: Torin Sandall <torinsandall@gmail.com>
T
Torin Sandall committed
e9779ebab6b105f9d3f394a364d40dbace4924b3
Parent: 6c7376c