Skip to content

Adding docstring to constructor leads to ERROR: LoadError: type BottomType has no field name #21016

@helgee

Description

@helgee

Loading of one of my packages started to fail when I added a second docstring to one of the constructors. I have boiled the problem down to this minimal example:

module Test

abstract type AbstractType end

# Necessary to trigger the bug.
Base.show{T<:AbstractType}(io::IO, ::Type{T}) = print(io, T.name.name)

struct Struct{T<:AbstractType}
    jd1::Float64
    jd2::Float64
end

""
function Struct{T}(arg1) where T<:AbstractType
end

""
function Struct{T}(arg1, arg2, arg3) where T<:AbstractType
end

end # module

If you comment out either of the docstrings the module will load. Otherwise the following error is raised:

julia> using Test
ERROR: LoadError: type BottomType has no field name
Stacktrace:
 [1] print(::Base.AbstractIOBuffer{Array{UInt8,1}}, ::Core.BottomType) at ./strings/io.jl:29
 [2] #print_to_string#220(::Void, ::Function, ::String, ::Vararg{Any,N} where N) at ./strings/io.jl:102
 [3] print_to_string(::String, ::Vararg{Any,N} where N) at ./strings/io.jl:91
 [4] string(::String, ::Base.Docs.Binding, ::Vararg{Any,N} where N) at ./strings/io.jl:120
 [5] doc!(::Base.Docs.Binding, ::Base.Docs.DocStr, ::Any) at ./docs/Docs.jl:225
 [6] include_from_node1(::String) at ./loading.jl:539
 [7] eval(::Module, ::Any) at ./boot.jl:235
 [8] require(::Symbol) at ./loading.jl:453
while loading /Users/helge/.julia/v0.6/Test/src/Test.jl, in expression starting on line 511

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIndicates an unexpected problem or unintended behaviordocsystemThe documentation building systemtypes and dispatchTypes, subtyping and method dispatch

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions