Skip to content

Commit e28a2bc

Browse files
authored
Merge pull request #723 from timholy/teh/codeedges
2 parents 58cd2cb + 13af9b1 commit e28a2bc

File tree

8 files changed

+35
-12
lines changed

8 files changed

+35
-12
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,11 @@ jobs:
5757
while !isdefined(Base, :active_repl_backend) sleep(0.1) end
5858
pushfirst!(Base.active_repl_backend.ast_transforms, Revise.revise_first)
5959
include(joinpath("test", "runtests.jl"))
60-
REPL.eval_user_input(:(exit()), Base.active_repl_backend)
61-
' "Methods at REPL"
60+
if Base.VERSION.major == 1 && Base.VERSION.minor >= 9
61+
REPL.eval_user_input(:(exit()), Base.active_repl_backend, Main)
62+
else
63+
REPL.eval_user_input(:(exit()), Base.active_repl_backend)
64+
end' "Methods at REPL"
6265
# Tests for out-of-process updates to manifest
6366
bash test/envs/use_exputils/setup.sh
6467
julia --project --code-coverage=user test/envs/use_exputils/switch_version.jl

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "Revise"
22
uuid = "295af30f-e4ad-537b-8983-00126c2a3abe"
3-
version = "3.4.0"
3+
version = "3.5.0"
44

55
[deps]
66
CodeTracking = "da1fd8a2-8d9e-5ec2-8556-3022fb5608a2"
@@ -19,7 +19,7 @@ Unicode = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5"
1919
[compat]
2020
CodeTracking = "1.1"
2121
JuliaInterpreter = "0.9"
22-
LoweredCodeUtils = "2.2"
22+
LoweredCodeUtils = "2.3"
2323
OrderedCollections = "1"
2424
# Exclude Requires-1.1.0 - see https://github.com/JuliaPackaging/Requires.jl/issues/94
2525
Requires = "~1.0, ^1.1.1"

src/lowered.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ function minimal_evaluation!(@nospecialize(predicate), methodinfo, src::Core.Cod
102102
end
103103
# All tracked expressions are marked. Now add their dependencies.
104104
# LoweredCodeUtils.print_with_code(stdout, src, isrequired)
105-
lines_required!(isrequired, src, edges;
106-
norequire=mode===:sigs ? LoweredCodeUtils.exclude_named_typedefs(src, edges) : ())
105+
lines_required!(isrequired, src, edges;)
106+
# norequire=mode===:sigs ? LoweredCodeUtils.exclude_named_typedefs(src, edges) : ())
107107
# LoweredCodeUtils.print_with_code(stdout, src, isrequired)
108108
add_dependencies!(methodinfo, edges, src, isrequired)
109109
return isrequired, evalassign

src/packagedef.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1136,7 +1136,7 @@ function get_expressions(id::PkgId, filename)
11361136
return fi.modexsigs
11371137
end
11381138

1139-
function add_definitions_from_repl(filename)
1139+
function add_definitions_from_repl(filename::String)
11401140
hist_idx = parse(Int, filename[6:end-1])
11411141
hp = (Base.active_repl::REPL.LineEditREPL).interface.modes[1].hist::REPL.REPLHistoryProvider
11421142
src = hp.history[hp.start_idx+hist_idx]
@@ -1149,6 +1149,7 @@ function add_definitions_from_repl(filename)
11491149
push!(pkgdata, filename=>fi)
11501150
return fi
11511151
end
1152+
add_definitions_from_repl(filename::AbstractString) = add_definitions_from_repl(convert(String, filename)::String)
11521153

11531154
function update_stacktrace_lineno!(trace)
11541155
local nrep

src/types.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,12 +163,12 @@ function hasfile(info, file)
163163
fileindex(info, file) !== nothing
164164
end
165165

166-
function fileinfo(pkgdata::PkgData, file::AbstractString)
166+
function fileinfo(pkgdata::PkgData, file::String)
167167
i = fileindex(pkgdata, file)
168168
i === nothing && error("file ", file, " not found")
169169
return pkgdata.fileinfos[i]
170170
end
171-
fileinfo(pkgdata::PkgData, i::Integer) = pkgdata.fileinfos[i]
171+
fileinfo(pkgdata::PkgData, i::Int) = pkgdata.fileinfos[i]
172172

173173
function Base.push!(pkgdata::PkgData, pr::Pair{<:Any,FileInfo})
174174
push!(srcfiles(pkgdata), pr.first)

test/non_jl_test.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ try
3636
cp(joinpath(@__DIR__, "fake_lang", "test.program"), path, force=true)
3737
m=MyFile(path)
3838
includet(m)
39-
Revise.revise()
39+
yry() # comes from test/common.jl
4040
@test fake_lang.y() == "2"
4141
@test fake_lang.x() == "1"
4242
cp(joinpath(@__DIR__, "fake_lang", "new_test.program"), path, force=true)

test/runtests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3621,7 +3621,7 @@ GC.gc(); GC.gc()
36213621
end
36223622
end
36233623
msg = Revise.watching_files[] ? "is not an existing file" : "is not an existing directory"
3624-
isempty(ARGS) && @test occursin(msg, read(warnfile, String))
3624+
isempty(ARGS) && !Sys.isapple() && @test occursin(msg, read(warnfile, String))
36253625
rm(warnfile)
36263626
end
36273627
end

test/sigtest.jl

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@ function extracttype(T)
5656
isa(p1, TypeVar) && return p1.ub
5757
error("unrecognized type ", T)
5858
end
59+
if isdefined(Core, :TypeofVararg)
60+
istva(T) = isa(T, Core.TypeofVararg)
61+
else
62+
istva(T) = false
63+
end
5964
function in_module_or_core(T, mod::Module)
6065
if isa(T, TypeVar)
6166
return in_module_or_core(T.ub, mod)
@@ -68,6 +73,10 @@ function in_module_or_core(T, mod::Module)
6873
in_module_or_core(T.a, mod) || return false
6974
return in_module_or_core(T.b, mod)
7075
end
76+
if istva(T)
77+
isdefined(T, :T) || return true
78+
return in_module_or_core(T.T, mod)
79+
end
7180
Tname = T.name
7281
if Tname.name === :Type
7382
return in_module_or_core(extracttype(T), mod)
@@ -111,4 +120,14 @@ for sig in failed
111120
all(T->in_module_or_core(T, Base), Base.unwrap_unionall(sig).parameters[2:end]) || continue
112121
push!(realfailed, sig)
113122
end
114-
@test length(realfailed) < 40 # big enough for some cushion in case new "difficult" methods get added
123+
if false # change to true to see the failures
124+
world = Base.get_world_counter()
125+
for tt in realfailed
126+
println(tt)
127+
mms = Base._methods_by_ftype(tt, -1, world)
128+
for mm in mms
129+
println(mm.method)
130+
end
131+
end
132+
end
133+
@test length(realfailed) < 60 # big enough for some cushion in case new "difficult" methods get added

0 commit comments

Comments
 (0)