tvl-depot/third_party/nix/src/libexpr
sterni 8709153973 fix(tvix/libexpr): backport fix for functionArgs failing on primops
Nix internally differentiates between lambdas and primops, but their
type in the nix expression language is the same (lambda). The
implementation of builtins.functionArgs only checks if the given
expression is of type tLambda and fails if the type is tPrimop or
tPrimopApp which are also functions. This most notably breaks
lib.generators.toPretty when called on a builtin making for example
yants fail if a primop is typechecked and an error message is
generated.

This fix generates an empty set for primops like for plain lambdas
and is based upstream commit b2748c6e99239ff6803ba0da76c362790c8be192.

Additionally we add to two tests:

* eval-okay-functionargs now includes a few test cases checking that
  builtins.functionArgs always returns an empty set for builtins and
  also works as expected for normal functions.
* eval-okay-types now also checks if builtins are functions.

Future work would be to make builtins.functionArgs work as users would
expect for builtins like builtins.fetchurl, builtins.fetchGit etc. which
take a set as an argument. These currently don't register as formal
arguments, but it would be an usability improvement at least if they
did.

See also https://github.com/NixOS/nix/pull/3626#issuecomment-698546704

Change-Id: I2bf4cb80d44a4b72ade13d3e0dbd7dfb1d049f32
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2477
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
Reviewed-by: glittershark <grfn@gws.fyi>
2021-02-02 10:52:33 +00:00
..
primops feat(tvix): Convert some DLOGs to VLOGs 2020-11-22 23:17:23 +00:00
attr-path.cc refactor(tvix): always pass Bindings by ptr, use shared/unique_ptr 2020-08-17 02:23:49 +00:00
attr-path.hh refactor(tvix): always pass Bindings by ptr, use shared/unique_ptr 2020-08-17 02:23:49 +00:00
attr-set.cc refactor(tvix/libexpr): Remove Bindings::SortedByKeys() 2020-12-23 11:33:54 +00:00
attr-set.hh refactor(tvix/libexpr): Remove Bindings::SortedByKeys() 2020-12-23 11:33:54 +00:00
CMakeLists.txt refactor(tvix): add explicit copy/move constructors for Value 2020-08-17 02:23:49 +00:00
common-eval-args.cc refactor(tvix): Clean up MixEvalArgs internals 2020-08-28 01:18:19 +00:00
common-eval-args.hh refactor(tvix): Clean up MixEvalArgs internals 2020-08-28 01:18:19 +00:00
eval-inline.hh refactor(3p/nix): Anchor local includes at src/ 2020-05-27 21:56:34 +01:00
eval.cc refactor(tvix/libexpr): Remove Bindings::SortedByKeys() 2020-12-23 11:33:54 +00:00
eval.hh refactor(3p/tvix): convert NixList usage to shared_ptr 2020-09-15 21:42:54 +00:00
function-trace.cc refactor(3p/nix): Anchor local includes at src/ 2020-05-27 21:56:34 +01:00
function-trace.hh refactor(3p/nix): Anchor local includes at src/ 2020-05-27 21:56:34 +01:00
get-drvs.cc refactor(tvix/libexpr): Remove Bindings::SortedByKeys() 2020-12-23 11:33:54 +00:00
get-drvs.hh style(tvix): Replace remaining typedefs with using statements 2020-08-21 03:55:56 +00:00
json-to-value.cc feat(tvix): Bump nlohmann-json version to 3.9.1 2020-11-27 19:59:51 +00:00
json-to-value.hh style(tvix): Sort out minor formatting errors 2020-08-10 17:40:18 +00:00
lexer.l refactor(3p/nix/libexpr): Move some code out of lexer.l 2020-07-19 02:59:41 +00:00
names.cc fix(3p/nix): revert "apply all clang-tidy fixes" 2020-08-01 22:45:15 +00:00
names.hh fix(3p/nix): revert "apply all clang-tidy fixes" 2020-08-01 22:45:15 +00:00
nix-expr.pc.in feat(3p/nix): install pkgconfig files for libexpr, libmain and libstore 2020-06-21 20:42:28 +00:00
nixexpr.cc refactor(tvix): remove signedness conversions by using std::optional 2020-11-27 18:34:20 +00:00
nixexpr.hh feat(tvix): Add a pos field to more expr classes 2020-11-22 21:59:58 +00:00
parser.cc feat(tvix): Convert some DLOGs to VLOGs 2020-11-22 23:17:23 +00:00
parser.hh style(tvix): Add missing braces in expressions 2020-08-21 03:55:56 +00:00
parser.y feat(tvix): Add a pos field to more expr classes 2020-11-22 21:59:58 +00:00
primops.cc fix(tvix/libexpr): backport fix for functionArgs failing on primops 2021-02-02 10:52:33 +00:00
primops.hh refactor(tvix): Replace several DiscardLogsSink() with std::cerr 2020-08-21 01:35:08 +00:00
symbol-table.cc refactor(3p/nix): Anchor local includes at src/ 2020-05-27 21:56:34 +01:00
symbol-table.hh chore(3p): Bump nixpkgs channels 2020-08-06 00:15:33 +00:00
value-to-json.cc feat(3p/nix): remove External values feature 2020-08-01 18:54:50 +00:00
value-to-json.hh refactor(3p/nix): Anchor local includes at src/ 2020-05-27 21:56:34 +01:00
value-to-xml.cc feat(3p/nix): remove External values feature 2020-08-01 18:54:50 +00:00
value-to-xml.hh refactor(3p/nix): Anchor local includes at src/ 2020-05-27 21:56:34 +01:00
value.cc refactor(tvix): add explicit copy/move constructors for Value 2020-08-17 02:23:49 +00:00
value.hh refactor(3p/tvix): make Value.primOp a std::shared_ptr 2020-09-15 21:52:56 +00:00