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

MethodError does not display worldage hint when kwargs are involved #50200

Closed
Keno opened this issue Jun 16, 2023 · 1 comment · Fixed by #50201
Closed

MethodError does not display worldage hint when kwargs are involved #50200

Keno opened this issue Jun 16, 2023 · 1 comment · Fixed by #50201

Comments

@Keno
Copy link
Member

Keno commented Jun 16, 2023

(Using opaque closure to easily get a captured world age, but happens with any other world age capture mechanism also)

This is expected:

julia> using Base.Experimental: @opaque

julia> global callback = (args...)->nothing
#1 (generic function with 1 method)

julia> f = @opaque ()->callback()
()::Any->◌

julia> f()

julia> callback = (args...)->nothing
#4 (generic function with 1 method)

julia> f()
ERROR: MethodError: no method matching (::var"#4#5")()
The applicable method may be too new: running in world age 30972, while current world is 30973.

Closest candidates are:
  (::var"#4#5")(::Any...) (method too new to be called from this world context.)
   @ Main REPL[5]:1

This is missing the world age hint in the errorshow:

julia> using Base.Experimental: @opaque

julia> global callback = (args...; kwargs...)->nothing
#1 (generic function with 1 method)

julia> f = @opaque ()->callback(;a=1)
()::Any->◌

julia> f()

julia> callback = (args...; kwargs...)->nothing
#5 (generic function with 1 method)

julia> f()
ERROR: MethodError: no method matching (::var"#5#7")(; a::Int64)

Closest candidates are:
  (::var"#5#7")(::Any...; kwargs...)
   @ Main REPL[5]:1

Stacktrace:
 [1] (::Tuple{})()
   @ Main ./REPL[3]:1
 [2] top-level scope
   @ REPL[6]:1
@Keno
Copy link
Member Author

Keno commented Jun 16, 2023

Also the ::Any... in the closets candidates is shown in red in both cases, which is wrong.

Keno added a commit that referenced this issue Jun 16, 2023
Keno added a commit that referenced this issue Jun 16, 2023
Fixes the drive-by observation I made in #50200.
Keno added a commit that referenced this issue Jun 19, 2023
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

Successfully merging a pull request may close this issue.

1 participant