From 1438b1578941d0f1cc8f8c958cf3bd2927fd482c Mon Sep 17 00:00:00 2001 From: Ian Butterworth Date: Fri, 11 Oct 2024 01:57:36 -0400 Subject: [PATCH] Remove warning from c when binding is ambiguous (#56103) --- doc/src/manual/modules.md | 4 ++-- src/module.c | 5 ----- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/doc/src/manual/modules.md b/doc/src/manual/modules.md index 6b335305ac569..b4f0fd78c816a 100644 --- a/doc/src/manual/modules.md +++ b/doc/src/manual/modules.md @@ -283,14 +283,14 @@ julia> module B B ``` -The statement `using .A, .B` works, but when you try to call `f`, you get a warning +The statement `using .A, .B` works, but when you try to call `f`, you get an error with a hint ```jldoctest module_manual julia> using .A, .B julia> f -WARNING: both B and A export "f"; uses of it in module Main must be qualified ERROR: UndefVarError: `f` not defined in `Main` +Hint: It looks like two or more modules export different bindings with this name, resulting in ambiguity. Try explicitly importing it from a particular module, or qualifying the name with the module it should come from. ``` Here, Julia cannot decide which `f` you are referring to, so you have to make a choice. The following solutions are commonly used: diff --git a/src/module.c b/src/module.c index f4da7e1e994de..36c35f50b44af 100644 --- a/src/module.c +++ b/src/module.c @@ -430,11 +430,6 @@ static jl_binding_t *using_resolve_binding(jl_module_t *m JL_PROPAGATES_ROOT, jl tempb = jl_get_module_binding(m, var, 1); tempbpart = jl_get_binding_partition(tempb, jl_current_task->world_age); jl_atomic_store_release(&tempbpart->restriction, encode_restriction(NULL, BINDING_KIND_FAILED)); - jl_printf(JL_STDERR, - "WARNING: both %s and %s export \"%s\"; uses of it in module %s must be qualified\n", - jl_symbol_name(owner->name), - jl_symbol_name(imp->name), jl_symbol_name(var), - jl_symbol_name(m->name)); } return NULL; }