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
  • Loading branch information
IanButterworth authored Oct 11, 2024
1 parent 9c619c3 commit 1438b15
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 @@ -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:
Expand Down
5 changes: 0 additions & 5 deletions src/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 1438b15

Please sign in to comment.