@@ -1063,14 +1063,22 @@ JL_DLLEXPORT void jl_method_table_insert(jl_methtable_t *mt, jl_method_t *method
10631063    JL_GC_POP ();
10641064}
10651065
1066- void  JL_NORETURN  jl_method_error_bare (jl_function_t  * f , jl_value_t  * args )
1066+ void  JL_NORETURN  jl_method_error_bare (jl_function_t  * f , jl_value_t  * args ,  size_t   world )
10671067{
10681068    if  (jl_methoderror_type ) {
1069-         jl_throw (jl_new_struct (jl_methoderror_type , f , args ));
1069+         jl_value_t  * e  =  jl_new_struct_uninit (jl_methoderror_type );
1070+         struct  jl_method_error  {
1071+             jl_value_t  * f ;
1072+             jl_value_t  * args ;
1073+             size_t  world ;
1074+         } * pe  =  (void * )e ,
1075+            ee  =  {f , args , world };
1076+         * pe  =  ee ;
1077+         jl_throw (e );
10701078    }
10711079    else  {
10721080        jl_printf ((JL_STREAM * )STDERR_FILENO , "A method error occurred before the base MethodError type was defined. Aborting...\n" );
1073-         jl_static_show ((JL_STREAM * )STDERR_FILENO ,(jl_value_t * )f ); jl_printf ((JL_STREAM * )STDERR_FILENO ,"\n" );
1081+         jl_static_show ((JL_STREAM * )STDERR_FILENO ,(jl_value_t * )f ); jl_printf ((JL_STREAM * )STDERR_FILENO ," world %u \n" , ( unsigned ) world );
10741082        jl_static_show ((JL_STREAM * )STDERR_FILENO ,args ); jl_printf ((JL_STREAM * )STDERR_FILENO ,"\n" );
10751083        jl_ptls_t  ptls  =  jl_get_ptls_states ();
10761084        ptls -> bt_size  =  rec_backtrace (ptls -> bt_data , JL_MAX_BT_SIZE );
@@ -1080,11 +1088,11 @@ void JL_NORETURN jl_method_error_bare(jl_function_t *f, jl_value_t *args)
10801088    // not reached 
10811089}
10821090
1083- void  JL_NORETURN  jl_method_error (jl_function_t  * f , jl_value_t  * * args , size_t  na )
1091+ void  JL_NORETURN  jl_method_error (jl_function_t  * f , jl_value_t  * * args , size_t  na ,  size_t   world )
10841092{
10851093    jl_value_t  * argtup  =  jl_f_tuple (NULL , args + 1 , na - 1 );
10861094    JL_GC_PUSH1 (& argtup );
1087-     jl_method_error_bare (f , argtup );
1095+     jl_method_error_bare (f , argtup ,  world );
10881096    // not reached 
10891097}
10901098
@@ -1985,7 +1993,7 @@ JL_DLLEXPORT jl_value_t *jl_apply_generic(jl_value_t **args, uint32_t nargs)
19851993                show_call (F , args , nargs );
19861994#endif 
19871995            JL_GC_POP ();
1988-             jl_method_error ((jl_function_t * )args [0 ], args , nargs );
1996+             jl_method_error ((jl_function_t * )args [0 ], args , nargs ,  world );
19891997            // unreachable 
19901998        }
19911999    }
@@ -2032,7 +2040,7 @@ jl_value_t *jl_gf_invoke(jl_tupletype_t *types0, jl_value_t **args, size_t nargs
20322040    jl_typemap_entry_t  * entry  =  (jl_typemap_entry_t * )jl_gf_invoke_lookup (types , world );
20332041
20342042    if  ((jl_value_t * )entry  ==  jl_nothing ) {
2035-         jl_method_error_bare (gf , (jl_value_t * )types0 );
2043+         jl_method_error_bare (gf , (jl_value_t * )types0 ,  world );
20362044        // unreachable 
20372045    }
20382046
0 commit comments