-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Allow calls to kwarg functions before Base is defined. #18396
Conversation
e84a9f9
to
cdf9daa
Compare
yes, any for testing, you could use some variant of: julia> eval(Core.Inference, quote
f(;x...) = println(;x...)
end)
f (generic function with 1 method)
julia> Core.Inference.f(a=1, b=2, c=3)
ERROR: UndefVarError: vector_any not defined
in #f#213(::Array{Any,1}, ::Function) at REPL[1]:2
in (::Core.Inference.#kw##f)(::Array{Any,1}, ::Core.Inference.#f) at <missing>:0
in eval(::Module, ::Any) at ./boot.jl:234
in eval(::Module, ::Any) at /Volumes/Lion/Users/jameson/Documents/julia/usr/lib/julia/sys.dylib:?
in eval_user_input(::Any, ::Base.REPL.REPLBackend) at REPL.jl:66
in macro expansion; at REPL.jl:97 [inlined]
in (::Base.REPL.##3#4{Base.REPL.REPLBackend})() at event.jl:68 |
This enables calls to kwarg functions before Base is defined (eg. in inference), as the frontend generates a call to vector_any.
cdf9daa
to
d75e4eb
Compare
Call a kwarg function in Core.Inference where vector_any was unavailable.
Thanks. Turns out this did work on 0.4, so I've added the regression label. |
f18396(;kwargs...) = g18396(;kwargs...) | ||
g18396(;x=1,y=2) = x+y | ||
end) | ||
Core.Inference.f18396() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably best to also @test
the return value so that it is also confirmed to do something
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, updated.
d75e4eb
to
8ea9a72
Compare
Call a kwarg function in Core.Inference where vector_any was unavailable.
Call a kwarg function in Core.Inference where vector_any was unavailable.
8ea9a72
to
fab9560
Compare
waiting until 0.5.1 |
This enables calls to kwarg functions before Base is defined (eg. in inference), as the frontend generates a call to vector_any. (cherry picked from commit 95c26b5) ref #18396 Add a test for #18396. Call a kwarg function in Core.Inference where vector_any was unavailable. (cherry picked from commit fab9560)
Used in #18338.
Couldn't find a way to test..