@@ -131,7 +131,7 @@ function similar_type(::Type{A}, ::Type{T}, S::Size) where {T,A<:FieldArray}
131
131
# FieldArrays with parametric `eltype` would be adapted to the new `eltype` automatically.
132
132
A′ = Base. typeintersect (base_type (A), StaticArray{Tuple{Tuple (S)... },T,length (S)})
133
133
# But extra parameters are disallowed here. Also we check `fieldtypes` to make sure the result is valid.
134
- isconcretetype (A′) && fieldtypes (A′) === ntuple (Returns (T) , Val (prod (S))) && return A′
134
+ isconcretetype (A′) && fieldtypes (A′) === ntuple (_ -> T , Val (prod (S))) && return A′
135
135
# Otherwise, we fallback to `S/MArray` based on it's mutability.
136
136
if ismutabletype (A)
137
137
return mutable_similar_type (T, S, length_val (S))
@@ -141,7 +141,12 @@ function similar_type(::Type{A}, ::Type{T}, S::Size) where {T,A<:FieldArray}
141
141
end
142
142
143
143
# return `Union{}` for Union Type. Otherwise return the constructor with no parameters.
144
- @pure base_type (@nospecialize (T:: Type )) = (T′ = Base. unwrap_unionall (T); T′ isa DataType ? T′. name. wrapper : Union{})
145
- if VERSION < v " 1.7"
146
- @pure ismutabletype (@nospecialize (T:: Type )) = (T′ = Base. unwrap_unionall (T); T′ isa DataType && T′. mutable)
144
+ @pure base_type (@nospecialize (T:: Type )) = (T′ = Base. unwrap_unionall (T);
145
+ T′ isa DataType ? T′. name. wrapper : Union{})
146
+ if VERSION < v " 1.8"
147
+ fieldtypes (:: Type{T} ) where {T} = ntuple (i -> fieldtype (T, i), Val (fieldcount (T)))
148
+ @eval @pure function ismutabletype (@nospecialize (T:: Type ))
149
+ T′ = Base. unwrap_unionall (T)
150
+ T′ isa DataType && $ (VERSION < v " 1.7" ? :(T′. mutable) : :(T′. name. flags & 0x2 == 0x2 ))
151
+ end
147
152
end
0 commit comments