Skip to content

Commit

Permalink
don't overwrite s and s_syms in register macro -- use a var"##...#" i…
Browse files Browse the repository at this point in the history
…nstead
  • Loading branch information
shashi committed Mar 22, 2023
1 parent 426eb80 commit 67d05bb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/register.jl
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ macro register_symbolic(expr, define_promotion = true, Ts = [])
end
end

eval_method = :(@eval function $f($(Expr(:$, :(s...))),)
args = [$(Expr(:$, :(s_syms...)))]
eval_method = :(@eval function $f($(Expr(:$, :(var"##_register_macro_s"...))),)
args = [$(Expr(:$, :(var"##_register_macro_s_syms"...)))]
unwrapped_args = map($unwrap, args)
res = if !any(x->$issym(x) || $istree(x), unwrapped_args)
$f(unwrapped_args...)
Expand All @@ -74,8 +74,8 @@ macro register_symbolic(expr, define_promotion = true, Ts = [])
end

for sig in $Ts
s = map(((i,T,),)->Expr(:(::), Symbol("arg", i), T), enumerate(sig.parameters))
s_syms = map(x->x.args[1], s)
var"##_register_macro_s" = map(((i,T,),)->Expr(:(::), Symbol("arg", i), T), enumerate(sig.parameters))
var"##_register_macro_s_syms" = map(x->x.args[1], var"##_register_macro_s")
$eval_method
end
if $define_promotion
Expand Down

0 comments on commit 67d05bb

Please sign in to comment.