Skip to content

Commit

Permalink
remove visible include identifier in Main (#23664)
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson authored Sep 13, 2017
1 parent 5c9a249 commit 957848b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion base/client.jl
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ function _start()
empty!(ARGS)
append!(ARGS, Core.ARGS)
opts = JLOptions()
@eval Main include(x) = $include(Main, x)
@eval Main using Base.MainInclude
try
(quiet,repl,startup,color_set,history_file) = process_options(opts)
banner = opts.banner == 1
Expand Down
6 changes: 3 additions & 3 deletions base/interactiveutil.jl
Original file line number Diff line number Diff line change
Expand Up @@ -690,9 +690,9 @@ function workspace()
m = Core.Main # now grab a handle to the new Main module
ccall(:jl_add_standard_imports, Void, (Any,), m)
eval(m, Expr(:toplevel,
:(const Base = $b),
:(const LastMain = $last),
:(include(x) = $include($m, x))))
:(const Base = $b),
:(const LastMain = $last),
:(using Base.MainInclude)))
empty!(package_locks)
return m
end
Expand Down
5 changes: 5 additions & 0 deletions base/sysimg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ let SOURCE_PATH = ""
end
INCLUDE_STATE = 1 # include = Core.include

baremodule MainInclude
export include
include(fname::AbstractString) = Main.Base.include(Main, fname)
end

include("coreio.jl")

eval(x) = Core.eval(Base, x)
Expand Down
3 changes: 3 additions & 0 deletions test/misc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -821,3 +821,6 @@ let flags = Cmd(filter(a->!contains(a, "depwarn"), collect(test_exeflags)))
error("Deprecation test failed, cmd : $cmd")
end
end

# PR #23664, make sure names don't get added to the default `Main` workspace
@test readlines(`$(Base.julia_cmd()) --startup-file=no -e 'foreach(println, names(Main))'`) == ["Base","Core","Main"]

0 comments on commit 957848b

Please sign in to comment.