Skip to content

Commit 8084402

Browse files
timholyKristofferC
authored andcommitted
Fix several sources of invalidation
These changes fix invalidation from the JuliaData ecosystem, presumably mostly due to new AbstractString subtypes.
1 parent eb0bd3f commit 8084402

File tree

3 files changed

+15
-9
lines changed

3 files changed

+15
-9
lines changed

src/packagedef.jl

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,6 @@ end
316316

317317
function eval_rex(rex::RelocatableExpr, exs_sigs_old::ExprsSigs, mod::Module; mode::Symbol=:eval)
318318
return with_logger(_debug_logger) do
319-
sigs, includes = nothing, nothing
320319
rexo = getkey(exs_sigs_old, rex, nothing)
321320
# extract the signatures and update the line info
322321
if rexo === nothing
@@ -337,13 +336,16 @@ function eval_rex(rex::RelocatableExpr, exs_sigs_old::ExprsSigs, mod::Module; mo
337336
end
338337
end
339338
storedeps(deps, rex, mod)
339+
return sigs, includes
340340
else
341-
sigs = exs_sigs_old[rexo]
341+
sigs, includes = exs_sigs_old[rexo], nothing
342342
# Update location info
343343
ln, lno = firstline(unwrap(rex)), firstline(unwrap(rexo))
344344
if sigs !== nothing && !isempty(sigs) && ln != lno
345345
ln, lno = ln::LineNumberNode, lno::LineNumberNode
346-
@debug "LineOffset" _group="Action" time=time() deltainfo=(sigs, lno=>ln)
346+
let sigs=sigs # #15276
347+
@debug "LineOffset" _group="Action" time=time() deltainfo=(sigs, lno=>ln)
348+
end
347349
for sig in sigs
348350
locdefs = CodeTracking.method_info[sig]::AbstractVector
349351
ld = map(pr->linediff(lno, pr[1]), locdefs)
@@ -356,8 +358,8 @@ function eval_rex(rex::RelocatableExpr, exs_sigs_old::ExprsSigs, mod::Module; mo
356358
locdefs[idx] = (newloc(methloc, ln, lno), methdef)
357359
end
358360
end
361+
return sigs, includes
359362
end
360-
return sigs, includes
361363
end
362364
end
363365

@@ -655,7 +657,7 @@ function handle_deletions(pkgdata, file)
655657
end
656658
topmod = first(keys(mexsold))
657659
fileok = file_exists(String(filep)::String)
658-
mexsnew = fileok ? parse_source(filep, topmod) : ModuleExprsSigs(topmod)
660+
mexsnew = fileok ? Base.invokelatest(parse_source, filep, topmod) : ModuleExprsSigs(topmod)
659661
if mexsnew !== nothing
660662
delete_missing!(mexsold, mexsnew)
661663
end

src/pkgs.jl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -357,13 +357,14 @@ end
357357
function has_writable_paths(pkgdata::PkgData)
358358
dir = basedir(pkgdata)
359359
isdir(dir) || return true
360-
haswritable = false
360+
haswritable = Ref(false) # avoids Core.Box
361361
cd(dir) do
362362
for file in srcfiles(pkgdata)
363-
haswritable |= iswritable(file)
363+
isa(file, AbstractString) || continue
364+
haswritable[] |= iswritable(file::String)
364365
end
365366
end
366-
return haswritable
367+
return haswritable[]
367368
end
368369

369370
function watch_includes(mod::Module, fn::AbstractString)
@@ -439,6 +440,8 @@ function watch_manifest(mfile)
439440
files = String[]
440441
mustnotify = false
441442
for file in srcfiles(pkgdata)
443+
isa(file, AbstractString) || continue
444+
file = file::String
442445
fi = try
443446
maybe_parse_from_cache!(pkgdata, file)
444447
catch err

src/utils.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ end
2727
function unique_dirs(iter)
2828
udirs = Set{String}()
2929
for file in iter
30-
dir, basename = splitdir(file)
30+
isa(file, AbstractString) || continue
31+
dir, basename = splitdir(file::String)
3132
push!(udirs, dir)
3233
end
3334
return udirs

0 commit comments

Comments
 (0)