@@ -113,15 +113,15 @@ function Base.IndexStyle(::Type{S}) where {S<:StructArray}
113113 index_type (S) === Int ? IndexLinear () : IndexCartesian ()
114114end
115115
116- function _undef_array (:: Type{T} , sz; unwrap = t -> false ) where {T}
116+ function _undef_array (:: Type{T} , sz; unwrap:: F = alwaysfalse ) where {T, F }
117117 if unwrap (T)
118118 return StructArray {T} (undef, sz; unwrap = unwrap)
119119 else
120120 return Array {T} (undef, sz)
121121 end
122122end
123123
124- function _similar (v:: AbstractArray , :: Type{Z} ; unwrap = t -> false ) where {Z}
124+ function _similar (v:: AbstractArray , :: Type{Z} ; unwrap:: F = alwaysfalse ) where {Z, F }
125125 if unwrap (Z)
126126 return buildfromschema (typ -> _similar (v, typ; unwrap = unwrap), Z)
127127 else
@@ -149,12 +149,12 @@ julia> StructArray{ComplexF64}(undef, (2,3))
149149"""
150150StructArray (:: Base.UndefInitializer , sz:: Dims )
151151
152- function StructArray {T} (:: Base.UndefInitializer , sz:: Dims ; unwrap = t -> false ) where {T}
152+ function StructArray {T} (:: Base.UndefInitializer , sz:: Dims ; unwrap:: F = alwaysfalse ) where {T, F }
153153 buildfromschema (typ -> _undef_array (typ, sz; unwrap = unwrap), T)
154154end
155- StructArray {T} (u:: Base.UndefInitializer , d:: Integer... ; unwrap = t -> false ) where {T} = StructArray {T} (u, convert (Dims, d); unwrap = unwrap)
155+ StructArray {T} (u:: Base.UndefInitializer , d:: Integer... ; unwrap:: F = alwaysfalse ) where {T, F } = StructArray {T} (u, convert (Dims, d); unwrap = unwrap)
156156
157- function similar_structarray (v:: AbstractArray , :: Type{Z} ; unwrap = t -> false ) where {Z}
157+ function similar_structarray (v:: AbstractArray , :: Type{Z} ; unwrap:: F = alwaysfalse ) where {Z, F }
158158 buildfromschema (typ -> _similar (v, typ; unwrap = unwrap), Z)
159159end
160160
@@ -203,11 +203,11 @@ julia> StructArray((1, Complex(i, j)) for i = 1:3, j = 2:4; unwrap = T -> !(T<:R
203203 (1, 3+2im) (1, 3+3im) (1, 3+4im)
204204```
205205"""
206- function StructArray (v; unwrap = t -> false ):: StructArray
206+ function StructArray (v; unwrap:: F = alwaysfalse ):: StructArray where {F}
207207 collect_structarray (v; initializer = StructArrayInitializer (unwrap))
208208end
209209
210- function StructArray (v:: AbstractArray{T} ; unwrap = t -> false ) where {T}
210+ function StructArray (v:: AbstractArray{T} ; unwrap:: F = alwaysfalse ) where {T, F }
211211 s = similar_structarray (v, T; unwrap = unwrap)
212212 for i in eachindex (v)
213213 @inbounds s[i] = v[i]
0 commit comments