1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-05 12:21:48 +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)) { if (auto s = std::get_if<string_t>(&cachedValue->second)) {
bool valid = true; bool valid = true;
for (auto & c : s->second) { for (auto & c : s->second) {
const StorePath & path = std::visit(overloaded { const StorePath * path = std::visit(overloaded {
[&](const NixStringContextElem::DrvDeep & d) -> const StorePath & { [&](const NixStringContextElem::DrvDeep & d) -> const StorePath * {
return d.drvPath; return &d.drvPath;
}, },
[&](const NixStringContextElem::Built & b) -> const StorePath & { [&](const NixStringContextElem::Built & b) -> const StorePath * {
return b.drvPath->getBaseStorePath(); return &b.drvPath->getBaseStorePath();
}, },
[&](const NixStringContextElem::Opaque & o) -> const StorePath & { [&](const NixStringContextElem::Opaque & o) -> const StorePath * {
return o.path; return &o.path;
}, },
[&](const NixStringContextElem::Path & p) -> const StorePath & { [&](const NixStringContextElem::Path & p) -> const StorePath * {
abort(); // FIXME return nullptr;
}, },
}, c.raw); }, c.raw);
if (!root->state.store->isValidPath(path)) { if (!path || !root->state.store->isValidPath(*path)) {
valid = false; valid = false;
break; break;
} }

View file

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

View file

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

View file

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