about summary refs log tree commit diff
path: root/tvix/eval/src/tests/tvix_tests/eval-okay-let-inherit.nix (follow)
AgeCommit message (Collapse)AuthorFilesLines
2022-09-11 r/4805 fix(tvix/eval): declare let inherit (from) locals before compilingsterni1-1/+5
The recent change that split declaration of let based locals and the compilation of their values did not touch locals bound by inherit in let. These were previously declared and compiled immediately before starting to work on the other locals introduced in a let. In the case of plain inherits, this behavior is kept in this change, because there's nothing wrong with it: The value of a plain inherit will always resolve to a higher scope, either statically or dynamically. Since inherit (from) expression might refer to other locals bound in the same let, we need to handle them in the same three steps as ordinary let based locals: 1. We need to declare the (uninitialised) locals. 2. We need to compile the expression that obtains their value. For this, we create a new thunk, since the from expression may very well return a thunk which we need to force before selecting the value we are interested in. 3. Thunks need to be finalised. For 1., we create an extra pass over the inherits that already declares and initialises plain inherits and notes inherit (from) expressions in the entries vector after declaring them. 2. only needs a bit of adapting to create the thunks for selecting if appropriate, the rest of the existing code can be reused. Change-Id: Ie4ac1c0f9ffcbf7c07c452036aa8e577443af773 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6490 Tested-by: BuildkiteCI Reviewed-by: sterni <sternenseemann@systemli.org> Reviewed-by: tazjin <tazjin@tvl.su>
2022-08-31 r/4549 feat(tvix/eval): implement inherit in let expressionsVincent Ambo1-0/+8
Note that at this point recursive bindings do not yet work in either attrsets or let, so inheriting from the same scope is generally not possible yet. Change-Id: I6ca820d04b8ded5c22fb7ea18e2ec203bcaa8e9c Reviewed-on: https://cl.tvl.fyi/c/depot/+/6215 Reviewed-by: sterni <sternenseemann@systemli.org> Reviewed-by: grfn <grfn@gws.fyi> Tested-by: BuildkiteCI