JuliaDocs / JuliaDocs/DocStringExtensions.jl
Parametric constructors cause `SIGNATURE` and `TYPEDSIGNATURE` to be empty / wrong
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 126
- Forks
- 35
- PR merge metrics
- No merged PRs in 30d
Description
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.)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Julia example in the issue and inspect how SIGNATURES and TYPEDSIGNATURES process the parametric zero-argument constructor. Compare the generated documentation with the expected MyStruct{T}() and MyStruct{T<:Number}() -> MyStruct forms; the issue is done when both substitutions preserve the constructor's parametric signature.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- documentation
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100