fix(tvix/eval): inherit scope poisoning data in nested contexts
Scope poisoning must be inherited across lambda context boundaries, e.g. if an outer scope has a poisoned `null`, any lambdas defined on the same level must reference that poisoned identifier correctly. Change-Id: I1aac64e1c048a6f3bacadb6d78ed295fa439e8b4 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6410 Reviewed-by: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI
This commit is contained in:
parent
0a13d267f0
commit
5ee89bcf5c
4 changed files with 36 additions and 4 deletions
|
|
@ -152,6 +152,15 @@ impl Scope {
|
|||
}
|
||||
}
|
||||
|
||||
/// Inherit scope details from a parent scope (required for
|
||||
/// correctly nesting scopes in lambdas and thunks when special
|
||||
/// scope features like poisoning are present).
|
||||
pub fn inherit(&self) -> Self {
|
||||
let mut scope = Self::default();
|
||||
scope.poisoned_tokens = self.poisoned_tokens.clone();
|
||||
scope
|
||||
}
|
||||
|
||||
/// Check whether a given token is poisoned.
|
||||
pub fn is_poisoned(&self, name: &str) -> bool {
|
||||
self.poisoned_tokens.contains_key(name)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue