1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-05 08:11:47 +02:00

Handle FIXMEs

This commit is contained in:
Eelco Dolstra 2025-05-07 21:36:13 +02:00
parent 0f48a152dd
commit 2bbf755bee
4 changed files with 17 additions and 14 deletions

View file

@ -618,21 +618,21 @@ string_t AttrCursor::getStringWithContext()
if (auto s = std::get_if<string_t>(&cachedValue->second)) {
bool valid = true;
for (auto & c : s->second) {
const StorePath & path = std::visit(overloaded {
[&](const NixStringContextElem::DrvDeep & d) -> const StorePath & {
return d.drvPath;
const StorePath * path = std::visit(overloaded {
[&](const NixStringContextElem::DrvDeep & d) -> const StorePath * {
return &d.drvPath;
},
[&](const NixStringContextElem::Built & b) -> const StorePath & {
return b.drvPath->getBaseStorePath();
[&](const NixStringContextElem::Built & b) -> const StorePath * {
return &b.drvPath->getBaseStorePath();
},
[&](const NixStringContextElem::Opaque & o) -> const StorePath & {
return o.path;
[&](const NixStringContextElem::Opaque & o) -> const StorePath * {
return &o.path;
},
[&](const NixStringContextElem::Path & p) -> const StorePath & {
abort(); // FIXME
[&](const NixStringContextElem::Path & p) -> const StorePath * {
return nullptr;
},
}, c.raw);
if (!root->state.store->isValidPath(path)) {
if (!path || !root->state.store->isValidPath(*path)) {
valid = false;
break;
}

View file

@ -2512,7 +2512,9 @@ std::pair<SingleDerivedPath, std::string_view> EvalState::coerceToSingleDerivedP
return std::move(b);
},
[&](NixStringContextElem::Path && p) -> SingleDerivedPath {
abort(); // FIXME
error<EvalError>(
"string '%s' has no context",
s).withTrace(pos, errorCtx).debugThrow();
},
}, ((NixStringContextElem &&) *context.begin()).raw);
return {

View file

@ -150,8 +150,9 @@ static void prim_addDrvOutputDependencies(EvalState & state, const PosIdx pos, V
return std::move(c);
},
[&](const NixStringContextElem::Path & p) -> NixStringContextElem::DrvDeep {
// FIXME: don't know what to do here.
abort();
state.error<EvalError>(
"`addDrvOutputDependencies` does not work on a string without context"
).atPos(pos).debugThrow();
},
}, context.begin()->raw) }),
};

View file

@ -93,7 +93,7 @@ UnresolvedApp InstallableValue::toApp(EvalState & state)
};
},
[&](const NixStringContextElem::Path & p) -> DerivedPath {
abort(); // FIXME
throw Error("'program' attribute of an 'app' output cannot have no context");
},
}, c.raw));
}