diff --git a/base/docs/Docs.jl b/base/docs/Docs.jl index 1327a1f795d4f..1a2403bbb8644 100644 --- a/base/docs/Docs.jl +++ b/base/docs/Docs.jl @@ -577,6 +577,10 @@ function _doc(binding::Binding, sig::Type = Union{}) for msig in multidoc.order sig <: msig && return multidoc.docs[msig] end + # if no matching signatures, return first + if !isempty(multidoc.docs) + return first(values(multidoc.docs)) + end end end return nothing diff --git a/test/docs.jl b/test/docs.jl index f62f7f8b63b2c..a6ef6afec5807 100644 --- a/test/docs.jl +++ b/test/docs.jl @@ -4,6 +4,7 @@ import Base.Docs: meta, @var, DocStr, parsedoc # check that @doc can work before REPL is loaded @test !startswith(read(`$(Base.julia_cmd()) -E '@doc sin'`, String), "nothing") +@test !startswith(read(`$(Base.julia_cmd()) -E '@doc @time'`, String), "nothing") using Markdown using REPL