Skip to content

Commit 551c9e2

Browse files
authored
Type-piracy in Fill indexing (#287)
1 parent 6970e33 commit 551c9e2

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/blocklinalg.jl

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,6 @@ sub_materialize(::ArrayLayouts.OnesLayout, V, ax::Tuple{<:AbstractUnitRange,<:Bl
130130
sub_materialize(::ArrayLayouts.ZerosLayout, V, ax::Tuple{<:AbstractUnitRange,<:BlockedUnitRange}) =
131131
Zeros{eltype(V)}(ax)
132132

133-
@propagate_inbounds Base.view(A::FillArrays.AbstractFill, I::Union{Real, AbstractArray, Block}...) =
134-
FillArrays._fill_getindex(A, Base.to_indices(A, I)...)
135-
136133
conjlayout(::Type{T}, ::BlockLayout{MLAY,BLAY}) where {T<:Complex,MLAY,BLAY} = BlockLayout{MLAY,typeof(conjlayout(T,BLAY()))}()
137134
conjlayout(::Type{T}, ::BlockLayout{MLAY,BLAY}) where {T<:Real,MLAY,BLAY} = BlockLayout{MLAY,BLAY}()
138135

test/test_blockviews.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,15 @@ bview(a, b) = Base.invoke(view, Tuple{AbstractArray,Any}, a, b)
9393
@test view(A, Block(1), 2, 1) == A[1:1,2,1]
9494
@test view(A, 1, Block(2), 1) == A[1,2:3,1]
9595
@test view(A, 1, 2, Block(2)) == A[1,2,2:3]
96+
97+
@testset "Fill arrays" begin
98+
f = Fill(3, 4, 5)
99+
@test view(f, 1, 2:3) === Fill(3, 2)
100+
@test view(f, Block(1), 1:1) === Fill(3, 4, 1)
101+
@test view(f, Block(1), 2) === Fill(3, 4)
102+
@test view(f, 1, Block(1)) === Fill(3, 5)
103+
@test view(f, 1:2, Block(1)) === Fill(3, 2, 5)
104+
end
96105
end
97106

98107
@testset "block view pointers" begin

0 commit comments

Comments
 (0)