Skip to content

Commit 21489fe

Browse files
committed
Flip version gate to VERSION < v"1.6" for the fold workaround
Puts the old-Julia workaround in the leading branch so it can be dropped easily once Julia 1.0 support is no longer needed. Created by generative AI.
1 parent dbb9d6c commit 21489fe

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

src/with_ladj.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,7 @@ function _with_ladj_on_mapped(y_with_ladj::Tuple{NoLogAbsDetJacobian, Vararg{Uni
143143
return first(y_with_ladj)
144144
end
145145

146-
@static if VERSION >= v"1.6"
147-
function _with_ladj_on_mapped(y_with_ladj::Tuple{Tuple{Any,Real}, Vararg{Union{NoLogAbsDetJacobian, Tuple{Any,Real}}}})
148-
a, bs = first(y_with_ladj), Base.tail(y_with_ladj)
149-
return foldl(_combine_y_ladj, bs, init = ((a[1],), a[2]))
150-
end
151-
else
146+
@static if VERSION < v"1.6"
152147
# Hand-rolled foldl, foldl over tuples is not inferrable on Julia < 1.6:
153148
_foldl_combine_y_ladj(acc) = acc
154149
_foldl_combine_y_ladj(acc, b, bs...) = _foldl_combine_y_ladj(_combine_y_ladj(acc, b), bs...)
@@ -157,6 +152,11 @@ else
157152
a = first(y_with_ladj)
158153
return _foldl_combine_y_ladj(((a[1],), a[2]), Base.tail(y_with_ladj)...)
159154
end
155+
else
156+
function _with_ladj_on_mapped(y_with_ladj::Tuple{Tuple{Any,Real}, Vararg{Union{NoLogAbsDetJacobian, Tuple{Any,Real}}}})
157+
a, bs = first(y_with_ladj), Base.tail(y_with_ladj)
158+
return foldl(_combine_y_ladj, bs, init = ((a[1],), a[2]))
159+
end
160160
end
161161

162162
@static if VERSION >= v"1.6"

0 commit comments

Comments
 (0)