Skip to content

Commit

Permalink
Add show_supertypes in type help
Browse files Browse the repository at this point in the history
  • Loading branch information
omus committed Apr 22, 2017
1 parent d24238d commit 2478f29
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
7 changes: 7 additions & 0 deletions base/docs/Docs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,13 @@ function summarize(io::IO, T::DataType, binding)
end
println(io, "```")
end
if supertype(T) != Any
println(io, "**Supertype Hierarchy:**")
println(io, "```")
Base.show_supertypes(io, T)
println(io)
println(io, "```")
end
end

function summarize(io::IO, m::Module, binding)
Expand Down
15 changes: 15 additions & 0 deletions test/docs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,11 @@ abstract type $(curmod_prefix)Undocumented.B <: $(curmod_prefix)Undocumented.A
```
$(curmod_prefix)Undocumented.D
```
**Supertype Hierarchy:**
```
$(curmod_prefix)Undocumented.B <: $(curmod_prefix)Undocumented.A <: Any
```
""")
@test docstrings_equal(@doc(Undocumented.B), doc"$doc_str")

Expand All @@ -760,6 +765,11 @@ No documentation found.
```
mutable struct $(curmod_prefix)Undocumented.C <: $(curmod_prefix)Undocumented.A
```
**Supertype Hierarchy:**
```
$(curmod_prefix)Undocumented.C <: $(curmod_prefix)Undocumented.A <: Any
```
""")
@test docstrings_equal(@doc(Undocumented.C), doc"$doc_str")

Expand All @@ -777,6 +787,11 @@ one :: Any
two :: String
three :: Float64
```
**Supertype Hierarchy:**
```
$(curmod_prefix)Undocumented.D <: $(curmod_prefix)Undocumented.B <: $(curmod_prefix)Undocumented.A <: Any
```
""")
@test docstrings_equal(@doc(Undocumented.D), doc"$doc_str")

Expand Down

0 comments on commit 2478f29

Please sign in to comment.