Skip to content

Commit 74f2ae0

Browse files
Merge pull request #132 from JuliaDocs/mh/fix-115
Fix #115, `TYPES` template does not apply to parametric types.
2 parents 9de856b + 5e0cfff commit 74f2ae0

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

src/abbreviations.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -670,6 +670,7 @@ function template_key(doc::Docs.DocStr)
670670
_key(::Function, ::typeof(Union{}), binding) = ismacro(binding) ? :MACROS : :FUNCTIONS
671671
_key(::Function, sig, binding) = ismacro(binding) ? :MACROS : :METHODS
672672
_key(::DataType, ::typeof(Union{}), binding) = :TYPES
673+
_key(::UnionAll, ::typeof(Union{}), binding) = :TYPES
673674
_key(::DataType, sig, binding) = :METHODS
674675
_key(other, sig, binding) = :DEFAULT
675676

test/templates.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ const K = 1
3535
"mutable struct `T`"
3636
mutable struct T end
3737

38+
"mutable struct `ISSUE_115{S}`"
39+
mutable struct ISSUE_115{S} end
40+
3841
"`@kwdef` struct `S`"
3942
Base.@kwdef struct S end
4043

@@ -101,6 +104,9 @@ module OtherModule
101104
"mutable struct `T`"
102105
mutable struct T end
103106

107+
"mutable struct `ISSUE_115{S}`"
108+
mutable struct ISSUE_115{S} end
109+
104110
"macro `@m`"
105111
macro m(x) end
106112

test/tests.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,7 @@ end
496496
@test occursin("(DEFAULT)", fmt(:(TemplateTests.K)))
497497
@test occursin("(TYPES)", fmt(:(TemplateTests.T)))
498498
@test occursin("(TYPES)", fmt(:(TemplateTests.S)))
499+
@test occursin("(TYPES)", fmt(:(TemplateTests.ISSUE_115)))
499500
@test occursin("(METHODS, MACROS)", fmt(:(TemplateTests.f)))
500501
@test occursin("(METHODS, MACROS)", fmt(:(TemplateTests.g)))
501502
@test occursin("(METHODS, MACROS)", fmt(:(TemplateTests.h)))
@@ -508,6 +509,7 @@ end
508509
@test occursin("(MACROS)", fmt(:(TemplateTests.InnerModule.@m)))
509510

510511
@test occursin("(TYPES)", fmt(:(TemplateTests.OtherModule.T)))
512+
@test occursin("(TYPES)", fmt(:(TemplateTests.OtherModule.ISSUE_115)))
511513
@test occursin("(MACROS)", fmt(:(TemplateTests.OtherModule.@m)))
512514
@test fmt(:(TemplateTests.OtherModule.f)) == "method `f`\n"
513515
end

0 commit comments

Comments
 (0)