diff --git a/base/compiler/ssair/show.jl b/base/compiler/ssair/show.jl index 4174267ec5a5e..258cdb4483a2a 100644 --- a/base/compiler/ssair/show.jl +++ b/base/compiler/ssair/show.jl @@ -153,7 +153,7 @@ function should_print_ssa_type(@nospecialize node) !isa(node, QuoteNode) end -function default_expr_type_printer(io::IO, @nospecialize(typ), used::Bool) +function default_expr_type_printer(io::IO, @nospecialize(typ), idx::Int, used::Bool) printstyled(io, "::", typ, color=(used ? :cyan : :light_black)) nothing end @@ -628,7 +628,7 @@ function show_ir_stmt(io::IO, code::Union{IRCode, CodeInfo}, idx::Int, line_info if new_node_type === UNDEF # try to be robust against errors printstyled(io, "::#UNDEF", color=:red) elseif show_type - line_info_postprinter(IOContext(io, :idx => node_idx), new_node_type, node_idx in used) + line_info_postprinter(IOContext(io, :idx => node_idx), new_node_type, node_idx, node_idx in used) end println(io) i += 1 @@ -643,7 +643,7 @@ function show_ir_stmt(io::IO, code::Union{IRCode, CodeInfo}, idx::Int, line_info # This is an error, but can happen if passes don't update their type information printstyled(io, "::#UNDEF", color=:red) elseif show_type - line_info_postprinter(IOContext(io, :idx => idx), type, idx in used) + line_info_postprinter(IOContext(io, :idx => idx), type, idx, idx in used) end end println(io) diff --git a/stdlib/InteractiveUtils/src/codeview.jl b/stdlib/InteractiveUtils/src/codeview.jl index b292324a17134..5d54485f0cb79 100644 --- a/stdlib/InteractiveUtils/src/codeview.jl +++ b/stdlib/InteractiveUtils/src/codeview.jl @@ -27,7 +27,7 @@ end # displaying type warnings -function warntype_type_printer(io::IO, @nospecialize(ty), used::Bool) +function warntype_type_printer(io::IO, @nospecialize(ty), idx::Int, used::Bool) used || return str = "::$ty" if !highlighting[:warntype] @@ -120,13 +120,13 @@ function code_warntype(io::IO, @nospecialize(f), @nospecialize(t); end print(io, " ", slotnames[i]) if isa(slottypes, Vector{Any}) - warntype_type_printer(io, slottypes[i], true) + warntype_type_printer(io, slottypes[i], 0, true) end println(io) end end print(io, "Body") - warntype_type_printer(io, rettype, true) + warntype_type_printer(io, rettype, 0, true) println(io) irshow_config = Base.IRShow.IRShowConfig(lineprinter(src), warntype_type_printer) Base.IRShow.show_ir(lambda_io, src, irshow_config)