diff --git a/base/channels.jl b/base/channels.jl index f4fe1c7916883..929f61c7c1de6 100644 --- a/base/channels.jl +++ b/base/channels.jl @@ -49,14 +49,6 @@ mutable struct Channel{T} <: AbstractChannel end return ch end - - # deprecated empty constructor - function Channel{T}() where T - depwarn(string("The empty constructor Channel() is deprecated. ", - "The channel size needs to be specified explictly. ", - "Defaulting to Channel{$T}(32)."), :Channel) - Channel(32) - end end Channel(sz) = Channel{Any}(sz) @@ -119,10 +111,6 @@ function Channel(func::Function; ctype=Any, csize=0, taskref=nothing) end - -# deprecated empty constructor -Channel() = Channel{Any}() - closed_exception() = InvalidStateException("Channel is closed.", :closed) isbuffered(c::Channel) = c.sz_max==0 ? false : true diff --git a/base/deprecated.jl b/base/deprecated.jl index 9e10f28c8e4ab..6a5bc7231a811 100644 --- a/base/deprecated.jl +++ b/base/deprecated.jl @@ -147,187 +147,16 @@ macro deprecate_moved(old, new, export_old=true, default_package=false) Expr(:call, :deprecate, __module__, Expr(:quote, old), 2)) end -# BEGIN 0.6-alpha deprecations (delete when 0.6 is released) - -@deprecate isambiguous(m1::Method, m2::Method, b::Bool) isambiguous(m1, m2, ambiguous_bottom=b) false -# TODO: delete allow_bottom keyword code in Test.detect_ambiguities - -# END 0.6-alpha deprecations - # BEGIN 0.6 deprecations -const _oldstyle_array_vcat_ = false - -@deprecate write(x) write(STDOUT::IO, x) - -function delete!(::EnvDict, k::AbstractString, def) - depwarn("`delete!(ENV, k, def)` should be replaced with `pop!(ENV, k, def)`. Be aware that `pop!` returns `k` or `def`, while `delete!` returns `ENV` or `def`.", :delete!) - haskey(ENV,k) ? delete!(ENV,k) : def -end - -# Deprecate methods that convert Diagonal and Bidiagonal to <:AbstractTriangular. -function convert(::Type{UpperTriangular}, A::Diagonal) - depwarn(string("`convert(::Type{UpperTriangular}, A::Diagonal)` and other methods ", - "that convert `Diagonal`/`Bidiagonal` to `<:AbstractTriangular` are deprecated. ", - "Consider calling the `UpperTriangular` constructor directly ", - "(`UpperTriangular(A)`) instead."), :convert) - UpperTriangular(A) -end -function convert(::Type{LowerTriangular}, A::Diagonal) - depwarn(string("`convert(::Type{LowerTriangular}, A::Diagonal)` and other methods ", - "that convert `Diagonal`/`Bidiagonal` to `<:AbstractTriangular` are deprecated. ", - "Consider calling the `LowerTriangular` constructor directly ", - "(`LowerTriangular(A)`) instead."), :convert) - LowerTriangular(A) -end -function convert(::Type{Base.LinAlg.UnitUpperTriangular}, A::Diagonal) - depwarn(string("`convert(::Type{UnitUpperTriangular}, A::Diagonal)` and other methods ", - "that convert `Diagonal`/`Bidiagonal` to `<:AbstractTriangular` are deprecated. ", - "Consider calling the `UnitUpperTriangular` constructor directly ", - "(`Base.LinAlg.UnitUpperTriangular(A)`) instead."), :convert) - if !all(x -> x == oneunit(x), A.diag) - throw(ArgumentError("matrix cannot be represented as UnitUpperTriangular")) - end - Base.LinAlg.UnitUpperTriangular(Array(A)) -end -function convert(::Type{Base.LinAlg.UnitLowerTriangular}, A::Diagonal) - depwarn(string("`convert(::Type{UnitLowerTriangular}, A::Diagonal)` and other methods ", - "that convert `Diagonal`/`Bidiagonal` to `<:AbstractTriangular` are deprecated. ", - "Consider calling the `UnitLowerTriangular` constructor directly ", - "(`Base.LinAlg.UnitLowerTriangular(A)`) instead."), :convert) - if !all(x -> x == oneunit(x), A.diag) - throw(ArgumentError("matrix cannot be represented as UnitLowerTriangular")) - end - Base.LinAlg.UnitLowerTriangular(Array(A)) -end -function convert(::Type{LowerTriangular}, A::Bidiagonal) - depwarn(string("`convert(::Type{LowerTriangular}, A::Bidiagonal)` and other methods ", - "that convert `Diagonal`/`Bidiagonal` to `<:AbstractTriangular` are deprecated. ", - "Consider calling the `LowerTriangular` constructor directly (`LowerTriangular(A)`) ", - "instead."), :convert) - if !A.isupper - LowerTriangular(Array(A)) - else - throw(ArgumentError("Bidiagonal matrix must have lower off diagonal to be converted to LowerTriangular")) - end -end -function convert(::Type{UpperTriangular}, A::Bidiagonal) - depwarn(string("`convert(::Type{UpperTriangular}, A::Bidiagonal)` and other methods ", - "that convert `Diagoinal`/`Bidiagonal` to `<:AbstractTriangular` are deprecated. ", - "Consider calling the `UpperTriangular` constructor directly (`UpperTriangular(A)`) ", - "instead."), :convert) - if A.isupper - UpperTriangular(Array(A)) - else - throw(ArgumentError("Bidiagonal matrix must have upper off diagonal to be converted to UpperTriangular")) - end -end - -# Deprecate three-arg SubArray since the constructor doesn't need the dims tuple -@deprecate SubArray(parent::AbstractArray, indices::Tuple, dims::Tuple) SubArray(parent, indices) - -# Deprecate vectorized unary functions over sparse matrices in favor of compact broadcast syntax (#17265). -for f in (:sind, :asind, :tand, :atand, :sinpi, :cosc, :ceil, :floor, :trunc, - :round, :log1p, :expm1, :abs, :abs2, :log2, :log10, :exp2, :exp10, - :sinc, :cospi, :cosd, :acosd, :cotd, :acotd, :secd, :cscd) - @eval import .Math: $f - @eval @deprecate $f(A::SparseMatrixCSC) $f.(A) -end - -# For deprecating vectorized functions in favor of compact broadcast syntax -macro dep_vectorize_1arg(S, f) - AbstractArray = GlobalRef(Base, :AbstractArray) - return esc(:( @deprecate $f(x::$AbstractArray{T}) where {T<:$S} $f.(x) )) -end -macro dep_vectorize_2arg(S, f) - AbstractArray = GlobalRef(Base, :AbstractArray) - return esc(quote - @deprecate $f(x::$S, y::$AbstractArray{T1}) where {T1<:$S} $f.(x, y) - @deprecate $f(x::$AbstractArray{T1}, y::$S) where {T1<:$S} $f.(x, y) - @deprecate $f(x::$AbstractArray{T1}, y::$AbstractArray{T2}) where {T1<:$S, T2<:$S} $f.(x, y) - end) -end - -# Deprecate @vectorize_1arg-vectorized functions from... -for f in ( - # base/special/trig.jl - :sinpi, :cospi, :sinc, :cosc, - # base/special/log.jl - :log1p, - # base/special/gamma.jl - :gamma, :lfact, - # base/math.jl - :cbrt, :exp2, :expm1, :exp10, :log2, :log10, :lgamma, #=:log1p,=# - # base/floatfuncs.jl - :abs, :abs2, :angle, :isnan, :isinf, :isfinite, - # base/complex.jl - :cis, - ) - @eval import .Math: $f - @eval @dep_vectorize_1arg Number $f -end -# base/fastmath.jl -for f in ( :acos_fast, :acosh_fast, :angle_fast, :asin_fast, :asinh_fast, - :atan_fast, :atanh_fast, :cbrt_fast, :cis_fast, :cos_fast, - :cosh_fast, :exp10_fast, :exp2_fast, :exp_fast, :expm1_fast, - :lgamma_fast, :log10_fast, :log1p_fast, :log2_fast, :log_fast, - :sin_fast, :sinh_fast, :sqrt_fast, :tan_fast, :tanh_fast ) - @eval import .FastMath: $f - @eval @dep_vectorize_1arg Number $f -end -for f in ( - :trunc, :floor, :ceil, :round, # base/floatfuncs.jl - :rad2deg, :deg2rad, :exponent, :significand, # base/math.jl - :sind, :cosd, :tand, :asind, :acosd, :atand, :asecd, :acscd, :acotd, # base/special/trig.jl - ) - @eval import .Math: $f - @eval @dep_vectorize_1arg Real $f -end -# base/complex.jl -@dep_vectorize_1arg Complex round -@dep_vectorize_1arg Complex float - -# Deprecate @vectorize_2arg-vectorized functions from... -for f in ( - # base/special/gamma.jl - :beta, :lbeta, - # base/math.jl - :log, :hypot, :atan2, - ) - @eval import .Math: $f - @eval @dep_vectorize_2arg Number $f -end -# base/fastmath.jl -for f in (:pow_fast, :atan2_fast, :hypot_fast, :max_fast, :min_fast, :minmax_fast) - @eval import .FastMath: $f - @eval @dep_vectorize_2arg Number $f -end -for f in ( - :max, :min, # base/math.jl - :copysign, :flipsign, # base/floatfuncs.jl - ) - @eval @dep_vectorize_2arg Real $f -end +## produce, consume, and task iteration +# NOTE: When removing produce/consume, also remove field Task.consumers and related code in +# task.jl and event.jl -# Deprecate @vectorize_1arg and @vectorize_2arg themselves -macro vectorize_1arg(S, f) - depwarn(string("`@vectorize_1arg` is deprecated in favor of compact broadcast syntax. ", - "Instead of `@vectorize_1arg`'ing function `f` and calling `f(arg)`, call `f.(arg)`."), - :vectorize_1arg) - quote - @dep_vectorize_1arg($S, $f) - end -end -macro vectorize_2arg(S, f) - depwarn(string("`@vectorize_2arg` is deprecated in favor of compact broadcast syntax. ", - "Instead of `@vectorize_2arg`'ing function `f` and calling `f(arg1, arg2)`, call ", - "`f.(arg1, arg2)`. "), :vectorize_2arg) - quote - @dep_vectorize_2arg($S, $f) - end -end -export @vectorize_1arg, @vectorize_2arg +# TODO: remove `:typealias` from BINDING_HEADS in base/docs/Docs.jl +# TODO: remove `'typealias` case in expand-table in julia-syntax.scm +# removing the .op deprecations breaks a few things. TODO: fix # deprecations for uses of old dot operators (.* etc) as objects, rather than # just calling them infix. for op in (:(!=), :≠, :+, :-, :*, :/, :÷, :%, :<, :(<=), :≤, :(==), :>, :>=, :≥, :\, :^, ://, :>>, :<<) @@ -342,478 +171,6 @@ for op in (:(!=), :≠, :+, :-, :*, :/, :÷, :%, :<, :(<=), :≤, :(==), :>, :>= @eval export $dotop end -# Devectorize manually vectorized abs methods in favor of compact broadcast syntax -@deprecate abs(f::Base.Pkg.Resolve.MaxSum.Field) abs.(f) -@deprecate abs(B::BitArray) abs.(B) -@deprecate abs(M::Bidiagonal) abs.(M) -@deprecate abs(D::Diagonal) abs.(D) -@deprecate abs(M::Tridiagonal) abs.(M) -@deprecate abs(M::SymTridiagonal) abs.(M) -@deprecate abs(x::AbstractSparseVector) abs.(x) - -# Deprecate @textmime into the Multimedia module, #18441 -@eval Multimedia macro textmime(mime) - Base.depwarn(string("`@textmime \"mime\"` is deprecated, use ", - "`Base.Multimedia.istextmime(::MIME\"mime\") = true` instead." - ), :textmime) - quote - Base.Multimedia.istextmime(::MIME{$(Meta.quot(Symbol(mime)))}) = true - end -end - -@deprecate ipermutedims(A::AbstractArray,p) permutedims(A, invperm(p)) - -# PR #25168 -@deprecate ipermute!(a, p::AbstractVector) invpermute!(a, p) - -# 18696 -function ($)(x, y) - depwarn("`x \$ y` is deprecated. use `xor(x, y)` or `x ⊻ y` instead.", :$) - xor(x, y) -end -export $ - -@deprecate is (===) - -# midpoints of intervals -@deprecate midpoints(r::AbstractRange) r[1:length(r)-1] + 0.5*step(r) -@deprecate midpoints(v::AbstractVector) [0.5*(v[i] + v[i+1]) for i in 1:length(v)-1] - -@deprecate_binding Filter Iterators.Filter -@deprecate_binding Zip Iterators.Zip -@deprecate filter(flt, itr) Iterators.filter(flt, itr) -@deprecate_binding rest Iterators.rest -@deprecate_binding countfrom Iterators.countfrom -@deprecate_binding take Iterators.take -@deprecate_binding drop Iterators.drop -@deprecate_binding cycle Iterators.cycle -@deprecate_binding repeated Iterators.repeated - -# promote_op method where the operator is also a type -function promote_op(op::Type, Ts::Type...) - depwarn("`promote_op(op::Type, ::Type...)` is deprecated as it is no " * - "longer needed in Base. If you need its functionality, consider " * - "defining it locally.", :promote_op) - if isdefined(Core, :Inference) - return Core.Inference.return_type(op, Tuple{Ts...}) - end - return op -end - -# NOTE: Deprecation of `isdefined(a::Array, i::Int)` is implemented in src/array.c -# and deprecation of `invoke(f, (types...), ...)` is implemented in src/builtins.c -# To be removed when 0.6 deprecations are removed - -# NOTE: Deprecation of Channel{T}() is implemented in channels.jl. -# To be removed from there when 0.6 deprecations are removed. - -# Not exported, but probably better to have deprecations anyway -function reduced_dims(::Tuple{}, d::Int) - d < 1 && throw(ArgumentError("dimension must be ≥ 1, got $d")) - () -end -reduced_dims(::Tuple{}, region) = () -function reduced_dims(dims::Dims, region) - Base.depwarn("`reduced_dims` is deprecated for Dims-tuples; pass `indices` to `reduced_indices` instead", :reduced_dims) - map(last, reduced_indices(map(OneTo, dims), region)) -end - -function reduced_dims0(::Tuple{}, d::Int) - d < 1 && throw(ArgumentError("dimension must be ≥ 1, got $d")) - () -end -reduced_dims0(::Tuple{}, region) = () -function reduced_dims0(dims::Dims, region) - Base.depwarn("`reduced_dims0` is deprecated for Dims-tuples; pass `indices` to `reduced_indices0` instead", :reduced_dims0) - map(last, reduced_indices0(map(OneTo, dims), region)) -end - -function reduced_dims(a::AbstractArray, region) - Base.depwarn("`reduced_dims` is deprecated in favor of `reduced_indices`", :reduced_dims) - to_shape(reduced_indices(a, region)) # to_shape keeps the return-type consistent, when it's possible to do so -end - -function reduced_dims0(a::AbstractArray, region) - Base.depwarn("`reduced_dims0` is deprecated in favor of `reduced_indices0`", :reduced_dims) - to_shape(reduced_indices0(a, region)) -end - -# #18218 -@eval Base.LinAlg begin - function arithtype(T) - Base.depwarn(string("`arithtype` is deprecated. If you were using it inside a ", - "promote_op call, use `promote_op(LinAlg.matprod, Ts...)` instead. Otherwise, ", - "if you need its functionality, consider defining it locally."), - :arithtype) - T - end - function arithtype(::Type{Bool}) - Base.depwarn(string("`arithtype` is deprecated. If you were using it inside a ", - "promote_op call, use `promote_op(LinAlg.matprod, Ts...)` instead. Otherwise, ", - "if you need its functionality, consider defining it locally."), - :arithtype) - Int - end -end - -# #19246 -@deprecate den denominator -@deprecate num numerator - -# #19088 -@deprecate takebuf_array take! -@deprecate takebuf_string(b) String(take!(b)) - -# Index conversions revamp; #19730 -function getindex(A::LogicalIndex, i::Int) - depwarn("`getindex(A::LogicalIndex, i)` is deprecated, use iteration or index into the result of `collect(A)` instead.", :getindex) - checkbounds(A, i) - first(Iterators.drop(A, i-1)) -end -function to_indexes(I...) - Istr = join(I, ", ") - depwarn("`to_indexes` is deprecated, pass both the source array `A` and indices as `to_indices(A, $Istr)` instead.", :to_indexes) - map(_to_index, I) -end -_to_index(i) = to_index(I) -_to_index(c::Colon) = c -const _colon_usage_msg = "convert Colons to a set of indices for indexing into array `A` by passing them in a complete tuple of indices `I` to `to_indices(A, I)`." -function getindex(::Colon, i) - depwarn("`getindex(::Colon, i)` is deprecated, $_colon_usage_msg", :getindex) - to_index(i) -end -function unsafe_getindex(::Colon, i::Integer) - depwarn("`getindex(::Colon, i)` is deprecated, $_colon_usage_msg", :unsafe_getindex) - to_index(i) -end -function step(::Colon) - depwarn("`step(::Colon)` is deprecated, $_colon_usage_msg", :step) - 1 -end -function isempty(::Colon) - depwarn("`isempty(::Colon)` is deprecated, $_colon_usage_msg", :isempty) - false -end -function in(::Integer, ::Colon) - depwarn("`in(::Integer, ::Colon)` is deprecated, $_colon_usage_msg", :in) - true -end - -# #18931 -@deprecate cummin(A, dim=1) accumulate(min, A, dim) -@deprecate cummax(A, dim=1) accumulate(max, A, dim) - -# #19598 -@deprecate sumabs(x) sum(abs, x) -@deprecate sumabs(A, region) sum(abs, A, region) -@deprecate sumabs2(x) sum(abs2, x) -@deprecate sumabs2(A, region) sum(abs2, A, region) -@deprecate minabs(x) minimum(abs, x) -@deprecate minabs(A, region) minimum(abs, A, region) -@deprecate maxabs(x) maximum(abs, x) -@deprecate maxabs(A, region) maximum(abs, A, region) - -for (dep, f, op) in [(:sumabs!, :sum!, :abs), - (:sumabs2!, :sum!, :abs2), - (:minabs!, :minimum!, :abs), - (:maxabs!, :maximum!, :abs)] - @eval function ($dep)(r, A; init=true) - Base.depwarn("`$dep(r, A; init=$init)` is deprecated, use `$f($op, r, A; init=$init)` instead.", Symbol($dep)) - ($f)($op, r, A; init=init) - end -end - -## Deprecate broadcast_zpreserving[!] (wasn't exported, but might as well be friendly) -function gen_broadcast_function_sparse(genbody::Function, f::Function, is_first_sparse::Bool) - body = genbody(f, is_first_sparse) - @eval let - local _F_ - function _F_(B::SparseMatrixCSC{Tv,Ti}, A_1, A_2) where {Tv,Ti} - $body - end - _F_ - end -end -function gen_broadcast_body_zpreserving(f::Function, is_first_sparse::Bool) - F = Expr(:quote, f) - if is_first_sparse - A1 = :(A_1) - A2 = :(A_2) - op1 = :(val1) - op2 = :(val2) - else - A1 = :(A_2) - A2 = :(A_1) - op1 = :(val2) - op2 = :(val1) - end - quote - Base.Broadcast.check_broadcast_indices(axes(B), $A1) - Base.Broadcast.check_broadcast_indices(axes(B), $A2) - - nnzB = isempty(B) ? 0 : - nnz($A1) * div(B.n, ($A1).n) * div(B.m, ($A1).m) - if length(B.rowval) < nnzB - resize!(B.rowval, nnzB) - end - if length(B.nzval) < nnzB - resize!(B.nzval, nnzB) - end - z = zero(Tv) - - ptrB = 1 - B.colptr[1] = 1 - - @inbounds for col = 1:B.n - ptr1::Int = ($A1).n == 1 ? ($A1).colptr[1] : ($A1).colptr[col] - stop1::Int = ($A1).n == 1 ? ($A1).colptr[2] : ($A1).colptr[col+1] - col2 = size($A2, 2) == 1 ? 1 : col - row = 1 - while ptr1 < stop1 && row <= B.m - if ($A1).m != 1 - row = ($A1).rowval[ptr1] - end - row2 = size($A2, 1) == 1 ? 1 : row - val1 = ($A1).nzval[ptr1] - val2 = ($A2)[row2,col2] - res = ($F)($op1, $op2) - if res != z - B.rowval[ptrB] = row - B.nzval[ptrB] = res - ptrB += 1 - end - if ($A1).m != 1 - ptr1 += 1 - else - row += 1 - end - end - B.colptr[col+1] = ptrB - end - deleteat!(B.rowval, B.colptr[end]:length(B.rowval)) - deleteat!(B.nzval, B.colptr[end]:length(B.nzval)) - nothing - end -end -for (Bsig, A1sig, A2sig, gbb, funcname) in - ( - (SparseMatrixCSC , SparseMatrixCSC , Array, :gen_broadcast_body_zpreserving, :_broadcast_zpreserving!), - (SparseMatrixCSC , Array , SparseMatrixCSC, :gen_broadcast_body_zpreserving, :_broadcast_zpreserving!), - (SparseMatrixCSC , Number , SparseMatrixCSC, :gen_broadcast_body_zpreserving, :_broadcast_zpreserving!), - (SparseMatrixCSC , SparseMatrixCSC , Number, :gen_broadcast_body_zpreserving, :_broadcast_zpreserving!), - (SparseMatrixCSC , BitArray , SparseMatrixCSC, :gen_broadcast_body_zpreserving, :_broadcast_zpreserving!), - (SparseMatrixCSC , SparseMatrixCSC , BitArray, :gen_broadcast_body_zpreserving, :_broadcast_zpreserving!), - ) - @eval let cache = Dict{Function,Function}() - global $funcname - function $funcname(f::Function, B::$Bsig, A1::$A1sig, A2::$A2sig) - func = @get! cache f gen_broadcast_function_sparse($gbb, f, ($A1sig) <: SparseMatrixCSC) - # need eval because func was just created by gen_broadcast_function_sparse - # TODO: convert this to a generated function - eval(_current_module(), Expr(:body, Expr(:return, Expr(:call, QuoteNode(func), QuoteNode(B), QuoteNode(A1), QuoteNode(A2))))) - return B - end - end # let broadcast_cache -end -_broadcast_zpreserving!(args...) = broadcast!(args...) -# note: promote_eltype_op also deprecated, defined later in this file -_broadcast_zpreserving(f, As...) = - broadcast!(f, similar(Array{_promote_eltype_op(f, As...)}, Base.Broadcast.broadcast_indices(As...)), As...) -_broadcast_zpreserving(f::Function, A_1::SparseMatrixCSC{Tv1,Ti1}, A_2::SparseMatrixCSC{Tv2,Ti2}) where {Tv1,Ti1,Tv2,Ti2} = - _broadcast_zpreserving!(f, spzeros(promote_type(Tv1, Tv2), promote_type(Ti1, Ti2), Base.to_shape(Base.Broadcast.broadcast_indices(A_1, A_2))), A_1, A_2) -_broadcast_zpreserving(f::Function, A_1::SparseMatrixCSC{<:Any,Ti}, A_2::Union{Array,BitArray,Number}) where {Ti} = - _broadcast_zpreserving!(f, spzeros(promote_eltype(A_1, A_2), Ti, Base.to_shape(Base.Broadcast.broadcast_indices(A_1, A_2))), A_1, A_2) -_broadcast_zpreserving(f::Function, A_1::Union{Array,BitArray,Number}, A_2::SparseMatrixCSC{<:Any,Ti}) where {Ti} = - _broadcast_zpreserving!(f, spzeros(promote_eltype(A_1, A_2), Ti, Base.to_shape(Base.Broadcast.broadcast_indices(A_1, A_2))), A_1, A_2) - -function _depstring_bczpres() - return string("broadcast_zpreserving[!] is deprecated. Generic sparse broadcast[!] ", - "provides most of broadcast_zpreserving[!]'s functionality. If you have a use case ", - "that generic sparse broadcast[!] does not cover, please describe your use case in ", - " issue #19533 (https://github.com/JuliaLang/julia/issues/19533).") -end -function _depwarn_bczpres(f, args...) - depwarn(_depstring_bczpres(), :broadcast_zpreserving) - return _broadcast_zpreserving(f, args...) -end -function _depwarn_bczpres!(f, args...) - depwarn(_depstring_bczpres(), :broadcast_zpreserving!) - return _broadcast_zpreserving!(f, args...) -end -@eval SparseArrays begin - broadcast_zpreserving(f, args...) = Base._depwarn_bczpres(f, args...) - broadcast_zpreserving(f, A::SparseMatrixCSC, B::SparseMatrixCSC) = Base._depwarn_bczpres(f, A, B) - broadcast_zpreserving(f, A::SparseMatrixCSC, B::Union{Array,BitArray,Number}) = Base._depwarn_bczpres(f, A, B) - broadcast_zpreserving(f, A::Union{Array,BitArray,Number}, B::SparseMatrixCSC) = Base._depwarn_bczpres(f, A, B) - broadcast_zpreserving!(f, args...) = Base._depwarn_bczpres!(f, args...) - broadcast_zpreserving!(f, C::SparseMatrixCSC, A::SparseMatrixCSC, B::Union{Array,BitArray,Number}) = Base._depwarn_bczpres!(f, C, A, B) - broadcast_zpreserving!(f, C::SparseMatrixCSC, A::Union{Array,BitArray,Number}, B::SparseMatrixCSC) = Base._depwarn_bczpres!(f, C, A, B) -end - -# #19719 -@deprecate getindex(t::Tuple, r::AbstractArray) getindex(t, vec(r)) -@deprecate getindex(t::Tuple, b::AbstractArray{Bool}) getindex(t, vec(b)) - -# Deprecate isimag (#19947). -@deprecate isimag(z::Number) iszero(real(z)) - -# Deprecate vectorized xor in favor of compact broadcast syntax -@deprecate xor(a::Bool, B::BitArray) xor.(a, B) -@deprecate xor(A::BitArray, b::Bool) xor.(A, b) -@deprecate xor(a::Number, B::AbstractArray) xor.(a, B) -@deprecate xor(A::AbstractArray, b::Number) xor.(A, b) -@deprecate xor(A::AbstractArray, B::AbstractArray) xor.(A, B) - -# Broadcast now returns a BitArray when the resulting eltype is Bool (#17623) -@deprecate bitbroadcast broadcast - -# Deprecate two-argument map! (map!(f, A)) for a cycle in anticipation of semantic change -@deprecate map!(f::F, A::AbstractArray) where {F} 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(F, ::Type{<:Real}, ::Type{A}, ::Type) where {A<:AbstractFloat} = A -_promote_array_type(F, ::Type{<:Integer}, ::Type{A}, ::Type) where {A<:Integer} = A -_promote_array_type(::typeof(/), ::Type{<:Integer}, ::Type{<:Integer}, T::Type) = T -_promote_array_type(::typeof(\), ::Type{<:Integer}, ::Type{<:Integer}, T::Type) = T -_promote_array_type(::typeof(/), ::Type{<:Integer}, ::Type{Bool}, T::Type) = T -_promote_array_type(::typeof(\), ::Type{<:Integer}, ::Type{Bool}, T::Type) = T -_promote_array_type(F, ::Type{<:Integer}, ::Type{Bool}, T::Type) = T -_promote_array_type(F, ::Type{<:Union{Complex, Real}}, ::Type{Complex{T}}, ::Type) where {T<:AbstractFloat} = 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) - -# Deprecate manually vectorized sign methods in favor of compact broadcast syntax -@deprecate sign(A::AbstractArray) sign.(A) - -# Deprecate manually vectorized trigonometric and hyperbolic functions in favor of compact broadcast syntax -for f in (:secd, :cscd, :cotd) - @eval import .Math: $f - @eval @deprecate $f(A::AbstractArray{<:Number}) $f.(A) -end - -# Deprecate vectorized two-argument complex in favor of compact broadcast syntax -@deprecate complex(A::AbstractArray, b::Real) complex.(A, b) -@deprecate complex(a::Real, B::AbstractArray) complex.(a, B) -@deprecate complex(A::AbstractArray, B::AbstractArray) complex.(A, B) - -# Deprecate manually vectorized clamp methods in favor of compact broadcast syntax -import .Math: clamp -@deprecate clamp(A::AbstractArray, lo, hi) clamp.(A, lo, hi) - -# Deprecate manually vectorized round methods in favor of compact broadcast syntax -@deprecate round(M::Bidiagonal) round.(M) -@deprecate round(M::Tridiagonal) round.(M) -@deprecate round(M::SymTridiagonal) round.(M) -@deprecate round(::Type{T}, x::AbstractArray) where {T} round.(T, x) -@deprecate round(::Type{T}, x::AbstractArray, r::RoundingMode) where {T} round.(T, x, r) -@deprecate round(x::AbstractArray, r::RoundingMode) round.(x, r) -@deprecate round(x::AbstractArray, digits::Integer, base::Integer = 10) round.(x, digits, base) - -# Deprecate manually vectorized trunc methods in favor of compact broadcast syntax -@deprecate trunc(M::Bidiagonal) trunc.(M) -@deprecate trunc(M::Tridiagonal) trunc.(M) -@deprecate trunc(M::SymTridiagonal) trunc.(M) -@deprecate trunc(::Type{T}, x::AbstractArray) where {T} trunc.(T, x) -@deprecate trunc(x::AbstractArray, digits::Integer, base::Integer = 10) trunc.(x, digits, base) - -# Deprecate manually vectorized floor methods in favor of compact broadcast syntax -@deprecate floor(M::Bidiagonal) floor.(M) -@deprecate floor(M::Tridiagonal) floor.(M) -@deprecate floor(M::SymTridiagonal) floor.(M) -@deprecate floor(::Type{T}, A::AbstractArray) where {T} floor.(T, A) -@deprecate floor(A::AbstractArray, digits::Integer, base::Integer = 10) floor.(A, digits, base) - -# Deprecate manually vectorized ceil methods in favor of compact broadcast syntax -@deprecate ceil(M::Bidiagonal) ceil.(M) -@deprecate ceil(M::Tridiagonal) ceil.(M) -@deprecate ceil(M::SymTridiagonal) ceil.(M) -@deprecate ceil(::Type{T}, x::AbstractArray) where {T} ceil.(T, x) -@deprecate ceil(x::AbstractArray, digits::Integer, base::Integer = 10) ceil.(x, digits, base) - -# Deprecate manually vectorized `big` methods in favor of compact broadcast syntax -@deprecate big(r::UnitRange) big.(r) -@deprecate big(r::StepRange) big.(r) -@deprecate big(r::StepRangeLen) big.(r) -@deprecate big(r::LinSpace) big.(r) -@deprecate big(x::AbstractArray{<:Integer}) big.(x) -@deprecate big(x::AbstractArray{<:AbstractFloat}) big.(x) -@deprecate big(A::LowerTriangular) big.(A) -@deprecate big(A::UpperTriangular) big.(A) -@deprecate big(A::Base.LinAlg.UnitLowerTriangular) big.(A) -@deprecate big(A::Base.LinAlg.UnitUpperTriangular) big.(A) -@deprecate big(B::Bidiagonal) big.(B) -@deprecate big(A::AbstractArray{<:Complex{<:Integer}}) big.(A) -@deprecate big(A::AbstractArray{<:Complex{<:AbstractFloat}}) big.(A) -@deprecate big(x::AbstractArray{<:Complex{<:Rational{<:Integer}}}) big.(A) - -# Deprecate manually vectorized div methods in favor of compact broadcast syntax -@deprecate div(A::Number, B::AbstractArray) div.(A, B) -@deprecate div(A::AbstractArray, B::Number) div.(A, B) -@deprecate div(A::AbstractArray, B::AbstractArray) div.(A, B) - -# Deprecate manually vectorized rem methods in favor of compact broadcast syntax -@deprecate rem(A::Number, B::AbstractArray) rem.(A, B) -@deprecate rem(A::AbstractArray, B::Number) rem.(A, B) - -# Deprecate manually vectorized mod methods in favor of compact broadcast syntax -@deprecate mod(B::BitArray, x::Bool) mod.(B, x) -@deprecate mod(x::Bool, B::BitArray) mod.(x, B) -@deprecate mod(A::AbstractArray, B::AbstractArray) mod.(A, B) -@deprecate mod(x::Number, A::AbstractArray) mod.(x, A) -@deprecate mod(A::AbstractArray, x::Number) mod.(A, x) - -# Deprecate vectorized & in favor of dot syntax -@deprecate (&)(a::Bool, B::BitArray) a .& B -@deprecate (&)(A::BitArray, b::Bool) A .& b -@deprecate (&)(a::Number, B::AbstractArray) a .& B -@deprecate (&)(A::AbstractArray, b::Number) A .& b -@deprecate (&)(A::AbstractArray, B::AbstractArray) A .& B - -# Deprecate vectorized | in favor of compact broadcast syntax -@deprecate (|)(a::Bool, B::BitArray) a .| B -@deprecate (|)(A::BitArray, b::Bool) A .| b -@deprecate (|)(a::Number, B::AbstractArray) a .| B -@deprecate (|)(A::AbstractArray, b::Number) A .| b -@deprecate (|)(A::AbstractArray, B::AbstractArray) A .| B - -# Deprecate vectorized ifelse -@deprecate ifelse(c::AbstractArray{Bool}, x, y) ifelse.(c, x, y) -@deprecate ifelse(c::AbstractArray{Bool}, x, y::AbstractArray) ifelse.(c, x, y) -@deprecate ifelse(c::AbstractArray{Bool}, x::AbstractArray, y) ifelse.(c, x, y) -@deprecate ifelse(c::AbstractArray{Bool}, x::AbstractArray, y::AbstractArray) ifelse.(c, x, y) - -# Deprecate vectorized ! -@deprecate(!(A::AbstractArray{Bool}), .!A) # parens for #20541 -@deprecate(!(B::BitArray), .!B) # parens for #20541 - -# Deprecate vectorized ~ -@deprecate ~(A::AbstractArray) .~A -@deprecate ~(B::BitArray) .~B - -function Math.frexp(A::Array{<:AbstractFloat}) - depwarn(string("`frexp(x::Array)` is discontinued. Though not a direct replacement, ", - "consider using dot-syntax to `broadcast` scalar `frexp` over `Array`s ", - "instead, for example `frexp.(rand(4))`."), :frexp) - F = similar(A) - E = Array{Int}(uninitialized, size(A)) - for (iF, iE, iA) in zip(eachindex(F), eachindex(E), eachindex(A)) - F[iF], E[iE] = frexp(A[iA]) - end - return (F, E) -end - -# Deprecate reducing isinteger over arrays -@deprecate isinteger(A::AbstractArray) all(isinteger, A) - # Deprecate promote_eltype_op (#19814, #19937) _promote_eltype_op(::Any) = Any _promote_eltype_op(op, A) = (@_inline_meta; promote_op(op, eltype(A))) @@ -827,291 +184,6 @@ _promote_eltype_op(op, A, B, C, D...) = (@_inline_meta; _promote_eltype_op(op, e _promote_eltype_op(args...) end - -function unsafe_wrap(::Type{String}, p::Union{Ptr{UInt8},Ptr{Int8}}, len::Integer, own::Bool=false) - Base.depwarn("`unsafe_wrap(String, ...)` is deprecated, use `unsafe_string` instead.", :unsafe_wrap) - #ccall(:jl_array_to_string, Ref{String}, (Any,), - # ccall(:jl_ptr_to_array_1d, Vector{UInt8}, (Any, Ptr{UInt8}, Csize_t, Cint), - # Vector{UInt8}, p, len, own)) - unsafe_string(p, len) -end -unsafe_wrap(::Type{String}, p::Union{Ptr{UInt8},Ptr{Int8}}, own::Bool=false) = - unsafe_wrap(String, p, ccall(:strlen, Csize_t, (Ptr{UInt8},), p), own) -unsafe_wrap(::Type{String}, p::Cstring, own::Bool=false) = unsafe_wrap(String, convert(Ptr{UInt8}, p), own) -unsafe_wrap(::Type{String}, p::Cstring, len::Integer, own::Bool=false) = - unsafe_wrap(String, convert(Ptr{UInt8}, p), len, own) - -# #19660 -@deprecate finalize(sa::LibGit2.StrArrayStruct) LibGit2.free(sa) -@deprecate finalize(sa::LibGit2.Buffer) LibGit2.free(sa) - -## produce, consume, and task iteration -# NOTE: When removing produce/consume, also remove field Task.consumers and related code in -# task.jl and event.jl - -function produce(v) - depwarn("`produce` is deprecated, use Channels for inter-task communication.", :produce) - - ct = current_task() - local empty, t, q - while true - q = ct.consumers - if isa(q,Task) - t = q - ct.consumers = nothing - empty = true - break - elseif isa(q,Condition) && !isempty(q.waitq) - t = popfirst!(q.waitq) - empty = isempty(q.waitq) - break - end - wait() - end - - t.state == :runnable || throw(AssertionError("producer.consumer.state == :runnable")) - if empty - schedule_and_wait(t, v) - while true - # wait until there are more consumers - q = ct.consumers - if isa(q,Task) - return q.result - elseif isa(q,Condition) && !isempty(q.waitq) - return q.waitq[1].result - end - wait() - end - else - schedule(t, v) - # make sure `t` runs before us. otherwise, the producer might - # finish before `t` runs again, causing it to see the producer - # as done, causing done(::Task, _) to miss the value `v`. - # see issue #7727 - yield() - return q.waitq[1].result - end -end -produce(v...) = produce(v) -export produce - -function consume(P::Task, values...) - depwarn("`consume` is deprecated, use Channels for inter-task communication.", :consume) - - if istaskdone(P) - return wait(P) - end - - ct = current_task() - ct.result = length(values)==1 ? values[1] : values - - #### un-optimized version - #if P.consumers === nothing - # P.consumers = Condition() - #end - #push!(P.consumers.waitq, ct) - # optimized version that avoids the queue for 1 consumer - if P.consumers === nothing || (isa(P.consumers,Condition)&&isempty(P.consumers.waitq)) - P.consumers = ct - else - if isa(P.consumers, Task) - t = P.consumers - P.consumers = Condition() - push!(P.consumers.waitq, t) - end - push!(P.consumers.waitq, ct) - end - - P.state == :runnable ? schedule_and_wait(P) : wait() # don't attempt to queue it twice -end -export consume - -function start(t::Task) - depwarn(string("Task iteration is deprecated,", - " use Channels for inter-task communication. ", - " A for-loop on a Channel object is terminated by calling `close` on the object."), :taskfor) - nothing -end -function done(t::Task, val) - t.result = consume(t) - istaskdone(t) -end -next(t::Task, val) = (t.result, nothing) -IteratorSize(::Type{Task}) = SizeUnknown() -IteratorEltype(::Type{Task}) = EltypeUnknown() - -isempty(::Task) = error("isempty not defined for Tasks") - -# Deprecate Array(T, dims...) in favor of proper type constructors -@deprecate Array(::Type{T}, d::NTuple{N,Int}) where {T,N} Array{T}(uninitialized, d) -@deprecate Array(::Type{T}, d::Int...) where {T} Array{T}(uninitialized, d...) -@deprecate Array(::Type{T}, m::Int) where {T} Array{T}(uninitialized, m) -@deprecate Array(::Type{T}, m::Int,n::Int) where {T} Array{T}(uninitialized, m,n) -@deprecate Array(::Type{T}, m::Int,n::Int,o::Int) where {T} Array{T}(uninitialized, m,n,o) -@deprecate Array(::Type{T}, d::Integer...) where {T} Array{T}(uninitialized, convert(Tuple{Vararg{Int}}, d)) -@deprecate Array(::Type{T}, m::Integer) where {T} Array{T}(uninitialized, Int(m)) -@deprecate Array(::Type{T}, m::Integer,n::Integer) where {T} Array{T}(uninitialized, Int(m),Int(n)) -@deprecate Array(::Type{T}, m::Integer,n::Integer,o::Integer) where {T} Array{T}(uninitialized, Int(m),Int(n),Int(o)) - -@noinline function is_intrinsic_expr(@nospecialize(x)) - Base.depwarn("`is_intrinsic_expr` is deprecated. There are no intrinsic functions anymore.", :is_intrinsic_expr) - return false -end - -@deprecate EachLine(stream, ondone) EachLine(stream, ondone=ondone) - -# LibGit2 refactor (#19839) -@eval Base.LibGit2 begin - Base.@deprecate_binding Oid GitHash - Base.@deprecate_binding GitAnyObject GitUnknownObject - - @deprecate owner(x) repository(x) false - @deprecate get(::Type{T}, repo::GitRepo, x) where {T<:GitObject} T(repo, x) false - @deprecate get(::Type{T}, repo::GitRepo, oid::GitHash, oid_size::Int) where {T<:GitObject} T(repo, GitShortHash(oid, oid_size)) false - @deprecate revparse(repo::GitRepo, objname::AbstractString) GitObject(repo, objname) false - @deprecate object(repo::GitRepo, te::GitTreeEntry) GitObject(repo, te) false - @deprecate commit(ann::GitAnnotated) GitHash(ann) false - @deprecate lookup(repo::GitRepo, oid::GitHash) GitBlob(repo, oid) false - function Base.cat(repo::GitRepo, ::Type{T}, spec::Union{AbstractString,AbstractGitHash}) where T<:GitObject - Base.depwarn("`cat(repo::GitRepo, T, spec)` is deprecated, use `content(T(repo, spec))` instead.", :cat) - try - return content(GitBlob(repo, spec)) - catch e - isa(e, LibGit2.GitError) && return nothing - rethrow(e) - end - end - Base.cat(repo::GitRepo, spec::Union{AbstractString,AbstractGitHash}) = cat(repo, GitBlob, spec) -end - -# TODO: remove `:typealias` from BINDING_HEADS in base/docs/Docs.jl -# TODO: remove `'typealias` case in expand-table in julia-syntax.scm - -# FloatRange replaced by StepRangeLen - -## Old-style floating point ranges. We reimplement them here because -## the replacement StepRangeLen also has 4 real-valued fields, which -## makes deprecation tricky. See #20506. - -struct Use_StepRangeLen_Instead{T<:AbstractFloat} <: AbstractRange{T} - start::T - step::T - len::T - divisor::T -end - -Use_StepRangeLen_Instead(a::AbstractFloat, s::AbstractFloat, l::Real, d::AbstractFloat) = - Use_StepRangeLen_Instead{promote_type(typeof(a),typeof(s),typeof(d))}(a,s,l,d) - -isempty(r::Use_StepRangeLen_Instead) = length(r) == 0 - -step(r::Use_StepRangeLen_Instead) = r.step/r.divisor - -length(r::Use_StepRangeLen_Instead) = Integer(r.len) - -first(r::Use_StepRangeLen_Instead{T}) where {T} = convert(T, r.start/r.divisor) - -last(r::Use_StepRangeLen_Instead{T}) where {T} = convert(T, (r.start + (r.len-1)*r.step)/r.divisor) - -start(r::Use_StepRangeLen_Instead) = 0 -done(r::Use_StepRangeLen_Instead, i::Int) = length(r) <= i -next(r::Use_StepRangeLen_Instead{T}, i::Int) where {T} = - (convert(T, (r.start + i*r.step)/r.divisor), i+1) - -function getindex(r::Use_StepRangeLen_Instead{T}, i::Integer) where T - @_inline_meta - @boundscheck checkbounds(r, i) - convert(T, (r.start + (i-1)*r.step)/r.divisor) -end - -function getindex(r::Use_StepRangeLen_Instead, s::OrdinalRange) - @_inline_meta - @boundscheck checkbounds(r, s) - Use_StepRangeLen_Instead(r.start + (first(s)-1)*r.step, step(s)*r.step, length(s), r.divisor) -end - --(r::Use_StepRangeLen_Instead) = Use_StepRangeLen_Instead(-r.start, -r.step, r.len, r.divisor) -+(x::Real, r::Use_StepRangeLen_Instead) = Use_StepRangeLen_Instead(r.divisor*x + r.start, r.step, r.len, r.divisor) --(x::Real, r::Use_StepRangeLen_Instead) = Use_StepRangeLen_Instead(r.divisor*x - r.start, -r.step, r.len, r.divisor) --(r::Use_StepRangeLen_Instead, x::Real) = Use_StepRangeLen_Instead(r.start - r.divisor*x, r.step, r.len, r.divisor) -*(x::Real, r::Use_StepRangeLen_Instead) = Use_StepRangeLen_Instead(x*r.start, x*r.step, r.len, r.divisor) -*(r::Use_StepRangeLen_Instead, x::Real) = x * r -/(r::Use_StepRangeLen_Instead, x::Real) = Use_StepRangeLen_Instead(r.start/x, r.step/x, r.len, r.divisor) -promote_rule(::Type{Use_StepRangeLen_Instead{T1}},::Type{Use_StepRangeLen_Instead{T2}}) where {T1,T2} = - Use_StepRangeLen_Instead{promote_type(T1,T2)} -convert(::Type{Use_StepRangeLen_Instead{T}}, r::Use_StepRangeLen_Instead{T}) where {T<:AbstractFloat} = r -convert(::Type{Use_StepRangeLen_Instead{T}}, r::Use_StepRangeLen_Instead) where {T<:AbstractFloat} = - Use_StepRangeLen_Instead{T}(r.start,r.step,r.len,r.divisor) - -promote_rule(::Type{Use_StepRangeLen_Instead{F}}, ::Type{OR}) where {F,OR<:OrdinalRange} = - Use_StepRangeLen_Instead{promote_type(F,eltype(OR))} -convert(::Type{Use_StepRangeLen_Instead{T}}, r::OrdinalRange) where {T<:AbstractFloat} = - Use_StepRangeLen_Instead{T}(first(r), step(r), length(r), one(T)) -convert(::Type{Use_StepRangeLen_Instead}, r::OrdinalRange{T}) where {T} = - Use_StepRangeLen_Instead{typeof(float(first(r)))}(first(r), step(r), length(r), one(T)) - -promote_rule(::Type{LinSpace{F}}, ::Type{OR}) where {F,OR<:Use_StepRangeLen_Instead} = - LinSpace{promote_type(F,eltype(OR))} -convert(::Type{LinSpace{T}}, r::Use_StepRangeLen_Instead) where {T<:AbstractFloat} = - linspace(convert(T, first(r)), convert(T, last(r)), convert(T, length(r))) -convert(::Type{LinSpace}, r::Use_StepRangeLen_Instead{T}) where {T<:AbstractFloat} = - convert(LinSpace{T}, r) - -reverse(r::Use_StepRangeLen_Instead) = Use_StepRangeLen_Instead(r.start + (r.len-1)*r.step, -r.step, r.len, r.divisor) - -function sum(r::Use_StepRangeLen_Instead) - l = length(r) - if iseven(l) - s = r.step * (l-1) * (l>>1) - else - s = (r.step * l) * ((l-1)>>1) - end - return (l * r.start + s)/r.divisor -end - -@deprecate_binding FloatRange Use_StepRangeLen_Instead - -## end of FloatRange - -@noinline zero_arg_matrix_constructor(prefix::String) = - depwarn("`$prefix()` is deprecated, use `$prefix(uninitialized, 0, 0)` instead.", :zero_arg_matrix_constructor) -function Matrix{T}() where T - zero_arg_matrix_constructor("Matrix{T}") - return Matrix{T}(uninitialized, 0, 0) -end -function Matrix() - zero_arg_matrix_constructor("Matrix") - return Matrix(uninitialized, 0, 0) -end - -# TODO: remove warning for using `_` in parse_input_line in base/client.jl - -# Special functions have been moved to a package -for f in (:airyai, :airyaiprime, :airybi, :airybiprime, :airyaix, :airyaiprimex, :airybix, :airybiprimex, - :besselh, :besselhx, :besseli, :besselix, :besselj, :besselj0, :besselj1, :besseljx, :besselk, - :besselkx, :bessely, :bessely0, :bessely1, :besselyx, - :dawson, :erf, :erfc, :erfcinv, :erfcx, :erfi, :erfinv, - :eta, :zeta, :digamma, :invdigamma, :polygamma, :trigamma, - :hankelh1, :hankelh1x, :hankelh2, :hankelh2x, - :airy, :airyx, :airyprime) - @eval @deprecate_moved $f "SpecialFunctions" -end - -@deprecate_binding LinearIndexing IndexStyle false -@deprecate_binding LinearFast IndexLinear false -@deprecate_binding LinearSlow IndexCartesian false -@deprecate_binding linearindexing IndexStyle false - -# #19635 -for fname in (:ones, :zeros) - @eval @deprecate ($fname)(T::Type, arr) ($fname)(T, size(arr)) - @eval ($fname)(::Type{T}, i::Integer) where {T} = ($fname)(T, (i,)) # provides disambiguation with method in Base - @eval function ($fname)(::Type{T}, arr::Array{T}) where T - msg = $("`$fname{T}(::Type{T}, arr::Array{T})` is deprecated, use `$fname(T, size(arr))` instead.") - error(msg) - end -end - # END 0.6 deprecations # BEGIN 0.7 deprecations @@ -1448,6 +520,7 @@ for op in (:floor, :ceil, :trunc, :round, :sin, :tan, :sind, :tand, :asin, :atan, :asind, :atand, :sinh, :tanh, :asinh, :atanh) + @eval import .Math: $op @eval @deprecate ($op)(x::AbstractSparseVector{<:Number,<:Integer}) ($op).(x) end # deprecate remaining vectorized methods over SparseVectors (not-zero-preserving) diff --git a/src/array.c b/src/array.c index f42b8cc36f517..519e56d75987b 100644 --- a/src/array.c +++ b/src/array.c @@ -531,38 +531,6 @@ JL_DLLEXPORT int jl_array_isassigned(jl_array_t *a, size_t i) return 1; } -int jl_array_isdefined(jl_value_t **args0, int nargs) -{ - assert(jl_is_array(args0[0])); - jl_depwarn("`isdefined(a::Array, i::Int)` is deprecated, " - "use `isassigned(a, i)` instead", (jl_value_t*)jl_symbol("isdefined")); - - jl_array_t *a = (jl_array_t*)args0[0]; - jl_value_t **args = &args0[1]; - size_t nidxs = nargs-1; - size_t i=0; - size_t k, stride=1; - size_t nd = jl_array_ndims(a); - for(k=0; k < nidxs; k++) { - if (!jl_is_long(args[k])) - jl_type_error("isdefined", (jl_value_t*)jl_long_type, args[k]); - size_t ii = jl_unbox_long(args[k])-1; - i += ii * stride; - size_t d = k>=nd ? 1 : jl_array_dim(a, k); - if (k < nidxs-1 && ii >= d) - return 0; - stride *= d; - } - for(; k < nd; k++) - stride *= jl_array_dim(a, k); - if (i >= stride) - return 0; - - if (a->flags.ptrarray) - return ((jl_value_t**)jl_array_data(a))[i] != NULL; - return 1; -} - JL_DLLEXPORT void jl_arrayset(jl_array_t *a, jl_value_t *rhs, size_t i) { assert(i < jl_array_len(a)); diff --git a/src/builtins.c b/src/builtins.c index d5b980ac24d03..5f9b2c2c20214 100644 --- a/src/builtins.c +++ b/src/builtins.c @@ -644,9 +644,6 @@ JL_CALLABLE(jl_f_isdefined) jl_module_t *m = NULL; jl_sym_t *s = NULL; JL_NARGSV(isdefined, 1); - if (jl_is_array(args[0])) { - return jl_array_isdefined(args, nargs) ? jl_true : jl_false; - } if (nargs == 1) { JL_TYPECHK(isdefined, symbol, args[0]); s = (jl_sym_t*)args[0]; @@ -925,16 +922,7 @@ JL_CALLABLE(jl_f_invoke) JL_NARGSV(invoke, 2); jl_value_t *argtypes = args[1]; JL_GC_PUSH1(&argtypes); - if (jl_is_tuple(args[1])) { - jl_depwarn("`invoke(f, (types...), ...)` is deprecated, " - "use `invoke(f, Tuple{types...}, ...)` instead", - (jl_value_t*)jl_symbol("invoke")); - argtypes = (jl_value_t*)jl_apply_tuple_type_v((jl_value_t**)jl_data_ptr(argtypes), - jl_nfields(argtypes)); - } - else { - jl_check_type_tuple(args[1], jl_gf_name(args[0]), "invoke"); - } + jl_check_type_tuple(args[1], jl_gf_name(args[0]), "invoke"); if (!jl_tuple_isa(&args[2], nargs-2, (jl_datatype_t*)argtypes)) jl_error("invoke: argument type error"); args[1] = args[0]; // move function directly in front of arguments diff --git a/src/julia_internal.h b/src/julia_internal.h index 56490e34e1c44..f194ed7f5484d 100644 --- a/src/julia_internal.h +++ b/src/julia_internal.h @@ -846,7 +846,6 @@ JL_DLLEXPORT jl_value_t *jl_flipsign_int(jl_value_t *a, jl_value_t *b); JL_DLLEXPORT jl_value_t *jl_select_value(jl_value_t *isfalse, jl_value_t *a, jl_value_t *b); JL_DLLEXPORT jl_value_t *jl_arraylen(jl_value_t *a); int jl_array_store_unboxed(jl_value_t *el_type); -int jl_array_isdefined(jl_value_t **args, int nargs); JL_DLLEXPORT jl_value_t *(jl_array_data_owner)(jl_array_t *a); JL_DLLEXPORT int jl_array_isassigned(jl_array_t *a, size_t i); diff --git a/stdlib/Test/src/Test.jl b/stdlib/Test/src/Test.jl index d480b368cc468..3568542e64c16 100644 --- a/stdlib/Test/src/Test.jl +++ b/stdlib/Test/src/Test.jl @@ -1276,12 +1276,7 @@ want to set this to `false`. See [`Base.isambiguous`](@ref). function detect_ambiguities(mods...; imported::Bool = false, recursive::Bool = false, - ambiguous_bottom::Bool = false, - allow_bottom::Union{Bool,Nothing} = nothing) - if allow_bottom !== nothing - Base.depwarn("the `allow_bottom` keyword to detect_ambiguities has been renamed to `ambiguous_bottom`", :detect_ambiguities) - ambiguous_bottom = allow_bottom - end + ambiguous_bottom::Bool = false) function sortdefs(m1, m2) ord12 = m1.file < m2.file if !ord12 && (m1.file == m2.file) diff --git a/test/arrayops.jl b/test/arrayops.jl index 27c6807906ff9..73e3d40262d28 100644 --- a/test/arrayops.jl +++ b/test/arrayops.jl @@ -310,16 +310,8 @@ end @test size(Matrix{Int}(uninitialized, 2,3)) == (2,3) @test size(Matrix(uninitialized, 2,3)) == (2,3) - # TODO: will throw MethodError after 0.6 deprecations are deleted - dw = Base.JLOptions().depwarn - if dw == 2 - # FIXME: Remove this special case after deperror cleanup - @test_throws ErrorException Matrix{Int}() - @test_throws ErrorException Matrix() - else - @test size(@test_deprecated Matrix{Int}()) == (0,0) - @test size(@test_deprecated Matrix()) == (0,0) - end + @test_throws MethodError Matrix() + @test_throws MethodError Matrix{Int}() @test_throws MethodError Array{Int,3}() end @testset "get" begin @@ -2222,7 +2214,7 @@ end test_zeros(zeros(Int, (2, 3)), Matrix{Int}, (2,3)) # #19265" - @test_throws ErrorException zeros(Float64, [1.]) # TODO change to MethodError, when v0.6 deprecations are done + @test_throws MethodError zeros(Float64, [1.]) end # issue #11053