Skip to content

Commit

Permalink
filter out duplicate modules in auto-install search, fixes #42133 (#4…
Browse files Browse the repository at this point in the history
  • Loading branch information
IanButterworth authored Sep 6, 2021
1 parent 8812c5c commit f2d03be
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion stdlib/REPL/src/REPL.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

"""
Expand Down
2 changes: 2 additions & 0 deletions stdlib/REPL/test/repl.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit f2d03be

Please sign in to comment.