Skip to content

Commit

Permalink
Do not return disconnected IdDict from Docs.meta (JuliaLang#38821)
Browse files Browse the repository at this point in the history
  • Loading branch information
timholy authored and ElOceanografo committed May 4, 2021
1 parent f3f4594 commit 297597d
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 297597d

Please sign in to comment.