1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-08 19:46:02 +01:00
nix/tests/functional/lang/eval-fail-genericClosure-deeply-nested-element.nix
Robert Hensing d262efc240 libexpr: improve error messages for builtins.genericClosure
Show which element(s) are involved at each error point:

- When an element is missing the "key" attribute, show the element
- When an element is not an attribute set, show the element
- When comparing keys fails, show both elements being compared
- When calling operator fails, show which element was being processed

This provides concrete context using ValuePrinter with errorPrintOptions.

Note: errorPrintOptions uses maxDepth=10 by default, which may print
quite deeply nested structures in error messages. This could potentially
be overwhelming, but follows the existing default for error contexts.
2025-11-06 22:28:49 +01:00

35 lines
644 B
Nix

let
finite = {
a0 = {
a1 = {
a2 = {
a3 = {
a4 = {
a5 = {
a6 = {
a7 = {
a8 = {
a9 = "deep";
};
};
};
};
};
};
};
};
};
};
finiteVal = builtins.deepSeq finite finite;
in
builtins.seq finiteVal (
builtins.genericClosure {
startSet = [
{
infinite = import ./infinite-nesting.nix;
finite = finiteVal;
}
];
operator = x: [ (import ./infinite-nesting.nix) ];
}
)