fix(tvix/eval): consider let ... inherit ... in dynamic scopes
In conditions where no dynamic identifiers exist in a scope, inheriting is usually a no-op - *unless* the identifier is not statically known and the scope has a non-empty `with`-stack. Change-Id: Iff4138d9cd4c56e844bc574203708dacc11c3f73 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6264 Reviewed-by: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI
This commit is contained in:
parent
c3b13416b0
commit
2023b8e33f
3 changed files with 40 additions and 3 deletions
|
|
@ -0,0 +1 @@
|
|||
1
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
# Normally using an `inherit` without a source attribute set within a
|
||||
# `let` is a no-op, *unless* there is a with in-scope that might
|
||||
# provide the value.
|
||||
|
||||
# Provide a dynamic `x` identifier in the scope.
|
||||
with ({ x = 1;});
|
||||
|
||||
# inherit this `x` as a static identifier
|
||||
let inherit x;
|
||||
|
||||
# Provide another dynamic `x` identifier
|
||||
in with ({ x = 3; });
|
||||
|
||||
# Inherited static identifier should have precedence
|
||||
x
|
||||
Loading…
Add table
Add a link
Reference in a new issue