Skip to content

Commit

Permalink
Do not return disconnected IdDict from Docs.meta
Browse files Browse the repository at this point in the history
  • Loading branch information
timholy committed Dec 10, 2020
1 parent edfcd5a commit 83ba919
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
7 changes: 6 additions & 1 deletion base/docs/Docs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,12 @@ const modules = Module[]
const META = gensym(:meta)
const METAType = IdDict{Any,Any}

meta(m::Module) = isdefined(m, META) ? getfield(m, META)::METAType : METAType()
function meta(m::Module)
if !isdefined(m, META)
initmeta(m)
end
return getfield(m, META)::METAType
end

function initmeta(m::Module)
if !isdefined(m, META)
Expand Down
5 changes: 5 additions & 0 deletions test/docs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ end
@test docstrings_equal(@doc(ModuleMacroDoc), doc"I am a module")
@test docstrings_equal(@doc(ModuleMacroDoc.@m), doc"I am a macro")

# issue #38819

module NoDocStrings end
@test meta(NoDocStrings) === getfield(NoDocStrings, Base.Docs.META)

# General tests for docstrings.

const LINE_NUMBER = @__LINE__() + 1
Expand Down

0 comments on commit 83ba919

Please sign in to comment.