Skip to content

Add "mea culpa" to foreign module assignment error. #56956

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

Merged
merged 1 commit into from
Jan 6, 2025
Merged
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: 5 additions & 1 deletion src/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,11 @@ JL_DLLEXPORT jl_binding_t *jl_get_binding_wr(jl_module_t *m JL_PROPAGATES_ROOT,
if (decode_restriction_kind(pku) != BINDING_KIND_DECLARED) {
check_safe_newbinding(m, var);
if (!alloc)
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));
jl_errorf("Global %s.%s does not exist and cannot be assigned.\n"
"Note: Julia 1.9 and 1.10 inadvertently omitted this error check (#56933).\n"
"Hint: Declare it using `global %s` inside `%s` before attempting assignment.",
jl_symbol_name(m->name), jl_symbol_name(var),
jl_symbol_name(var), jl_symbol_name(m->name));
}
jl_ptr_kind_union_t new_pku = encode_restriction((jl_value_t*)jl_any_type, BINDING_KIND_GLOBAL);
if (!jl_atomic_cmpswap(&bpart->restriction, &pku, new_pku))
Expand Down
Loading