Skip to content

Commit a7e9899

Browse files
JeffBezansonKristofferC
authored andcommitted
fix #58013, error for too few arguments in invokelatest (#58056)
Also a couple builtins had the wrong function name in their error messages. fix #58013 (cherry picked from commit 90eb96f)
1 parent ebdb9c0 commit a7e9899

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/builtins.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -846,6 +846,7 @@ JL_CALLABLE(jl_f__apply_iterate)
846846
// this is like a regular call, but always runs in the newest world
847847
JL_CALLABLE(jl_f_invokelatest)
848848
{
849+
JL_NARGSV(invokelatest, 1);
849850
jl_task_t *ct = jl_current_task;
850851
size_t last_age = ct->world_age;
851852
if (!ct->ptls->in_pure_callback)
@@ -859,10 +860,10 @@ JL_CALLABLE(jl_f_invokelatest)
859860
// If world > jl_atomic_load_acquire(&jl_world_counter), run in the latest world.
860861
JL_CALLABLE(jl_f_invoke_in_world)
861862
{
862-
JL_NARGSV(_apply_in_world, 2);
863+
JL_NARGSV(invoke_in_world, 2);
863864
jl_task_t *ct = jl_current_task;
864865
size_t last_age = ct->world_age;
865-
JL_TYPECHK(_apply_in_world, ulong, args[0]);
866+
JL_TYPECHK(invoke_in_world, ulong, args[0]);
866867
size_t world = jl_unbox_ulong(args[0]);
867868
if (!ct->ptls->in_pure_callback) {
868869
ct->world_age = jl_atomic_load_acquire(&jl_world_counter);
@@ -877,7 +878,7 @@ JL_CALLABLE(jl_f_invoke_in_world)
877878
JL_CALLABLE(jl_f__call_in_world_total)
878879
{
879880
JL_NARGSV(_call_in_world_total, 2);
880-
JL_TYPECHK(_apply_in_world, ulong, args[0]);
881+
JL_TYPECHK(_call_in_world_total, ulong, args[0]);
881882
jl_task_t *ct = jl_current_task;
882883
int last_in = ct->ptls->in_pure_callback;
883884
jl_value_t *ret = NULL;

test/worlds.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
using Base: get_world_counter, tls_world_age
66
@test typemax(UInt) > get_world_counter() == tls_world_age() > 0
77

8+
# issue #58013
9+
@test_throws ArgumentError invokelatest()
10+
811
# test simple method replacement
912
begin
1013
g265a() = f265a(0)

0 commit comments

Comments
 (0)