diff --git a/stdlib/SparseArrays/src/sparsematrix.jl b/stdlib/SparseArrays/src/sparsematrix.jl index 6a4f7a36c2214..74b7089eb34d2 100644 --- a/stdlib/SparseArrays/src/sparsematrix.jl +++ b/stdlib/SparseArrays/src/sparsematrix.jl @@ -2575,6 +2575,7 @@ function setindex!(A::SparseMatrixCSC{Tv,Ti}, V::AbstractVecOrMat, Ix::Union{Int @assert !has_offset_axes(A, V, Ix, Jx) (I, J) = Base.ensure_indexable(to_indices(A, (Ix, Jx))) checkbounds(A, I, J) + Base._setindex!(IndexStyle(A), A, V, to_indices(A, (Ix, Jx))...) B = _to_same_csc(A, V, I, J) issortedI = issorted(I) diff --git a/stdlib/SparseArrays/test/sparse.jl b/stdlib/SparseArrays/test/sparse.jl index 3ef2cef966ae2..5d02c5727e991 100644 --- a/stdlib/SparseArrays/test/sparse.jl +++ b/stdlib/SparseArrays/test/sparse.jl @@ -186,6 +186,10 @@ end end end +@testset "Issue #28963" begin + @test_throws DimensionMismatch (spzeros(10,10)[:, :] = sprand(10,20,0.5)) +end + @testset "matrix-vector multiplication (non-square)" begin for i = 1:5 a = sprand(10, 5, 0.5)