408408function combinearg (arg_name, arg_type, is_splat, default)
409409 @assert arg_name != = nothing || arg_type != = nothing
410410 a = arg_name=== nothing ? :(:: $arg_type ) :
411- arg_type=== nothing ? arg_name :
411+ arg_type== :Any ? arg_name :
412412 :($ arg_name:: $arg_type )
413413 a2 = is_splat ? Expr (:... , a) : a
414414 return default === nothing ? a2 : Expr (:kw , a2, default)
@@ -418,16 +418,16 @@ end
418418 splitarg(arg)
419419
420420Match function arguments (whether from a definition or a function call) such as
421- `x::Int=2` and return `(arg_name, arg_type, is_splat, default)`. `arg_name`,
422- `arg_type`, and ` default` are `nothing` when they are absent. For example:
421+ `x::Int=2` and return `(arg_name, arg_type, is_splat, default)`. `arg_name` and
422+ `default` are `nothing` when they are absent. For example:
423423
424424```julia
425425julia> map(splitarg, (:(f(a=2, x::Int=nothing, y, args...))).args[2:end])
4264264-element Array{Tuple{Symbol,Symbol,Bool,Any},1}:
427- (:a, nothing , false, 2)
427+ (:a, :Any , false, 2)
428428 (:x, :Int, false, :nothing)
429429 (:y, :Any, false, nothing)
430- (:args, nothing , true, nothing)
430+ (:args, :Any , true, nothing)
431431```
432432
433433See also: [`combinearg`](@ref)
@@ -443,7 +443,7 @@ function splitarg(arg_expr)
443443 (arg_name, arg_type) = (@match arg_expr3 begin
444444 :: T_ => (nothing , T)
445445 name_:: T_ => (name, T)
446- x_ => (x, nothing )
446+ x_ => (x, :Any )
447447 end ):: NTuple{2,Any} # the pattern `x_` matches any expression
448448 return (arg_name, arg_type, is_splat, default)
449449end
0 commit comments