diff --git a/base/replutil.jl b/base/replutil.jl index 39d6563ccb560..d2c026922c5da 100644 --- a/base/replutil.jl +++ b/base/replutil.jl @@ -207,7 +207,7 @@ function showerror_ambiguous(io::IO, meth, f, args) end print(io, " is ambiguous. Candidates:") for m in meth - print(io, "\n ", m) + print(io, "\n ", m[3]) end nothing end diff --git a/test/replutil.jl b/test/replutil.jl index 40d69ef76f15f..a767d00f7b8e7 100644 --- a/test/replutil.jl +++ b/test/replutil.jl @@ -367,3 +367,13 @@ let d = Dict(1 => 2, 3 => 45) @test contains(replace(result, " ", ""), string(el)) end end + +# issue #17007, printing ambiguity errors +f17007(x::Integer, y::Integer) = true +f17007(x::Int, y::Any) = false +let + local buf = IOBuffer() + Base.showerror(buf, MethodError(f17007, (1, 2))) + @test contains(takebuf_string(buf), + "MethodError: f17007(::Int64, ::Int64) is ambiguous. Candidates:\n f17007(x::Int64, y)") +end