FluxML/IRTools.jl

Adjustment needed for Julia 1.8

Closed this issue · 1 comments

Noticed in JuliaLang/julia#43023: Since v1.8.0-DEV.267, the nargs argument of replace_code_newstyle! has changed its semantics, being offset by one. I.e. it now requires

diff --git a/src/reflection/utils.jl b/src/reflection/utils.jl
index f5dc511..66bacf6 100644
--- a/src/reflection/utils.jl
+++ b/src/reflection/utils.jl
@@ -134,7 +134,7 @@ function splicearg!(ir::IR)
 end
 
 function update!(ci::CodeInfo, ir::Core.Compiler.IRCode)
-  Core.Compiler.replace_code_newstyle!(ci, ir, length(ir.argtypes)-1)
+  Core.Compiler.replace_code_newstyle!(ci, ir, length(ir.argtypes))
   ci.inferred = false
   ci.ssavaluetypes = length(ci.code)
   slots!(ci)

(That obviously needs to be put inside an if VERSION check.)

Nice catch, thank you so much for figuring this out!