diff --git a/base/client.jl b/base/client.jl index a6b07aadde5a7..5341c465bf9bb 100644 --- a/base/client.jl +++ b/base/client.jl @@ -427,7 +427,7 @@ using ..Base # include(fname::AbstractString) = Main.Base.include(Main, fname) function include(fname::AbstractString) mod = Main - isa(fname, String) || (fname = Base.convert(String, fname)) + isa(fname, String) || (fname = Base.convert(String, fname)::String) path, prev = Base._include_dependency(mod, fname) for callback in Base.include_callbacks # to preserve order, must come before Core.include Base.invokelatest(callback, mod, path) diff --git a/base/loading.jl b/base/loading.jl index 1de844128d547..cc4153e9a31e6 100644 --- a/base/loading.jl +++ b/base/loading.jl @@ -1086,8 +1086,8 @@ include_string(m::Module, txt::AbstractString, fname::AbstractString="string") = function source_path(default::Union{AbstractString,Nothing}="") s = current_task().storage - if s !== nothing && haskey(s, :SOURCE_PATH) - return s[:SOURCE_PATH] + if s !== nothing && haskey(s::IdDict{Any,Any}, :SOURCE_PATH) + return s[:SOURCE_PATH]::Union{Nothing,String} end return default end @@ -1487,7 +1487,7 @@ Alternatively see [`PROGRAM_FILE`](@ref). """ macro __FILE__() __source__.file === nothing && return nothing - return String(__source__.file) + return String(__source__.file::Symbol) end """ @@ -1499,6 +1499,6 @@ Return the current working directory if run from a REPL or if evaluated by `juli """ macro __DIR__() __source__.file === nothing && return nothing - _dirname = dirname(String(__source__.file)) + _dirname = dirname(String(__source__.file::Symbol)) return isempty(_dirname) ? pwd() : abspath(_dirname) end diff --git a/base/logging.jl b/base/logging.jl index a9dd022cf8105..517bcd3e0d5b4 100644 --- a/base/logging.jl +++ b/base/logging.jl @@ -204,7 +204,7 @@ end macro _sourceinfo() esc(quote (__module__, - __source__.file === nothing ? "?" : String(__source__.file), + __source__.file === nothing ? "?" : String(__source__.file::Symbol), __source__.line) end) end diff --git a/stdlib/REPL/src/REPLCompletions.jl b/stdlib/REPL/src/REPLCompletions.jl index 3af98d6e53e8f..b31b41f2405bf 100644 --- a/stdlib/REPL/src/REPLCompletions.jl +++ b/stdlib/REPL/src/REPLCompletions.jl @@ -266,7 +266,7 @@ function complete_path(path::AbstractString, pos; use_envpath=false, shell_escap end end - matchList = Completion[PathCompletion(shell_escape ? replace(s, r"\s" => s"\\\0") : s) for s in matches] + matchList = PathCompletion[PathCompletion(shell_escape ? replace(s, r"\s" => s"\\\0") : s) for s in matches] startpos = pos - lastindex(prefix) + 1 - count(isequal(' '), prefix) # The pos - lastindex(prefix) + 1 is correct due to `lastindex(prefix)-lastindex(prefix)==0`, # hence we need to add one to get the first index. This is also correct when considering @@ -544,7 +544,7 @@ end # This needs to be a separate non-inlined function, see #19441 @noinline function find_dict_matches(identifier, partial_key) - matches = [] + matches = String[] for key in keys(identifier) rkey = repr(key) startswith(rkey,partial_key) && push!(matches,rkey)