Skip to content

Use invokelatest after eval to adjust to upcoming julia change #369

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions test/expressions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
Loading