Merge pull request #3626 from W95Psp/master

Make `functionArgs` primitive accept primops (fix #3624)
This commit is contained in:
Eelco Dolstra 2020-09-25 15:14:18 +02:00 committed by GitHub
commit cbb9862cd9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2236,6 +2236,10 @@ static RegisterPrimOp primop_catAttrs({
static void prim_functionArgs(EvalState & state, const Pos & pos, Value * * args, Value & v)
{
state.forceValue(*args[0], pos);
if (args[0]->type == tPrimOpApp || args[0]->type == tPrimOp) {
state.mkAttrs(v, 0);
return;
}
if (args[0]->type != tLambda)
throw TypeError({
.hint = hintfmt("'functionArgs' requires a function"),