summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
authorsternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org>2021-02-01 16:27:38 +0100
committersternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org>2021-02-01 16:27:38 +0100
commit06d3b2898717877bb23ae32467dbebba9f307ac4 (patch)
treeb66761faeb4d36145091c44a2912ef3e0f8db454 /lib
parent64e47786944359c4ab170c7307e1b77d2ee39b5c (diff)
downloadnixpkgs-06d3b2898717877bb23ae32467dbebba9f307ac4.tar
nixpkgs-06d3b2898717877bb23ae32467dbebba9f307ac4.tar.gz
nixpkgs-06d3b2898717877bb23ae32467dbebba9f307ac4.tar.bz2
nixpkgs-06d3b2898717877bb23ae32467dbebba9f307ac4.tar.lz
nixpkgs-06d3b2898717877bb23ae32467dbebba9f307ac4.tar.xz
nixpkgs-06d3b2898717877bb23ae32467dbebba9f307ac4.tar.zst
nixpkgs-06d3b2898717877bb23ae32467dbebba9f307ac4.zip
Revert "lib/generators: fix toPretty throwing on (partially applied) builtins"
This reverts commit d9a7d03da8c58aa863911506ae3153729f8931da.

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.
Diffstat (limited to 'lib')
-rw-r--r--lib/generators.nix13
1 files changed, 4 insertions, 9 deletions
diff --git a/lib/generators.nix b/lib/generators.nix
index 9546f5b5b0a..501a23599f4 100644
--- a/lib/generators.nix
+++ b/lib/generators.nix
@@ -236,17 +236,12 @@ rec {
         + libStr.concatMapStringsSep introSpace (go (indent + "  ")) v
         + outroSpace + "]"
     else if isFunction v then
-      # 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);
+      let fna = lib.functionArgs v;
           showFnas = concatStringsSep ", " (libAttr.mapAttrsToList
                        (name: hasDefVal: if hasDefVal then name + "?" else name)
-                       fna.value);
-      in if !fna.success || fna.value == {}
-         then "<function>"
-         else "<function, args: {${showFnas}}>"
+                       fna);
+      in if fna == {}    then "<function>"
+                         else "<function, args: {${showFnas}}>"
     else if isAttrs    v then
       # apply pretty values if allowed
       if attrNames v == [ "__pretty" "val" ] && allowPrettyValues