Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simplify JET #84

Merged
merged 2 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion test/test_express_opt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
express(state)
nocache = @timed express(state2)
withcache = @timed express(state2)
@test nocache.time > 50*withcache.time
@test nocache.time > 20*withcache.time
@test withcache.bytes == 0
@test nocache.value ≈ withcache.value ≈ express(state2)

Expand Down
19 changes: 1 addition & 18 deletions test/test_jet.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,9 @@
using JET
using QuantumOptics, QuantumClifford # to load the extensions

using JET: ReportPass, BasicPass, InferenceErrorReport, UncaughtExceptionReport

# Custom report pass that ignores `UncaughtExceptionReport`
# Too coarse currently, but it serves to ignore the various
# "may throw" messages for runtime errors we raise on purpose
# (mostly on malformed user input)
struct MayThrowIsOk <: ReportPass end

# ignores `UncaughtExceptionReport` analyzed by `JETAnalyzer`
(::MayThrowIsOk)(::Type{UncaughtExceptionReport}, @nospecialize(_...)) = return

# forward to `BasicPass` for everything else
function (::MayThrowIsOk)(report_type::Type{<:InferenceErrorReport}, @nospecialize(args...))
BasicPass()(report_type, args...)
end

using InteractiveUtils, Latexify, SymbolicUtils

rep = report_package("QuantumSymbolics";
report_pass=MayThrowIsOk(), # TODO have something more fine grained than a generic "do not care about thrown errors"
ignored_modules=(
AnyFrameModule(InteractiveUtils),
AnyFrameModule(Latexify),
Expand All @@ -30,5 +13,5 @@ rep = report_package("QuantumSymbolics";
)
@show rep
@test_broken length(JET.get_reports(rep)) == 0
@test length(JET.get_reports(rep)) <= 7
@test length(JET.get_reports(rep)) <= 6
end
Loading