Skip to content

Commit fa4c02c

Browse files
authored
Use typed_hcat in typed_hvcat (#18398)
Fixes 18395
1 parent 600d363 commit fa4c02c

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

base/abstractarray.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1425,7 +1425,7 @@ function typed_hvcat{T}(::Type{T}, rows::Tuple{Vararg{Int}}, as...)
14251425
rs = Array{Any,1}(nbr)
14261426
a = 1
14271427
for i = 1:nbr
1428-
rs[i] = hcat(as[a:a-1+rows[i]]...)
1428+
rs[i] = typed_hcat(T, as[a:a-1+rows[i]]...)
14291429
a += rows[i]
14301430
end
14311431
T[rs...;]

test/abstractarray.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,9 @@ function test_cat(::Type{TestAbstractArray})
560560
# check for # of columns mismatch b/w rows
561561
@test_throws ArgumentError hvcat((3, 2), 1, 2, 3, 4, 5, 6)
562562
@test_throws ArgumentError Base.typed_hvcat(Int, (3, 2), 1, 2, 3, 4, 5, 6)
563+
564+
# 18395
565+
@test isa(Any["a" 5; 2//3 1.0][2,1], Rational{Int})
563566
end
564567

565568
function test_ind2sub(::Type{TestAbstractArray})

0 commit comments

Comments
 (0)