Skip to content

Commit

Permalink
followups on undef static parameter report
Browse files Browse the repository at this point in the history
  • Loading branch information
aviatesk committed Jan 5, 2024
1 parent 85de6b2 commit 50eea5f
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/analyzers/jetanalyzer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -335,20 +335,19 @@ function CC.abstract_invoke(analyzer::JETAnalyzer, arginfo::ArgInfo, si::StmtInf
return ret
end

# report pass for undefined static parameter
@static if VERSION v"1.11.0-DEV.888"
function CC.abstract_eval_statement_expr(analyzer::JETAnalyzer, e::Expr, vtypes::VarTable, sv::InferenceState)
ret = @invoke CC.abstract_eval_statement_expr(analyzer::AbstractInterpreter, e::Expr, vtypes::VarTable, sv::InferenceState)
ret = @invoke CC.abstract_eval_statement_expr(analyzer::AbstractAnalyzer, e::Expr, vtypes::VarTable, sv::InferenceState)
if e.head === :static_parameter
# report pass for undefined static parameter
ReportPass(analyzer)(UndefVarErrorReport, analyzer, sv, e.args[1]::Int)
end
return ret
end
else
function CC.abstract_eval_value_expr(analyzer::JETAnalyzer, e::Expr, vtypes::VarTable, sv::InferenceState)
ret = @invoke CC.abstract_eval_value_expr(analyzer::AbstractInterpreter, e::Expr, vtypes::VarTable, sv::InferenceState)
ret = @invoke CC.abstract_eval_value_expr(analyzer::AbstractAnalyzer, e::Expr, vtypes::VarTable, sv::InferenceState)
if e.head === :static_parameter
# report pass for undefined static parameter
ReportPass(analyzer)(UndefVarErrorReport, analyzer, sv, e.args[1]::Int)
end
return ret
Expand Down Expand Up @@ -461,9 +460,7 @@ end
@jetreport struct GeneratorErrorReport <: InferenceErrorReport
@nospecialize err # actual error wrapped
end
function print_report_message(io::IO, (; err)::GeneratorErrorReport)
showerror(io, err)
end
print_report_message(io::IO, rep::GeneratorErrorReport) = showerror(io, rep.err)

# XXX what's the "soundness" of a `@generated` function ?
# adapted from https://github.com/JuliaLang/julia/blob/f806df603489cfca558f6284d52a38f523b81881/base/compiler/utilities.jl#L107-L137
Expand Down

0 comments on commit 50eea5f

Please sign in to comment.