Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions stdlib/REPL/src/docview.jl
Original file line number Diff line number Diff line change
Expand Up @@ -684,10 +684,16 @@ function fielddoc(binding::Binding, field::Symbol)
end
end
end
fs = fieldnames(resolve(binding))
fields = isempty(fs) ? "no fields" : (length(fs) == 1 ? "field " : "fields ") *
join(("`$f`" for f in fs), ", ", ", and ")
Markdown.parse("`$(resolve(binding))` has $fields.")
resolved = resolve(binding)
return if isabstracttype(resolved)
# Avoid calling `fieldnames`, as that would throw (#60783)
Markdown.parse("`$resolved` does not have fields as it is an abstract type.")
else
fs = fieldnames(resolved)
fields = isempty(fs) ? "no fields" : (length(fs) == 1 ? "field " : "fields ") *
join(("`$f`" for f in fs), ", ", ", and ")
Markdown.parse("`$resolved` has $fields.")
end
end

# As with the additional `doc` methods, this converts an object to a `Binding` first.
Expand Down