mirror of
https://github.com/NixOS/nix.git
synced 2025-11-21 01:39:36 +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:
parent
4a80c92a4d
commit
e43888890f
9 changed files with 16 additions and 18 deletions
|
|
@ -154,7 +154,7 @@ void ExprList::show(const SymbolTable & symbols, std::ostream & str) const
|
|||
void ExprLambda::show(const SymbolTable & symbols, std::ostream & str) const
|
||||
{
|
||||
str << "(";
|
||||
if (hasFormals()) {
|
||||
if (hasFormals) {
|
||||
str << "{ ";
|
||||
bool first = true;
|
||||
// the natural Symbol ordering is by creation time, which can lead to the
|
||||
|
|
@ -451,14 +451,14 @@ void ExprLambda::bindVars(EvalState & es, const std::shared_ptr<const StaticEnv>
|
|||
if (es.debugRepl)
|
||||
es.exprEnvs.insert(std::make_pair(this, env));
|
||||
|
||||
auto newEnv = std::make_shared<StaticEnv>(nullptr, env, nFormals + (!arg ? 0 : 1));
|
||||
auto newEnv = std::make_shared<StaticEnv>(nullptr, env, (hasFormals ? getFormals().size() : 0) + (!arg ? 0 : 1));
|
||||
|
||||
Displacement displ = 0;
|
||||
|
||||
if (arg)
|
||||
newEnv->vars.emplace_back(arg, displ++);
|
||||
|
||||
if (hasFormals()) {
|
||||
if (hasFormals) {
|
||||
for (auto & i : getFormals())
|
||||
newEnv->vars.emplace_back(i.name, displ++);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue