Skip to content

Commit afe76b2

Browse files
committed
Hide IRShow include from Revise
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 afe76b2

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

Compiler/src/Compiler.jl

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,11 +182,20 @@ include("reflection_interface.jl")
182182
include("opaque_closure.jl")
183183

184184
module IRShow end
185+
function load_irshow!()
186+
if isdefined(Base, :end_base_include)
187+
# This code path is exclusively for Revise, which may want to re-run this
188+
# after bootstrap.
189+
include(IRShow, Base.joinpath(Base.dirname(@__FILE__), "ssair/show.jl"))
190+
else
191+
include(IRShow, "ssair/show.jl")
192+
end
193+
end
185194
if !isdefined(Base, :end_base_include)
186195
# During bootstrap, skip including this file and defer it to base/show.jl to include later
187196
else
188197
# When this module is loaded as the standard library, include this file as usual
189-
include(IRShow, "ssair/show.jl")
198+
load_irshow!()
190199
end
191200

192201
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)