Skip to content

Commit

Permalink
Adjust to upcoming julia#54341 (#125)
Browse files Browse the repository at this point in the history
The feature check is done using julia#53849 (which is itself a bit of an experiment),
so the idea is to merge/tag this before the base PR is merged to prevent breakage on julia master.

See also JuliaDiff/Diffractor.jl#292
  • Loading branch information
Keno authored May 7, 2024
1 parent cd28093 commit af40b50
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/eval.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ function build_codeinfo(ir::IR)
push!(ci.slotnames, Symbol(""))
push!(ci.slotflags, 0)
end
if isdefined(Base, :__has_internal_change) && Base.__has_internal_change(v"1.12-alpha", :codeinfonargs)
ci.nargs = length(arguments(ir)) + 1
ci.isva = false
end
argument!(ir, at = 1)
update!(ci, ir)
end
Expand Down
8 changes: 8 additions & 0 deletions src/reflection/dynamo.jl
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ function dynamo(cache, world, f, args...)
m === nothing && error("Error looking up metadata for $f")
m.code.method_for_inference_limit_heuristics = nothing
end
if isdefined(Base, :__has_internal_change) && Base.__has_internal_change(v"1.12-alpha", :codeinfonargs)
m.code.nargs = 2
m.code.isva = true
end
_self = splicearg!(ir)
prewalk!(x -> x === self ? _self : x, ir)
return update!(m.code, ir)
Expand All @@ -112,6 +116,10 @@ function dynamo_lambda(cache, world, f::Type{<:Lambda{S,I}}) where {S,I}
closureargs!(ir)
m = @meta world dummy(1)
m.code.method_for_inference_limit_heuristics = nothing
if isdefined(Base, :__has_internal_change) && Base.__has_internal_change(v"1.12-alpha", :codeinfonargs)
m.code.nargs = 2
m.code.isva = true
end
return update!(m.code, ir)
end

Expand Down

0 comments on commit af40b50

Please sign in to comment.