Mercurial > repos > public > sbplib_julia
changeset 2029:1fa47cacd3dd
Fix bug in IndexStyle for ArrayComponentView
| author | Jonatan Werpers <jonatan@werpers.com> |
|---|---|
| date | Wed, 28 Jan 2026 11:00:28 +0100 |
| parents | df2cbcb7a2b1 |
| children | fecc92392156 d368ff757eb3 |
| files | src/Grids/grid.jl |
| diffstat | 1 files changed, 4 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/Grids/grid.jl Thu May 01 15:05:11 2025 +0200 +++ b/src/Grids/grid.jl Wed Jan 28 11:00:28 2026 +0100 @@ -74,10 +74,13 @@ end end +_array_type(v::ArrayComponentView) = typeof(v) +_array_type(::Type{ArrayComponentView{CT,T,D,AT,IT}}) where {CT,T,D,AT,IT} = AT + Base.size(cv::ArrayComponentView) = size(cv.v) Base.getindex(cv::ArrayComponentView, i::Int) = cv.v[i][cv.component_index...] Base.getindex(cv::ArrayComponentView, I::Vararg{Int}) = cv.v[I...][cv.component_index...] -IndexStyle(::Type{<:ArrayComponentView{<:Any,<:Any,AT}}) where AT = IndexStyle(AT) +IndexStyle(ACT::Type{ArrayComponentView}) = IndexStyle(_array_type(ACT)) # TODO: Implement `setindex!`? # TODO: Implement a more general ComponentView that can handle non-AbstractArrays.
