diff --git a/ext/BijectorsEnzymeExt.jl b/ext/BijectorsEnzymeExt.jl index 1e8d8aa3..724c4d3d 100644 --- a/ext/BijectorsEnzymeExt.jl +++ b/ext/BijectorsEnzymeExt.jl @@ -8,7 +8,21 @@ else using ..Bijectors: find_alpha end -@import_rrule typeof(find_alpha) Real Real Real -@import_frule typeof(find_alpha) Real Real Real +# Julia 1.11.1 caused a change in the ordering of precompilation for extensions. +# https://github.com/TuringLang/Bijectors.jl/issues/332 +# See https://github.com/JuliaLang/julia/issues/56204 +@static if v"1.11.1" <= VERSION < v"1.12" + function __init__() + if !Base.generating_output() + Base.eval(quote + @import_rrule typeof(find_alpha) Real Real Real + @import_frule typeof(find_alpha) Real Real Real + end) + end + end +else + @import_rrule typeof(find_alpha) Real Real Real + @import_frule typeof(find_alpha) Real Real Real +end end