Skip to content

Commit 68afc6e

Browse files
committed
fix inference of SparseVector cat
This little gadget creates a closure over Type{T} instead of DataType. Fix JuliaLang/julia#50623
1 parent c402d09 commit 68afc6e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/sparsevector.jl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1108,7 +1108,9 @@ function hcat(Xin::AbstractSparseVector...)
11081108
X = map(_unsafe_unfix, Xin)
11091109
Tv = promote_type(map(eltype, X)...)
11101110
Ti = promote_type(map(indtype, X)...)
1111-
r = _absspvec_hcat(map(x -> convert(SparseVector{Tv,Ti}, x), X)...)
1111+
r = (function (::Type{SV}) where SV
1112+
_absspvec_hcat(map(x -> convert(SV, x), X)...)
1113+
end)(SparseVector{Tv,Ti})
11121114
return @if_move_fixed Xin... r
11131115
end
11141116
function _absspvec_hcat(X::AbstractSparseVector{Tv,Ti}...) where {Tv,Ti}
@@ -1144,7 +1146,9 @@ function vcat(Xin::AbstractSparseVector...)
11441146
X = map(_unsafe_unfix, Xin)
11451147
Tv = promote_type(map(eltype, X)...)
11461148
Ti = promote_type(map(indtype, X)...)
1147-
r = _absspvec_vcat(map(x -> convert(SparseVector{Tv,Ti}, x), X)...)
1149+
r = (function (::Type{SV}) where SV
1150+
_absspvec_vcat(map(x -> convert(SV, x), X)...)
1151+
end)(SparseVector{Tv,Ti})
11481152
return @if_move_fixed Xin... r
11491153
end
11501154
function _absspvec_vcat(X::AbstractSparseVector{Tv,Ti}...) where {Tv,Ti}

0 commit comments

Comments
 (0)