Skip to content

Commit

Permalink
allow re-importing the same module from different owners (#28197)
Browse files Browse the repository at this point in the history
* allow re-importing the same module from different owners

* test
  • Loading branch information
stevengj authored Jul 23, 2018
1 parent 10002fc commit e6f5098
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/toplevel.c
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ static void import_module(jl_module_t *m, jl_module_t *import)
jl_binding_t *b;
if (jl_binding_resolved_p(m, name)) {
b = jl_get_binding(m, name);
if (b->owner != m || (b->value && b->value != (jl_value_t*)import)) {
if ((!b->constp && b->owner != m) || (b->value && b->value != (jl_value_t*)import)) {
jl_errorf("importing %s into %s conflicts with an existing identifier",
jl_symbol_name(name), jl_symbol_name(m->name));
}
Expand Down
5 changes: 5 additions & 0 deletions test/loading.jl
Original file line number Diff line number Diff line change
Expand Up @@ -552,3 +552,8 @@ append!(empty!(LOAD_PATH), saved_load_path)
append!(empty!(DEPOT_PATH), saved_depot_path)
Base.HOME_PROJECT[] = saved_home_project
Base.ACTIVE_PROJECT[] = saved_active_project

# issue #28190
module Foo; import Libdl; end
import .Foo.Libdl; import Libdl
@test Foo.Libdl === Libdl

0 comments on commit e6f5098

Please sign in to comment.