Skip to content
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

feat: support passing arrays of Symbolic to registered functions #1307

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 3 additions & 3 deletions src/wrapper-types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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})))
Comment on lines -125 to +128
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why was it commented?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm pretty sure I disabled it temporarily in #1197 because of the issues with this (and the AbstractArray{Num}) dispatch for registered Base functions, but forgot to uncomment it once it was resolved.

end
end
Ts
Expand Down
8 changes: 8 additions & 0 deletions test/macro.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading