Skip to content

Commit e912b26

Browse files
committed
Merge branch 'master' of github.com:JuliaLang/julia
2 parents 1767b9a + db48dae commit e912b26

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

base/subarray.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ function translate_indexes(s::SubArray, I::Union(Real,AbstractArray)...)
202202
j = 1
203203
for i = 1:ndp
204204
t = s.indexes[i]
205-
if s.strides[j] == sp[i]
205+
if j <= nds && s.strides[j] == sp[i]
206206
#TODO: don't generate the dense vector indexes if they can be ranges
207207
if j==n && n < nds
208208
newindexes[i] = translate_linear_indexes(s, j, I[j])

test/arrayops.jl

+3
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,9 @@ sA = sub(A, 2, 1:5, 1:8)
9999
sA[2:5:end] = -1
100100
@test all(sA[2:5:end] .== -1)
101101
@test all(A[5:15:120] .== -1)
102+
sA = sub(A, 1:3, 1:5, 5)
103+
sA[1:3,1:5] = -2
104+
@test all(A[:,:,5] .== -2)
102105

103106
# slice
104107
A = reshape(1:120, 3, 5, 8)

0 commit comments

Comments
 (0)