From 6a91ea3577a50e97ed65a404cfed5fe7f298cfe2 Mon Sep 17 00:00:00 2001 From: Tim Holy Date: Sun, 1 Jul 2018 20:52:15 -0500 Subject: [PATCH] Update to Julia 0.7 --- .travis.yml | 1 - REQUIRE | 2 +- appveyor.yml | 2 -- src/MappedArrays.jl | 10 +++++----- test/runtests.jl | 14 +++++++------- 5 files changed, 13 insertions(+), 16 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9d49456..477c979 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,6 @@ os: - linux - osx julia: - - 0.6 - nightly notifications: email: false diff --git a/REQUIRE b/REQUIRE index 137767a..cdbb2dc 100644 --- a/REQUIRE +++ b/REQUIRE @@ -1 +1 @@ -julia 0.6 +julia 0.7-alpha diff --git a/appveyor.yml b/appveyor.yml index e37cef1..390c623 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,7 +1,5 @@ environment: matrix: - - JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.6/julia-0.6-latest-win32.exe" - - JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.6/julia-0.6-latest-win64.exe" - JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe" - JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe" diff --git a/src/MappedArrays.jl b/src/MappedArrays.jl index e8cc7f8..1cc1bf7 100644 --- a/src/MappedArrays.jl +++ b/src/MappedArrays.jl @@ -22,7 +22,7 @@ struct ReadonlyMultiMappedArray{T,N,AAs<:Tuple{Vararg{AbstractArray}},F} <: Abst data::AAs function ReadonlyMultiMappedArray{T,N,AAs,F}(f, data) where {T,N,AAs,F} - inds = indices(first(data)) + inds = axes(first(data)) checkinds(inds, Base.tail(data)...) new(f, data) end @@ -30,8 +30,8 @@ end # TODO: remove @inline for 0.7 @inline function checkinds(inds, A, As...) - @noinline throw1(i, j) = throw(DimensionMismatch("arrays do not all have the same indices (got $i and $j)")) - iA = indices(A) + @noinline throw1(i, j) = throw(DimensionMismatch("arrays do not all have the same axes (got $i and $j)")) + iA = axes(A) iA == inds || throw1(inds, iA) checkinds(inds, As...) end @@ -77,8 +77,8 @@ of_eltype(::T, data::AbstractArray{S}) where {S,T} = of_eltype(T, data) Base.parent(A::AbstractMappedArray) = A.data Base.size(A::AbstractMappedArray) = size(A.data) Base.size(A::ReadonlyMultiMappedArray) = size(first(A.data)) -Base.indices(A::AbstractMappedArray) = indices(A.data) -Base.indices(A::ReadonlyMultiMappedArray) = indices(first(A.data)) +Base.axes(A::AbstractMappedArray) = axes(A.data) +Base.axes(A::ReadonlyMultiMappedArray) = axes(first(A.data)) parenttype(::Type{ReadonlyMappedArray{T,N,A,F}}) where {T,N,A,F} = A parenttype(::Type{MappedArray{T,N,A,F,Finv}}) where {T,N,A,F,Finv} = A parenttype(::Type{ReadonlyMultiMappedArray{T,N,A,F}}) where {T,N,A,F} = A diff --git a/test/runtests.jl b/test/runtests.jl index 8961c6d..a84483b 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,5 +1,5 @@ using MappedArrays -using Base.Test +using Test @test isempty(detect_ambiguities(MappedArrays, Base, Core)) @@ -20,7 +20,7 @@ b = @inferred(mappedarray(sqrt, a)) b = mappedarray(sqrt, a') @test isa(eachindex(b), AbstractUnitRange) b = mappedarray(sqrt, s) -@test isa(eachindex(b), CartesianRange) +@test isa(eachindex(b), CartesianIndices) c = @inferred(mappedarray((sqrt, x->x*x), a)) @test parent(c) === a @@ -35,7 +35,7 @@ c[3] = 2 b = @inferred(mappedarray(sqrt, a')) @test isa(eachindex(b), AbstractUnitRange) c = @inferred(mappedarray((sqrt, x->x*x), s)) -@test isa(eachindex(c), CartesianRange) +@test isa(eachindex(c), CartesianIndices) sb = similar(b) @test isa(sb, Array{Float64}) @@ -65,7 +65,7 @@ b = @inferred(of_eltype(0.0, a)) # OffsetArrays a = OffsetArray(randn(5), -2:2) aabs = mappedarray(abs, a) -@test indices(aabs) == (-2:2,) +@test axes(aabs) == (-2:2,) for i = -2:2 @test aabs[i] == abs(a[i]) end @@ -84,13 +84,13 @@ astr = @inferred(mappedarray(uppercase, ["abc", "def"])) # multiple arrays a = reshape(1:6, 2, 3) -@test @inferred(indices(a)) == (Base.OneTo(2), Base.OneTo(3)) # prevents error on 0.7 +@test @inferred(axes(a)) == (Base.OneTo(2), Base.OneTo(3)) # prevents error on 0.7 b = fill(10.0f0, 2, 3) M = @inferred(mappedarray(+, a, b)) @test @inferred(eltype(M)) == Float32 @test @inferred(IndexStyle(M)) == IndexLinear() @test @inferred(IndexStyle(typeof(M))) == IndexLinear() -@test @inferred(indices(M)) === indices(a) +@test @inferred(axes(M)) === axes(a) @test M == a + b @test @inferred(M[1]) === 11.0f0 @test @inferred(M[CartesianIndex(1, 1)]) === 11.0f0 @@ -100,7 +100,7 @@ M = @inferred(mappedarray(+, c, b)) @test @inferred(eltype(M)) == Float32 @test @inferred(IndexStyle(M)) == IndexCartesian() @test @inferred(IndexStyle(typeof(M))) == IndexCartesian() -@test @inferred(indices(M)) === indices(c) +@test @inferred(axes(M)) === axes(c) @test M == c + b @test @inferred(M[1]) === 11.0f0 @test @inferred(M[CartesianIndex(1, 1)]) === 11.0f0