diff --git a/base/compiler/ssair/show.jl b/base/compiler/ssair/show.jl index 7977826426b12..9598d3e8cfa26 100644 --- a/base/compiler/ssair/show.jl +++ b/base/compiler/ssair/show.jl @@ -629,8 +629,10 @@ function show_ir_stmt(io::IO, code::Union{IRCode, CodeInfo}, idx::Int, line_info @assert new_node_inst !== UNDEF # we filtered these out earlier show_type = should_print_ssa_type(new_node_inst) - with_output_color(:green, io) do io′ - print_stmt(io′, node_idx, new_node_inst, used, maxlength_idx, false, show_type) + let maxlength_idx=maxlength_idx, show_type=show_type + with_output_color(:green, io) do io′ + print_stmt(io′, node_idx, new_node_inst, used, maxlength_idx, false, show_type) + end end if new_node_type === UNDEF # try to be robust against errors diff --git a/base/errorshow.jl b/base/errorshow.jl index 121fb50db91c1..8b8ec532355a8 100644 --- a/base/errorshow.jl +++ b/base/errorshow.jl @@ -345,13 +345,15 @@ function showerror_ambiguous(io::IO, meth, f, args) sigfix = typeintersect(m.sig, sigfix) end if isa(unwrap_unionall(sigfix), DataType) && sigfix <: Tuple - if all(m->morespecific(sigfix, m.sig), meth) - print(io, "\nPossible fix, define\n ") - Base.show_tuple_as_call(io, :function, sigfix) - else - println(io) - print(io, "To resolve the ambiguity, try making one of the methods more specific, or ") - print(io, "adding a new method more specific than any of the existing applicable methods.") + let sigfix=sigfix + if all(m->morespecific(sigfix, m.sig), meth) + print(io, "\nPossible fix, define\n ") + Base.show_tuple_as_call(io, :function, sigfix) + else + println(io) + print(io, "To resolve the ambiguity, try making one of the methods more specific, or ") + print(io, "adding a new method more specific than any of the existing applicable methods.") + end end end nothing diff --git a/base/shell.jl b/base/shell.jl index c0537821638f3..f443a1f9c094a 100644 --- a/base/shell.jl +++ b/base/shell.jl @@ -211,8 +211,8 @@ function print_shell_escaped_posixly(io::IO, args::AbstractString...) first || print(io, ' ') # avoid printing quotes around simple enough strings # that any (reasonable) shell will definitely never consider them to be special - have_single = false - have_double = false + have_single::Bool = false + have_double::Bool = false function isword(c::AbstractChar) if '0' <= c <= '9' || 'a' <= c <= 'z' || 'A' <= c <= 'Z' # word characters diff --git a/base/weakkeydict.jl b/base/weakkeydict.jl index 8e1a3d480b995..5b59949d35965 100644 --- a/base/weakkeydict.jl +++ b/base/weakkeydict.jl @@ -129,10 +129,12 @@ function get!(default::Callable, wkh::WeakKeyDict{K}, key) where {K} end function getkey(wkh::WeakKeyDict{K}, kk, default) where K - k = lock(wkh) do - k = getkey(wkh.ht, kk, nothing) - k === nothing && return nothing - return k.value + k = let wkh=wkh + lock(wkh) do + k = getkey(wkh.ht, kk, nothing) + k === nothing && return nothing + return k.value + end end return k === nothing ? default : k::K end diff --git a/stdlib/REPL/src/LineEdit.jl b/stdlib/REPL/src/LineEdit.jl index 5f5d81ead637e..ba69eaa3a2ad4 100644 --- a/stdlib/REPL/src/LineEdit.jl +++ b/stdlib/REPL/src/LineEdit.jl @@ -1979,11 +1979,11 @@ function enter_prefix_search(s::MIState, p::PrefixHistoryPrompt, backward::Bool) pss.indent = state(s, parent).indent pss.mi = s end - pss = state(s, p) + pss_ = state(s, p) if backward - history_prev_prefix(pss, pss.histprompt.hp, pss.prefix) + history_prev_prefix(pss_, pss_.histprompt.hp, pss_.prefix) else - history_next_prefix(pss, pss.histprompt.hp, pss.prefix) + history_next_prefix(pss_, pss_.histprompt.hp, pss_.prefix) end nothing end