File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change 229
229
# Iterate over input indices
230
230
ind_types = inds. parameters
231
231
current_ind = ones (Int,length (linearsizes))
232
- more = linearsizes[ 1 ] != 0
232
+ more = ! isempty (exprs)
233
233
while more
234
234
exprs_tmp = [_ind (i, current_ind[i], ind_types[i]) for i = 1 : length (linearsizes)]
235
235
exprs[current_ind... ] = :(getindex (a, $ (exprs_tmp... )))
331
331
# Iterate over input indices
332
332
ind_types = inds. parameters
333
333
current_ind = ones (Int,length (ind_types))
334
- more = linearsizes[ 1 ] != 0
334
+ more = ! isempty (exprs)
335
335
while more
336
336
exprs_tmp = [_ind (i, current_ind[i], ind_types[i]) for i = 1 : length (ind_types)]
337
337
exprs[current_ind... ] = :(setindex! (a, value, $ (exprs_tmp... )))
Original file line number Diff line number Diff line change 153
153
@test b == a
154
154
end
155
155
156
+ @testset " Indexing empty arrays" begin
157
+ @test size (SVector {0} ()[:]) == (0 ,)
158
+ @test size (SMatrix {0,0} ()[:,:]) == (0 ,0 )
159
+ @test size (SMatrix {5,0} ()[1 ,:]) == (0 ,)
160
+ @test size (SMatrix {5,0} ()[:,:]) == (5 ,0 )
161
+ @test size (SMatrix {0,5} ()[:,1 ]) == (0 ,)
162
+ @test size (SMatrix {0,5} ()[:,:]) == (0 ,5 )
163
+
164
+ @test (zeros (0 )[SVector {0,Int} ()] = 0 ) == 0
165
+ @test (zeros (0 ,2 )[SVector {0,Int} (),SVector (1 )] = 0 ) == 0
166
+ @test (zeros (2 ,0 )[SVector (1 ),SVector {0,Int} ()] = 0 ) == 0
167
+ end
168
+
156
169
@testset " inferabilty of index_sizes helper" begin
157
170
# see JuliaLang/julia#21244
158
171
# it's not about inferring the correct type, but about inference throwing an error
You can’t perform that action at this time.
0 commit comments