Skip to content

Commit

Permalink
add missing @nospecialize annotation (#439)
Browse files Browse the repository at this point in the history
  • Loading branch information
aviatesk authored Dec 14, 2022
1 parent 53d5afd commit 027bf46
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/JET.jl
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ JETCallResult(result::InferenceResult, analyzer::AbstractAnalyzer, source::Abstr
return state > $(fieldcount(JETCallResult)) ? nothing : (getfield(res, state), state+1)

function get_result(result::JETCallResult)
if any(@nospecialize(r) -> isa(r, GeneratorErrorReport), get_reports(result))
if any(@nospecialize(r::InferenceErrorReport) -> isa(r, GeneratorErrorReport), get_reports(result))
return Bottom
else
return result.result.result
Expand Down
8 changes: 4 additions & 4 deletions src/abstractinterpret/abstractanalyzer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -536,18 +536,18 @@ get_any_reports(analyzer::AbstractAnalyzer, result::InferenceResult) = (analyzer
Adds new [`report::InferenceErrorReport`](@ref InferenceErrorReport) associated with `result::InferenceResult`.
"""
function add_new_report!(analyzer::AbstractAnalyzer, result::InferenceResult, report::InferenceErrorReport)
function add_new_report!(analyzer::AbstractAnalyzer, result::InferenceResult, @nospecialize(report::InferenceErrorReport))
push!(get_reports(analyzer, result), report)
return report
end

function add_cached_report!(analyzer::AbstractAnalyzer, caller::InferenceResult, cached::InferenceErrorReport)
function add_cached_report!(analyzer::AbstractAnalyzer, caller::InferenceResult, @nospecialize(cached::InferenceErrorReport))
cached = copy_report′(cached)
push!(get_reports(analyzer, caller), cached)
return cached
end

add_caller_cache!(analyzer::AbstractAnalyzer, report::InferenceErrorReport) = push!(get_caller_cache(analyzer), report)
add_caller_cache!(analyzer::AbstractAnalyzer, @nospecialize(report::InferenceErrorReport)) = push!(get_caller_cache(analyzer), report)
add_caller_cache!(analyzer::AbstractAnalyzer, reports::Vector{InferenceErrorReport}) = append!(get_caller_cache(analyzer), reports)

# AbstractInterpreter
Expand Down Expand Up @@ -628,7 +628,7 @@ ignores the identity of error point's `MethodInstance`, under the assumption tha
identical as far as they're collected at the same file and line.
"""
aggregation_policy(::AbstractAnalyzer) = default_aggregation_policy
function default_aggregation_policy(@nospecialize(report#=::InferenceErrorReport=#))
function default_aggregation_policy(@nospecialize(report::InferenceErrorReport))
return DefaultReportIdentity(
typeof(Base.inferencebarrier(report))::DataType,
report.sig,
Expand Down
2 changes: 1 addition & 1 deletion src/abstractinterpret/inferenceerrorreport.jl
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ report_color(::InferenceErrorReport) = ERROR_COLOR
# ------

# to help inference
function Base.getproperty(er::InferenceErrorReport, sym::Symbol)
@inline function Base.getproperty(@nospecialize(er::InferenceErrorReport), sym::Symbol)
return if sym === :vst
getfield(er, sym)::VirtualStackTrace
elseif sym === :sig
Expand Down
1 change: 1 addition & 0 deletions src/abstractinterpret/typeinfer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,7 @@ because it is not detected within `linfo3` but within `linfo1` (so it's not a "l
"""
function islineage(parent::MethodInstance, current::MethodInstance)
function (report::InferenceErrorReport)
@nospecialize report
@inbounds begin
vst = report.vst
length(vst) > 1 || return false
Expand Down
4 changes: 3 additions & 1 deletion src/analyzers/jetanalyzer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,9 @@ function (::BasicPass)(::Type{UncaughtExceptionReport}, analyzer::JETAnalyzer, f
# (if exists) are caught and not propagated here
# we don't want to cache the caught `UncaughtExceptionReport`s for this frame and
# its parents, and just filter them away now
filter!(report->!isa(report, UncaughtExceptionReport), get_reports(analyzer, frame.result))
filter!(get_reports(analyzer, frame.result)) do @nospecialize(report::InferenceErrorReport)
return !isa(report, UncaughtExceptionReport)
end
end
return false
end
Expand Down

0 comments on commit 027bf46

Please sign in to comment.