about summary refs log tree commit diff
path: root/default.nix
diff options
context:
space:
mode:
authorsterni <sternenseemann@systemli.org>2022-09-07T13·37+0200
committertazjin <tazjin@tvl.su>2022-09-11T12·26+0000
commit4d8f35353b41080c57f7a65093c29060877f646c (patch)
treeb56bc4830f13d80d894eba45f1284c2b7bb65e46 /default.nix
parentb4309f5b8a3a51dd8851d71a4d25d7695f04c8e7 (diff)
fix(tvix/eval): declare let inherit (from) locals before compiling r/4805
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>
Diffstat (limited to 'default.nix')
0 files changed, 0 insertions, 0 deletions