Skip to content

Commit a367268

Browse files
Fix deprecations
1 parent 0ab5bd4 commit a367268

File tree

8 files changed

+14
-22
lines changed

8 files changed

+14
-22
lines changed

src/array_partition.jl

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ end
44

55
## constructors
66

7-
ArrayPartition(x...) = ArrayPartition((x...))
7+
ArrayPartition(x...) = ArrayPartition((x...,))
88

99
function ArrayPartition(x::S, ::Type{Val{copy_x}}=Val{false}) where {S<:Tuple,copy_x}
1010
T = promote_type(eltype.(x)...)
@@ -145,12 +145,8 @@ end
145145
## indexing
146146

147147
# Interface for the linear indexing. This is just a view of the underlying nested structure
148-
@static if VERSION >= v"0.7-"
149-
@inline Base.firstindex(A::ArrayPartition) = 1
150-
@inline Base.lastindex(A::ArrayPartition) = length(A)
151-
else
152-
@inline Base.endof(A::ArrayPartition) = length(A)
153-
end
148+
@inline Base.firstindex(A::ArrayPartition) = 1
149+
@inline Base.lastindex(A::ArrayPartition) = length(A)
154150

155151
@inline function Base.getindex(A::ArrayPartition, i::Int)
156152
@boundscheck checkbounds(A, i)

src/utils.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,9 @@ recursive_unitless_bottom_eltype(a) = recursive_unitless_bottom_eltype(eltype(a)
100100
recursive_unitless_bottom_eltype(a::Type{T}) where {T<:Number} = typeof(one(eltype(a)))
101101

102102
Base.@pure recursive_unitless_eltype(a) = recursive_unitless_eltype(eltype(a))
103-
Base.@pure recursive_unitless_eltype{T<:StaticArray}(a::Type{T}) = similar_type(a,recursive_unitless_eltype(eltype(a)))
104-
Base.@pure recursive_unitless_eltype{T<:Array}(a::Type{T}) = Array{recursive_unitless_eltype(eltype(a)),ndims(a)}
105-
Base.@pure recursive_unitless_eltype{T<:Number}(a::Type{T}) = typeof(one(eltype(a)))
103+
Base.@pure recursive_unitless_eltype(a::Type{T}) where {T<:StaticArray} = similar_type(a,recursive_unitless_eltype(eltype(a)))
104+
Base.@pure recursive_unitless_eltype(a::Type{T}) where {T<:Array} = Array{recursive_unitless_eltype(eltype(a)),ndims(a)}
105+
Base.@pure recursive_unitless_eltype(a::Type{T}) where {T<:Number} = typeof(one(eltype(a)))
106106

107107
recursive_mean(x...) = mean(x...)
108108
function recursive_mean(vecvec::Vector{T}) where T<:AbstractArray

src/vector_of_array.jl

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,8 @@ DiffEqArray(vec::AbstractVector,ts::AbstractVector) = DiffEqArray(vec, ts, (size
1818

1919

2020
# Interface for the linear indexing. This is just a view of the underlying nested structure
21-
@static if VERSION >= v"0.7-"
22-
@inline Base.firstindex(VA::AbstractVectorOfArray) = firstindex(VA.u)
23-
@inline Base.lastindex(VA::AbstractVectorOfArray) = lastindex(VA.u)
24-
else
25-
@inline Base.endof(VA::AbstractVectorOfArray) = endof(VA.u)
26-
end
21+
@inline Base.firstindex(VA::AbstractVectorOfArray) = firstindex(VA.u)
22+
@inline Base.lastindex(VA::AbstractVectorOfArray) = lastindex(VA.u)
2723

2824
@inline Base.length(VA::AbstractVectorOfArray) = length(VA.u)
2925
@inline Base.eachindex(VA::AbstractVectorOfArray) = Base.OneTo(length(VA.u))

test/copy_static_array_test.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using Base.Test, RecursiveArrayTools, StaticArrays
1+
using Test, RecursiveArrayTools, StaticArrays
22

33
struct ImmutableFV <: FieldVector{2,Float64}
44
a::Float64

test/interface_tests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using RecursiveArrayTools, Base.Test
1+
using RecursiveArrayTools, Test
22

33
recs = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
44
testva = VectorOfArray(recs)

test/partitions_test.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using RecursiveArrayTools, Base.Test
1+
using RecursiveArrayTools, Test
22
A = (rand(5),rand(5))
33
p = ArrayPartition(A)
44
@test (p.x[1][1],p.x[2][1]) == (p[1],p[6])

test/runtests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
using RecursiveArrayTools
2-
using Base.Test
2+
using Test
33

44
tic()
55
@time @testset "Utils Tests" begin include("utils_test.jl") end

test/utils_test.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using RecursiveArrayTools, Unitful, StaticArrays
2-
using Base.Test
2+
using Test
33

4-
t = collect(linspace(0,10,200))
4+
t = collect(range(0, stop=10, length=200))
55
randomized = VectorOfArray([.01randn(2) for i in 1:10])
66
data = convert(Array,randomized)
77
@test typeof(data) <: Matrix{Float64}

0 commit comments

Comments
 (0)