Skip to content

Commit 4045e7b

Browse files
authored
fix #52986, regression in @doc of macro without REPL loaded (#55795)
fix #52986
1 parent 58b239c commit 4045e7b

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

base/docs/Docs.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,10 @@ function _doc(binding::Binding, sig::Type = Union{})
577577
for msig in multidoc.order
578578
sig <: msig && return multidoc.docs[msig]
579579
end
580+
# if no matching signatures, return first
581+
if !isempty(multidoc.docs)
582+
return first(values(multidoc.docs))
583+
end
580584
end
581585
end
582586
return nothing

test/docs.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import Base.Docs: meta, @var, DocStr, parsedoc
44

55
# check that @doc can work before REPL is loaded
66
@test !startswith(read(`$(Base.julia_cmd()) -E '@doc sin'`, String), "nothing")
7+
@test !startswith(read(`$(Base.julia_cmd()) -E '@doc @time'`, String), "nothing")
78

89
using Markdown
910
using REPL

0 commit comments

Comments
 (0)