Skip to main content

eval_plan_group

Function eval_plan_group 

Source
pub fn eval_plan_group(plan: &GroupPlan, env: &Env) -> Result<Value, EvalError>
Expand description

Build an attrset from a sui-normalize [GroupPlan].

This is the plan-driven replacement for the entry loops in [eval_attrset] / the LetIn arm / eval_entries. It exists because nix’s duplicate-key merge is a parse-time splice into the first-declared node, not a value-level union: the second side’s bindings become bindings of the first node, so they are scoped by it and the later rec is discarded. sui-normalize performed that splice; this function only evaluates the result.

The consequence worth stating: there is no merging here, and no collision to resolve. attrs.insert is a plain insert because the plan’s postcondition is that no name appears twice. That is what retires merge_nested_insert from the construction path — and with it the force-to-WHNF-on-collision that turned let f = x: x+1; a.b = {x = f 1;}; a.b.y = 2; in a.b.x into UndefinedVar 'f' on an expression nix evaluates to 2.