Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions base/deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1298,6 +1298,18 @@ end
end
end

# #19635
for fname in (:ones, :zeros)
@eval @deprecate ($fname)(T::Type, arr) ($fname)(T, size(arr))
@eval ($fname)(T::Type, i::Integer) = ($fname)(T, (i,))
@eval function ($fname){T}(::Type{T}, arr::Array{T})
msg = string("`", $fname, "{T}(::Type{T}, arr::Array{T})` is deprecated, use ",
"`", $fname , "(T, size(arr))` instead. ",
)
error(msg)
end
end

# END 0.6 deprecations

# BEGIN 1.0 deprecations
Expand Down
11 changes: 5 additions & 6 deletions test/arrayops.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2054,12 +2054,11 @@ end
zs = zeros(SparseMatrixCSC([1 2; 3 4]), Complex{Float64}, (2,3))
test_zeros(zs, SparseMatrixCSC{Complex{Float64}}, (2, 3))

@testset "#19265" begin
@test_throws MethodError zeros(Float64, [1.])
x = [1.]
test_zeros(zeros(x, Float64), Vector{Float64}, (1,))
@test x == [1.]
end
# #19265"
@test_throws ErrorException zeros(Float64, [1.]) # TODO change to MethodError, when v0.6 deprecations are done
x = [1.]
test_zeros(zeros(x, Float64), Vector{Float64}, (1,))
@test x == [1.]

# exotic indexing
oarr = zeros(randn(3), UInt16, 1:3, -1:0)
Expand Down