From 859c8caae2de0ee571721f3bac4e37670d76a0d4 Mon Sep 17 00:00:00 2001 From: eldritch horrors Date: Sat, 26 Apr 2025 22:14:05 +0200 Subject: [PATCH] libcmd: don't determinePos in repl replInitFilesFunction is always valid, but pointing to it is misleading because the source is inaccessible. every replInit is better identified by its path if it isn't a lambda; determinePos will return noPos anyway Change-Id: I0b6fcd2f95f121a802c87cb1085d3a0b1c585aeb --- lix/libcmd/repl.cc | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/lix/libcmd/repl.cc b/lix/libcmd/repl.cc index 91b60eba7..fe2984cab 100644 --- a/lix/libcmd/repl.cc +++ b/lix/libcmd/repl.cc @@ -962,13 +962,7 @@ void NixRepl::loadReplOverlays() Value &newAttrs(*evaluator.mem.allocValue()); SmallValueVector<3> args = {replInitInfo(), bindingsToAttrs(), replOverlays()}; - state.callFunction( - *replInitFilesFunction, - args.size(), - args.data(), - newAttrs, - replInitFilesFunction->determinePos(noPos) - ); + state.callFunction(*replInitFilesFunction, args.size(), args.data(), newAttrs, noPos); // n.b. this does in fact load the stuff into the environment twice (once // from the superset of the environment returned by repl-overlays and once @@ -1014,11 +1008,11 @@ Value * NixRepl::replOverlays() if (!replInit->isLambda()) { evaluator.errors.make( - "Expected `repl-overlays` to be a lambda but found %1%: %2%", + "Expected `repl-overlays` entry %s to be a lambda but found %s: %s", + path, showType(*replInit), ValuePrinter(state, *replInit, errorPrintOptions) ) - .atPos(replInit->determinePos(noPos)) .debugThrow(); } @@ -1028,7 +1022,7 @@ Value * NixRepl::replOverlays() "repl-overlays", "..." ) - .atPos(replInit->determinePos(noPos)) + .atPos(replInit->lambda.fun->pos) .debugThrow(); }