Skip to content

Commit

Permalink
JETAnalyzer: disable bail_out_const_call
Browse files Browse the repository at this point in the history
To get nicer error reports.
  • Loading branch information
aviatesk committed Jan 31, 2024
1 parent 05714f2 commit dd34e12
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/analyzers/jetanalyzer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,13 @@ function CC.add_call_backedges!(
sv::InferenceState)
end

@static if VERSION v"1.11.0-DEV.1284"
CC.bail_out_const_call(::JETAnalyzer, ::MethodCallResult, ::StmtInfo, ::MethodMatch, ::InferenceState) = false
else
CC.const_prop_enabled(::JETAnalyzer, ::MethodMatch, ::InferenceState) = true
CC.bail_out_const_call(::JETAnalyzer, ::MethodCallResult, ::StmtInfo, ::InferenceState) = false

Check warning on line 282 in src/analyzers/jetanalyzer.jl

View check run for this annotation

Codecov / codecov/patch

src/analyzers/jetanalyzer.jl#L281-L282

Added lines #L281 - L282 were not covered by tests
end

# TODO Reasons about error found by [semi-]concrete evaluation:
# For now JETAnalyzer allows the regular constant-prop' only,
# unless the analyzed effects are proven to be `:nothrow`.
Expand Down
10 changes: 10 additions & 0 deletions test/analyzers/test_jetanalyzer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -810,6 +810,16 @@ end
x.y = "bar"
end
end
let # Note: on v1.11 and above, we need to disable `bail_out_const_call`
# in order to get a nicer report for this case
result = report_call((Float64,)) do x
x.num
end
@test only(get_reports_with_test(result)) isa BuiltinErrorReport
test_builtinerror_compatibility(result) do
(0.0).num
end
end
end

@testset "getfield analysis" begin
Expand Down

0 comments on commit dd34e12

Please sign in to comment.