Skip to content

Commit a43b1ad

Browse files
authored
show: support toplevel InferenceResult (#49202)
1 parent fe1e1c4 commit a43b1ad

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

base/show.jl

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2664,13 +2664,18 @@ function show(io::IO, src::CodeInfo; debuginfo::Symbol=:source)
26642664
end
26652665

26662666
function show(io::IO, inferred::Core.Compiler.InferenceResult)
2667-
tt = inferred.linfo.specTypes.parameters[2:end]
2667+
mi = inferred.linfo
2668+
tt = mi.specTypes.parameters[2:end]
26682669
tts = join(["::$(t)" for t in tt], ", ")
26692670
rettype = inferred.result
26702671
if isa(rettype, Core.Compiler.InferenceState)
26712672
rettype = rettype.bestguess
26722673
end
2673-
print(io, "$(inferred.linfo.def.name)($(tts)) => $(rettype)")
2674+
if isa(mi.def, Method)
2675+
print(io, mi.def.name, "(", tts, " => ", rettype, ")")
2676+
else
2677+
print(io, "Toplevel MethodInstance thunk from ", mi.def, " => ", rettype)
2678+
end
26742679
end
26752680

26762681
function show(io::IO, ::Core.Compiler.NativeInterpreter)

0 commit comments

Comments
 (0)