diff --git a/src/abstractinterpret/typeinfer.jl b/src/abstractinterpret/typeinfer.jl index c55c1ba0b..4fe24c5f9 100644 --- a/src/abstractinterpret/typeinfer.jl +++ b/src/abstractinterpret/typeinfer.jl @@ -212,21 +212,6 @@ function CC.getindex(wvc::WorldView{<:AbstractAnalyzerView}, mi::MethodInstance) return codeinst::CodeInstance end -function CC.transform_result_for_cache(analyzer::AbstractAnalyzer, - linfo::MethodInstance, valid_worlds::WorldRange, result::InferenceResult) - cache = InferenceErrorReport[] - for report in get_any_reports(analyzer, result) - @static if JET_DEV_MODE - actual, expected = first(report.vst).linfo, linfo - @assert actual === expected "invalid global caching detected, expected $expected but got $actual" - end - cache_report!(cache, report) - end - inferred_result = @invoke transform_result_for_cache(analyzer::AbstractInterpreter, - linfo::MethodInstance, valid_worlds::WorldRange, result::InferenceResult) - return CachedAnalysisResult(inferred_result, cache) -end - function CC.setindex!(wvc::WorldView{<:AbstractAnalyzerView}, codeinst::CodeInstance, mi::MethodInstance) analysis_cache = AnalysisCache(wvc) @static if VERSION < v"1.11.0-DEV.1552" @@ -545,6 +530,21 @@ function CC.cache_result!(analyzer::AbstractAnalyzer, caller::InferenceResult) @invoke CC.cache_result!(analyzer::AbstractInterpreter, caller::InferenceResult) end +function CC.transform_result_for_cache(analyzer::AbstractAnalyzer, + linfo::MethodInstance, valid_worlds::WorldRange, result::InferenceResult) + cache = InferenceErrorReport[] + for report in get_any_reports(analyzer, result) + @static if JET_DEV_MODE + actual, expected = first(report.vst).linfo, linfo + @assert actual === expected "invalid global caching detected, expected $expected but got $actual" + end + cache_report!(cache, report) + end + inferred_result = @invoke transform_result_for_cache(analyzer::AbstractInterpreter, + linfo::MethodInstance, valid_worlds::WorldRange, result::InferenceResult) + return CachedAnalysisResult(inferred_result, cache) +end + # top-level bridge # ================