Skip to content

Commit 19629d7

Browse files
don't look for packages in code that isn't going to be run this eval (#41887)
1 parent 6f8bb64 commit 19629d7

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

stdlib/REPL/src/REPL.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ function check_for_missing_packages_and_run_hooks(ast)
178178
end
179179

180180
function modules_to_be_loaded(ast, mods = Symbol[])
181+
ast.head == :quote && return mods # don't search if it's not going to be run during this eval
181182
if ast.head in [:using, :import]
182183
for arg in ast.args
183184
if first(arg.args) isa Symbol # i.e. `Foo`

stdlib/REPL/test/repl.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1355,6 +1355,11 @@ end
13551355
mods = REPL.modules_to_be_loaded(Base.parse_input_line("using Core"))
13561356
@test isempty(mods)
13571357

1358+
mods = REPL.modules_to_be_loaded(Base.parse_input_line(":(using Foo)"))
1359+
@test isempty(mods)
1360+
mods = REPL.modules_to_be_loaded(Base.parse_input_line("ex = :(using Foo)"))
1361+
@test isempty(mods)
1362+
13581363
mods = REPL.modules_to_be_loaded(Base.parse_input_line("# comment"))
13591364
@test isempty(mods)
13601365
mods = REPL.modules_to_be_loaded(Base.parse_input_line("Foo"))

0 commit comments

Comments
 (0)