Skip to content

Commit

Permalink
fix method error printing for missing (#35315)
Browse files Browse the repository at this point in the history
fix method error printing for missing

(cherry picked from commit 0b0b126)
  • Loading branch information
KristofferC committed Apr 4, 2020
1 parent 069f137 commit 6c08ec4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 1 addition & 2 deletions base/errorshow.jl
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ function showerror(io::IO, ex::MethodError)
kwargs = pairs(ex.args[1])
ex = MethodError(f, ex.args[3:end])
end
if f == Base.convert && length(arg_types_param) == 2 && !is_arg_types
if f === Base.convert && length(arg_types_param) == 2 && !is_arg_types
f_is_function = true
show_convert_error(io, ex, arg_types_param)
elseif isempty(methods(f)) && isa(f, DataType) && f.abstract
Expand Down Expand Up @@ -716,4 +716,3 @@ function show(io::IO, ip::InterpreterIP)
print(io, " in $(ip.code) at statement $(Int(ip.stmt))")
end
end

5 changes: 5 additions & 0 deletions test/missing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -527,3 +527,8 @@ mutable struct Obj; x; end
@test ismissing(wref[1] == missing)
@test ismissing(missing == wref[1])
end

@testset "showerror missing function" begin
me = try missing(1) catch e e end
@test sprint(showerror, me) == "MethodError: objects of type Missing are not callable"
end

0 comments on commit 6c08ec4

Please sign in to comment.