From 749d0a8617d6db62f943819e20e9c2a014cf9d78 Mon Sep 17 00:00:00 2001 From: Michael Abbott <32575566+mcabbott@users.noreply.github.com> Date: Thu, 1 Apr 2021 10:09:41 -0400 Subject: [PATCH] bold Any, tidy, simplify --- base/errorshow.jl | 2 +- base/methodshow.jl | 21 ++++++--------------- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/base/errorshow.jl b/base/errorshow.jl index fe3b00cdebf6f..dcec833e75a36 100644 --- a/base/errorshow.jl +++ b/base/errorshow.jl @@ -720,7 +720,7 @@ function print_module_path_file(io, modul, file, line, modulecolor = :light_blac printstyled(io, " " ^ (digit_align_width + 2) * "@ ", color = :light_black) # module - if modul !== nothing + if modul !== nothing && modulecolor !== nothing printstyled(io, modul, color = modulecolor) print(io, " ") end diff --git a/base/methodshow.jl b/base/methodshow.jl index 21548851ed3c2..26a99350265a8 100644 --- a/base/methodshow.jl +++ b/base/methodshow.jl @@ -35,11 +35,7 @@ function argtype_decl(env, n, @nospecialize(sig::DataType), i::Int, nargs, isva: end if isvarargtype(t) if !isdefined(t, :N) - # if unwrapva(t) === Any # ??? - # return string(s, "..."), "" - # else - return s, string_with_env(env, unwrapva(t)) * "..." - # end + return s, string_with_env(env, unwrapva(t)) * "..." end return s, string_with_env(env, "Vararg{", t.T, ", ", t.N, "}") end @@ -210,17 +206,13 @@ function show(io::IO, m::Method; modulecolor = :light_black, digit_align_width = # arguments for (i,d) in enumerate(decls[2:end]) printstyled(io, d[1], color=:light_black) + print(io, "::") if isempty(d[2]) - print(io, "::Any") # ?? - # printstyled(io, "::Any", color=:bold) # ?? - elseif d[2] == "Any..." - print(io, "::Any") - printstyled(io, "...", color=:bold) + printstyled(io, "Any", color=:bold) else - print(io, "::") print_type_bicolor(io, d[2], color=:bold, inner_color=:normal) end - i < length(decls)-1 && print(io, ", ") # printstyled(io, ", ", color=:light_black) + i < length(decls)-1 && print(io, ", ") end kwargs = kwarg_decl(m) if !isempty(kwargs) @@ -230,12 +222,11 @@ function show(io::IO, m::Method; modulecolor = :light_black, digit_align_width = print(io, ")") show_method_params(io, tv) - # module & flie + # module & flie, re-using function from errorshow.jl if digit_align_width > 0 println(io) end - showmodule = isnothing(modulecolor) ? nothing : m.module - print_module_path_file(io, showmodule, string(file), line, modulecolor, digit_align_width) + print_module_path_file(io, m.module, string(file), line, modulecolor, digit_align_width) end function show_method_list_header(io::IO, ms::MethodList, namefmt::Function)