Skip to content

Commit

Permalink
udpate path to Compiler stdlib to a valid one
Browse files Browse the repository at this point in the history
  • Loading branch information
KristofferC committed Feb 5, 2025
1 parent 99fd5d9 commit 7215684
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
14 changes: 9 additions & 5 deletions base/methodshow.jl
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,17 @@ function fixup_stdlib_path(path::String)
# The file defining Base.Sys gets included after this file is included so make sure
# this function is valid even in this intermediary state
if isdefined(@__MODULE__, :Sys)
BUILD_STDLIB_PATH = Sys.BUILD_STDLIB_PATH::String
STDLIB = Sys.STDLIB::String
if BUILD_STDLIB_PATH != STDLIB
if Sys.BUILD_STDLIB_PATH != Sys.STDLIB
# BUILD_STDLIB_PATH gets defined in sysinfo.jl
npath = normpath(path)
npath′ = replace(npath, normpath(BUILD_STDLIB_PATH) => normpath(STDLIB))
return npath == npath′ ? path : npath′
npath′ = replace(npath, normpath(Sys.BUILD_STDLIB_PATH) => normpath(Sys.STDLIB))
path = npath == npath′ ? path : npath′
end
if isdefined(@__MODULE__, :Core) && isdefined(Core, :Compiler)
compiler_folder = dirname(string(methods(Core.Compiler.eval)[1].file))
if dirname(path) == compiler_folder
return abspath(Sys.STDLIB, "..", "..", "Compiler", "src", basename(path))
end
end
end
return path
Expand Down
4 changes: 4 additions & 0 deletions stdlib/InteractiveUtils/test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,10 @@ file, ln = functionloc(versioninfo, Tuple{})
@test isfile(pathof(InteractiveUtils))
@test isdir(pkgdir(InteractiveUtils))

# compiler stdlib path updating
file, ln = functionloc(Core.Compiler.tmeet, Tuple{Int, Float64)})
@test isfile(file)

@testset "buildbot path updating" begin
file, ln = functionloc(versioninfo, Tuple{})
@test isfile(file)
Expand Down

0 comments on commit 7215684

Please sign in to comment.