-
-
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
hide internally created methods in stacktraces that occur as a result of argument forwarding #49102
Conversation
…orwarding methods
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.
Can we move the kwcall hiding into the same place (instead of the process_backtrace function below), using this same approach of looking at the parent too?
What would the Looking at
there doesn't even really seem to be a parent to the |
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.
Thanks for tackling this!
Looking at another case of non ideal stacktraces: f(g, a; kw...) = error();
f(a; kw...) = f(identity, a; kw...);
f(1; kw=3) giving ERROR:
Stacktrace:
[1] error()
@ Base ./error.jl:44
[2] f(g::Function, a::Int64; kw::Base.Pairs{Symbol, Int64, Tuple{Symbol}, NamedTuple{(:kw,), Tuple{Int64}}})
@ Main ./REPL[1]:1
[3] f(a::Int64; kw::Base.Pairs{Symbol, Int64, Tuple{Symbol}, NamedTuple{(:kw,), Tuple{Int64}}})
@ Main ./REPL[2]:1
[4] top-level scope
@ REPL[4]:1
[5] top-level scope
@ ~/julia/usr/share/julia/stdlib/v1.10/REPL/src/REPL.jl:1410 seems like the printing of the |
kw...
forwarding methods
The new code LGTM. Merge at will. |
7872abf
to
08d93cb
Compare
…w...` forwarding methods
params, last_params = Base.unwrap_unionall(m.sig).parameters, Base.unwrap_unionall(last_m.sig).parameters | ||
|
||
if last_m.nkw != 0 | ||
pos_sig_params = Base.rewrap_unionall(Tuple{last_params[(last_m.nkw+2):end]...}, last_m.sig).parameters |
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.
Seems like you meant just last_params[(last_m.nkw+2):end]
here, since the rest doesn't generally make sense
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.
I took it from here:
Line 232 in 703b3f8
pos_sig = Base.rewrap_unionall(Tuple{uw.parameters[(def.nkw+2):end]...}, sig) |
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.
That is useful if you want to do subtyping queries, but it doesn't seem like you wanted to?
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.
You potentially could phrase it as a subtyping query though, by adding Vararg
to the shorter one
… of argument forwarding (JuliaLang#49102)
Inspired by #49044, I tried to make a small incremental improvement. This hides some frames that are automatically generated in
kw...
forwarding.Running
and looking at the stacktrace we have before:
and after:
The "MWE" for this is
which before shows as
and after (frame 4 above removed).
There are more cases to detect, for example:
could maybe hide [3] (or [2]??) but it is also a bit hard to not also filter out "real" calls.