diff --git a/stdlib/REPL/src/REPL.jl b/stdlib/REPL/src/REPL.jl index 9a9114aed9e3d..9e67ad9c2d8ab 100644 --- a/stdlib/REPL/src/REPL.jl +++ b/stdlib/REPL/src/REPL.jl @@ -197,7 +197,7 @@ function modules_to_be_loaded(ast::Expr, mods::Vector{Symbol} = Symbol[]) arg isa Expr && modules_to_be_loaded(arg, mods) end filter!(mod -> !in(String(mod), ["Base", "Main", "Core"]), mods) # Exclude special non-package modules - return mods + return unique(mods) end """ diff --git a/stdlib/REPL/test/repl.jl b/stdlib/REPL/test/repl.jl index 6724eb5e13ac3..3fbf6d8825bba 100644 --- a/stdlib/REPL/test/repl.jl +++ b/stdlib/REPL/test/repl.jl @@ -1332,6 +1332,8 @@ end @test mods == [:Foo, :Bar] mods = REPL.modules_to_be_loaded(Base.parse_input_line("import Foo, Bar")) @test mods == [:Foo, :Bar] + mods = REPL.modules_to_be_loaded(Base.parse_input_line("using Foo.bar, Foo.baz")) + @test mods == [:Foo] mods = REPL.modules_to_be_loaded(Base.parse_input_line("if false using Foo end")) @test mods == [:Foo]