Skip to content

Commit

Permalink
enable the type-repr simplification unconditionally in the stack trace
Browse files Browse the repository at this point in the history
Since keyword pairs can appear within positional arguments, it can be
confusing if we print the same type with different representations.
  • Loading branch information
aviatesk committed May 30, 2023
1 parent 284d7ab commit 8aa7e1e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
6 changes: 3 additions & 3 deletions base/show.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion base/stacktraces.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

0 comments on commit 8aa7e1e

Please sign in to comment.