Skip to content
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

More readable "no method was found" messages with !Matched indication #620

Open
orenbenkiki opened this issue Apr 7, 2024 · 1 comment

Comments

@orenbenkiki
Copy link

When invoking a function with arguments of the wrong type, the Julia runtime helpfully lists the methods and marks for each one which argument(s) were !Matched. This makes it easy to figure out what's wrong.

In contrast, when JET complains "no method was found", the error message is much less comprehensible. Instead of showing the call using the usual syntax, it wraps it with a kwcall. More importantly, it gives one no hint as to which of the arguments is causing the problem.

As a random example, JET produces this pretty opaque message:

no matching method found kwcall(::@NamedTuple{prefix::String}, ::typeof(Daf.Groups.groups), ::Daf.Formats.DafWriter, ::String, ::Vector{UInt32}): sphere_names = Core.kwcall(NamedTuple{(:prefix,)}(tuple("S")::Tuple{String})::@NamedTuple{prefix::String}, Metacells.Spheres.groups, daf::Daf.Formats.DafWriter, "metacell", spheres_of_metacells)

Instead of something more readable like this:

no matching method found for ::Daf.Groups.groups(daf::Daf.Formats.DafWriter, "metacell"::String, spheres_of_metacells::Vector{UInt32}; prefix="S"::String)
mismatched method: ::Daf.Groups.groups(daf::DafReader, axis::String, !Matched(entries::Vector{Vector{UInt32}}); prefix::String)::Vector{String}
mismatched method: ... (if there are multiple methods)

@MilesCranmer
Copy link
Contributor

+1. @aviatesk would it be possible to adjust this printout?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants