Skip to content

Commit 2b086fe

Browse files
committed
Deprecate Array(T, dims...)
1 parent 29a3563 commit 2b086fe

8 files changed

+14
-20
lines changed

base/asyncmap.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ end
246246

247247
# Special handling for some types.
248248
function asyncmap(f, s::AbstractString; kwargs...)
249-
s2=Array(Char, length(s))
249+
s2 = Array{Char,1}(length(s))
250250
asyncmap!(f, s2, s; kwargs...)
251251
return convert(String, s2)
252252
end

base/boot.jl

-7
Original file line numberDiff line numberDiff line change
@@ -330,13 +330,6 @@ typealias NTuple{N,T} Tuple{Vararg{T,N}}
330330
(::Type{Array{T,1}}){T}() = Array{T,1}(0)
331331
(::Type{Array{T,2}}){T}() = Array{T,2}(0, 0)
332332

333-
# TODO: possibly turn these into deprecations
334-
Array{T,N}(::Type{T}, d::NTuple{N,Int}) = Array{T,N}(d)
335-
Array{T}(::Type{T}, d::Int...) = Array(T, d)
336-
Array{T}(::Type{T}, m::Int) = Array{T,1}(m)
337-
Array{T}(::Type{T}, m::Int,n::Int) = Array{T,2}(m,n)
338-
Array{T}(::Type{T}, m::Int,n::Int,o::Int) = Array{T,3}(m,n,o)
339-
340333
# primitive Symbol constructors
341334
function Symbol(s::String)
342335
return ccall(:jl_symbol_n, Ref{Symbol}, (Ptr{UInt8}, Int),

base/deprecated.jl

+7
Original file line numberDiff line numberDiff line change
@@ -1540,4 +1540,11 @@ unsafe_wrap(::Type{String}, p::Cstring, len::Integer, own::Bool=false) =
15401540
# Rename LibGit2.GitAnyObject to LibGit2.GitUnknownObject (part of #19839)
15411541
eval(LibGit2, :(Base.@deprecate_binding GitAnyObject GitUnknownObject))
15421542

1543+
# Deprecate Array(T, dims...) in favor of proper type constructors
1544+
@deprecate Array{T,N}(::Type{T}, d::NTuple{N,Int}) Array{T,N}(d)
1545+
@deprecate Array{T}(::Type{T}, d::Int...) Array{T,length(d)}(d...)
1546+
@deprecate Array{T}(::Type{T}, m::Int) Array{T,1}(m)
1547+
@deprecate Array{T}(::Type{T}, m::Int,n::Int) Array{T,2}(m,n)
1548+
@deprecate Array{T}(::Type{T}, m::Int,n::Int,o::Int) Array{T,3}(m,n,o)
1549+
15431550
# End deprecations scheduled for 0.6

base/sparse/sparsematrix.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -1390,7 +1390,7 @@ speye_scaled(diag, m::Integer, n::Integer) = speye_scaled(typeof(diag), diag, m,
13901390
function speye_scaled(T, diag, m::Integer, n::Integer)
13911391
((m < 0) || (n < 0)) && throw(ArgumentError("invalid array dimensions"))
13921392
nnz = min(m,n)
1393-
colptr = Array(Int, 1+n)
1393+
colptr = Array{Int,1}(1+n)
13941394
colptr[1:nnz+1] = 1:nnz+1
13951395
colptr[nnz+2:end] = nnz+1
13961396
SparseMatrixCSC(Int(m), Int(n), colptr, Vector{Int}(1:nnz), fill!(Vector{T}(nnz), diag))

base/sparse/sparsevector.jl

+3-3
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ end
563563

564564
function find{Tv,Ti}(x::SparseVector{Tv,Ti})
565565
numnz = nnz(x)
566-
I = Array(Ti, numnz)
566+
I = Array{Ti,1}(numnz)
567567

568568
nzind = x.nzind
569569
nzval = x.nzval
@@ -587,8 +587,8 @@ end
587587
function findnz{Tv,Ti}(x::SparseVector{Tv,Ti})
588588
numnz = nnz(x)
589589

590-
I = Array(Ti, numnz)
591-
V = Array(Tv, numnz)
590+
I = Array{Ti,1}(numnz)
591+
V = Array{Tv,1}(numnz)
592592

593593
nzind = x.nzind
594594
nzval = x.nzval

base/sysimg.jl

-6
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,6 @@ include("subarray.jl")
9999
(::Type{Matrix{T}}){T}(m::Integer, n::Integer) = Matrix{T}(Int(m), Int(n))
100100
(::Type{Matrix})(m::Integer, n::Integer) = Matrix{Any}(Int(m), Int(n))
101101

102-
# TODO: possibly turn these into deprecations
103-
Array{T}(::Type{T}, d::Integer...) = Array(T, convert(Tuple{Vararg{Int}}, d))
104-
Array{T}(::Type{T}, m::Integer) = Array{T,1}(Int(m))
105-
Array{T}(::Type{T}, m::Integer,n::Integer) = Array{T,2}(Int(m),Int(n))
106-
Array{T}(::Type{T}, m::Integer,n::Integer,o::Integer) = Array{T,3}(Int(m),Int(n),Int(o))
107-
108102
# numeric operations
109103
include("hashing.jl")
110104
include("rounding.jl")

src/julia-syntax.scm

+1-1
Original file line numberDiff line numberDiff line change
@@ -2242,7 +2242,7 @@
22422242
,.(map (lambda (v r) `(= ,v (call (top length) ,r))) lengths rv)
22432243
(scope-block
22442244
(block
2245-
(= ,result (call (core Array) ,atype ,@lengths))
2245+
(= ,result (call (curly Array ,atype) ,@lengths))
22462246
(= ,ri 1)
22472247
,(construct-loops (reverse ranges) (reverse rv) is states (reverse lengths))
22482248
,result)))))

test/test.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
@test 1234 === @test_nowarn(1234)
2828
@test 5678 === @test_warn("WARNING: foo", begin warn("foo"); 5678; end)
2929

30-
a = Array(Float64, 2, 2, 2, 2, 2)
30+
a = Array{Float64,5}(2, 2, 2, 2, 2)
3131
a[1,1,1,1,1] = 10
3232
@test a[1,1,1,1,1] == 10
3333
@test a[1,1,1,1,1] != 2

0 commit comments

Comments
 (0)