Skip to content

Commit

Permalink
bold Any, tidy, simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
mcabbott committed May 20, 2021
1 parent 90121b3 commit 749d0a8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 16 deletions.
2 changes: 1 addition & 1 deletion base/errorshow.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
21 changes: 6 additions & 15 deletions base/methodshow.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit 749d0a8

Please sign in to comment.