Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix panic when evaluating cyclic environment references (#466)
We track the lifetime of each environments import evaluations to detect cyclic imports. Right now this is tracked while we're evaluating the imports decl. However, #443 introduced a way to import environment values inline. Once we've started evaluating the environment values root, we currently stop tracking whether the environment is evaluating because we're done with all the imports. The result of this is that a cyclic environment reference will look up the environment name in the imports map and won't detect that it is still evaluating. Since the cached value in the imports map hasn't been set yet (since the environment hasn't finished evaluating) we return nil as the value. This results in a panic when we try to actually access the value. To fix this, I'm just hoisting the evaluation lifetime tracking to the evaluation root, rather than just the imports node, so it'll correctly detect cycles for inline references.
- Loading branch information