Skip to content

Commit 7c49f8e

Browse files
committed
Account for wrappers in ismutable
1 parent 5da20c7 commit 7c49f8e

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/ArrayInterface.jl

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,23 @@ https://github.com/JuliaDiffEq/RecursiveArrayTools.jl/issues/19.
7171
"""
7272
ismutable(x) = ismutable(typeof(x))
7373

74-
ismutable(::Type{<:AbstractArray}) = true
74+
function ismutable(::Type{T}) where {T<:AbstractArray}
75+
if parent_type(T) <: T
76+
return true
77+
else
78+
return ismutable(parent_type(T))
79+
end
80+
end
7581
ismutable(::Type{<:AbstractRange}) = false
7682
ismutable(::Type{<:AbstractDict}) = true
7783
ismutable(::Type{<:Base.ImmutableDict}) = false
78-
ismutable(::Type{T}) where {T} = T.mutable
84+
function ismutable(::Type{T}) where {T}
85+
if parent_type(T) <: T
86+
return T.mutable
87+
else
88+
return ismutable(parent_type(T))
89+
end
90+
end
7991

8092
# Piracy
8193
function Base.setindex(x::AbstractArray,v,i...)

0 commit comments

Comments
 (0)