Skip to content

Commit

Permalink
fix test_misc.jl on v1.11
Browse files Browse the repository at this point in the history
  • Loading branch information
aviatesk committed Oct 7, 2024
1 parent e9a0cfe commit 9002b8d
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
4 changes: 3 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Preferences = "1.4"
Random = "1.10"
Revise = "3.3"
StaticArrays = "1.7.0"
TOML = "1.0.3"
Test = "1.10"
julia = "1.10"

Expand All @@ -53,7 +54,8 @@ Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Revise = "295af30f-e4ad-537b-8983-00126c2a3abe"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
TOML = "fa267f1f-6049-4f14-aa54-33bafae1ed76"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Aqua", "BenchmarkTools", "Cthulhu", "Example", "Libdl", "Logging", "Random", "Revise", "StaticArrays", "Test"]
test = ["Aqua", "BenchmarkTools", "Cthulhu", "Example", "Libdl", "Logging", "Random", "Revise", "StaticArrays", "TOML", "Test"]
16 changes: 16 additions & 0 deletions src/JET.jl
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,9 @@ General users should use high-level entry points like [`report_call`](@ref) and
"""
function analyze_and_report_call!(analyzer::AbstractAnalyzer, @nospecialize(f), @nospecialize(types = Base.default_tt(f));
jetconfigs...)
if f isa Core.OpaqueClosure
return analyze_and_report_opaque_closure!(analyzer, f, types; jetconfigs...)
end
tt = Base.signature_type(f, types)
return analyze_and_report_call!(analyzer, tt::Type{<:Tuple}; jetconfigs...)
end
Expand Down Expand Up @@ -675,6 +678,19 @@ function analyze_method_signature!(analyzer::AbstractAnalyzer, m::Method, @nospe
return analyze_method_instance!(analyzer, mi)
end

function analyze_and_report_opaque_closure!(analyzer::AbstractAnalyzer, oc::Core.OpaqueClosure, @nospecialize(types);
jetconfigs...)
validate_configs(analyzer, jetconfigs)
env = Base.to_tuple_type(Any[Core.Typeof(x) for x in oc.captures])
tt = Tuple{env, #=sig=#(Base.to_tuple_type(types)::DataType).parameters...}
mi = specialize_method(oc.source::Method, tt, svec())
analyzer, result = analyze_method_instance!(analyzer, mi)
analyzername = nameof(typeof(analyzer))
sig = LazyPrinter(io->Base.show_tuple_as_call(io, Symbol(""), tt))
source = lazy"$analyzername: $sig"
return JETCallResult(result, analyzer, source; jetconfigs...)
end

function analyze_method_instance!(analyzer::AbstractAnalyzer, mi::MethodInstance)
result = InferenceResult(mi)

Expand Down
6 changes: 5 additions & 1 deletion test/test_misc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,12 @@ end
end
end

using Base.TOML
using JET: process_config_dict
@static if VERSION v"1.11-"
using TOML: TOML
else
using Base.TOML: TOML
end
macro toml_str(s); TOML.parse(TOML.Parser(s)); end

@testset "`process_config_dict`" begin
Expand Down

0 comments on commit 9002b8d

Please sign in to comment.