From 8aa7e1ed64823fa1e226c231a59776b000e1dafc Mon Sep 17 00:00:00 2001 From: Shuhei Kadowaki Date: Tue, 30 May 2023 11:38:15 +0900 Subject: [PATCH] enable the type-repr simplification unconditionally in the stack trace Since keyword pairs can appear within positional arguments, it can be confusing if we print the same type with different representations. --- base/show.jl | 6 +++--- base/stacktraces.jl | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/base/show.jl b/base/show.jl index c82eaaceab4e2..583d0bd04c727 100644 --- a/base/show.jl +++ b/base/show.jl @@ -1117,11 +1117,11 @@ function show_datatype(io::IO, x::DataType, wheres::Vector{TypeVar}=TypeVar[]) print(io, "}") return end - elseif get(io, :simplify_kwstype, false)::Bool && kwsnt !== nothing + elseif get(io, :backtrace, false)::Bool && kwsnt !== nothing # simplify the type representation of keyword arguments - # when printing signature of keyword method + # when printing signature of keyword method in the stack trace print(io, "@Kwargs{") - show_at_namedtuple(io, kwsnt.parameters...) + show_at_namedtuple(io, kwsnt.parameters[1]::Tuple, kwsnt.parameters[2]::DataType) print(io, "}") return end diff --git a/base/stacktraces.jl b/base/stacktraces.jl index 9dbc8f4e5544d..523ca827897d5 100644 --- a/base/stacktraces.jl +++ b/base/stacktraces.jl @@ -352,7 +352,6 @@ function show_spec_sig(io::IO, m::Method, @nospecialize(sig::Type)) kwnames[i] = Symbol(str[1:end-3]) end end - io = IOContext(io, :simplify_kwstype=>true) # see the comment in `show_datatype` Base.show_tuple_as_call(io, m.name, pos_sig; demangle=true, kwargs=zip(kwnames, kwarg_types),