Skip to content

Commit 1bbc846

Browse files
maleadttkelman
authored andcommitted
Define vector_any in coreimg.
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)
1 parent a97fbda commit 1bbc846

File tree

3 files changed

+17
-10
lines changed

3 files changed

+17
-10
lines changed

base/base.jl

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -145,16 +145,6 @@ finalize(o::ANY) = ccall(:jl_finalize_th, Void, (Ptr{Void}, Any,),
145145
gc(full::Bool=true) = ccall(:jl_gc_collect, Void, (Cint,), full)
146146
gc_enable(on::Bool) = ccall(:jl_gc_enable, Cint, (Cint,), on)!=0
147147

148-
# used by interpolating quote and some other things in the front end
149-
function vector_any(xs::ANY...)
150-
n = length(xs)
151-
a = Array{Any}(n)
152-
@inbounds for i = 1:n
153-
arrayset(a,xs[i],i)
154-
end
155-
a
156-
end
157-
158148
immutable Nullable{T}
159149
isnull::Bool
160150
value::T

base/essentials.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,3 +209,13 @@ const (:) = Colon()
209209
# For passing constants through type inference
210210
immutable Val{T}
211211
end
212+
213+
# used by interpolating quote and some other things in the front end
214+
function vector_any(xs::ANY...)
215+
n = length(xs)
216+
a = Array{Any}(n)
217+
@inbounds for i = 1:n
218+
Core.arrayset(a,xs[i],i)
219+
end
220+
a
221+
end

test/keywordargs.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,3 +218,10 @@ end
218218
@test f9948(x=5) == 5
219219
@test_throws UndefVarError f9948()
220220
@test getx9948() == 3
221+
222+
# pr #18396, kwargs before Base is defined
223+
eval(Core.Inference, quote
224+
f18396(;kwargs...) = g18396(;kwargs...)
225+
g18396(;x=1,y=2) = x+y
226+
end)
227+
@test Core.Inference.f18396() == 3

0 commit comments

Comments
 (0)