@@ -458,6 +458,7 @@ static jl_binding_t *new_binding(jl_module_t *mod, jl_sym_t *name)
458458 b -> publicp = 0 ;
459459 b -> deprecated = 0 ;
460460 b -> did_print_backdate_admonition = 0 ;
461+ b -> did_print_implicit_import_admonition = 0 ;
461462 JL_GC_PUSH1 (& b );
462463 b -> globalref = jl_new_globalref (mod , name , b );
463464 jl_gc_wb (b , b -> globalref );
@@ -537,14 +538,14 @@ JL_DLLEXPORT jl_module_t *jl_get_module_of_binding(jl_module_t *m, jl_sym_t *var
537538
538539static NOINLINE void print_backdate_admonition (jl_binding_t * b ) JL_NOTSAFEPOINT
539540{
541+ b -> did_print_backdate_admonition = 1 ;
540542 jl_safe_printf (
541543 "WARNING: Detected access to binding `%s.%s` in a world prior to its definition world.\n"
542544 " Julia 1.12 has introduced more strict world age semantics for global bindings.\n"
543545 " !!! This code may malfunction under Revise.\n"
544546 " !!! This code will error in future versions of Julia.\n"
545547 "Hint: Add an appropriate `invokelatest` around the access to this binding.\n" ,
546548 jl_symbol_name (b -> globalref -> mod -> name ), jl_symbol_name (b -> globalref -> name ));
547- b -> did_print_backdate_admonition = 1 ;
548549}
549550
550551static inline void check_backdated_binding (jl_binding_t * b , enum jl_partition_kind kind ) JL_NOTSAFEPOINT
@@ -696,10 +697,12 @@ JL_DLLEXPORT jl_binding_t *jl_get_binding_for_method_def(jl_module_t *m, jl_sym_
696697 else if (kind != BINDING_KIND_IMPORTED ) {
697698 int should_error = strcmp (jl_symbol_name (var ), "=>" ) == 0 ;
698699 jl_module_t * from = jl_binding_dbgmodule (b , m , var );
699- if (should_error )
700+ if (should_error ) {
700701 jl_errorf ("invalid method definition in %s: function %s.%s must be explicitly imported to be extended" ,
701702 jl_module_debug_name (m ), jl_module_debug_name (from ), jl_symbol_name (var ));
702- else
703+ }
704+ else if (!b -> did_print_implicit_import_admonition ) {
705+ b -> did_print_implicit_import_admonition = 1 ;
703706 jl_printf (JL_STDERR , "WARNING: Constructor for type \"%s\" was extended in `%s` without explicit qualification or import.\n"
704707 " NOTE: Assumed \"%s\" refers to `%s.%s`. This behavior is deprecated and may differ in future versions.`\n"
705708 " NOTE: This behavior may have differed in Julia versions prior to 1.12.\n"
@@ -709,6 +712,7 @@ JL_DLLEXPORT jl_binding_t *jl_get_binding_for_method_def(jl_module_t *m, jl_sym_
709712 jl_symbol_name (var ), jl_module_debug_name (from ), jl_symbol_name (var ),
710713 jl_symbol_name (var ), jl_symbol_name (var ), jl_module_debug_name (from ), jl_symbol_name (var ),
711714 jl_module_debug_name (from ), jl_symbol_name (var ));
715+ }
712716 }
713717 return ownerb ;
714718}
0 commit comments