Skip to content

Commit

Permalink
Fix registration without using
Browse files Browse the repository at this point in the history
Fixes #1023
  • Loading branch information
ChrisRackauckas committed Dec 27, 2023
1 parent 9975197 commit 2888d49
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/register.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ macro register_symbolic(expr, define_promotion = true, Ts = :([]))
args′ = map((a, T) -> :($a::$T), argnames, Ts)
ret_type = isnothing(ret_type) ? Real : ret_type

fexpr = :(@wrapped function $f($(args′...))
fexpr = :(Symbolics.@wrapped function $f($(args′...))
args = [$(argnames...),]
unwrapped_args = map($unwrap, args)
res = if !any(x->$issym(x) || $istree(x), unwrapped_args)
Expand Down
4 changes: 2 additions & 2 deletions src/wrapper-types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ function wrap_func_expr(mod, expr)
# expected to be defined outside Symbolics
if arg isa Expr && arg.head == :(::)
T = Base.eval(mod, arg.args[2])
has_symwrapper(T) ? (T, :(SymbolicUtils.Symbolic{<:$T}), wrapper_type(T)) :
(T,:(SymbolicUtils.Symbolic{<:$T}))
has_symwrapper(T) ? (T, :(Symbolics.SymbolicUtils.Symbolic{<:$T}), wrapper_type(T)) :
(T,:(Symbolics.SymbolicUtils.Symbolic{<:$T}))
elseif arg isa Expr && arg.head == :(...)
Ts = type_options(arg.args[1])
map(x->Vararg{x},Ts)
Expand Down
2 changes: 2 additions & 0 deletions test/registration_without_using.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
using StaticArrays, DiffEqBase
import Symbolics;Symbolics.@register_symbolic foo(x, y)
1 change: 1 addition & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ if GROUP == "All" || GROUP == "Core"
@safetestset "Integral Test" begin include("integral.jl") end
@safetestset "CartesianIndex Test" begin include("cartesianindex.jl") end
@safetestset "LogExpFunctions Test" begin include("logexpfunctions.jl") end
@safetestset "Registration without using Test" begin include("registration_without_using.jl") end
end

if GROUP == "All" || GROUP == "Core" || GROUP == "SymbolicIndexingInterface"
Expand Down

0 comments on commit 2888d49

Please sign in to comment.