Skip to content

Commit fbbb8ee

Browse files
authored
Merge pull request #68 from piever/pv/compat
make reshaping backward compatible
2 parents a6d5b6a + ccee6d6 commit fbbb8ee

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/structarray.jl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,13 @@ function Base.reshape(s::StructArray{T}, d::Dims) where {T}
189189
StructArray{T}(map(x -> reshape(x, d), fieldarrays(s)))
190190
end
191191

192-
for typ in [:Integer, :(Base.OneTo), :UnitRange, :(Base.IdentityUnitRange)]
192+
@static if !isdefined(Base, :IdentityUnitRange)
193+
const IdentityUnitRange = Base.Slice
194+
else
195+
using Base: IdentityUnitRange
196+
end
197+
198+
for typ in [:Integer, :(Base.OneTo), :UnitRange, :IdentityUnitRange]
193199
@eval function Base.reshape(s::StructArray{T}, d::Tuple{$typ, Vararg{$typ}}) where {T}
194200
StructArray{T}(map(x -> reshape(x, d), fieldarrays(s)))
195201
end

0 commit comments

Comments
 (0)