diff --git a/NEWS.md b/NEWS.md index a7dc330a5e45e..df95b7e25b544 100644 --- a/NEWS.md +++ b/NEWS.md @@ -324,6 +324,8 @@ Deprecated or removed * `produce`, `consume` and iteration over a Task object have been deprecated in favor of using Channels for inter-task communication ([#19841]). + * `deleteat!` has been deprecated in favor of `delete!` ([#20531]). + [#265]: https://github.com/JuliaLang/julia/issues/265 [#7669]: https://github.com/JuliaLang/julia/issues/7669 diff --git a/base/array.jl b/base/array.jl index 355da7c2c71a7..d22e577e91a0a 100644 --- a/base/array.jl +++ b/base/array.jl @@ -767,13 +767,13 @@ function insert!{T}(a::Array{T,1}, i::Integer, item) end """ - deleteat!(a::Vector, i::Integer) + delete!(a::Vector, i::Integer) Remove the item at the given `i` and return the modified `a`. Subsequent items are shifted to fill the resulting gap. ```jldoctest -julia> deleteat!([6, 5, 4, 3, 2, 1], 2) +julia> delete!([6, 5, 4, 3, 2, 1], 2) 5-element Array{Int64,1}: 6 4 @@ -782,34 +782,34 @@ julia> deleteat!([6, 5, 4, 3, 2, 1], 2) 1 ``` """ -deleteat!(a::Vector, i::Integer) = (_deleteat!(a, i, 1); a) +delete!(a::Vector, i::Integer) = (_deleteat!(a, i, 1); a) -function deleteat!{T<:Integer}(a::Vector, r::UnitRange{T}) +function delete!{T<:Integer}(a::Vector, r::UnitRange{T}) n = length(a) isempty(r) || _deleteat!(a, first(r), length(r)) return a end """ - deleteat!(a::Vector, inds) + delete!(a::Vector, inds) Remove the items at the indices given by `inds`, and return the modified `a`. Subsequent items are shifted to fill the resulting gap. `inds` must be sorted and unique. ```jldoctest -julia> deleteat!([6, 5, 4, 3, 2, 1], 1:2:5) +julia> delete!([6, 5, 4, 3, 2, 1], 1:2:5) 3-element Array{Int64,1}: 5 3 1 -julia> deleteat!([6, 5, 4, 3, 2, 1], (2, 2)) +julia> delete!([6, 5, 4, 3, 2, 1], (2, 2)) ERROR: ArgumentError: indices must be unique and sorted Stacktrace: - [1] deleteat!(::Array{Int64,1}, ::Tuple{Int64,Int64}) at ./array.jl:808 + [1] delete!(::Array{Int64,1}, ::Tuple{Int64,Int64}) at ./array.jl:822 ``` """ -function deleteat!(a::Vector, inds) +function delete!(a::Vector, inds) n = length(a) s = start(inds) done(inds, s) && return a @@ -938,7 +938,7 @@ function splice!{T<:Integer}(a::Vector, r::UnitRange{T}, ins=_default_splice) v = a[r] m = length(ins) if m == 0 - deleteat!(a, r) + delete!(a, r) return v end @@ -1746,7 +1746,7 @@ function filter!(f, a::Vector) insrt += 1 end end - deleteat!(a, insrt:length(a)) + delete!(a, insrt:length(a)) return a end diff --git a/base/bitarray.jl b/base/bitarray.jl index 1356b702fd9af..9406b64c990a3 100644 --- a/base/bitarray.jl +++ b/base/bitarray.jl @@ -894,7 +894,7 @@ function resize!(B::BitVector, n::Integer) n == n0 && return B n >= 0 || throw(BoundsError(B, n)) if n < n0 - deleteat!(B, n+1:n0) + delete!(B, n+1:n0) return B end Bc = B.chunks @@ -992,7 +992,7 @@ function insert!(B::BitVector, i::Integer, item) B end -function _deleteat!(B::BitVector, i::Integer) +function _delete!(B::BitVector, i::Integer) k, j = get_chunks_id(i) msk_bef = _msk64 >>> (63 - j) @@ -1025,14 +1025,14 @@ function _deleteat!(B::BitVector, i::Integer) return B end -function deleteat!(B::BitVector, i::Integer) +function delete!(B::BitVector, i::Integer) n = length(B) 1 <= i <= n || throw(BoundsError(B, i)) - return _deleteat!(B, i) + return _delete!(B, i) end -function deleteat!(B::BitVector, r::UnitRange{Int}) +function delete!(B::BitVector, r::UnitRange{Int}) n = length(B) i_f = first(r) i_l = last(r) @@ -1056,7 +1056,7 @@ function deleteat!(B::BitVector, r::UnitRange{Int}) return B end -function deleteat!(B::BitVector, inds) +function delete!(B::BitVector, inds) n = new_l = length(B) s = start(inds) done(inds, s) && return B @@ -1099,7 +1099,7 @@ function splice!(B::BitVector, i::Integer) 1 <= i <= n || throw(BoundsError(B, i)) v = B[i] # TODO: change to a copy if/when subscripting becomes an ArrayView - _deleteat!(B, i) + _delete!(B, i) return v end diff --git a/base/client.jl b/base/client.jl index 0e2e997b02746..46dc1c1ba7e94 100644 --- a/base/client.jl +++ b/base/client.jl @@ -241,7 +241,7 @@ try_include(path::AbstractString) = isfile(path) && include(path) function process_options(opts::JLOptions) if !isempty(ARGS) idxs = find(x -> x == "--", ARGS) - length(idxs) > 0 && deleteat!(ARGS, idxs[1]) + length(idxs) > 0 && delete!(ARGS, idxs[1]) end repl = true startup = (opts.startupfile != 2) diff --git a/base/deprecated.jl b/base/deprecated.jl index 9db39ec2b8eda..29635cd96d8d5 100644 --- a/base/deprecated.jl +++ b/base/deprecated.jl @@ -605,8 +605,8 @@ function gen_broadcast_body_zpreserving(f::Function, is_first_sparse::Bool) 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)) + delete!(B.rowval, B.colptr[end]:length(B.rowval)) + delete!(B.nzval, B.colptr[end]:length(B.nzval)) nothing end end @@ -1227,6 +1227,8 @@ for name in ("alnum", "alpha", "cntrl", "digit", "number", "graph", @eval @deprecate ($f)(s::AbstractString) all($f, s) end +@deprecate deleteat! delete! + # END 0.6 deprecations # BEGIN 1.0 deprecations diff --git a/base/dict.jl b/base/dict.jl index 229de51ef4050..8d26affca44ef 100644 --- a/base/dict.jl +++ b/base/dict.jl @@ -554,6 +554,14 @@ function _delete!(h::Dict, index) return h end +""" + delete!(collection, keys) + +Delete the mapping for the given key(s) or index(es) in a collection, and return +the collection. +""" +function delete! end + function delete!(h::Dict, key) index = ht_keyindex(h, key) if index > 0 diff --git a/base/docs/helpdb/Base.jl b/base/docs/helpdb/Base.jl index b79496acbfee0..ea0aecd90f842 100644 --- a/base/docs/helpdb/Base.jl +++ b/base/docs/helpdb/Base.jl @@ -1170,13 +1170,6 @@ The largest integer losslessly representable by the given floating-point DataTyp """ maxintfloat -""" - delete!(collection, key) - -Delete the mapping for the given key in a collection, and return the collection. -""" -delete! - """ eps(T) diff --git a/base/event.jl b/base/event.jl index 2b671aaa1d826..98832d4bc32aa 100644 --- a/base/event.jl +++ b/base/event.jl @@ -204,7 +204,7 @@ function wait() end # return ourself to the runnable state i = findfirst(Workqueue, ct) - i == 0 || deleteat!(Workqueue, i) + i == 0 || delete!(Workqueue, i) ct.state = :runnable end rethrow(e) diff --git a/base/exports.jl b/base/exports.jl index 78b9ee477cc2b..c8fa957ff4273 100644 --- a/base/exports.jl +++ b/base/exports.jl @@ -708,7 +708,6 @@ export contains, count, delete!, - deleteat!, eltype, empty!, endof, diff --git a/base/expr.jl b/base/expr.jl index fa1db381bf005..c5bc7c8261175 100644 --- a/base/expr.jl +++ b/base/expr.jl @@ -230,8 +230,8 @@ function popmeta!(body::Array{Any,1}, sym::Symbol) return false, [] end ret = isa(metaargs[i], Expr) ? (metaargs[i]::Expr).args : [] - deleteat!(metaargs, i) - isempty(metaargs) && deleteat!(blockargs, idx) + delete!(metaargs, i) + isempty(metaargs) && delete!(blockargs, idx) true, ret end diff --git a/base/inference.jl b/base/inference.jl index 5670a6edbdede..d59fbc956b349 100644 --- a/base/inference.jl +++ b/base/inference.jl @@ -3066,8 +3066,8 @@ function type_annotate!(sv::InferenceState) end # This can create `Expr(:gotoifnot)` with dangling label, which we # clean up in `reindex_labels!` - deleteat!(body, i) - deleteat!(states, i) + delete!(body, i) + delete!(states, i) nexpr -= 1 continue end @@ -4898,7 +4898,7 @@ function alloc_elim_pass!(sv::InferenceState) continue end - deleteat!(body, i) # remove tuple allocation + delete!(body, i) # remove tuple allocation # convert tuple allocation to a series of local var assignments n_ins = 0 if var === nothing @@ -4993,7 +4993,7 @@ function delete_void_use!(body, var::Slot, i0) while i <= narg a = body[i] if isa(a, Slot) && slot_id(a) == slot_id(var) - deleteat!(body, i) + delete!(body, i) if i + ndel < i0 ndel += 1 end diff --git a/base/methodshow.jl b/base/methodshow.jl index e3fe26c282f1b..f391c1a5f239b 100644 --- a/base/methodshow.jl +++ b/base/methodshow.jl @@ -79,7 +79,7 @@ function kwarg_decl(m::Method, kwtype::DataType) i = findfirst(x -> endswith(string(x), "..."), kws) i==0 && return kws push!(kws, kws[i]) - return deleteat!(kws,i) + return delete!(kws,i) end return () end diff --git a/base/path.jl b/base/path.jl index 6b04246a5f777..3157f31ffdddf 100644 --- a/base/path.jl +++ b/base/path.jl @@ -222,7 +222,7 @@ function normpath(path::String) clean = true for j = 1:length(parts)-1 if parts[j] != ".." && parts[j+1] == ".." - deleteat!(parts, j:j+1) + delete!(parts, j:j+1) clean = false break end diff --git a/base/precompile.jl b/base/precompile.jl index 86247eec17b9d..47566d04e0d65 100644 --- a/base/precompile.jl +++ b/base/precompile.jl @@ -194,7 +194,7 @@ precompile(Base.convert, (Type{Module}, Module)) precompile(Base.convert, (Type{AbstractString}, String)) precompile(Base.copy!, (Array{Dict{Any, Any}, 1}, Int, Array{Dict{Any, Any}, 1}, Int, Int)) precompile(Base.copy, (Bool,)) -precompile(Base.deleteat!, (Array{UInt8, 1}, Base.UnitRange{Int})) +precompile(Base.delete!, (Array{UInt8, 1}, Base.UnitRange{Int})) precompile(Base.done, (Array{Base.LineEdit.TextInterface, 1}, Int)) precompile(Base.done, (Dict{Any,Any}, Int)) precompile(Base.done, (Dict{Symbol,Any}, Int)) diff --git a/base/printf.jl b/base/printf.jl index 754e91276b176..6fa301907b11a 100644 --- a/base/printf.jl +++ b/base/printf.jl @@ -64,7 +64,7 @@ function parse(s::AbstractString) end list[i] *= list[j] end - deleteat!(list,i+1:j) + delete!(list,i+1:j) end i += 1 end diff --git a/base/sparse/linalg.jl b/base/sparse/linalg.jl index 477757b6f280b..b78d2dff6babf 100644 --- a/base/sparse/linalg.jl +++ b/base/sparse/linalg.jl @@ -184,8 +184,8 @@ function spmatmul{Tv,Ti}(A::SparseMatrixCSC{Tv,Ti}, B::SparseMatrixCSC{Tv,Ti}; colptrC[nB+1] = ip end - deleteat!(rowvalC, colptrC[end]:length(rowvalC)) - deleteat!(nzvalC, colptrC[end]:length(nzvalC)) + delete!(rowvalC, colptrC[end]:length(rowvalC)) + delete!(nzvalC, colptrC[end]:length(nzvalC)) # The Gustavson algorithm does not guarantee the product to have sorted row indices. Cunsorted = SparseMatrixCSC(mA, nB, colptrC, rowvalC, nzvalC) @@ -394,8 +394,8 @@ function sparse_diff1{Tv,Ti}(S::SparseMatrixCSC{Tv,Ti}) end colptr[col+1] = numnz+1 end - deleteat!(rowval, numnz+1:length(rowval)) - deleteat!(nzval, numnz+1:length(nzval)) + delete!(rowval, numnz+1:length(rowval)) + delete!(nzval, numnz+1:length(nzval)) return SparseMatrixCSC(m-1, n, colptr, rowval, nzval) end @@ -483,8 +483,8 @@ function sparse_diff2{Tv,Ti}(a::SparseMatrixCSC{Tv,Ti}) colptr[col+1] = ptrS end - deleteat!(rowval, ptrS:length(rowval)) - deleteat!(nzval, ptrS:length(nzval)) + delete!(rowval, ptrS:length(rowval)) + delete!(nzval, ptrS:length(nzval)) return SparseMatrixCSC(m, n-1, colptr, rowval, nzval) end diff --git a/base/sparse/sparsematrix.jl b/base/sparse/sparsematrix.jl index 7ebaae7c0b5fd..9af26554ebc4f 100644 --- a/base/sparse/sparsematrix.jl +++ b/base/sparse/sparsematrix.jl @@ -271,8 +271,8 @@ function copy!(A::SparseMatrixCSC, B::SparseMatrixCSC) lastmodptrA -= 1 if lastmodptrA >= nnzB # A will have fewer non-zero elements; unmodified elements are kept at the end. - deleteat!(A.rowval, nnzB+1:lastmodptrA) - deleteat!(A.nzval, nnzB+1:lastmodptrA) + delete!(A.rowval, nnzB+1:lastmodptrA) + delete!(A.nzval, nnzB+1:lastmodptrA) else # A will have more non-zero elements; unmodified elements are kept at the end. resize!(A.rowval, nnzB + nnzA - lastmodptrA) @@ -429,8 +429,8 @@ function sparse_IJ_sorted!{Ti<:Integer}(I::AbstractVector{Ti}, J::AbstractVector # Allow up to 20% slack if ndups > 0.2*L numnz = L-ndups - deleteat!(I, (numnz+1):L) - deleteat!(V, (numnz+1):length(V)) + delete!(I, (numnz+1):L) + delete!(V, (numnz+1):length(V)) end return SparseMatrixCSC(m, n, colptr, I, V) @@ -1172,8 +1172,8 @@ function findn{Tv,Ti}(S::SparseMatrixCSC{Tv,Ti}) count -= 1 if numnz != count - deleteat!(I, (count+1):numnz) - deleteat!(J, (count+1):numnz) + delete!(I, (count+1):numnz) + delete!(J, (count+1):numnz) end return (I, J) @@ -1197,9 +1197,9 @@ function findnz{Tv,Ti}(S::SparseMatrixCSC{Tv,Ti}) count -= 1 if numnz != count - deleteat!(I, (count+1):numnz) - deleteat!(J, (count+1):numnz) - deleteat!(V, (count+1):numnz) + delete!(I, (count+1):numnz) + delete!(J, (count+1):numnz) + delete!(V, (count+1):numnz) end return (I, J, V) @@ -2152,8 +2152,8 @@ function getindex{Tv}(A::SparseMatrixCSC{Tv}, I::AbstractArray) end colptrB = cumsum(colptrB) if n > (idxB-1) - deleteat!(nzvalB, idxB:n) - deleteat!(rowvalB, idxB:n) + delete!(nzvalB, idxB:n) + delete!(rowvalB, idxB:n) end SparseMatrixCSC(outm, outn, colptrB, rowvalB, nzvalB) end @@ -2363,8 +2363,8 @@ function _spsetnz_setindex!{Tv,TiI<:Integer,TiJ<:Integer}(A::SparseMatrixCSC{Tv} if nadd > 0 A.colptr[n+1] = rowidx - deleteat!(rowvalA, rowidx:nnzA) - deleteat!(nzvalA, rowidx:nnzA) + delete!(rowvalA, rowidx:nnzA) + delete!(nzvalA, rowidx:nnzA) end return A end @@ -2498,8 +2498,8 @@ function setindex!{Tv,Ti,T<:Integer}(A::SparseMatrixCSC{Tv,Ti}, B::SparseMatrixC colB += 1 end - deleteat!(rowvalA, colptrA[end]:length(rowvalA)) - deleteat!(nzvalA, colptrA[end]:length(nzvalA)) + delete!(rowvalA, colptrA[end]:length(rowvalA)) + delete!(nzvalA, colptrA[end]:length(nzvalA)) return A end @@ -2612,8 +2612,8 @@ function setindex!{Tv,Ti}(A::SparseMatrixCSC{Tv,Ti}, x, I::AbstractMatrix{Bool}) if (nadd != 0) n = length(nzvalB) if n > (bidx-1) - deleteat!(nzvalB, bidx:n) - deleteat!(rowvalB, bidx:n) + delete!(nzvalB, bidx:n) + delete!(rowvalB, bidx:n) end end A @@ -2721,8 +2721,8 @@ function setindex!{Tv,Ti,T<:Real}(A::SparseMatrixCSC{Tv,Ti}, x, I::AbstractVecto n = length(nzvalB) if n > (bidx-1) - deleteat!(nzvalB, bidx:n) - deleteat!(rowvalB, bidx:n) + delete!(nzvalB, bidx:n) + delete!(rowvalB, bidx:n) end end A @@ -2743,8 +2743,8 @@ function dropstored!(A::SparseMatrixCSC, i::Integer, j::Integer) searchk = searchsortedfirst(A.rowval, i, coljfirstk, coljlastk, Base.Order.Forward) if searchk <= coljlastk && A.rowval[searchk] == i # Entry A[i,j] is stored. Drop and return. - deleteat!(A.rowval, searchk) - deleteat!(A.nzval, searchk) + delete!(A.rowval, searchk) + delete!(A.nzval, searchk) @simd for m in (j+1):(A.n + 1) @inbounds A.colptr[m] -= 1 end @@ -2815,8 +2815,8 @@ function dropstored!{TiI<:Integer,TiJ<:Integer}(A::SparseMatrixCSC, if ndel > 0 A.colptr[n+1] = rowidx - deleteat!(rowvalA, rowidx:nnzA) - deleteat!(nzvalA, rowidx:nnzA) + delete!(rowvalA, rowidx:nnzA) + delete!(nzvalA, rowidx:nnzA) end return A end diff --git a/base/sparse/sparsevector.jl b/base/sparse/sparsevector.jl index f9478910d66f7..136aaee04c8a6 100644 --- a/base/sparse/sparsevector.jl +++ b/base/sparse/sparsevector.jl @@ -226,8 +226,8 @@ function dropstored!(x::SparseVector, i::Integer) searchk = searchsortedfirst(x.nzind, i) if searchk <= length(x.nzind) && x.nzind[searchk] == i # Entry x[i] is stored. Drop and return. - deleteat!(x.nzind, searchk) - deleteat!(x.nzval, searchk) + delete!(x.nzind, searchk) + delete!(x.nzval, searchk) end return x end @@ -322,8 +322,8 @@ function prep_sparsevec_copy_dest!(A::SparseVector, lB, nnzB) lastmodindA = searchsortedlast(A.nzind, lB) if lastmodindA >= nnzB # A will have fewer non-zero elements; unmodified elements are kept at the end. - deleteat!(A.nzind, nnzB+1:lastmodindA) - deleteat!(A.nzval, nnzB+1:lastmodindA) + delete!(A.nzind, nnzB+1:lastmodindA) + delete!(A.nzval, nnzB+1:lastmodindA) else # A will have more non-zero elements; unmodified elements are kept at the end. resize!(A.nzind, nnzB + nnzA - lastmodindA) @@ -482,8 +482,8 @@ function _logical_index{Tv}(A::SparseMatrixCSC{Tv}, I::AbstractArray{Bool}) (rowB > n) && break end if nnzB > (c-1) - deleteat!(nzvalB, c:nnzB) - deleteat!(rowvalB, c:nnzB) + delete!(nzvalB, c:nnzB) + delete!(rowvalB, c:nnzB) end SparseVector(n, rowvalB, nzvalB) end @@ -521,8 +521,8 @@ function getindex{Tv}(A::SparseMatrixCSC{Tv}, I::UnitRange) end end if nnzB > (idxB-1) - deleteat!(nzvalB, idxB:nnzB) - deleteat!(rowvalB, idxB:nnzB) + delete!(nzvalB, idxB:nnzB) + delete!(rowvalB, idxB:nnzB) end SparseVector(n, rowvalB, nzvalB) end @@ -558,8 +558,8 @@ function getindex{Tv}(A::SparseMatrixCSC{Tv}, I::AbstractVector) end end if nnzB > (idxB-1) - deleteat!(nzvalB, idxB:nnzB) - deleteat!(rowvalB, idxB:nnzB) + delete!(nzvalB, idxB:nnzB) + delete!(rowvalB, idxB:nnzB) end SparseVector(n, rowvalB, nzvalB) end @@ -581,7 +581,7 @@ function find{Tv,Ti}(x::SparseVector{Tv,Ti}) count -= 1 if numnz != count - deleteat!(I, (count+1):numnz) + delete!(I, (count+1):numnz) end return I @@ -607,8 +607,8 @@ function findnz{Tv,Ti}(x::SparseVector{Tv,Ti}) count -= 1 if numnz != count - deleteat!(I, (count+1):numnz) - deleteat!(V, (count+1):numnz) + delete!(I, (count+1):numnz) + delete!(V, (count+1):numnz) end return (I, V) @@ -1802,7 +1802,7 @@ function sort{Tv,Ti}(x::SparseVector{Tv,Ti}; kws...) z = findfirst(sinds,k) newnzind = collect(Ti,1:k-1) newnzind[z:end]+= n-k+1 - newnzvals = allvals[deleteat!(sinds[1:k],z)] + newnzvals = allvals[delete!(sinds[1:k],z)] SparseVector(n,newnzind,newnzvals) end diff --git a/contrib/add_license_to_files.jl b/contrib/add_license_to_files.jl index 7cfaae2ab9f0a..81ab65b35d65e 100644 --- a/contrib/add_license_to_files.jl +++ b/contrib/add_license_to_files.jl @@ -94,7 +94,7 @@ function check_lines!( end end end - deleteat!(lines, remove) + delete!(lines, remove) end license_linenum(line) = startswith(strip(line), "#!") ? 2 : 1 diff --git a/doc/src/stdlib/collections.md b/doc/src/stdlib/collections.md index 29d8c38f3b1a8..6039e2b8b33e5 100644 --- a/doc/src/stdlib/collections.md +++ b/doc/src/stdlib/collections.md @@ -251,7 +251,6 @@ Base.pop!(::Any) Base.unshift! Base.shift! Base.insert! -Base.deleteat! Base.splice! Base.resize! Base.append! diff --git a/test/arrayops.jl b/test/arrayops.jl index 2b5c6641fb1c9..ca1f9e007b8b0 100644 --- a/test/arrayops.jl +++ b/test/arrayops.jl @@ -1064,19 +1064,19 @@ end end end -@testset "deleteat!" begin +@testset "delete!" begin for idx in Any[1, 2, 5, 9, 10, 1:0, 2:1, 1:1, 2:2, 1:2, 2:4, 9:8, 10:9, 9:9, 10:10, 8:9, 9:10, 6:9, 7:10] a = [1:10;]; acopy = copy(a) - @test deleteat!(a, idx) == [acopy[1:(first(idx)-1)]; acopy[(last(idx)+1):end]] + @test delete!(a, idx) == [acopy[1:(first(idx)-1)]; acopy[(last(idx)+1):end]] end a = [1:10;] - @test deleteat!(a, 11:10) == [1:10;] - @test deleteat!(a, [1,3,5,7:10...]) == [2,4,6] - @test_throws BoundsError deleteat!(a, 13) - @test_throws BoundsError deleteat!(a, [1,13]) - @test_throws ArgumentError deleteat!(a, [5,3]) - @test_throws BoundsError deleteat!(a, 5:20) + @test delete!(a, 11:10) == [1:10;] + @test delete!(a, [1,3,5,7:10...]) == [2,4,6] + @test_throws BoundsError delete!(a, 13) + @test_throws BoundsError delete!(a, [1,13]) + @test_throws ArgumentError delete!(a, [5,3]) + @test_throws BoundsError delete!(a, 5:20) end @testset "comprehensions" begin diff --git a/test/bitarray.jl b/test/bitarray.jl index caa518eaab58b..04143690ff476 100644 --- a/test/bitarray.jl +++ b/test/bitarray.jl @@ -593,15 +593,15 @@ timesofar("indexing") i1 = Array(b1) for m = v1:-1:1 j = rand(1:m) - deleteat!(b1, j) - deleteat!(i1, j) + delete!(b1, j) + delete!(i1, j) @test isequal(Array(b1), i1) @test bitcheck(b1) end @test length(b1) == 0 b1 = bitrand(v1) - @test_throws ArgumentError deleteat!(b1, [1, 1, 2]) - @test_throws BoundsError deleteat!(b1, [1, length(b1)+1]) + @test_throws ArgumentError delete!(b1, [1, 1, 2]) + @test_throws BoundsError delete!(b1, [1, length(b1)+1]) b1 = bitrand(v1) i1 = Array(b1) @@ -617,8 +617,8 @@ timesofar("indexing") b1 = bitrand(v1) i1 = Array(b1) for j in [63, 64, 65, 127, 128, 129, 191, 192, 193] - deleteat!(b1, j) - deleteat!(i1, j) + delete!(b1, j) + delete!(i1, j) @test isequal(Array(b1), i1) @test bitcheck(b1) end @@ -641,8 +641,8 @@ timesofar("indexing") for m1 = 1:v1, m2 = m1:v1 b2 = copy(b1) i2 = copy(i1) - deleteat!(b2, m1:m2) - deleteat!(i2, m1:m2) + delete!(b2, m1:m2) + delete!(i2, m1:m2) @test isequal(Array(b2), i2) @test bitcheck(b2) end @@ -703,8 +703,8 @@ timesofar("indexing") m = [m1:m2...][locs] b2 = copy(b1) i2 = copy(i1) - deleteat!(b2, m) - deleteat!(i2, m) + delete!(b2, m) + delete!(i2, m) @test isequal(Array(b2), i2) @test bitcheck(b2) end diff --git a/test/compile.jl b/test/compile.jl index 718c24f6f7a24..38c69c53bb1d4 100644 --- a/test/compile.jl +++ b/test/compile.jl @@ -341,7 +341,7 @@ let module_name = string("a",randstring()) write(file_name, code) reload(module_name) @test isa(eval(Main, Symbol(module_name)), Module) - deleteat!(LOAD_PATH,1) + delete!(LOAD_PATH,1) rm(file_name) end diff --git a/test/core.jl b/test/core.jl index f5499e64f4d1b..77328dbbae58f 100644 --- a/test/core.jl +++ b/test/core.jl @@ -3729,8 +3729,8 @@ function test_shared_array_resize{T}(::Type{T}) test_unshare(a->ccall(:jl_array_del_end, Void, (Any, Csize_t), a, 1)) test_unshare(a->ccall(:jl_array_del_beg, Void, (Any, Csize_t), a, 0)) test_unshare(a->ccall(:jl_array_del_beg, Void, (Any, Csize_t), a, 1)) - test_unshare(a->deleteat!(a, 10)) - test_unshare(a->deleteat!(a, 90)) + test_unshare(a->delete!(a, 10)) + test_unshare(a->delete!(a, 90)) test_unshare(a->ccall(:jl_array_grow_end, Void, (Any, Csize_t), a, 0)) test_unshare(a->ccall(:jl_array_grow_end, Void, (Any, Csize_t), a, 1)) test_unshare(a->ccall(:jl_array_grow_beg, Void, (Any, Csize_t), a, 0)) diff --git a/test/test.jl b/test/test.jl index b7fefdb894444..a6d9841c1515e 100644 --- a/test/test.jl +++ b/test/test.jl @@ -194,7 +194,7 @@ end @test total_broken == 0 end ts.anynonpass = false - deleteat!(Base.Test.get_testset().results,1) + delete!(Base.Test.get_testset().results,1) end @test .1+.1+.1 ≈ .3