Skip to content

Doctest failures on julia 0.6 related to world age counter #398

@ajkeller34

Description

@ajkeller34

I'm encountering a doctest failure on Julia 0.6.0-dev (built yesterday) which is related to the newly-implemented world age counter (JuliaLang/julia#17057). I've made a minimal example in a mockup package that I'll call DocumenterTest. Here's the code:

module DocumenterTest

immutable TestType{T} end

function _show end
Base.show(io::IO, t::TestType) = _show(io, t)

macro define_show_and_make_object(x, y)
    z = Expr(:quote, x)
    esc(quote
        DocumenterTest._show(io::IO, t::DocumenterTest.TestType{$z}) = print(io, $y)
        const $x = DocumenterTest.TestType{$z}()
    end)
end

end # module

At the REPL you may try using the macro, which defines a method for show and makes an object:

julia> DocumenterTest.@define_show_and_make_object q "abcd"
abcd

julia> q
abcd

julia> DocumenterTest.TestType{:q}()
abcd

Now suppose we open a new Julia session. If we try to run Documenter with the following markdown file, the doctest will error (pretend I used three backticks, I'm not sure how to get the formatting right here):

``@meta
DocTestSetup = quote
    using DocumenterTest
end
``

``jldoctest
julia> DocumenterTest.@define_show_and_make_object q "abcd"
abcd
``

The output from the doctest is the following error instead of "abcd":

MethodError: no method matching _show(::IOContext{Base.AbstractIOBuffer{Array{UInt8,1}}}, ::DocumenterTest.TestType{:q})
The applicable method may be too new: running in world age 20490, while current world is 20492.
Closest candidates are:
  _show(::IO, ::DocumenterTest.TestType{:q}) at /Users/ajkeller/.julia/v0.6/DocumenterTest/src/DocumenterTest.jl:12 (method too new to be called from this world context.)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions