nix repl :doc: Don't return docs for partially applied primops

This gives misleading results for Nixpkgs functions like lib.toUpper.

Fixes #4596.
This commit is contained in:
Eelco Dolstra 2021-03-03 17:52:57 +01:00
parent 1b2f5786d1
commit 665d4ec2da

View File

@ -592,10 +592,8 @@ Value & EvalState::getBuiltin(const string & name)
std::optional<EvalState::Doc> EvalState::getDoc(Value & v)
{
if (v.isPrimOp() || v.isPrimOpApp()) {
if (v.isPrimOp()) {
auto v2 = &v;
while (v2->isPrimOpApp())
v2 = v2->primOpApp.left;
if (v2->primOp->doc)
return Doc {
.pos = noPos,