Skip to content

Commit

Permalink
add @static annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
aviatesk committed Aug 15, 2023
1 parent f250f1c commit a14a9f1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/codeview.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/reflection.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions test/test_Cthulhu.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit a14a9f1

Please sign in to comment.