Skip to content

Commit 991ba01

Browse files
Merge pull request #126 from Gregstrq/arraypartition_eltype
Fixes #125
2 parents b869b88 + 1638362 commit 991ba01

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/array_partition.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ end
77
ArrayPartition(x...) = ArrayPartition((x...,))
88

99
function ArrayPartition(x::S, ::Type{Val{copy_x}}=Val{false}) where {S<:Tuple,copy_x}
10-
T = promote_type(eltype.(x)...)
10+
T = promote_type(recursive_bottom_eltype.(x)...)
1111
if copy_x
1212
return ArrayPartition{T,S}(copy.(x))
1313
else
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
using Test, RecursiveArrayTools, StaticArrays
2+
3+
p = ArrayPartition((zeros(Float32, 2), zeros(SMatrix{2,2, Int64},2), zeros(SVector{3, Float64}, 2)))
4+
@test eltype(p)==Float64
5+
@test recursive_bottom_eltype(p)==Float64
6+
@test recursive_unitless_eltype(p)==Float64
7+
@test recursive_unitless_bottom_eltype(p)==Float64
8+
9+
p2 = similar(p)
10+
@test typeof(p2)==typeof(p)

0 commit comments

Comments
 (0)