Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/libexpr/eval.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1692,7 +1692,11 @@ void EvalState::callFunction(Value & fun, size_t nrArgs, Value * * args, Value &
}

else
error("attempt to call something which is not a function but %1%", showType(vCur)).atPos(pos).debugThrow<TypeError>();
error("attempt to call something which is not a function but %1%: %2%",
showType(vCur),
ValuePrinter(*this, vCur, errorPrintOptions))
.atPos(pos)
.debugThrow<TypeError>();
}

vRes = vCur;
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/libexpr/error_traces.cc
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,7 @@ namespace nix {

ASSERT_TRACE1("foldl' (_: 1) \"foo\" [ true ]",
TypeError,
hintfmt("attempt to call something which is not a function but %s", "an integer"));
hintfmt("attempt to call something which is not a function but %s: %s", "an integer", ANSI_CYAN "1" ANSI_NORMAL));

ASSERT_TRACE2("foldl' (a: b: a && b) \"foo\" [ true ]",
TypeError,
Expand Down Expand Up @@ -835,7 +835,7 @@ namespace nix {

ASSERT_TRACE1("sort (_: 1) [ \"foo\" \"bar\" ]",
TypeError,
hintfmt("attempt to call something which is not a function but %s", "an integer"));
hintfmt("attempt to call something which is not a function but %s: %s", "an integer", ANSI_CYAN "1" ANSI_NORMAL));

ASSERT_TRACE2("sort (_: _: 1) [ \"foo\" \"bar\" ]",
TypeError,
Expand Down