diff --git a/Project.toml b/Project.toml index 89386a84..cc3ebcbe 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "OffsetArrays" uuid = "6fe1bfb0-de20-5000-8ca7-80f57d26f881" -version = "1.12.0" +version = "1.12.1" [deps] Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e" diff --git a/src/OffsetArrays.jl b/src/OffsetArrays.jl index 1a39c22c..b35ecae4 100644 --- a/src/OffsetArrays.jl +++ b/src/OffsetArrays.jl @@ -626,7 +626,7 @@ function Base.replace_in_print_matrix(A::OffsetArray{<:Any,1}, i::Integer, j::In end # Actual unsafe_wrap implementation -@inline function _unsafe_wrap(pointer::Ptr{T}, inds::NTuple{N}; own = false, kw...) where {T,N} +@inline function _unsafe_wrap(pointer::Ptr{T}, inds::NTuple{N, OffsetAxisKnownLength}; own = false, kw...) where {T,N} _checkindices(N, inds, "indices") AA = Base.unsafe_wrap(Array, pointer, map(_indexlength, inds); own=own) OffsetArray{T, N, typeof(AA)}(AA, map(_indexoffset, inds); kw...) diff --git a/test/runtests.jl b/test/runtests.jl index 078a95d3..f6327287 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -2678,11 +2678,6 @@ include("origin.jl") @test OffsetArrays._addoffset(3:2:9, 1) == 4:2:10 end -@info "Following deprecations are expected" -@testset "deprecations" begin - A = reshape(collect(1:9), 3, 3) - @test OffsetArrays.centered(A, RoundDown) == OffsetArrays.centered(A, RoundUp) -end @testset "unsafe_wrap" begin p = Ptr{UInt16}(Libc.malloc(2*3*4*2)) @test unsafe_wrap(OffsetArray, p, 2, 3, 4) isa OffsetArray{UInt16, 3} @@ -2697,5 +2692,12 @@ end @test unsafe_wrap(OffsetArray, p, 2:3, 3:5, 4:7) isa OffsetArray{UInt8, 3} @test unsafe_wrap(OffsetArray, p, (2:3, 3:5, 4:7)) isa OffsetArray{UInt8, 3} @test unsafe_wrap(OffsetVector, p, 1:(2*3*4) .- 1) isa OffsetVector{UInt8} - @test unsafe_wrap(OffsetMatrix, p, 1:(2*3) .+ 6, 4:7; own = true) isa OffsetMatrix{UInt8} + @test unsafe_wrap(OffsetMatrix, p, 1:(2*3) .+ 6, 4:7) isa OffsetMatrix{UInt8} + @test unsafe_wrap(OffsetMatrix, p, -5:5, Base.OneTo(3); own = true) isa OffsetMatrix{UInt8} +end + +@info "Following deprecations are expected" +@testset "deprecations" begin + A = reshape(collect(1:9), 3, 3) + @test OffsetArrays.centered(A, RoundDown) == OffsetArrays.centered(A, RoundUp) end