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

Error involving SIGNATURES and UnionAll type arguments #32

Closed
tkoolen opened this issue Jul 7, 2017 · 1 comment
Closed

Error involving SIGNATURES and UnionAll type arguments #32

tkoolen opened this issue Jul 7, 2017 · 1 comment

Comments

@tkoolen
Copy link
Contributor

tkoolen commented Jul 7, 2017

Thanks for the great package!

I found an annoying issue on 0.6 related to UnionAll types. If you use SIGNATURES as follows:

using DocStringExtensions
"""
$(SIGNATURES)
"""
function f(::Type{T}) where {T}
    T
end

then ?f results in

ERROR: type UnionAll has no field parameters
Stacktrace:
 [1] to_tuple_type(::Any) at ./reflection.jl:468
 [2] methods(::Any, ::Any) at ./reflection.jl:583
 [3] getmethods!(::Array{Method,1}, ::Function, ::Type{T} where T) at /home/twan/code/RigidBodyDynamics/v0.6/DocStringExtensions/src/utilities.jl:86
 [4] #methodgroups#3(::Bool, ::Function, ::Function, ::Type{T} where T, ::Module) at /home/twan/code/RigidBodyDynamics/v0.6/DocStringExtensions/src/utilities.jl:24
 [5] format(::DocStringExtensions.MethodSignatures, ::Base.AbstractIOBuffer{Array{UInt8,1}}, ::Base.Docs.DocStr) at /home/twan/code/RigidBodyDynamics/v0.6/DocStringExtensions/src/abbreviations.jl:290
 [6] formatdoc(::Base.AbstractIOBuffer{Array{UInt8,1}}, ::Base.Docs.DocStr, ::DocStringExtensions.MethodSignatures) at /home/twan/code/RigidBodyDynamics/v0.6/DocStringExtensions/src/abbreviations.jl:25
 [7] formatdoc(::Base.Docs.DocStr) at ./docs/Docs.jl:178
 [8] parsedoc(::Base.Docs.DocStr) at ./docs/Docs.jl:186
 [9] _collect(::Array{Base.Docs.DocStr,1}, ::Base.Generator{Array{Base.Docs.DocStr,1},Base.Docs.#parsedoc}, ::Base.EltypeUnknown, ::Base.HasShape) at ./array.jl:454
 [10] doc(::Base.Docs.Binding, ::Type{T} where T) at ./docs/Docs.jl:312
 [11] doc(::Base.Docs.Binding) at ./docs/Docs.jl:280

This is because the sig passed into getmethods! is Union{Tuple{Type{T}}, Tuple{T}} where T, which is a UnionAll, not a Union.

@tkoolen
Copy link
Contributor Author

tkoolen commented Aug 8, 2017

Ref: JuliaLang/julia#20872.

tkoolen added a commit to tkoolen/DocStringExtensions.jl that referenced this issue Aug 8, 2017
tkoolen added a commit to tkoolen/DocStringExtensions.jl that referenced this issue Aug 8, 2017
tkoolen added a commit to tkoolen/DocStringExtensions.jl that referenced this issue Aug 9, 2017
mortenpi pushed a commit that referenced this issue Aug 13, 2017
* Fix #32.

* Add tests.

* Fix templates for `where` expression header, add test.

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

No branches or pull requests

2 participants