From d69d842c2c133159c0c53cbd71e5e335e64d2377 Mon Sep 17 00:00:00 2001 From: Aayush Sabharwal Date: Wed, 16 Oct 2024 18:03:54 +0530 Subject: [PATCH] feat: support passing arrays of `Symbolic` to registered functions --- src/wrapper-types.jl | 6 +++--- test/macro.jl | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/wrapper-types.jl b/src/wrapper-types.jl index 75f4e2d42..fd575b66c 100644 --- a/src/wrapper-types.jl +++ b/src/wrapper-types.jl @@ -122,10 +122,10 @@ function wrap_func_expr(mod, expr, wrap_arrays = true) (elT) -> :(AbstractArray{T} where {T <: $elT}) end if has_symwrapper(eT) - Ts = (Ts..., # _arr_type_fn(:(Symbolics.SymbolicUtils.Symbolic{<:$eT})), + Ts = (Ts..., _arr_type_fn(:(Symbolics.SymbolicUtils.Symbolic{<:$eT})), _arr_type_fn(wrapper_type(eT))) - # else - # Ts = (Ts..., _arr_type_fn(:(Symbolics.SymbolicUtils.Symbolic{<:$eT}))) + else + Ts = (Ts..., _arr_type_fn(:(Symbolics.SymbolicUtils.Symbolic{<:$eT}))) end end Ts diff --git a/test/macro.jl b/test/macro.jl index 0dd82728b..a9bc912d8 100644 --- a/test/macro.jl +++ b/test/macro.jl @@ -34,6 +34,14 @@ let @test eltype(gg) == Real @test symtype(unwrap(gg)) == SymMatrix{Real, 2} @test promote_symtype(ggg, Vector{symtype(typeof(a))}) == Any + + _a = unwrap(a) + gg = ggg([_a, 2_a]) + @test ndims(gg) == 2 + @test size(gg) == (4, 4) + @test eltype(gg) == Real + @test symtype(unwrap(gg)) == SymMatrix{Real, 2} + @test promote_symtype(ggg, Vector{symtype(typeof(a))}) == Any end let # redefine with promote_symtype