Skip to content

Commit 248d9f9

Browse files
wsmosesdkarrasch
andauthored
More adhereance to 1.10 error types (hopefully) (#592)
It looks like in base that error was only enabled on number inputs, lets see if this fixes it? cc @gbaraldi @KristofferC --------- Co-authored-by: Daniel Karrasch <[email protected]>
1 parent 78035e1 commit 248d9f9

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

src/sparsevector.jl

+11-9
Original file line numberDiff line numberDiff line change
@@ -1243,15 +1243,17 @@ function hvcat_internal(rows::Tuple{Vararg{Int}}, X1::_SparseConcatGroup, X::_Sp
12431243
if anysparse(X1) || anysparse(X...)
12441244
vcat(_hvcat_rows(rows, X1, X...)...)
12451245
else
1246-
# Needed to match error type with Base Julia. See https://github.com/JuliaLang/julia/pull/56543#issuecomment-2508637550
1247-
matrix_len = if length(rows) == 0
1248-
0
1249-
else
1250-
length(rows) * rows[1]
1251-
end
1252-
if matrix_len != 1 + length(X)
1253-
throw(ArgumentError("argument count does not match specified shape (expected $matrix_len, got $(1+length(X)))"))
1254-
end
1246+
if X1 isa Number && all(Base.Fix2(isa, Number), X)
1247+
# Needed to match error type with Base Julia. See https://github.com/JuliaLang/julia/pull/56543#issuecomment-2508637550
1248+
matrix_len = if length(rows) == 0
1249+
0
1250+
else
1251+
length(rows) * rows[1]
1252+
end
1253+
if matrix_len != 1 + length(X)
1254+
throw(ArgumentError("argument count does not match specified shape (expected $matrix_len, got $(1+length(X)))"))
1255+
end
1256+
end
12551257
Base.typed_hvcat(Base.promote_eltypeof(X1, X...), rows, X1, X...)
12561258
end
12571259
end

0 commit comments

Comments
 (0)