-
-
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
Show closest matching methods on MethodError #7714
Conversation
Looks good to me. Bonus for doing the whitespace removal in a separate commit. |
Looks great. A few questions:
|
else | ||
print(buf, ", ") | ||
end | ||
if typeof(i[1]) <: i[2] |
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.
More concisely: isa(i[1], i[2])
. Also might be clearer to use for (arg, sigtype) in zip...
instead of referring to i[1]
and i[2]
here.
I agree with @mbauman that the output here needs to be limited. I would propose showing only methods with the maximum value of |
As this code will only be executed when the REPL is about to present an error to the user, I don't think there are much that could possibly be done to make it too slow. Network connections to slow servers would probably be acceptable from a performance point of view, although there are other reasons why we should avoid that. |
Thanks for the suggestions :) New version of my patch truncates the list after three candidates and displays @simonster Thanks! I got rid of |
@mbauman Because I'm new to Julia I don't know much about keyword arguments. As far as I can tell mistyping one will give |
Any news about getting this merged? |
6c7c7e3
to
1a4c02f
Compare
This seems like a good change. @JeffBezanson, any objections? |
Show closest matching methods on MethodError
Ok, works for me and is quite nice. Thank you and sorry for the delayed merge! |
Could this be backported? @JuliaBackports |
We'll see how this works on master for a few days, and unless we get some negative feedback, I think this might be a nice thing to include in 0.3.4. |
Sounds pretty cool! |
This seems very slow for functions with many methods. On my system, it takes nearly 10 seconds to print an error message for
|
In many ways this feature is really slick, but I have to be honest that its output often seems a bit odd. E.g. above, "perhaps you'd like to convert this to a pointer instead?" doesn't really make sense. The idea of a "close" method is subjective. |
discovered using TRACE_INFERENCE. this was specializing Zip2 for all method signatures processed by the reflective code.
The performance improvement from 052f54e relies on 0.4-only syntax, right? Can anyone evaluate the performance impact of backporting this to release-0.3? We may want to postpone this one to just after 0.3.4 if we can't get a solid feeling about it in the next week. |
No, there is no 0.4 syntax in the fix. The constructor for |
This is strictly a new feature, and so not something we would normally backport. |
While that's true, this is a purely interactive feature and one that only occurs upon errors, so it would not be crazy to consider backporting it. |
I'm against backporting it. We don't want to start randomly picking new functionality to backport. Nor can one argue that this feature is so important as to be worth the risk, and worth an exception from our pretty clear policy. Sure, it's not likely to cause a problem, but the point of a backporting policy is to avoid worrying about that. And to avoid a debate about whether every new feature deserves backporting. |
… match and removed the requirement of equal lengths of args.
… match and removed the requirement of equal lengths of args. The match also takes into acount that paremetric methods args needs to have the same type for one tvar.
… match and removed the requirement of equal lengths of args. The match also takes into acount that paremetric methods args needs to have the same type for one tvar.
… match and removed the requirement of equal lengths of args. The match also takes into acount that parametric methods args needs to have the same type for one tvar.
… match and removed the requirement of equal lengths of args. The match also takes into account that parametric methods args needs to have the same type for one tvar.
… match and removed the requirement of equal lengths of args. The match also takes into account that parametric methods args needs to have the same type for one tvar using typeintersect.
… match and removed the requirement of equal lengths of args. The match also takes into account that parametric methods args needs to have the same type for one tvar using typeintersect. There is also added test of `show_method_candidates`.
… match and removed the requirement of equal lengths of args. The match also takes into account that parametric methods args needs to have the same type for one tvar using typeintersect. There is also added test of `show_method_candidates`.
… match and removed the requirement of equal lengths of args. The match also takes into account that parametric methods args needs to have the same type for one tvar using typeintersect. There is also added test of `show_method_candidates`.
… match and removed the requirement of equal lengths of args. The match also takes into account that parametric methods args needs to have the same type for one tvar using typeintersect. There is also added test of `show_method_candidates`.
… match and removed the requirement of equal lengths of args. The match also takes into account that parametric methods args needs to have the same type for one tvar using typeintersect. There is also added test of `show_method_candidates`.
… match and removed the requirement of equal lengths of args. The match also takes into account that parametric methods args needs to have the same type for one tvar using typeintersect. There is also added test of `show_method_candidates`.
… match and removed the requirement of equal lengths of args. The match also takes into account that parametric methods args needs to have the same type for one tvar using typeintersect. There is also added test of `show_method_candidates`.
… match and removed the requirement of equal lengths of args. The match also takes into account that parametric methods args needs to have the same type for one tvar using typeintersect. There is also added test of `show_method_candidates`.
… match and removed the requirement of equal lengths of args. The match also takes into account that parametric methods args needs to have the same type for one tvar using typeintersect. There is also added test of `show_method_candidates`.
… match and removed the requirement of equal lengths of args. The match also takes into account that parametric methods args needs to have the same type for one tvar using typeintersect. There is also added test of `show_method_candidates`.
… match and removed the requirement of equal lengths of args. The match also takes into account that parametric methods args needs to have the same type for one tvar using typeintersect. There is also added test of `show_method_candidates`.
… match and removed the requirement of equal lengths of args. The match also takes into account that parametric methods args needs to have the same type for one tvar using typeintersect. There is also added test of `show_method_candidates`.
… match and removed the requirement of equal lengths of args. The match also takes into account that parametric methods args needs to have the same type for one tvar using typeintersect. There is also added test of `show_method_candidates`.
… match and removed the requirement of equal lengths of args. The match also takes into account that parametric methods args needs to have the same type for one tvar using typeintersect. There is also added test of `show_method_candidates`.
… match and removed the requirement of equal lengths of args. The match also takes into account that parametric methods args needs to have the same type for one tvar using typeintersect. There is also added test of `show_method_candidates`.
… match and removed the requirement of equal lengths of args. The match also takes into account that parametric methods args needs to have the same type for one tvar using typeintersect. There is also added test of `show_method_candidates`.
… match and removed the requirement of equal lengths of args. The match also takes into account that parametric methods args needs to have the same type for one tvar using typeintersect. There is also added test of `show_method_candidates`.
Implements my idea described in #7686 and #7512.
Screenshot what it looks like: