Skip to content

Parametric constructors cause SIGNATURE and TYPEDSIGNATURE to be empty / wrong #164

@henrik-wolf

Description

@henrik-wolf

I have something similar to the following setup where I try to create a zero argument constructor for a parametric struct:

using DocStringExtensions

"""
# struct definition
My test struct with fields
$(TYPEDFIELDS)
"""
struct MyStruct{T<:Number}
    a::T
end

"""
# empty constructor. Call with
$(SIGNATURES) or:
$(TYPEDSIGNATURES)
"""
function MyStruct{T}() where {T<:Number}
    return MyStruct{T}(one(T))
end

The constructed documentation look like this:

help?> MyStruct
search: MyStruct

  struct definition
  ≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡

  My test struct with fields

    •  a::Number

  ────────────────────────────────────────

  empty constructor. Call with
  ≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡

  MyStruct(a)
  


  or:

  MyStruct(a::Number) -> MyStruct

Which does not reproduce the signature of the parametric constructor. Ideally, I would expect something like
MyStruct{T}() for $SIGNATURES andMyStruct{T<:Number}() -> MyStruct for $TYPEDSIGNATURES.

(In the documenter build, the result of SIGNATURES and TYPEDSIGNATURES seems to just be empty, hence the empty in the title.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions