Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ function is_func_expr(@nospecialize(ex), meth::Method)
isexpr(lastarg, :...) && return true
continue
end
if isexpr(arg, :...) # also test the other order of $ and ..., e.g., `c470($argnames...)`
lastarg = only(arg.args)
isexpr(lastarg, :$) && return true
end
aname = get_argname(arg)
aname === :_ && continue
aname === marg || (aname === Symbol("#unused#") && marg === Symbol("")) || return false
Expand Down
4 changes: 3 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,9 @@ isdefined(Main, :Revise) ? Main.Revise.includet("script.jl") : include("script.j
src, line = definition(String, m)
@test occursin("x + y + z", src)
@test line == 94

src, line = definition(String, only(methods(c470)))
@test occursin("\$argnames", src)
@test line == 137

# unnamed arguments
m = which(unnamedarg, (Type{String}, Any))
Expand Down
12 changes: 11 additions & 1 deletion test/script.jl
Original file line number Diff line number Diff line change
Expand Up @@ -128,4 +128,14 @@ struct Invert end
# USERID gets parsed into a Symbol
struct symbol_struct2
USERID
end; '\n' ;symbol_function(x) = x
end; '\n' ;symbol_function(x) = x

# https://github.com/JuliaDebug/Cthulhu.jl/issues/470
# (arguments with evaled-names)
let argnames = :args
eval(quote
function c470($argnames...)
return $argnames
end
end)
end