Skip to content

Commit

Permalink
List Union{...} type aliases as "Type" (#1474)
Browse files Browse the repository at this point in the history
  • Loading branch information
mortenpi authored Nov 13, 2020
1 parent d046f46 commit f0176c5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

* ![Feature][badge-feature] Documenter can now deploy from Buildkite CI to GitHub Pages with `Documenter.Buildkite`. ([#1469][github-1469])

* ![Bugfix][badge-bugfix] Type aliases of `Union`s (e.g. `const MyAlias = Union{Foo,Bar}`) are now correctly listed as "Type" in docstrings. ([#1466][github-1466], [#1474][github-1474])

## Version `v0.25.3`

* ![Feature][badge-feature] Documenter can now deploy from GitLab CI to GitHub Pages with `Documenter.GitLab`. ([#1448][github-1448])
Expand Down Expand Up @@ -685,9 +687,11 @@
[github-1452]: https://github.com/JuliaDocs/Documenter.jl/pull/1452
[github-1462]: https://github.com/JuliaDocs/Documenter.jl/issues/1462
[github-1463]: https://github.com/JuliaDocs/Documenter.jl/pull/1463
[github-1466]: https://github.com/JuliaDocs/Documenter.jl/issues/1466
[github-1468]: https://github.com/JuliaDocs/Documenter.jl/pull/1468
[github-1469]: https://github.com/JuliaDocs/Documenter.jl/pull/1469
[github-1471]: https://github.com/JuliaDocs/Documenter.jl/pull/1471
[github-1474]: https://github.com/JuliaDocs/Documenter.jl/pull/1474

[julia-38079]: https://github.com/JuliaLang/julia/issues/38079

Expand Down
2 changes: 1 addition & 1 deletion src/Utilities/Utilities.jl
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ end
doccat(b::Binding, ::Type) = "Method"

doccat(::Function) = "Function"
doccat(::DataType) = "Type"
doccat(::Type) = "Type"
doccat(x::UnionAll) = doccat(Base.unwrap_unionall(x))
doccat(::Module) = "Module"
doccat(::Any) = "Constant"
Expand Down
7 changes: 7 additions & 0 deletions test/utilities.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ module UnitTests
f(x) = x

const pi = 3.0

const TA = Vector{UInt128}
const TB = Array{T, 8} where T
const TC = Union{Int64, Float64, String}
end

module OuterModule
Expand Down Expand Up @@ -97,6 +101,9 @@ end
@test Documenter.Utilities.doccat(UnitTests.S) == "Type"
@test Documenter.Utilities.doccat(UnitTests.f) == "Function"
@test Documenter.Utilities.doccat(UnitTests.pi) == "Constant"
@test Documenter.Utilities.doccat(UnitTests.TA) == "Type"
@test Documenter.Utilities.doccat(UnitTests.TB) == "Type"
@test Documenter.Utilities.doccat(UnitTests.TC) == "Type"

# repo type
@test Documenter.Utilities.repo_host_from_url("https://bitbucket.org/somerepo") == Documenter.Utilities.RepoBitbucket
Expand Down

0 comments on commit f0176c5

Please sign in to comment.