Skip to content

Commit f221cb5

Browse files
authored
update to LoweredCodeUtils@3 (#650)
* update to LoweredCodeUtils@3 * update test for v1.11
1 parent 25d95fb commit f221cb5

File tree

3 files changed

+5
-17
lines changed

3 files changed

+5
-17
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ InteractiveUtils = "1.10"
2929
JuliaInterpreter = "0.9"
3030
Libdl = "1.10"
3131
Logging = "1.10"
32-
LoweredCodeUtils = "2.4.5"
32+
LoweredCodeUtils = "3"
3333
MacroTools = "0.5.6"
3434
Pkg = "1.10"
3535
PrecompileTools = "1"

src/toplevel/virtualprocess.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1072,7 +1072,7 @@ Partially interprets statements in `src` using JuliaInterpreter.jl:
10721072
- special-cases `include` calls so that top-level analysis recursively enters the included file
10731073
"""
10741074
function partially_interpret!(interp::ConcreteInterpreter, mod::Module, src::CodeInfo)
1075-
concretize = select_statements(src)
1075+
concretize = select_statements(mod, src)
10761076
@assert length(src.code) == length(concretize)
10771077

10781078
with_toplevel_logger(interp.config; filter=(JET_LOGGER_LEVEL_DEBUG)) do @nospecialize(io)
@@ -1090,9 +1090,9 @@ function partially_interpret!(interp::ConcreteInterpreter, mod::Module, src::Cod
10901090
end
10911091

10921092
# select statements that should be concretized, and actually interpreted rather than abstracted
1093-
function select_statements(src::CodeInfo)
1093+
function select_statements(mod::Module, src::CodeInfo)
10941094
stmts = src.code
1095-
cl = LoweredCodeUtils.CodeLinks(src) # make `CodeEdges` hold `CodeLinks`?
1095+
cl = LoweredCodeUtils.CodeLinks(mod, src) # make `CodeEdges` hold `CodeLinks`?
10961096
edges = LoweredCodeUtils.CodeEdges(src, cl)
10971097

10981098
concretize = falses(length(stmts))

test/toplevel/test_virtualprocess.jl

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -681,18 +681,6 @@ end
681681
@test occursin("isexpr2", get_msg(report))
682682
end
683683

684-
# error handling for module usages
685-
let res = @analyze_toplevel begin
686-
using Base: foo
687-
end
688-
689-
@test !isempty(res.res.toplevel_error_reports)
690-
er = first(res.res.toplevel_error_reports)
691-
@test er isa ActualErrorWrapped
692-
@test er.err isa UndefVarError && er.err.var === :foo
693-
@test er.file == (@__FILE__) && er.line == (@__LINE__) - 7
694-
end
695-
696684
# sequential usage
697685
let res = @analyze_toplevel begin
698686
module foo
@@ -1735,7 +1723,7 @@ end
17351723
@eval global getsum() = $sum # concretization is forced
17361724
write(product) # should NOT be selected
17371725
end
1738-
slice = JET.select_statements(src)
1726+
slice = JET.select_statements(@__MODULE__, src)
17391727

17401728
found_N = found_sum = found_product = found_w = found_write = false
17411729
for (i, stmt) in enumerate(src.code)

0 commit comments

Comments
 (0)