aboutsummaryrefslogtreecommitdiff
path: root/src/libcmd/repl.cc
diff options
context:
space:
mode:
authorGuillaume Maudoux <guillaume.maudoux@tweag.io>2023-01-19 13:23:04 +0100
committerGuillaume Maudoux <guillaume.maudoux@tweag.io>2023-01-19 13:23:04 +0100
commite4726a0c797a2680b9149015dc5e6c1a922fc686 (patch)
treea5f4e60c2761932d3e40b789f9875706446ead6f /src/libcmd/repl.cc
parent38b90c618f5ce4334b89c0124c5a54f339a23db6 (diff)
Revert "Revert "Merge pull request #6204 from layus/coerce-string""
This reverts commit 9b33ef3879a764bed4cc2404a08344c3a697a646.
Diffstat (limited to 'src/libcmd/repl.cc')
-rw-r--r--src/libcmd/repl.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libcmd/repl.cc b/src/libcmd/repl.cc
index b7f691808..9b12f8fa2 100644
--- a/src/libcmd/repl.cc
+++ b/src/libcmd/repl.cc
@@ -397,7 +397,7 @@ StringSet NixRepl::completePrefix(const std::string & prefix)
Expr * e = parseString(expr);
Value v;
e->eval(*state, *env, v);
- state->forceAttrs(v, noPos);
+ state->forceAttrs(v, noPos, "nevermind, it is ignored anyway");
for (auto & i : *v.attrs) {
std::string_view name = state->symbols[i.name];
@@ -590,7 +590,7 @@ bool NixRepl::processLine(std::string line)
const auto [path, line] = [&] () -> std::pair<Path, uint32_t> {
if (v.type() == nPath || v.type() == nString) {
PathSet context;
- auto path = state->coerceToPath(noPos, v, context);
+ auto path = state->coerceToPath(noPos, v, context, "while evaluating the filename to edit");
return {path, 0};
} else if (v.isLambda()) {
auto pos = state->positions[v.lambda.fun->pos];
@@ -839,7 +839,7 @@ void NixRepl::loadFiles()
void NixRepl::addAttrsToScope(Value & attrs)
{
- state->forceAttrs(attrs, [&]() { return attrs.determinePos(noPos); });
+ state->forceAttrs(attrs, [&]() { return attrs.determinePos(noPos); }, "while evaluating an attribute set to be merged in the global scope");
if (displ + attrs.attrs->size() >= envSize)
throw Error("environment full; cannot add more variables");
@@ -944,7 +944,7 @@ std::ostream & NixRepl::printValue(std::ostream & str, Value & v, unsigned int m
Bindings::iterator i = v.attrs->find(state->sDrvPath);
PathSet context;
if (i != v.attrs->end())
- str << state->store->printStorePath(state->coerceToStorePath(i->pos, *i->value, context));
+ str << state->store->printStorePath(state->coerceToStorePath(i->pos, *i->value, context, "while evaluating the drvPath of a derivation"));
else
str << "???";
str << "ยป";