Skip to content

Commit 8aac4cc

Browse files
authored
Hide IRShow include from Revise (#56756)
Revise in theory wants to re-evaluate this include, but it fails at doing so, because the include call no longer works after bootstrap. It happens to work right now on master, because the lowering of `Compiler.include` happens to hide the include call from Revise, but that's a Revise bug I'm about to fix. Address this by moving the include call into the package and using an absolute include if necessary.
1 parent 35976df commit 8aac4cc

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

Compiler/src/Compiler.jl

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,12 +181,26 @@ include("bootstrap.jl")
181181
include("reflection_interface.jl")
182182
include("opaque_closure.jl")
183183

184+
macro __SOURCE_FILE__()
185+
__source__.file === nothing && return nothing
186+
return __source__.file::Symbol
187+
end
188+
184189
module IRShow end
190+
function load_irshow!()
191+
if isdefined(Base, :end_base_include)
192+
# This code path is exclusively for Revise, which may want to re-run this
193+
# after bootstrap.
194+
include(IRShow, Base.joinpath(Base.dirname(Base.String(@__SOURCE_FILE__)), "ssair/show.jl"))
195+
else
196+
include(IRShow, "ssair/show.jl")
197+
end
198+
end
185199
if !isdefined(Base, :end_base_include)
186200
# During bootstrap, skip including this file and defer it to base/show.jl to include later
187201
else
188202
# When this module is loaded as the standard library, include this file as usual
189-
include(IRShow, "ssair/show.jl")
203+
load_irshow!()
190204
end
191205

192206
end # baremodule Compiler

base/show.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2821,7 +2821,7 @@ function show(io::IO, vm::Core.TypeofVararg)
28212821
end
28222822
end
28232823

2824-
Compiler.include(Compiler.IRShow, "ssair/show.jl") # define `show` for the compiler types
2824+
Compiler.load_irshow!()
28252825
const IRShow = Compiler.IRShow # an alias for compatibility
28262826

28272827
function show(io::IO, src::CodeInfo; debuginfo::Symbol=:source)

0 commit comments

Comments
 (0)