Support Julia v1.5 short keyword argument syntax
Closed this issue · 0 comments
ericphanson commented
julia> using Mocking
julia> g(; x=1) = "I got x=$x"
g (generic function with 1 method)
julia> function f()
x = 1
result = @mock g(; x)
return result
end
ERROR: LoadError: MethodError: Cannot `convert` an object of type Symbol to an object of type Expr
Closest candidates are:
convert(::Type{Expr}, ::Revise.RelocatableExpr) at /Users/eph/.julia/packages/Revise/9lZUE/src/relocatable_exprs.jl:22
convert(::Type{T}, ::T) where T at essentials.jl:218
Expr(::Any...) at boot.jl:263
Stacktrace:
[1] push!(a::Vector{Expr}, item::Symbol)
@ Base ./array.jl:968
[2] extract_kwargs(expr::Expr)
@ Mocking ~/.julia/packages/Mocking/U41JO/src/expr.jl:22
[3] var"@mock"(__source__::LineNumberNode, __module__::Module, expr::Any)
@ Mocking ~/.julia/packages/Mocking/U41JO/src/mock.jl:10
in expression starting at REPL[15]:3
(This works of course if we write @mock g(; x=x)
).