1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-10 04:26:01 +01:00

restore proper handling of no formals vs. 0 formals

e.g. (foo@{}: 1) { a = 3; } should error, but wasn't with the previous
commit
This commit is contained in:
Taeer Bar-Yam 2025-10-27 22:58:37 +01:00
parent 4a80c92a4d
commit e43888890f
9 changed files with 16 additions and 18 deletions

View file

@ -1496,13 +1496,13 @@ void EvalState::callFunction(Value & fun, std::span<Value *> args, Value & vRes,
ExprLambda & lambda(*vCur.lambda().fun);
auto size = (!lambda.arg ? 0 : 1) + lambda.nFormals;
auto size = (!lambda.arg ? 0 : 1) + (lambda.hasFormals ? lambda.getFormals().size() : 0);
Env & env2(mem.allocEnv(size));
env2.up = vCur.lambda().env;
Displacement displ = 0;
if (!lambda.hasFormals())
if (!lambda.hasFormals)
env2.values[displ++] = args[0];
else {
try {
@ -1747,7 +1747,7 @@ void EvalState::autoCallFunction(const Bindings & args, Value & fun, Value & res
}
}
if (!fun.isLambda() || !fun.lambda().fun->hasFormals()) {
if (!fun.isLambda() || !fun.lambda().fun->hasFormals) {
res = fun;
return;
}