diff --git a/src/extra_functions.jl b/src/extra_functions.jl index 5c4f6cccf..4f934ae2f 100644 --- a/src/extra_functions.jl +++ b/src/extra_functions.jl @@ -1,4 +1,4 @@ -@register_symbolic Base.binomial(n, k)::Int true [Integer] +@register_symbolic Base.binomial(n, k::Integer)::Int true @register_symbolic Base.sign(x)::Int derivative(::typeof(sign), args::NTuple{1,Any}, ::Val{1}) = 0 diff --git a/src/register.jl b/src/register.jl index 9fc28218d..547086eee 100644 --- a/src/register.jl +++ b/src/register.jl @@ -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) diff --git a/src/wrapper-types.jl b/src/wrapper-types.jl index e5b1bb0fe..0532c3a24 100644 --- a/src/wrapper-types.jl +++ b/src/wrapper-types.jl @@ -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) diff --git a/test/registration_without_using.jl b/test/registration_without_using.jl new file mode 100644 index 000000000..f0d5f8564 --- /dev/null +++ b/test/registration_without_using.jl @@ -0,0 +1 @@ +import Symbolics;Symbolics.@register_symbolic foo(x, y) diff --git a/test/runtests.jl b/test/runtests.jl index 27d013a61..b11dab166 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -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"