Skip to content

Commit ad5533c

Browse files
authored
Add "mea culpa" to foreign module assignment error. (#56956)
As requested in #56933, acknowledge that this error was missing in Julia 1.9 and 1.10 and provide a reference to the issue so that people have an easier starting point.
1 parent a23a6de commit ad5533c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/module.c

+5-1
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,11 @@ JL_DLLEXPORT jl_binding_t *jl_get_binding_wr(jl_module_t *m JL_PROPAGATES_ROOT,
290290
if (decode_restriction_kind(pku) != BINDING_KIND_DECLARED) {
291291
check_safe_newbinding(m, var);
292292
if (!alloc)
293-
jl_errorf("Global %s.%s does not exist and cannot be assigned. Declare it using `global` before attempting assignment.", jl_symbol_name(m->name), jl_symbol_name(var));
293+
jl_errorf("Global %s.%s does not exist and cannot be assigned.\n"
294+
"Note: Julia 1.9 and 1.10 inadvertently omitted this error check (#56933).\n"
295+
"Hint: Declare it using `global %s` inside `%s` before attempting assignment.",
296+
jl_symbol_name(m->name), jl_symbol_name(var),
297+
jl_symbol_name(var), jl_symbol_name(m->name));
294298
}
295299
jl_ptr_kind_union_t new_pku = encode_restriction((jl_value_t*)jl_any_type, BINDING_KIND_GLOBAL);
296300
if (!jl_atomic_cmpswap(&bpart->restriction, &pku, new_pku))

0 commit comments

Comments
 (0)