feat(tvix/eval): display function names in documentation
... if they are known. We currently do not propagate names correctly for curried functions. Change-Id: I19d57fb30a5c0000ccdf690b91076f6b2191de23 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7596 Tested-by: BuildkiteCI Reviewed-by: grfn <grfn@gws.fyi>
This commit is contained in:
parent
e3f81e8d3b
commit
712f1167ad
1 changed files with 8 additions and 1 deletions
|
@ -446,7 +446,14 @@ impl Value {
|
|||
Value::Path(p) => format!("the path '{}'", p.to_string_lossy()),
|
||||
Value::Attrs(attrs) => format!("a {}-item attribute set", attrs.len()),
|
||||
Value::List(list) => format!("a {}-item list", list.len()),
|
||||
Value::Closure(_f) => format!("a user-defined Nix function"), // TODO: name, loc, etc.
|
||||
|
||||
Value::Closure(f) => {
|
||||
if let Some(name) = &f.lambda.name {
|
||||
format!("the user-defined Nix function '{}'", name)
|
||||
} else {
|
||||
format!("a user-defined Nix function")
|
||||
}
|
||||
}
|
||||
|
||||
Value::Builtin(b) => {
|
||||
let mut out = format!("the builtin function '{}'", b.name());
|
||||
|
|
Loading…
Reference in a new issue