diff --git a/base/arraymath.jl b/base/arraymath.jl index 75ea8897a131e..f6da0b5131821 100644 --- a/base/arraymath.jl +++ b/base/arraymath.jl @@ -19,15 +19,6 @@ end ## Binary arithmetic operators ## -promote_array_type(F, ::Type, ::Type, T::Type) = T -promote_array_type{S<:Real, A<:AbstractFloat}(F, ::Type{S}, ::Type{A}, ::Type) = A -promote_array_type{S<:Integer, A<:Integer}(F, ::Type{S}, ::Type{A}, ::Type) = A -promote_array_type{S<:Integer, A<:Integer}(::typeof(/), ::Type{S}, ::Type{A}, T::Type) = T -promote_array_type{S<:Integer, A<:Integer}(::typeof(\), ::Type{S}, ::Type{A}, T::Type) = T -promote_array_type{S<:Integer}(::typeof(/), ::Type{S}, ::Type{Bool}, T::Type) = T -promote_array_type{S<:Integer}(::typeof(\), ::Type{S}, ::Type{Bool}, T::Type) = T -promote_array_type{S<:Integer}(F, ::Type{S}, ::Type{Bool}, T::Type) = T - for f in (:+, :-) @eval function ($f)(A::AbstractArray, B::AbstractArray) promote_shape(A, B) # check size compatibility diff --git a/base/complex.jl b/base/complex.jl index 4c1f837fb1f86..c9f766253ad08 100644 --- a/base/complex.jl +++ b/base/complex.jl @@ -867,7 +867,6 @@ end ## promotion to complex ## _default_type(T::Type{Complex}) = Complex{Int} -promote_array_type{S<:Union{Complex, Real}, T<:AbstractFloat}(F, ::Type{S}, ::Type{Complex{T}}, ::Type) = Complex{T} function complex{S<:Real,T<:Real}(A::AbstractArray{S}, B::AbstractArray{T}) if size(A) != size(B); throw(DimensionMismatch()); end diff --git a/base/deprecated.jl b/base/deprecated.jl index 899daca0da638..c60de606849ba 100644 --- a/base/deprecated.jl +++ b/base/deprecated.jl @@ -1353,6 +1353,23 @@ export quadgk @deprecate map!{F}(f::F, A::AbstractArray) map!(f, A, A) @deprecate asyncmap!(f, c; ntasks=0, batch_size=nothing) asyncmap!(f, c, c; ntasks=ntasks, batch_size=batch_size) +# Not exported, but used outside Base +_promote_array_type(F, ::Type, ::Type, T::Type) = T +_promote_array_type{S<:Real, A<:AbstractFloat}(F, ::Type{S}, ::Type{A}, ::Type) = A +_promote_array_type{S<:Integer, A<:Integer}(F, ::Type{S}, ::Type{A}, ::Type) = A +_promote_array_type{S<:Integer, A<:Integer}(::typeof(/), ::Type{S}, ::Type{A}, T::Type) = T +_promote_array_type{S<:Integer, A<:Integer}(::typeof(\), ::Type{S}, ::Type{A}, T::Type) = T +_promote_array_type{S<:Integer}(::typeof(/), ::Type{S}, ::Type{Bool}, T::Type) = T +_promote_array_type{S<:Integer}(::typeof(\), ::Type{S}, ::Type{Bool}, T::Type) = T +_promote_array_type{S<:Integer}(F, ::Type{S}, ::Type{Bool}, T::Type) = T +_promote_array_type{S<:Union{Complex, Real}, T<:AbstractFloat}(F, ::Type{S}, ::Type{Complex{T}}, ::Type) = Complex{T} +function promote_array_type(F, R, S, T) + Base.depwarn("`promote_array_type` is deprecated as it is no longer needed " * + "in Base. See https://github.com/JuliaLang/julia/issues/19669 " * + "for more information.", :promote_array_type) + _promote_array_type(F, R, S, T) +end + # Deprecate manually vectorized abs2 methods in favor of compact broadcast syntax @deprecate abs2(x::AbstractSparseVector) abs2.(x)