From 8536ca409338ed31ef2141c48ffa0d697e56f085 Mon Sep 17 00:00:00 2001 From: Avik Pal Date: Fri, 24 Nov 2023 14:58:19 -0500 Subject: [PATCH] Fix the trait for SubArrays --- src/MaybeInplace.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/src/MaybeInplace.jl b/src/MaybeInplace.jl index f2c3675..162a5d1 100644 --- a/src/MaybeInplace.jl +++ b/src/MaybeInplace.jl @@ -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())