@@ -9,7 +9,8 @@ like `copy` on arrays of scalars.
99function recursivecopy (a)
1010 deepcopy (a)
1111end
12- recursivecopy (a:: Union{SVector,SMatrix,SArray,Number} ) = copy (a)
12+ recursivecopy (a:: Union {StaticArraysCore. SVector,StaticArraysCore. SMatrix,
13+ StaticArraysCore. SArray,Number}) = copy (a)
1314function recursivecopy (a:: AbstractArray{T,N} ) where {T<: Number ,N}
1415 copy (a)
1516end
@@ -33,7 +34,7 @@ like `copy!` on arrays of scalars.
3334"""
3435function recursivecopy! end
3536
36- function recursivecopy! (b:: AbstractArray{T,N} ,a:: AbstractArray{T2,N} ) where {T<: StaticArray ,T2<: StaticArray ,N}
37+ function recursivecopy! (b:: AbstractArray{T,N} ,a:: AbstractArray{T2,N} ) where {T<: StaticArraysCore. StaticArray ,T2<: StaticArraysCore. StaticArray ,N}
3738 @inbounds for i in eachindex (a)
3839 # TODO : Check for `setindex!`` and use `copy!(b[i],a[i])` or `b[i] = a[i]`, see #19
3940 b[i] = copy (a[i])
@@ -68,13 +69,13 @@ A recursive `fill!` function.
6869"""
6970function recursivefill! end
7071
71- function recursivefill! (b:: AbstractArray{T,N} ,a:: T2 ) where {T<: StaticArray ,T2<: StaticArray ,N}
72+ function recursivefill! (b:: AbstractArray{T,N} ,a:: T2 ) where {T<: StaticArraysCore. StaticArray ,T2<: StaticArraysCore. StaticArray ,N}
7273 @inbounds for i in eachindex (b)
7374 b[i] = copy (a)
7475 end
7576end
7677
77- function recursivefill! (b:: AbstractArray{T,N} ,a:: T2 ) where {T<: SArray ,T2<: Union{Number,Bool} ,N}
78+ function recursivefill! (b:: AbstractArray{T,N} ,a:: T2 ) where {T<: StaticArraysCore. SArray ,T2<: Union{Number,Bool} ,N}
7879 @inbounds for i in eachindex (b)
7980 b[i] = fill (a, typeof (b[i]))
8081 end
@@ -88,7 +89,7 @@ function recursivefill!(b::AbstractArray{T,N},a::T2) where {T<:Union{Number,Bool
8889 fill! (b, a)
8990end
9091
91- function recursivefill! (b:: AbstractArray{T,N} ,a) where {T<: MArray ,N}
92+ function recursivefill! (b:: AbstractArray{T,N} ,a) where {T<: StaticArraysCore. MArray ,N}
9293 @inbounds for i in eachindex (b)
9394 if isassigned (b,i)
9495 recursivefill! (b[i],a)
@@ -151,7 +152,7 @@ If `i<length(x)`, it's simply a `recursivecopy!` to the `i`th element. Otherwise
151152function copyat_or_push! (a:: AbstractVector{T} ,i:: Int ,x,nc:: Type{Val{perform_copy}} = Val{true }) where {T,perform_copy}
152153 @inbounds if length (a) >= i
153154 if ! ArrayInterfaceCore. ismutable (T) || ! perform_copy
154- # TODO : Check for `setindex!`` if T <: StaticArray and use `copy!(b[i],a[i])`
155+ # TODO : Check for `setindex!`` if T <: StaticArraysCore. StaticArray and use `copy!(b[i],a[i])`
155156 # or `b[i] = a[i]`, see https://github.com/JuliaDiffEq/RecursiveArrayTools.jl/issues/19
156157 a[i] = x
157158 else
@@ -208,7 +209,15 @@ ones has a `Array{Array{Float64,N},N}`, this will return `Array{Float64,N}`.
208209"""
209210recursive_unitless_eltype (a) = recursive_unitless_eltype (eltype (a))
210211recursive_unitless_eltype (a:: Type{Any} ) = Any
211- recursive_unitless_eltype (a:: Type{T} ) where {T<: StaticArray } = similar_type (a,recursive_unitless_eltype (eltype (a)))
212+
213+ # Should be:
214+ # recursive_unitless_eltype(a::Type{T}) where {T<:StaticArray} = similar_type(a,recursive_unitless_eltype(eltype(a)))
215+ # But missing from StaticArraysCore
216+ recursive_unitless_eltype (a:: Type{StaticArraysCore.SArray{S, T, N, L}} ) where {S, T, N, L} = StaticArraysCore. SArray{S, typeof (one (T)), N, L}
217+ recursive_unitless_eltype (a:: Type{StaticArraysCore.MArray{S, T, N, L}} ) where {S, T, N, L} = StaticArraysCore. MArray{S, typeof (one (T)), N, L}
218+ recursive_unitless_eltype (a:: Type{StaticArraysCore.SizedArray{S, T, N, M, TData}} ) where {
219+ S, T, N, M, TData} = StaticArraysCore. SizedArray{S, typeof (one (T)), N, M, TData}
220+
212221recursive_unitless_eltype (a:: Type{T} ) where {T<: Array } = Array{recursive_unitless_eltype (eltype (a)),ndims (a)}
213222recursive_unitless_eltype (a:: Type{T} ) where {T<: Number } = typeof (one (eltype (a)))
214223recursive_unitless_eltype (:: Type{<:Enum{T}} ) where T = T
0 commit comments