lib.modules: inline head defs variable

Each value passed to a function or primop is passed as a thunk, so `head
defs` will only be evaluated twice if we're throwing an error. Validated
with `builtins.trace`.
This commit is contained in:
Eman Resu
2026-06-07 16:28:24 -04:00
committed by Eman Resu
parent d95430f876
commit 96dbdd6a9e

View File

@@ -1193,11 +1193,8 @@ let
# original singleton straight to the type merge.
if
length defs == 1
&& (
let
d = head defs;
in
addErrorContext "while evaluating definitions from `${d.file}':" (!d.value ? _type)
&& addErrorContext "while evaluating definitions from `${(head defs).file}':" (
!(head defs).value ? _type
)
then
{