Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
henrik-wolf opened this issue May 24, 2024 · 0 comments

Comments

@henrik-wolf
Copy link

henrik-wolf commented May 24, 2024

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.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant