From c3fd3d41250c0c386345925530641c602253c84d Mon Sep 17 00:00:00 2001 From: Jake Bolewski Date: Thu, 10 Sep 2015 23:34:09 -0400 Subject: [PATCH] remove _oldstyle_array_vcat_ --- base/abstractarray.jl | 41 +++++------------------------------------ test/abstractarray.jl | 19 ------------------- test/arrayops.jl | 16 +++++++--------- 3 files changed, 12 insertions(+), 64 deletions(-) diff --git a/base/abstractarray.jl b/base/abstractarray.jl index f202fe6e7067ce..e90a61dea3bffe 100644 --- a/base/abstractarray.jl +++ b/base/abstractarray.jl @@ -12,42 +12,11 @@ typealias RangeIndex Union{Int, Range{Int}, UnitRange{Int}, Colon} vect() = Array(Any, 0) vect{T}(X::T...) = T[ X[i] for i=1:length(X) ] -const _oldstyle_array_vcat_ = true - -if _oldstyle_array_vcat_ - function oldstyle_vcat_warning(n::Int) - if n == 1 - before = "[a]" - after = "collect(a)" - elseif n == 2 - before = "[a,b]" - after = "[a;b]" - else - before = "[a,b,...]" - after = "[a;b;...]" - end - depwarn("$before concatenation is deprecated; use $after instead", :vect) - end - function vect(A::AbstractArray...) - oldstyle_vcat_warning(length(A)) - vcat(A...) - end - function vect(X...) - for a in X - if typeof(a) <: AbstractArray - oldstyle_vcat_warning(length(X)) - break - end - end - vcat(X...) - end -else - function vect(X...) - T = promote_typeof(X...) - #T[ X[i] for i=1:length(X) ] - # TODO: this is currently much faster. should figure out why. not clear. - copy!(Array(T,length(X)), X) - end +function vect(X...) + T = promote_typeof(X...) + #T[ X[i] for i=1:length(X) ] + # TODO: this is currently much faster. should figure out why. not clear. + copy!(Array(T,length(X)), X) end size{T,n}(t::AbstractArray{T,n}, d) = d <= n ? size(t)[d] : 1 diff --git a/test/abstractarray.jl b/test/abstractarray.jl index 58503c6cde14a0..7df2049bfb975e 100644 --- a/test/abstractarray.jl +++ b/test/abstractarray.jl @@ -434,24 +434,6 @@ function test_UInt_indexing(::Type{TestAbstractArray}) end end -function test_vcat_depwarn(::Type{TestAbstractArray}) - if (Base.JLOptions()).depwarn > 1 - @test_throws ErrorException [1:10] - @test_throws ErrorException [[1, 2], [3, 4]] - @test_throws ErrorException [[1, 2], [3, 4], [5, 6]] - else - olderr = STDERR - try - rd, wr = redirect_stderr() - @test [1:10] == [1:10...] - @test [[1, 2], [3, 4]] == [1, 2, 3, 4] - @test [[1, 2], [3, 4], [5, 6]] == [1, 2, 3, 4, 5, 6] - finally - redirect_stderr(olderr) - end - end -end - #----- run tests -------------------------------------------------------------# for T in (T24Linear, TSlow), shape in ((24,), (2, 12), (2,3,4), (1,2,3,4), (4,3,2,1)) @@ -470,4 +452,3 @@ test_ind2sub(TestAbstractArray) test_map(TestAbstractArray) test_map_promote(TestAbstractArray) test_UInt_indexing(TestAbstractArray) -test_vcat_depwarn(TestAbstractArray) diff --git a/test/arrayops.jl b/test/arrayops.jl index b949bcc77dbb20..1bd7ca00565c60 100644 --- a/test/arrayops.jl +++ b/test/arrayops.jl @@ -231,15 +231,13 @@ for i = 1:length(X) @test X[i] === Y[i] end _array_equiv(a,b) = eltype(a) == eltype(b) && a == b @test _array_equiv(UInt8[1:3;4], [0x1,0x2,0x3,0x4]) -if !Base._oldstyle_array_vcat_ - @test_throws MethodError UInt8[1:3] - @test_throws MethodError UInt8[1:3,] - @test_throws MethodError UInt8[1:3,4:6] - a = Array(UnitRange{Int},1); a[1] = 1:3 - @test _array_equiv([1:3,], a) - a = Array(UnitRange{Int},2); a[1] = 1:3; a[2] = 4:6 - @test _array_equiv([1:3,4:6], a) -end +@test_throws MethodError UInt8[1:3] +@test_throws MethodError UInt8[1:3,] +@test_throws MethodError UInt8[1:3,4:6] +a = Array(UnitRange{Int},1); a[1] = 1:3 +@test _array_equiv([1:3,], a) +a = Array(UnitRange{Int},2); a[1] = 1:3; a[2] = 4:6 +@test _array_equiv([1:3,4:6], a) # typed hvcat let X = Float64[1 2 3; 4 5 6]