:doc doesn't display docs for partially applied primops #1166
Labels
No labels
Affects/CppNix
Affects/Nightly
Affects/Only nightly
Affects/Stable
Area/build-packaging
Area/cli
Area/evaluator
Area/fetching
Area/flakes
Area/language
Area/lix ci
Area/nix-eval-jobs
Area/profiles
Area/protocol
Area/releng
Area/remote-builds
Area/repl
Area/repl/debugger
Area/store
awaiting
author
awaiting
contributors
bug
Context
contributors
Context
drive-by
Context
maintainers
Context
RFD
crash 💥
Cross Compilation
devx
docs
Downstream Dependents
E/easy
E/hard
E/help wanted
E/reproducible
E/requires rearchitecture
Feature/S3
Importance
High
Importance
Low
imported
Language/Bash
Language/C++
Language/NixLang
Language/Python
Language/Rust
Needs Langver
OS/Linux
OS/macOS
performance
regression
Release Blocking
Non-urgent
Release Blocking
Urgent
stability
Status
blocked
Status
invalid
Status
postponed
Status
wontfix
testing
testing/flakey
Topic/Large Scale Installations
Urgency
High
Urgency
Low
ux
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lix-project/lix#1166
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Describe the bug
When used on a user function, the
:doccommand will elide already-supplied arguments from the signature. For example,:doc lib.mapAttrsToList's header will display the signature asmapAttrsToList = f: attrs: ..., but:doc lib.mapAttrsToList (n: v: v)will showmapAttrsToList = attrs: ..., dropping thefparameter since it was provided.However, when used on a primop, such as
map, the command:doc map (x: x)will simply error-out, saying thatvalue 'map (x: x)' does not have documentation. This is kind of a shame, it'd be nice if it behaved like normal functions :)Steps To Reproduce
:doc map, observe that docs work fine:doc map (x: x), get an error :(Expected behavior
It displays the docs for the function, but removes the already-filled parameters from the signature.
nix --versionoutputAdditional context
While messing with the codebase earlier, i noticed that the way the docs are fetched for builtins uses a pretty different mechanism to the rest (namely
EvalBuiltins::getDoc), but i didn't have the time to dig deeper, so if someone could pitch in about how feasible this is, i'd really appreciate it :)cl/5221wanted to do something similar but got a bit stuck due to larger scope. if you're happy with just solving themap (_:_)case and you don't want to show the docs of the binding this value was bound to (as that cl did) you can retry thegetDocbit for the associated primopif i'm not mistaken, even with a normal function, it sometimes ends up showing the underlying value's documentation, instead of the binding for it (which is like the issue that cl tried to fix, but not restricted to primops). i'll admit though that i didn't think about the binding issue enough, i'm not sure that fixing
getDocwithout doing anything else would work as intended... i'll mess around with it next time i can, but yeah this isn't as trivial as i thought ;-;(funnily enough i saw that issue and cl a little while ago but completely forgot about it til now)