Revert "lib/generators: fix toPretty throwing on (partially applied) builtins"
This reverts commit d9a7d03da8
.
Reason for this is that it actually doesn't migitate the issue on nix
stable for another reason: builtins.tryEval doesn't prevent the error
generated by builtins.functionArgs from halting evaluation:
> builtins.tryEval (builtins.functionArgs builtins.functionArgs)
error: 'functionArgs' requires a function, at (string):1:19
Thus it seems that there is no workaround to make
lib.generators.toPretty work with nix stable and primops since there is
no way to distinguish between primops and lambdas in nix.
This commit is contained in:
parent
64e4778694
commit
06d3b28987
1 changed files with 4 additions and 9 deletions
|
@ -236,17 +236,12 @@ rec {
|
||||||
+ libStr.concatMapStringsSep introSpace (go (indent + " ")) v
|
+ libStr.concatMapStringsSep introSpace (go (indent + " ")) v
|
||||||
+ outroSpace + "]"
|
+ outroSpace + "]"
|
||||||
else if isFunction v then
|
else if isFunction v then
|
||||||
# functionArgs throws in case of (partially applied) builtins
|
let fna = lib.functionArgs v;
|
||||||
# on nix before commit b2748c6e99239ff6803ba0da76c362790c8be192
|
|
||||||
# which includes current nix stable
|
|
||||||
# TODO remove tryEval workaround when the issue is resolved on nix stable
|
|
||||||
let fna = builtins.tryEval (lib.functionArgs v);
|
|
||||||
showFnas = concatStringsSep ", " (libAttr.mapAttrsToList
|
showFnas = concatStringsSep ", " (libAttr.mapAttrsToList
|
||||||
(name: hasDefVal: if hasDefVal then name + "?" else name)
|
(name: hasDefVal: if hasDefVal then name + "?" else name)
|
||||||
fna.value);
|
fna);
|
||||||
in if !fna.success || fna.value == {}
|
in if fna == {} then "<function>"
|
||||||
then "<function>"
|
else "<function, args: {${showFnas}}>"
|
||||||
else "<function, args: {${showFnas}}>"
|
|
||||||
else if isAttrs v then
|
else if isAttrs v then
|
||||||
# apply pretty values if allowed
|
# apply pretty values if allowed
|
||||||
if attrNames v == [ "__pretty" "val" ] && allowPrettyValues
|
if attrNames v == [ "__pretty" "val" ] && allowPrettyValues
|
||||||
|
|
Loading…
Reference in a new issue