@@ -2,46 +2,21 @@ using QuantumInterface
22using Test
33using JET
44
5- using JET: ReportPass, BasicPass, InferenceErrorReport, UncaughtExceptionReport, MethodErrorReport
6-
7- # Custom report pass that ignores `UncaughtExceptionReport`
8- # Too coarse currently, but it serves to ignore the various
9- # "may throw" messages for runtime errors we raise on purpose
10- # (mostly on malformed user input)
11- struct MayThrowIsOk <: ReportPass end
5+ using JET: ReportPass, DefinitionAnalysisPass, BasicPass, InferenceErrorReport, UncaughtExceptionReport, MethodErrorReport
126
137# We define abstract methods, so it is unsurprising that there are no matching methods unless
148# we import other libraries.
159# TODO find a more fine-grained way to check these.
1610struct NoMatchingMethodIsOK <: ReportPass end
1711
18- # ignores `UncaughtExceptionReport` analyzed by `JETAnalyzer`
19- (:: MayThrowIsOk )(:: Type{UncaughtExceptionReport} , @nospecialize (_... )) = return
20-
21- # forward to `BasicPass` for everything else
22- function (:: MayThrowIsOk )(report_type:: Type{<:InferenceErrorReport} , @nospecialize (args... ))
23- BasicPass ()(report_type, args... )
24- end
25-
26- # ignores `UncaughtExceptionReport` and `MethodErrorReport` analyzed by `JETAnalyzer`
12+ # ignores `MethodErrorReport` analyzed by `JETAnalyzer`
2713(:: NoMatchingMethodIsOK )(:: Type{MethodErrorReport} , @nospecialize (_... )) = return
2814
29- # forward to `MayThrowIsOk` for everything else
3015function (:: NoMatchingMethodIsOK )(report_type:: Type{<:InferenceErrorReport} , @nospecialize (args... ))
31- MayThrowIsOk ()(report_type, args... )
16+ DefinitionAnalysisPass ()(report_type, args... ) # Using it instead of BasePass, see https://github.com/aviatesk/JET.jl/pull/532
3217end
3318
3419@testset " JET checks" begin
35- rep = report_package (" QuantumInterface" ;
36- report_pass= MayThrowIsOk (),
37- ignored_modules= (
38- # AnyFrameModule(...),
39- )
40- )
41- @show rep
42- @test length (JET. get_reports (rep)) <= 11
43- @test_broken length (JET. get_reports (rep)) == 0
44-
4520 rep = report_package (" QuantumInterface" ;
4621 report_pass= NoMatchingMethodIsOK (),
4722 ignored_modules= (
0 commit comments