From 83e18eb49e429145c857923267af6de4719cdf5e Mon Sep 17 00:00:00 2001 From: Billy Moses Date: Thu, 9 Jan 2025 12:29:54 -0500 Subject: [PATCH 1/3] More adhereance to 1.10 error types (hopefully) --- src/sparsevector.jl | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/sparsevector.jl b/src/sparsevector.jl index 24cae01f..dcf3d056 100644 --- a/src/sparsevector.jl +++ b/src/sparsevector.jl @@ -1243,15 +1243,17 @@ function hvcat_internal(rows::Tuple{Vararg{Int}}, X1::_SparseConcatGroup, X::_Sp if anysparse(X1) || anysparse(X...) vcat(_hvcat_rows(rows, X1, X...)...) else - # Needed to match error type with Base Julia. See https://github.com/JuliaLang/julia/pull/56543#issuecomment-2508637550 - matrix_len = if length(rows) == 0 - 0 - else - length(rows) * rows[1] - end - if matrix_len != 1 + length(X) - throw(ArgumentError("argument count does not match specified shape (expected $matrix_len, got $(1+length(X)))")) - end + if X1 <: Number && all(Base.Fix1(<:, Number), X) + # Needed to match error type with Base Julia. See https://github.com/JuliaLang/julia/pull/56543#issuecomment-2508637550 + matrix_len = if length(rows) == 0 + 0 + else + length(rows) * rows[1] + end + if matrix_len != 1 + length(X) + throw(ArgumentError("argument count does not match specified shape (expected $matrix_len, got $(1+length(X)))")) + end + end Base.typed_hvcat(Base.promote_eltypeof(X1, X...), rows, X1, X...) end end From 1b990c12a5635bc2ba34abb427af5af72ecf41ef Mon Sep 17 00:00:00 2001 From: William Moses Date: Thu, 9 Jan 2025 12:59:30 -0500 Subject: [PATCH 2/3] Update src/sparsevector.jl Co-authored-by: Daniel Karrasch --- src/sparsevector.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sparsevector.jl b/src/sparsevector.jl index dcf3d056..4f73c73a 100644 --- a/src/sparsevector.jl +++ b/src/sparsevector.jl @@ -1243,7 +1243,7 @@ function hvcat_internal(rows::Tuple{Vararg{Int}}, X1::_SparseConcatGroup, X::_Sp if anysparse(X1) || anysparse(X...) vcat(_hvcat_rows(rows, X1, X...)...) else - if X1 <: Number && all(Base.Fix1(<:, Number), X) + if X1 isa Number && all(Base.Fix2(isa, Number), X) # Needed to match error type with Base Julia. See https://github.com/JuliaLang/julia/pull/56543#issuecomment-2508637550 matrix_len = if length(rows) == 0 0 From 2e133899211e693886bbd35685ca91ad604de221 Mon Sep 17 00:00:00 2001 From: William Moses Date: Thu, 9 Jan 2025 13:18:38 -0500 Subject: [PATCH 3/3] Update sparsevector.jl --- src/sparsevector.jl | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/sparsevector.jl b/src/sparsevector.jl index 4f73c73a..d13b0714 100644 --- a/src/sparsevector.jl +++ b/src/sparsevector.jl @@ -1243,16 +1243,16 @@ function hvcat_internal(rows::Tuple{Vararg{Int}}, X1::_SparseConcatGroup, X::_Sp if anysparse(X1) || anysparse(X...) vcat(_hvcat_rows(rows, X1, X...)...) else - if X1 isa Number && all(Base.Fix2(isa, Number), X) - # Needed to match error type with Base Julia. See https://github.com/JuliaLang/julia/pull/56543#issuecomment-2508637550 - matrix_len = if length(rows) == 0 - 0 - else - length(rows) * rows[1] - end - if matrix_len != 1 + length(X) - throw(ArgumentError("argument count does not match specified shape (expected $matrix_len, got $(1+length(X)))")) - end + if X1 isa Number && all(Base.Fix2(isa, Number), X) + # Needed to match error type with Base Julia. See https://github.com/JuliaLang/julia/pull/56543#issuecomment-2508637550 + matrix_len = if length(rows) == 0 + 0 + else + length(rows) * rows[1] + end + if matrix_len != 1 + length(X) + throw(ArgumentError("argument count does not match specified shape (expected $matrix_len, got $(1+length(X)))")) + end end Base.typed_hvcat(Base.promote_eltypeof(X1, X...), rows, X1, X...) end