-
Notifications
You must be signed in to change notification settings - Fork 3
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
Multiple @kwcalls
redefines methods causing warnings
#16
Comments
Could this be handled with q = quote
KeywordCalls._call_in_default_order(::typeof($f), nt::NamedTuple{($(sorted_args...),)}) = $f(NamedTuple{($(args...),)}(nt))
if !hasmethod($f, Tuple{NamedTuple})
$f(nt::NamedTuple) = KeywordCalls._call_in_default_order($f, _sort(merge($defaults, $alias($f, nt))))
end
if !hasmethod($f, Tuple{})
$f(; kw...) = $f(merge($defaults, $alias($f, NamedTuple(kw))))
end
end |
Thanks for catching this! This seems like the right idea. Let's see if we can do this with the q = quote
KeywordCalls._call_in_default_order(::typeof($f), nt::NamedTuple{($(sorted_args...),)}) = $f(NamedTuple{($(args...),)}(nt))
end
if !hasmethod(f, Tuple{NamedTuple})
push!(q.args, :($f(nt::NamedTuple) = KeywordCalls._call_in_default_order($f, _sort(merge($defaults, $alias($f, nt)))))
end
if !hasmethod(f, Tuple{})
push!(q.args, :($f(; kw...) = $f(merge($defaults, $alias($f, NamedTuple(kw)))))
end If we need the |
This was referenced May 24, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
JuliaAstro/Transits.jl#23 (comment)
Calling
@kwcall
multiple times on the same method name will create warnings in module code. This is happening becauseKeywordCalls.jl/src/KeywordCalls.jl
Lines 39 to 43 in 96b14dc
foo(::NamedTuple)
andfoo(; kwargs...)
calls, regardless if they exist already.The text was updated successfully, but these errors were encountered: