Skip to content

Commit

Permalink
fix type-predicate queries
Browse files Browse the repository at this point in the history
  • Loading branch information
vtjnash committed Jan 10, 2018
1 parent 1381f0c commit bdaa13f
Show file tree
Hide file tree
Showing 35 changed files with 616 additions and 762 deletions.
2 changes: 1 addition & 1 deletion base/abstractarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1980,7 +1980,7 @@ function hash(a::AbstractArray{T}, h::UInt) where T
# to a range with more than two elements because more extreme values
# cannot be represented. We must still hash the two first values as a
# range since they can always be considered as such (in a wider type)
if isconcrete(T)
if isconcretetype(T)
try
step = x2 - x1
catch err
Expand Down
2 changes: 1 addition & 1 deletion base/complex.jl
Original file line number Diff line number Diff line change
Expand Up @@ -976,7 +976,7 @@ big(z::Complex{T}) where {T<:Real} = Complex{big(T)}(z)
complex(A::AbstractArray{<:Complex}) = A

function complex(A::AbstractArray{T}) where T
if !isconcrete(T)
if !isconcretetype(T)
error("`complex` not defined on abstractly-typed arrays; please convert to a more specific type")
end
convert(AbstractArray{typeof(complex(zero(T)))}, A)
Expand Down
2 changes: 1 addition & 1 deletion base/deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,7 @@ import .Iterators.enumerate
@deprecate map(f, d::T) where {T<:AbstractDict} T( f(p) for p in pairs(d) )

# issue #17086
@deprecate isleaftype isconcrete
@deprecate isleaftype isconcretetype

# PR #22932
@deprecate +(a::Number, b::AbstractArray) broadcast(+, a, b)
Expand Down
4 changes: 2 additions & 2 deletions base/dict.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function show(io::IO, t::AbstractDict{K,V}) where V where K
if isempty(t)
print(io, typeof(t), "()")
else
if _isleaftype(K) && _isleaftype(V)
if isconcretetype(K) && isconcretetype(V)
print(io, typeof(t).name)
else
print(io, typeof(t))
Expand Down Expand Up @@ -160,7 +160,7 @@ dict_with_eltype(DT_apply, ::Type) = DT_apply(Any, Any)()
dict_with_eltype(DT_apply::F, kv, t) where {F} = grow_to!(dict_with_eltype(DT_apply, @default_eltype(typeof(kv))), kv)
function dict_with_eltype(DT_apply::F, kv::Generator, t) where F
T = @default_eltype(kv)
if T <: Union{Pair, Tuple{Any, Any}} && _isleaftype(T)
if T <: Union{Pair, Tuple{Any, Any}} && isconcretetype(T)
return dict_with_eltype(DT_apply, kv, T)
end
return grow_to!(dict_with_eltype(DT_apply, T), kv)
Expand Down
3 changes: 2 additions & 1 deletion base/exports.jl
Original file line number Diff line number Diff line change
Expand Up @@ -865,7 +865,8 @@ export
fieldname,
fieldnames,
fieldcount,
isconcrete,
isconcretetype,
isdispatchtuple,
oftype,
promote,
promote_rule,
Expand Down
2 changes: 1 addition & 1 deletion base/float.jl
Original file line number Diff line number Diff line change
Expand Up @@ -863,7 +863,7 @@ Base.iszero(x::Float16) = reinterpret(UInt16, x) & ~sign_mask(Float16) == 0x0000
float(A::AbstractArray{<:AbstractFloat}) = A

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

0 comments on commit bdaa13f

Please sign in to comment.