diff --git a/src/codeview.jl b/src/codeview.jl index 02104072..5d799a66 100644 --- a/src/codeview.jl +++ b/src/codeview.jl @@ -168,7 +168,7 @@ function cthulhu_typed(io::IO, debuginfo::Symbol, preprinter = if src isa IRCode && inline_cost isa(mi, MethodInstance) || throw("`mi::MethodInstance` is required") if isa(src, IRCode) - if VERSION < v"1.11.0-DEV.258" + @static if VERSION < v"1.11.0-DEV.258" code = src.stmts.inst else code = src.stmts.stmt diff --git a/src/reflection.jl b/src/reflection.jl index 16377e67..6f559910 100644 --- a/src/reflection.jl +++ b/src/reflection.jl @@ -24,7 +24,7 @@ function find_callsites(interp::AbstractInterpreter, CI::Union{Core.CodeInfo, IR sptypes = sptypes_from_meth_instance(mi) callsites, sourcenodes = Callsite[], Union{TypedSyntax.MaybeTypedSyntaxNode,Callsite}[] if isa(CI, IRCode) - if VERSION < v"1.11.0-DEV.258" + @static if VERSION < v"1.11.0-DEV.258" stmts = CI.stmts.inst else stmts = CI.stmts.stmt diff --git a/test/test_Cthulhu.jl b/test/test_Cthulhu.jl index 2fd3524c..fefff45e 100644 --- a/test/test_Cthulhu.jl +++ b/test/test_Cthulhu.jl @@ -141,14 +141,14 @@ end end let (; src) = cthulhu_info(M.g, Tuple{Vector{Float64}}) - stmts = VERSION < v"1.11.0-DEV.258" ? src.stmts.inst : src.stmts.stmt + stmts = @static VERSION < v"1.11.0-DEV.258" ? src.stmts.inst : src.stmts.stmt @test all(stmts) do stmt isa(stmt, Core.GotoNode) || (isa(stmt, Core.ReturnNode) && isdefined(stmt, :val)) end end let (; src) = cthulhu_info(M.h, Tuple{Vector{Float64}}) - stmts = VERSION < v"1.11.0-DEV.258" ? src.stmts.inst : src.stmts.stmt + stmts = @static VERSION < v"1.11.0-DEV.258" ? src.stmts.inst : src.stmts.stmt @test count(!isnothing, stmts) == 2 stmt = stmts[end] @test isa(stmt, Core.ReturnNode) && !isdefined(stmt, :val) @@ -928,7 +928,7 @@ end j = only(findall(iscall((src, sin_noconstprop)), src.code)) @test i < j pc2remarks = interp.remarks[mi] - Base.VERSION >= v"1.8" && @test any(pc2remarks) do (pc, msg) + @test any(pc2remarks) do (pc, msg) pc == j && occursin("Disabled by method parameter", msg) end end