libexpr: mark eval error handling NeverAsync

technically it doesn't *have* to be NeverAsync, but not marking it as
such unconditionally requires templating DebugState over asyncness of
its callback (which then requires templating EvalState, which, *NO*.)

Change-Id: I4980d45b541c2e40328beac139b18c6c1ba0957c
This commit is contained in:
eldritch horrors
2025-03-25 21:26:47 +01:00
parent 8a90195cdb
commit fc58e7b217
12 changed files with 55 additions and 35 deletions
+12 -5
View File
@@ -1,6 +1,7 @@
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include "lix/libutil/types.hh"
#include "tests/libexpr.hh"
namespace nix {
@@ -12,19 +13,23 @@ namespace nix {
TEST_F(ErrorTraceTest, TraceBuilder) {
ASSERT_THROW(
evaluator.errors.make<EvalError>("puppy").debugThrow(),
evaluator.errors.make<EvalError>("puppy").debugThrow(always_progresses),
EvalError
);
ASSERT_THROW(
evaluator.errors.make<EvalError>("puppy").withTrace(noPos, "doggy").debugThrow(),
evaluator.errors.make<EvalError>("puppy")
.withTrace(noPos, "doggy")
.debugThrow(always_progresses),
EvalError
);
ASSERT_THROW(
try {
try {
evaluator.errors.make<EvalError>("puppy").withTrace(noPos, "doggy").debugThrow();
evaluator.errors.make<EvalError>("puppy")
.withTrace(noPos, "doggy")
.debugThrow(always_progresses);
} catch (Error & e) {
e.addTrace(evaluator.positions[noPos], "beans");
throw;
@@ -47,10 +52,12 @@ namespace nix {
TEST_F(ErrorTraceTest, NestedThrows) {
try {
evaluator.errors.make<EvalError>("puppy").withTrace(noPos, "doggy").debugThrow();
evaluator.errors.make<EvalError>("puppy")
.withTrace(noPos, "doggy")
.debugThrow(always_progresses);
} catch (BaseError & e) {
try {
evaluator.errors.make<EvalError>("beans").debugThrow();
evaluator.errors.make<EvalError>("beans").debugThrow(always_progresses);
} catch (Error & e2) {
e.addTrace(evaluator.positions[noPos], "beans2");
//e2.addTrace(state.positions[noPos], "Something", "");