Skip to content

Commit

Permalink
Fix 0.7 deprecations (#53)
Browse files Browse the repository at this point in the history
* Fix 0.7 deprecations

* isabstract -> isabstracttype
* isconcrete -> isconcretetype
* module_name -> nameof

* Compat for Markdown/Pkg stdlib packages

Removes deprecations on Julia 0.7.
  • Loading branch information
mortenpi authored Feb 5, 2018
1 parent a1a6226 commit 67b2db7
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion REQUIRE
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
julia 0.6
Compat 0.33 # Compat.Test
Compat 0.50 # isabstracttype / isconcretetype / nameof
1 change: 1 addition & 0 deletions src/DocStringExtensions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ module DocStringExtensions
# Imports.

using Compat
@static if VERSION >= v"0.7.0-DEV.3656" using Pkg end


# Exports.
Expand Down
4 changes: 2 additions & 2 deletions src/abbreviations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ function format(::TypeFields, buf, doc)
# On 0.7 fieldnames() on an abstract type throws an error. We then explicitly return
# an empty vector to be consistent with the behaviour on v0.6.
# Compat necessary since Base.isabstract was introduced in v0.6.
local fields = Compat.TypeUtils.isabstract(object) ? Symbol[] : fieldnames(object)
local fields = isabstracttype(object) ? Symbol[] : fieldnames(object)
if !isempty(fields)
println(buf)
for field in fields
Expand Down Expand Up @@ -136,7 +136,7 @@ function format(::ModuleExports, buf, doc)
# Sorting ignores the `@` in macro names and sorts them in with others.
for sym in sort(exports, by = s -> lstrip(string(s), '@'))
# Skip the module itself, since that's always exported.
sym === module_name(object) && continue
sym === nameof(object) && continue
# We print linked names using Documenter.jl cross-reference syntax
# for ease of integration with that package.
println(buf, " - [`", sym, "`](@ref)")
Expand Down
2 changes: 1 addition & 1 deletion src/utilities.jl
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ $(:SIGNATURES)
Is the type `t` a `bitstype`?
"""
isbitstype(@nospecialize(t)) = isconcrete(t) && sizeof(t) > 0 && isbits(t)
isbitstype(@nospecialize(t)) = isconcretetype(t) && sizeof(t) > 0 && isbits(t)

"""
$(:SIGNATURES)
Expand Down
1 change: 1 addition & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using DocStringExtensions
using Compat.Test
@static if VERSION >= v"0.7.0-DEV.3589" using Markdown end

include("tests.jl")

0 comments on commit 67b2db7

Please sign in to comment.