Skip to content

Commit abbc1ac

Browse files
Kenopulsipher
andauthored
Use invokelatest after eval to adjust to upcoming julia change (#369)
* Use invokelatest after eval to adjust to upcoming julia change In 1.12, we're cleaning up when implicit world age increments happen at toplevel. Because these test `eval` an expression and immediately call it, an `invokelatest` will likely be required (as it would be right now in local scope). See JuliaLang/julia#56509 * Added note for future reference --------- Co-authored-by: pulsipher <joshuapulsipher13@gmail.com> Co-authored-by: Joshua Pulsipher <33848311+pulsipher@users.noreply.github.com>
1 parent 740616e commit abbc1ac

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

test/expressions.jl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,10 +249,11 @@ end
249249
anon = :((t, x) -> f(t, x, 1, d = 1))
250250
@test InfiniteOpt._process_func_expr(error, anon) == (esc(anon), esc(:(t,x)), true)
251251
anon = :((t, x[1]) -> sin(t + x[1]))
252-
@test eval(InfiniteOpt._process_func_expr(error, anon)[1].args[1])(0.5, 0.2) == sin(0.5 + 0.2)
252+
# Need invokelatest due to https://github.com/infiniteopt/InfiniteOpt.jl/pull/369
253+
@test invokelatest(eval(InfiniteOpt._process_func_expr(error, anon)[1].args[1]), 0.5, 0.2) == sin(0.5 + 0.2)
253254
anon = :(t[i] -> t[i] + 3)
254-
@test eval(InfiniteOpt._process_func_expr(error, anon)[1].args[1])(2) == 5
255-
# test errors
255+
@test invokelatest(eval(InfiniteOpt._process_func_expr(error, anon)[1].args[1]), 2) == 5
256+
# test errors
256257
@test_throws ErrorException InfiniteOpt._process_func_expr(error, :(f(t, d = 2)))
257258
@test_throws ErrorException InfiniteOpt._process_func_expr(error, :(f(x, t; d = 2)))
258259
@test_throws ErrorException InfiniteOpt._process_func_expr(error, :(f >= 2))

0 commit comments

Comments
 (0)