From bbe537232655ca1f51930c6aba941aaebedfe01d Mon Sep 17 00:00:00 2001 From: Keno Fischer Date: Wed, 20 Nov 2024 03:13:05 +0000 Subject: [PATCH] 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 https://github.com/JuliaLang/julia/pull/56509 --- test/expressions.jl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/expressions.jl b/test/expressions.jl index 97b40fec..2645ded9 100644 --- a/test/expressions.jl +++ b/test/expressions.jl @@ -249,10 +249,10 @@ end anon = :((t, x) -> f(t, x, 1, d = 1)) @test InfiniteOpt._process_func_expr(error, anon) == (esc(anon), esc(:(t,x)), true) anon = :((t, x[1]) -> sin(t + x[1])) - @test eval(InfiniteOpt._process_func_expr(error, anon)[1].args[1])(0.5, 0.2) == sin(0.5 + 0.2) + @test invokelatest(eval(InfiniteOpt._process_func_expr(error, anon)[1].args[1]), 0.5, 0.2) == sin(0.5 + 0.2) anon = :(t[i] -> t[i] + 3) - @test eval(InfiniteOpt._process_func_expr(error, anon)[1].args[1])(2) == 5 - # test errors + @test invokelatest(eval(InfiniteOpt._process_func_expr(error, anon)[1].args[1]), 2) == 5 + # test errors @test_throws ErrorException InfiniteOpt._process_func_expr(error, :(f(t, d = 2))) @test_throws ErrorException InfiniteOpt._process_func_expr(error, :(f(x, t; d = 2))) @test_throws ErrorException InfiniteOpt._process_func_expr(error, :(f >= 2))