Skip to content

Commit 786dafb

Browse files
committed
fix type-predicate queries
expand the set of them to be more "complete", and document them more fully
1 parent 1d1f6fa commit 786dafb

38 files changed

+758
-809
lines changed

base/abstractarray.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1985,7 +1985,7 @@ function hash(a::AbstractArray{T}, h::UInt) where T
19851985
# to a range with more than two elements because more extreme values
19861986
# cannot be represented. We must still hash the two first values as a
19871987
# range since they can always be considered as such (in a wider type)
1988-
if isconcrete(T)
1988+
if isconcretetype(T)
19891989
try
19901990
step = x2 - x1
19911991
catch err

base/broadcast.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,7 @@ julia> string.(("one","two","three","four"), ": ", 1:4)
622622
const NonleafHandlingTypes = Union{DefaultArrayStyle,ArrayConflict,VectorStyle,MatrixStyle}
623623

624624
@inline function broadcast(f, s::NonleafHandlingTypes, ::Type{ElType}, inds::Indices, As...) where ElType
625-
if !Base._isleaftype(ElType)
625+
if !Base.isconcretetype(ElType)
626626
return broadcast_nonleaf(f, s, ElType, inds, As...)
627627
end
628628
dest = broadcast_similar(f, s, ElType, inds, As...)

base/complex.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -976,7 +976,7 @@ big(z::Complex{T}) where {T<:Real} = Complex{big(T)}(z)
976976
complex(A::AbstractArray{<:Complex}) = A
977977

978978
function complex(A::AbstractArray{T}) where T
979-
if !isconcrete(T)
979+
if !isconcretetype(T)
980980
error("`complex` not defined on abstractly-typed arrays; please convert to a more specific type")
981981
end
982982
convert(AbstractArray{typeof(complex(zero(T)))}, A)

base/deprecated.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -783,7 +783,8 @@ import .Iterators.enumerate
783783
@deprecate map(f, d::T) where {T<:AbstractDict} T( f(p) for p in pairs(d) )
784784

785785
# issue #17086
786-
@deprecate isleaftype isconcrete
786+
@deprecate isleaftype isconcretetype
787+
@deprecate isabstract isabstracttype
787788

788789
# PR #22932
789790
@deprecate +(a::Number, b::AbstractArray) broadcast(+, a, b)

base/dict.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function show(io::IO, t::AbstractDict{K,V}) where V where K
3434
if isempty(t)
3535
print(io, typeof(t), "()")
3636
else
37-
if _isleaftype(K) && _isleaftype(V)
37+
if isconcretetype(K) && isconcretetype(V)
3838
print(io, typeof(t).name)
3939
else
4040
print(io, typeof(t))
@@ -160,7 +160,7 @@ dict_with_eltype(DT_apply, ::Type) = DT_apply(Any, Any)()
160160
dict_with_eltype(DT_apply::F, kv, t) where {F} = grow_to!(dict_with_eltype(DT_apply, @default_eltype(typeof(kv))), kv)
161161
function dict_with_eltype(DT_apply::F, kv::Generator, t) where F
162162
T = @default_eltype(kv)
163-
if T <: Union{Pair, Tuple{Any, Any}} && _isleaftype(T)
163+
if T <: Union{Pair, Tuple{Any, Any}} && isconcretetype(T)
164164
return dict_with_eltype(DT_apply, kv, T)
165165
end
166166
return grow_to!(dict_with_eltype(DT_apply, T), kv)

base/exports.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -864,7 +864,11 @@ export
864864
fieldname,
865865
fieldnames,
866866
fieldcount,
867-
isconcrete,
867+
isabstracttype,
868+
isprimitivetype,
869+
isstructtype,
870+
isconcretetype,
871+
isdispatchtuple,
868872
oftype,
869873
promote,
870874
promote_rule,

base/float.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -863,7 +863,7 @@ Base.iszero(x::Float16) = reinterpret(UInt16, x) & ~sign_mask(Float16) == 0x0000
863863
float(A::AbstractArray{<:AbstractFloat}) = A
864864

865865
function float(A::AbstractArray{T}) where T
866-
if !isconcrete(T)
866+
if !isconcretetype(T)
867867
error("`float` not defined on abstractly-typed arrays; please convert to a more specific type")
868868
end
869869
convert(AbstractArray{typeof(float(zero(T)))}, A)

0 commit comments

Comments
 (0)