From a4ac8f71562997815ed1b0dd027c7c218f202f1d Mon Sep 17 00:00:00 2001 From: KristofferC Date: Wed, 10 May 2023 12:09:26 +0200 Subject: [PATCH 1/3] prevent REPL from erroring in numbered mode in some situations --- stdlib/REPL/src/REPL.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/stdlib/REPL/src/REPL.jl b/stdlib/REPL/src/REPL.jl index f8bb442ad6ec4..1328a87f1a77d 100644 --- a/stdlib/REPL/src/REPL.jl +++ b/stdlib/REPL/src/REPL.jl @@ -1418,6 +1418,7 @@ function out_transform(@nospecialize(x), n::Ref{Int}) end function get_usings!(usings, ex) + ex isa Expr || return usings # get all `using` and `import` statements which are at the top level for (i, arg) in enumerate(ex.args) if Base.isexpr(arg, :toplevel) From 25a11d9fe6876e91cdb092d089b1ecd594e365fe Mon Sep 17 00:00:00 2001 From: Kristoffer Carlsson Date: Fri, 12 May 2023 10:00:28 +0200 Subject: [PATCH 2/3] Update stdlib/REPL/src/REPL.jl Co-authored-by: Jameson Nash --- stdlib/REPL/src/REPL.jl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/stdlib/REPL/src/REPL.jl b/stdlib/REPL/src/REPL.jl index 1328a87f1a77d..5b37900af533e 100644 --- a/stdlib/REPL/src/REPL.jl +++ b/stdlib/REPL/src/REPL.jl @@ -1420,7 +1420,8 @@ end function get_usings!(usings, ex) ex isa Expr || return usings # get all `using` and `import` statements which are at the top level - for (i, arg) in enumerate(ex.args) + for i in 1:length(ex.args) + arg = ex.args[i] if Base.isexpr(arg, :toplevel) get_usings!(usings, arg) elseif Base.isexpr(arg, [:using, :import]) From b996c77fd9323b49caa63e6de17ecf0f7db0c7ea Mon Sep 17 00:00:00 2001 From: Kristoffer Carlsson Date: Fri, 12 May 2023 10:00:34 +0200 Subject: [PATCH 3/3] Update stdlib/REPL/src/REPL.jl Co-authored-by: Jameson Nash --- stdlib/REPL/src/REPL.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdlib/REPL/src/REPL.jl b/stdlib/REPL/src/REPL.jl index 5b37900af533e..76b3805f7540a 100644 --- a/stdlib/REPL/src/REPL.jl +++ b/stdlib/REPL/src/REPL.jl @@ -1417,7 +1417,7 @@ function out_transform(@nospecialize(x), n::Ref{Int}) end) end -function get_usings!(usings, ex) +function get_usings!(usings, @nospecialize(ex)) ex isa Expr || return usings # get all `using` and `import` statements which are at the top level for i in 1:length(ex.args)