@@ -319,42 +319,45 @@ function show_spec_linfo(io::IO, frame::StackFrame)
319319 print (io, " top-level scope" )
320320 elseif linfo isa Module
321321 Base. print_within_stacktrace (io, Base. demangle_function_name (string (frame. func)), bold= true )
322- else
323- def, sig = if linfo isa MethodInstance
324- linfo. def, linfo. specTypes
322+ elseif linfo isa MethodInstance
323+ def = linfo. def
324+ if def isa Module
325+ Base. show_mi (io, linfo, #= from_stackframe=# true )
325326 else
326- linfo, linfo. sig
327+ show_spec_sig (io, def, linfo. specTypes)
327328 end
328- if def isa Method
329- if get (io, :limit , :false ):: Bool
330- if ! haskey (io, :displaysize )
331- io = IOContext (io, :displaysize => displaysize (io))
332- end
333- end
334- argnames = Base. method_argnames (def)
335- argnames = replace (argnames, :var"#unused#" => :var"" )
336- if def. nkw > 0
337- # rearrange call kw_impl(kw_args..., func, pos_args...) to func(pos_args...)
338- kwarg_types = Any[ fieldtype (sig, i) for i = 2 : (1 + def. nkw) ]
339- uw = Base. unwrap_unionall (sig):: DataType
340- pos_sig = Base. rewrap_unionall (Tuple{uw. parameters[(def. nkw+ 2 ): end ]. .. }, sig)
341- kwnames = argnames[2 : (def. nkw+ 1 )]
342- for i = 1 : length (kwnames)
343- str = string (kwnames[i]):: String
344- if endswith (str, " ..." )
345- kwnames[i] = Symbol (str[1 : end - 3 ])
346- end
347- end
348- Base. show_tuple_as_call (io, def. name, pos_sig;
349- demangle= true ,
350- kwargs= zip (kwnames, kwarg_types),
351- argnames= argnames[def. nkw+ 2 : end ])
352- else
353- Base. show_tuple_as_call (io, def. name, sig; demangle= true , argnames)
329+ else
330+ m = linfo:: Method
331+ show_spec_sig (io, m, m. sig)
332+ end
333+ end
334+
335+ function show_spec_sig (io:: IO , m:: Method , @nospecialize (sig:: Type ))
336+ if get (io, :limit , :false ):: Bool
337+ if ! haskey (io, :displaysize )
338+ io = IOContext (io, :displaysize => displaysize (io))
339+ end
340+ end
341+ argnames = Base. method_argnames (m)
342+ argnames = replace (argnames, :var"#unused#" => :var"" )
343+ if m. nkw > 0
344+ # rearrange call kw_impl(kw_args..., func, pos_args...) to func(pos_args...; kw_args)
345+ kwarg_types = Any[ fieldtype (sig, i) for i = 2 : (1 + m. nkw) ]
346+ uw = Base. unwrap_unionall (sig):: DataType
347+ pos_sig = Base. rewrap_unionall (Tuple{uw. parameters[(m. nkw+ 2 ): end ]. .. }, sig)
348+ kwnames = argnames[2 : (m. nkw+ 1 )]
349+ for i = 1 : length (kwnames)
350+ str = string (kwnames[i]):: String
351+ if endswith (str, " ..." )
352+ kwnames[i] = Symbol (str[1 : end - 3 ])
354353 end
355- else
356- Base. show_mi (io, linfo, true )
357354 end
355+ Base. show_tuple_as_call (io, m. name, pos_sig;
356+ demangle= true ,
357+ kwargs= zip (kwnames, kwarg_types),
358+ argnames= argnames[m. nkw+ 2 : end ])
359+ else
360+ Base. show_tuple_as_call (io, m. name, sig; demangle= true , argnames)
358361 end
359362end
360363
0 commit comments