@@ -4,10 +4,57 @@ using Test: Test
44using Aqua: Aqua
55using JET: JET
66using CTBase: CTBase
7+ using Logging: Logging
78
89const VERBOSE = isdefined (Main, :TestData ) ? Main. TestData. VERBOSE : true
910const SHOWTIMING = isdefined (Main, :TestData ) ? Main. TestData. SHOWTIMING : true
1011
12+ # ==============================================================================
13+ # Filter LoweredCodeUtils' benign "skipping callee ... UndefRefError()" warnings
14+ # ==============================================================================
15+ #
16+ # JET.test_package collects method signatures via Revise/LoweredCodeUtils without
17+ # calling anything. For keyword-argument functor methods (a callable struct with a
18+ # `; kwarg=default` in its call signature), Julia compiles a hidden body function
19+ # named `var"#_#N"`; LoweredCodeUtils cannot statically attribute that hidden body
20+ # to its parent method and emits a `@warn "skipping callee ..." ` before moving on.
21+ # It is a collector limitation, not a JET finding — the flagged body is simply
22+ # excluded from the static scan; everything else (including its runtime behavior,
23+ # covered by the normal test suite) is unaffected.
24+ #
25+ # Filtered precisely by message prefix + emitting module, so any other, unrelated
26+ # warning from LoweredCodeUtils still surfaces normally.
27+ struct _SkipBenignLoweredCodeUtilsWarnings <: Logging.AbstractLogger
28+ logger:: Logging.AbstractLogger
29+ end
30+
31+ Logging. min_enabled_level (l:: _SkipBenignLoweredCodeUtilsWarnings ) =
32+ Logging. min_enabled_level (l. logger)
33+
34+ Logging. shouldlog (l:: _SkipBenignLoweredCodeUtilsWarnings , level, _module, group, id) =
35+ Logging. shouldlog (l. logger, level, _module, group, id)
36+
37+ function Logging. handle_message (
38+ l:: _SkipBenignLoweredCodeUtilsWarnings ,
39+ level,
40+ message,
41+ _module,
42+ group,
43+ id,
44+ file,
45+ line;
46+ kwargs... ,
47+ )
48+ if level == Logging. Warn &&
49+ nameof (_module) === :LoweredCodeUtils &&
50+ startswith (string (message), " skipping callee" )
51+ return nothing
52+ end
53+ return Logging. handle_message (
54+ l. logger, level, message, _module, group, id, file, line; kwargs...
55+ )
56+ end
57+
1158function test_code_quality ()
1259 Test. @testset verbose = VERBOSE showtiming = SHOWTIMING " Code quality" begin
1360 Test. @testset verbose = VERBOSE showtiming = SHOWTIMING " Aqua" begin
@@ -23,7 +70,11 @@ function test_code_quality()
2370 end
2471
2572 Test. @testset " JET" begin
26- JET. test_package (CTBase; target_modules= (CTBase,))
73+ Logging. with_logger (
74+ _SkipBenignLoweredCodeUtilsWarnings (Logging. current_logger ())
75+ ) do
76+ JET. test_package (CTBase; target_modules= (CTBase,))
77+ end
2778 end
2879
2980 # Test.@testset "JuliaFormatter" begin
0 commit comments