forked from lix-project/lix
Merge pull request #9818 from Ma27/print-value-on-function-call-type-error
libexpr: print value of what is attempted to be called as function
This commit is contained in:
commit
50e5d7b883
|
@ -1692,7 +1692,11 @@ void EvalState::callFunction(Value & fun, size_t nrArgs, Value * * args, Value &
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
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;
|
vRes = vCur;
|
||||||
|
|
|
@ -750,7 +750,7 @@ namespace nix {
|
||||||
|
|
||||||
ASSERT_TRACE1("foldl' (_: 1) \"foo\" [ true ]",
|
ASSERT_TRACE1("foldl' (_: 1) \"foo\" [ true ]",
|
||||||
TypeError,
|
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 ]",
|
ASSERT_TRACE2("foldl' (a: b: a && b) \"foo\" [ true ]",
|
||||||
TypeError,
|
TypeError,
|
||||||
|
@ -835,7 +835,7 @@ namespace nix {
|
||||||
|
|
||||||
ASSERT_TRACE1("sort (_: 1) [ \"foo\" \"bar\" ]",
|
ASSERT_TRACE1("sort (_: 1) [ \"foo\" \"bar\" ]",
|
||||||
TypeError,
|
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\" ]",
|
ASSERT_TRACE2("sort (_: _: 1) [ \"foo\" \"bar\" ]",
|
||||||
TypeError,
|
TypeError,
|
||||||
|
|
Loading…
Reference in a new issue