Skip to content

Commit

Permalink
Merge pull request #21539 from JuliaLang/vc/fix21492
Browse files Browse the repository at this point in the history
Fix wrong use of `isdefined` #21492
  • Loading branch information
vtjnash committed Apr 26, 2017
2 parents 4f4a72f + cd227e9 commit 98414b9
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
2 changes: 1 addition & 1 deletion base/loading.jl
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,7 @@ function stale_cachefile(modpath::String, cachefile::String)
if mod == :Main || mod == :Core || mod == :Base
continue
# Module is already loaded
elseif isdefined(Main, mod)
elseif isbindingresolved(Main, mod)
continue
end
name = string(mod)
Expand Down
33 changes: 33 additions & 0 deletions test/compile.jl
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,39 @@ let dir = mktempdir(),
end
end

# test loading a package with conflicting namespace
let dir = mktempdir()
Test_module = :Test6c92f26
try
write(joinpath(dir, "Iterators.jl"),
"""
module Iterators
__precompile__(true)
end
""")

write(joinpath(dir, "$Test_module.jl"),
"""
module $Test_module
__precompile__(true)
using Iterators
end
""")

testcode = """
insert!(LOAD_PATH, 1, $(repr(dir)))
insert!(Base.LOAD_CACHE_PATH, 1, $(repr(dir)))
using $Test_module
"""

exename = `$(Base.julia_cmd()) --startup-file=no`
@test readchomp(`$exename -E $(testcode)`) == "nothing"
@test readchomp(`$exename -E $(testcode)`) == "nothing"
finally
rm(dir, recursive=true)
end
end

let module_name = string("a",randstring())
insert!(LOAD_PATH, 1, pwd())
file_name = string(module_name, ".jl")
Expand Down

2 comments on commit 98414b9

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Executing the daily benchmark build, I will reply here when finished:

@nanosoldier runbenchmarks(ALL, isdaily = true)

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your benchmark job has completed - possible performance regressions were detected. A full report can be found here. cc @jrevels

Please sign in to comment.