Merge pull request #111469 from sternenseemann/topretty-fix-currying
lib/generators: fix toPretty throwing on (partially applied) builtins
This commit is contained in:
commit
59b45d66b2
|
@ -236,12 +236,17 @@ 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
|
||||||
let fna = lib.functionArgs v;
|
# functionArgs throws in case of (partially applied) builtins
|
||||||
|
# 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);
|
fna.value);
|
||||||
in if fna == {} then "<function>"
|
in if !fna.success || fna.value == {}
|
||||||
else "<function, args: {${showFnas}}>"
|
then "<function>"
|
||||||
|
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