Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix several sources of invalidation #732

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions src/packagedef.jl
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,6 @@ end

function eval_rex(rex::RelocatableExpr, exs_sigs_old::ExprsSigs, mod::Module; mode::Symbol=:eval)
return with_logger(_debug_logger) do
sigs, includes = nothing, nothing
rexo = getkey(exs_sigs_old, rex, nothing)
# extract the signatures and update the line info
if rexo === nothing
Expand All @@ -337,13 +336,16 @@ function eval_rex(rex::RelocatableExpr, exs_sigs_old::ExprsSigs, mod::Module; mo
end
end
storedeps(deps, rex, mod)
return sigs, includes
else
sigs = exs_sigs_old[rexo]
sigs, includes = exs_sigs_old[rexo], nothing
# Update location info
ln, lno = firstline(unwrap(rex)), firstline(unwrap(rexo))
if sigs !== nothing && !isempty(sigs) && ln != lno
ln, lno = ln::LineNumberNode, lno::LineNumberNode
@debug "LineOffset" _group="Action" time=time() deltainfo=(sigs, lno=>ln)
let sigs=sigs # #15276
@debug "LineOffset" _group="Action" time=time() deltainfo=(sigs, lno=>ln)
end
for sig in sigs
locdefs = CodeTracking.method_info[sig]::AbstractVector
ld = map(pr->linediff(lno, pr[1]), locdefs)
Expand All @@ -356,8 +358,8 @@ function eval_rex(rex::RelocatableExpr, exs_sigs_old::ExprsSigs, mod::Module; mo
locdefs[idx] = (newloc(methloc, ln, lno), methdef)
end
end
return sigs, includes
end
return sigs, includes
end
end

Expand Down Expand Up @@ -655,7 +657,7 @@ function handle_deletions(pkgdata, file)
end
topmod = first(keys(mexsold))
fileok = file_exists(String(filep)::String)
mexsnew = fileok ? parse_source(filep, topmod) : ModuleExprsSigs(topmod)
mexsnew = fileok ? Base.invokelatest(parse_source, filep, topmod) : ModuleExprsSigs(topmod)
if mexsnew !== nothing
delete_missing!(mexsold, mexsnew)
end
Expand Down
9 changes: 6 additions & 3 deletions src/pkgs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -357,13 +357,14 @@ end
function has_writable_paths(pkgdata::PkgData)
dir = basedir(pkgdata)
isdir(dir) || return true
haswritable = false
haswritable = Ref(false) # avoids Core.Box
cd(dir) do
for file in srcfiles(pkgdata)
haswritable |= iswritable(file)
isa(file, AbstractString) || continue
haswritable[] |= iswritable(file::String)
end
end
return haswritable
return haswritable[]
end

function watch_includes(mod::Module, fn::AbstractString)
Expand Down Expand Up @@ -439,6 +440,8 @@ function watch_manifest(mfile)
files = String[]
mustnotify = false
for file in srcfiles(pkgdata)
isa(file, AbstractString) || continue
file = file::String
fi = try
maybe_parse_from_cache!(pkgdata, file)
catch err
Expand Down
3 changes: 2 additions & 1 deletion src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ end
function unique_dirs(iter)
udirs = Set{String}()
for file in iter
dir, basename = splitdir(file)
isa(file, AbstractString) || continue
dir, basename = splitdir(file::String)
push!(udirs, dir)
end
return udirs
Expand Down