Skip to content

Commit

Permalink
bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
jishnub committed May 20, 2022
1 parent f9edfe7 commit 2313165
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 0 additions & 1 deletion base/subarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,6 @@ end
function getindex(V::FastContiguousSubArray{<:Any, 1}, i::AbstractUnitRange{Int})
@inline
@boundscheck checkbounds(V, i)
v = @view V.parent[V.offset1 .+ UnitRange(i)]
out = similar(V, axes(i))
li = length(i)
if li > 0
Expand Down
4 changes: 4 additions & 0 deletions test/subarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,10 @@ end
c1 = a12[ind1]
@test (c1[axes(c1,1)] = a12[ind1]; c1) == (c1[:] = a12[ind1]; c1) == a12[ind1]

inds1 = Base.IdentityUnitRange(Base.OneTo(4))
c1 = @view a1[inds1]
@test (c1[eachindex(c1)] = @view(a12[inds1]); c1) == @view(a12[inds1])

ind2 = 2:2:8
d1 = a12[ind2]
@test (d1[axes(d1,1)] = a12[ind2]; d1) == (d1[:] = a12[ind2]; d1) == a12[ind2]
Expand Down

0 comments on commit 2313165

Please sign in to comment.