Skip to content

Commit af40b50

Browse files
authored
Adjust to upcoming julia#54341 (#125)
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
1 parent cd28093 commit af40b50

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/eval.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ function build_codeinfo(ir::IR)
1515
push!(ci.slotnames, Symbol(""))
1616
push!(ci.slotflags, 0)
1717
end
18+
if isdefined(Base, :__has_internal_change) && Base.__has_internal_change(v"1.12-alpha", :codeinfonargs)
19+
ci.nargs = length(arguments(ir)) + 1
20+
ci.isva = false
21+
end
1822
argument!(ir, at = 1)
1923
update!(ci, ir)
2024
end

src/reflection/dynamo.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,10 @@ function dynamo(cache, world, f, args...)
100100
m === nothing && error("Error looking up metadata for $f")
101101
m.code.method_for_inference_limit_heuristics = nothing
102102
end
103+
if isdefined(Base, :__has_internal_change) && Base.__has_internal_change(v"1.12-alpha", :codeinfonargs)
104+
m.code.nargs = 2
105+
m.code.isva = true
106+
end
103107
_self = splicearg!(ir)
104108
prewalk!(x -> x === self ? _self : x, ir)
105109
return update!(m.code, ir)
@@ -112,6 +116,10 @@ function dynamo_lambda(cache, world, f::Type{<:Lambda{S,I}}) where {S,I}
112116
closureargs!(ir)
113117
m = @meta world dummy(1)
114118
m.code.method_for_inference_limit_heuristics = nothing
119+
if isdefined(Base, :__has_internal_change) && Base.__has_internal_change(v"1.12-alpha", :codeinfonargs)
120+
m.code.nargs = 2
121+
m.code.isva = true
122+
end
115123
return update!(m.code, ir)
116124
end
117125

0 commit comments

Comments
 (0)