Skip to content

Commit

Permalink
Remove warning from c when binding is ambiguous (#56103)
Browse files Browse the repository at this point in the history
(cherry picked from commit 1438b15)
  • Loading branch information
IanButterworth committed Oct 11, 2024
1 parent 4751c23 commit 4cf3975
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
4 changes: 2 additions & 2 deletions doc/src/manual/modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -281,14 +281,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:
Expand Down
5 changes: 0 additions & 5 deletions src/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -336,11 +336,6 @@ static jl_binding_t *using_resolve_binding(jl_module_t *m JL_PROPAGATES_ROOT, jl
// the owner will still be NULL, so it can be later imported or defined
tempb = jl_get_module_binding(m, var, 1);
tempb->usingfailed = 1;
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;
}
Expand Down

0 comments on commit 4cf3975

Please sign in to comment.