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: 3 additions & 1 deletion base/errorshow.jl
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,9 @@ function showerror(io::IO, ex::MethodError)
curworld = get_world_counter()
print(io, "\nThe applicable method may be too new: running in world age $(ex.world), while current world is $(curworld).")
elseif f isa Function
print(io, "\nThe function `$f` exists, but no method is defined for this combination of argument types.")
print(io, "\nThe ")
isgensym(nameof(f)) && print(io, "anonymous ")
print(io, "function `$f` exists, but no method is defined for this combination of argument types.")
elseif f isa Type
print(io, "\nThe type `$f` exists, but no method is defined for this combination of argument types when trying to construct it.")
else
Expand Down
7 changes: 7 additions & 0 deletions test/errorshow.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1262,3 +1262,10 @@ end

f33793(x::Float32, y::Float32) = 1
@test_throws "\nClosest candidates are:\n f33793(!Matched::Float32, !Matched::Float32)\n" f33793(Float64(0.0), Float64(0.0))

# https://github.com/JuliaLang/julia/issues/56325
let err_str
f56325 = x->x+1
err_str = @except_str f56325(1,2) MethodError
@test occursin("The anonymous function", err_str)
end