Skip to content

Commit

Permalink
Fix the trait for SubArrays
Browse files Browse the repository at this point in the history
  • Loading branch information
avik-pal committed Nov 24, 2023
1 parent 770f141 commit 8536ca4
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/MaybeInplace.jl
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ struct CanSetindex <: AbstractMaybeSetindex end

setindex_trait(::Number) = CannotSetindex()
setindex_trait(::Array) = CanSetindex()
setindex_trait(A::SubArray) = setindex_trait(parent(A))
# In recent versions of Julia, this function has a type stable return type even without
# overloading for sutom array types
setindex_trait(A) = ifelse(can_setindex(A), CanSetindex(), CannotSetindex())
Expand Down

0 comments on commit 8536ca4

Please sign in to comment.