Skip to content

chore: add has_trivial_array_constructor #443

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
test: add CA test
  • Loading branch information
DhairyaLGandhi committed Jun 4, 2024
commit c1ce4c19b36e7c20a625f1a0e395958eae20453c
2 changes: 1 addition & 1 deletion src/ArrayInterface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1000,7 +1000,7 @@ ensures_sorted(@nospecialize( T::Type{<:AbstractRange})) = true
ensures_sorted(T::Type) = is_forwarding_wrapper(T) ? ensures_sorted(parent_type(T)) : false
ensures_sorted(@nospecialize(x)) = ensures_sorted(typeof(x))

function has_trivial_array_contstructor(::Type{T}, args...) where T
function has_trivial_array_constructor(::Type{T}, args...) where T
applicable(convert, T, args...)
end

Expand Down
8 changes: 7 additions & 1 deletion test/core.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ using ArrayInterface
using ArrayInterface: zeromatrix, undefmatrix
import ArrayInterface: has_sparsestruct, findstructralnz, fast_scalar_indexing, lu_instance,
parent_type, zeromatrix
using ComponentArrays
using LinearAlgebra
using Random
using SparseArrays
Expand Down Expand Up @@ -289,4 +290,9 @@ end
end
@test ArrayInterface.ldlt_instance(SymTridiagonal(A' * A)) isa typeof(ldlt(SymTridiagonal(A' * A)))
end
end
end

@testset "Array conversion" begin
cv = ComponentVector((x = rand(3), y = rand(3)))
@test ArrayInterface.has_trivial_array_constructor(typeof(cv), rand(6))
end