From 939f7d12034721d70838d43795c0e3ccda640ca4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20H=C3=B8egh?= Date: Fri, 19 Dec 2014 16:28:30 +0100 Subject: [PATCH] Added so #7714 also takes care of args... when considering a match and removed the requirement of equal lengths of args. --- base/replutil.jl | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/base/replutil.jl b/base/replutil.jl index e5d96e6e1dd94b..fea206795203ef 100644 --- a/base/replutil.jl +++ b/base/replutil.jl @@ -147,23 +147,19 @@ function showerror(io::IO, e::MethodError) # Display up to three closest candidates lines = Array((IOBuffer, Int), 0) for method in methods(e.f) - n = length(e.args) - if n != length(method.sig) - continue - end buf = IOBuffer() print(buf, " $(e.f.env.name)(") - first = true right_matches = 0 - for (arg, sigtype) in Zip2{Any,Any}(e.args, method.sig) - if first - first = false - else + for (i, (arg, sigtype)) in enumerate(Zip2{Any,Any}(e.args, method.sig)) + if i != 1 print(buf, ", ") end if typeof(arg) <: sigtype right_matches += 1 print(buf, "::$(sigtype)") + elseif (Any...,) == (sigtype,) + right_matches += length(typeargs) - i + print(buf, "::$(sigtype)") else Base.with_output_color(:red, buf) do buf print(buf, "::$(sigtype)")