|  | 
| 50 | 50 | end | 
| 51 | 51 | 
 | 
| 52 | 52 | @testset "indexstyle" begin | 
| 53 |  | -    @inferred IndexStyle(StructArray(a=rand(10,10), b=view(rand(100,100), 1:10, 1:10))) | 
| 54 | 53 |     s = StructArray(a=rand(10,10), b=view(rand(100,100), 1:10, 1:10)) | 
| 55 | 54 |     T = typeof(s) | 
| 56 | 55 |     @test IndexStyle(T) === IndexCartesian() | 
| 57 |  | -    @test StructArrays.index_type(T) == CartesianIndex{2} | 
|  | 56 | +    @test StructArrays.index_type(s) == CartesianIndex{2} | 
| 58 | 57 |     @test s[100] == s[10, 10] == (a=s.a[10,10], b=s.b[10,10]) | 
| 59 | 58 |     s[100] = (a=1, b=1) | 
| 60 | 59 |     @test s[100] == s[10, 10] == (a=1, b=1) | 
|  | 
| 63 | 62 |     @inferred IndexStyle(StructArray(a=rand(10,10), b=rand(10,10))) | 
| 64 | 63 |     s = StructArray(a=rand(10,10), b=rand(10,10)) | 
| 65 | 64 |     T = typeof(s) | 
| 66 |  | -    @test IndexStyle(T) === IndexLinear() | 
| 67 |  | -    @test StructArrays.index_type(T) == Int | 
|  | 65 | +    @test StructArrays.index_type(s) == Int | 
|  | 66 | +    @inferred IndexStyle(s) | 
| 68 | 67 |     @test s[100] == s[10, 10] == (a=s.a[10,10], b=s.b[10,10]) | 
| 69 | 68 |     s[100] = (a=1, b=1) | 
| 70 | 69 |     @test s[100] == s[10, 10] == (a=1, b=1) | 
| 71 | 70 |     s[10, 10] = (a=0, b=0) | 
| 72 | 71 |     @test s[100] == s[10, 10] == (a=0, b=0) | 
| 73 | 72 | 
 | 
| 74 | 73 |     # inference for "many" types, both for linear ad Cartesian indexing | 
| 75 |  | -    @inferred StructArrays.index_type(NTuple{2, Vector{Float64}}) | 
| 76 |  | -    @inferred StructArrays.index_type(NTuple{3, Matrix{Float64}}) | 
| 77 |  | -    @inferred StructArrays.index_type(NTuple{4, Array{Float64, 3}}) | 
|  | 74 | +    @inferred StructArrays.index_type(ntuple(_ -> rand(5), 2)) | 
|  | 75 | +    @inferred StructArrays.index_type(ntuple(_ -> rand(5, 5), 3)) | 
|  | 76 | +    @inferred StructArrays.index_type(ntuple(_ -> rand(5, 5, 5), 4)) | 
|  | 77 | + | 
|  | 78 | +    @inferred StructArrays.index_type(ntuple(_ -> view(rand(5), 1:3), 2)) | 
|  | 79 | +    @inferred StructArrays.index_type(ntuple(_ -> view(rand(5, 5), 1:3, 1:2), 3)) | 
|  | 80 | +    @inferred StructArrays.index_type(ntuple(_ -> view(rand(5, 5, 5), 1:3, 1:2, 1:4), 4)) | 
| 78 | 81 | 
 | 
| 79 |  | -    @inferred StructArrays.index_type(NTuple{2, SubArray{Float64, 1, Array{Float64, 2}, Tuple{Base.Slice{Base.OneTo{Int64}}, Int64}, true}}) | 
| 80 |  | -    @inferred StructArrays.index_type(NTuple{3, SubArray{Float64, 1, Array{Float64, 2}, Tuple{Base.Slice{Base.OneTo{Int64}}, Int64}, true}}) | 
| 81 |  | -    @inferred StructArrays.index_type(NTuple{4, SubArray{Float64, 1, Array{Float64, 2}, Tuple{Base.Slice{Base.OneTo{Int64}}, Int64}, true}}) | 
|  | 82 | +    @inferred StructArrays.index_type(ntuple(n -> n == 1 ? rand(5, 5) : view(rand(5, 5), 1:2, 1:3), 5)) | 
|  | 83 | +    @inferred IndexStyle(StructArray(a=rand(10,10), b=view(rand(100,100), 1:10, 1:10))) | 
| 82 | 84 | end | 
| 83 | 85 | 
 | 
| 84 | 86 | @testset "replace_storage" begin | 
|  | 
0 commit comments