Skip to content

Commit 4007f63

Browse files
authored
Remove is(abstract|bits)type functions (#116)
* Remove is(abstract|bits)type * Replace .mutable -> ismutabletype and add fallback definition for ismutabletype * Set version to 0.8.5
1 parent fe77575 commit 4007f63

File tree

3 files changed

+13
-18
lines changed

3 files changed

+13
-18
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "DocStringExtensions"
22
uuid = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
3-
version = "0.8.4"
3+
version = "0.8.5"
44

55
[deps]
66
LibGit2 = "76f85450-5226-5b5a-8eaa-529ad045b433"

src/abbreviations.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ function print_abstract_type(buf, object)
512512
end
513513

514514
function print_mutable_struct_or_struct(buf, object)
515-
object.mutable && print(buf, "mutable ")
515+
ismutabletype(object) && print(buf, "mutable ")
516516
print(buf, "struct ", object.name.name)
517517
print_params(buf, object)
518518
print_supertype(buf, object)

src/utilities.jl

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ function getmethods!(results, f, sig)
8989
end
9090
return results
9191
end
92+
9293
"""
9394
$(:SIGNATURES)
9495
@@ -99,22 +100,6 @@ more consistently that `methods`.
99100
"""
100101
getmethods(f, sig) = unique(getmethods!(Method[], f, sig))
101102

102-
103-
"""
104-
$(:SIGNATURES)
105-
106-
Is the type `t` a `bitstype`?
107-
"""
108-
isbitstype(@nospecialize(t)) = isconcretetype(t) && sizeof(t) > 0 && isbits(t)
109-
110-
"""
111-
$(:SIGNATURES)
112-
113-
Is the type `t` an `abstract` type?
114-
"""
115-
isabstracttype(@nospecialize(t)) = isa(t, DataType) && getfield(t, :abstract)
116-
117-
118103
"""
119104
$(:SIGNATURES)
120105
@@ -476,3 +461,13 @@ function url(mod::Module, file::AbstractString, line::Integer)
476461
end
477462
end
478463
end
464+
465+
# This is compat to make sure that we have ismutabletype available pre-1.7.
466+
# Implementation borrowed from JuliaLang/julia (MIT license).
467+
# https://github.com/JuliaLang/julia/pull/39037
468+
if !isdefined(Base, :ismutabletype)
469+
function ismutabletype(@nospecialize(t::Type))
470+
t = Base.unwrap_unionall(t)
471+
return isa(t, DataType) && t.mutable
472+
end
473+
end

0 commit comments

Comments
 (0)