Skip to content

Commit 5de52cf

Browse files
replace ASCIIString & UTF8String with String (#16058)
1 parent 90de028 commit 5de52cf

File tree

147 files changed

+770
-1013
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

147 files changed

+770
-1013
lines changed

base/LineEdit.jl

+5-5
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ type MIState
2323
current_mode
2424
aborted::Bool
2525
mode_state
26-
kill_buffer::ByteString
26+
kill_buffer::String
2727
previous_key::Array{Char,1}
2828
key_repeats::Int
2929
end
@@ -624,7 +624,7 @@ function write_prompt(terminal, p::Prompt)
624624
write(terminal, Base.text_colors[:normal])
625625
write(terminal, suffix)
626626
end
627-
write_prompt(terminal, s::ByteString) = write(terminal, s)
627+
write_prompt(terminal, s::String) = write(terminal, s)
628628

629629
### Keymap Support
630630

@@ -703,11 +703,11 @@ end
703703
# This is different from the default eager redirect, which only looks at the current and lower
704704
# layers of the stack.
705705
immutable KeyAlias
706-
seq::ASCIIString
706+
seq::String
707707
KeyAlias(seq) = new(normalize_key(seq))
708708
end
709709

710-
match_input(k::Function, s, term, cs, keymap) = (update_key_repeats(s, cs); return keymap_fcn(k, ByteString(cs)))
710+
match_input(k::Function, s, term, cs, keymap) = (update_key_repeats(s, cs); return keymap_fcn(k, String(cs)))
711711
match_input(k::Void, s, term, cs, keymap) = (s,p) -> return :ok
712712
match_input(k::KeyAlias, s, term, cs, keymap) = match_input(keymap, s, IOBuffer(k.seq), Char[], keymap)
713713
function match_input(k::Dict, s, term=terminal(s), cs=Char[], keymap = k)
@@ -1013,7 +1013,7 @@ init_state(terminal, p::HistoryPrompt) = SearchState(terminal, p, true, IOBuffer
10131013
type PrefixSearchState <: ModeState
10141014
terminal
10151015
histprompt
1016-
prefix::ByteString
1016+
prefix::String
10171017
response_buffer::IOBuffer
10181018
ias::InputAreaState
10191019
indent::Int

base/REPL.jl

+11-11
Original file line numberDiff line numberDiff line change
@@ -230,11 +230,11 @@ end
230230
type LineEditREPL <: AbstractREPL
231231
t::TextTerminal
232232
hascolor::Bool
233-
prompt_color::AbstractString
234-
input_color::AbstractString
235-
answer_color::AbstractString
236-
shell_color::AbstractString
237-
help_color::AbstractString
233+
prompt_color::String
234+
input_color::String
235+
answer_color::String
236+
shell_color::String
237+
help_color::String
238238
history_file::Bool
239239
in_shell::Bool
240240
in_help::Bool
@@ -297,7 +297,7 @@ end
297297

298298

299299
type REPLHistoryProvider <: HistoryProvider
300-
history::Array{AbstractString,1}
300+
history::Array{String,1}
301301
history_file
302302
start_idx::Int
303303
cur_idx::Int
@@ -308,7 +308,7 @@ type REPLHistoryProvider <: HistoryProvider
308308
modes::Array{Symbol,1}
309309
end
310310
REPLHistoryProvider(mode_mapping) =
311-
REPLHistoryProvider(AbstractString[], nothing, 0, 0, -1, IOBuffer(),
311+
REPLHistoryProvider(String[], nothing, 0, 0, -1, IOBuffer(),
312312
nothing, mode_mapping, UInt8[])
313313

314314
const invalid_history_message = """
@@ -356,7 +356,7 @@ function hist_from_file(hp, file)
356356
error(munged_history_message, countlines)
357357
line[1] != '\t' &&
358358
error(invalid_history_message, repr(line[1]), " at line ", countlines)
359-
lines = UTF8String[]
359+
lines = String[]
360360
while !isempty(line)
361361
push!(lines, chomp(line[2:end]))
362362
eof(file) && break
@@ -893,9 +893,9 @@ end
893893

894894
type StreamREPL <: AbstractREPL
895895
stream::IO
896-
prompt_color::AbstractString
897-
input_color::AbstractString
898-
answer_color::AbstractString
896+
prompt_color::String
897+
input_color::String
898+
answer_color::String
899899
waserror::Bool
900900
StreamREPL(stream,pc,ic,ac) = new(stream,pc,ic,ac,false)
901901
end

base/REPLCompletions.jl

+20-20
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ end
1313
function filtered_mod_names(ffunc::Function, mod::Module, name::AbstractString, all::Bool=false, imported::Bool=false)
1414
ssyms = names(mod, all, imported)
1515
filter!(ffunc, ssyms)
16-
syms = UTF8String[string(s) for s in ssyms]
16+
syms = String[string(s) for s in ssyms]
1717
filter!(x->completes_global(x, name), syms)
1818
end
1919

@@ -47,12 +47,12 @@ function complete_symbol(sym, ffunc)
4747
lookup_module = false
4848
t, found = get_type(ex, context_module)
4949
end
50-
found || return UTF8String[]
50+
found || return String[]
5151
# Ensure REPLCompletion do not crash when asked to complete a tuple, #15329
52-
!lookup_module && t <: Tuple && return UTF8String[]
52+
!lookup_module && t <: Tuple && return String[]
5353
end
5454

55-
suggestions = UTF8String[]
55+
suggestions = String[]
5656
if lookup_module
5757
# We will exclude the results that the user does not want, as well
5858
# as excluding Main.Main.Main, etc., because that's most likely not what
@@ -82,7 +82,7 @@ function complete_symbol(sym, ffunc)
8282
suggestions
8383
end
8484

85-
function complete_keyword(s::ByteString)
85+
function complete_keyword(s::String)
8686
const sorted_keywords = [
8787
"abstract", "baremodule", "begin", "bitstype", "break", "catch", "ccall",
8888
"const", "continue", "do", "else", "elseif", "end", "export", "false",
@@ -117,13 +117,13 @@ function complete_path(path::AbstractString, pos; use_envpath=false)
117117
elseif isdir(dir)
118118
files = readdir(dir)
119119
else
120-
return UTF8String[], 0:-1, false
120+
return String[], 0:-1, false
121121
end
122122
catch
123-
return UTF8String[], 0:-1, false
123+
return String[], 0:-1, false
124124
end
125125

126-
matches = Set{UTF8String}()
126+
matches = Set{String}()
127127
for file in files
128128
if startswith(file, prefix)
129129
id = try isdir(joinpath(dir, file)) catch; false end
@@ -174,7 +174,7 @@ function complete_path(path::AbstractString, pos; use_envpath=false)
174174
end
175175
end
176176

177-
matchList = UTF8String[replace(s, r"\s", "\\ ") for s in matches]
177+
matchList = String[replace(s, r"\s", "\\ ") for s in matches]
178178
startpos = pos - endof(prefix) + 1 - length(matchall(r" ", prefix))
179179
# The pos - endof(prefix) + 1 is correct due to `endof(prefix)-endof(prefix)==0`,
180180
# hence we need to add one to get the first index. This is also correct when considering
@@ -289,7 +289,7 @@ function get_type_call(expr::Expr)
289289
(tree, return_type) = Core.Inference.typeinf(linfo, m[1], m[2])
290290
return return_type, true
291291
end
292-
# Returns the return type. example: get_type(:(Base.strip("",' ')),Main) returns (ASCIIString,true)
292+
# Returns the return type. example: get_type(:(Base.strip("",' ')),Main) returns (String,true)
293293
function get_type(sym::Expr, fn)
294294
sym=expand(sym)
295295
val, found = get_value(sym, fn)
@@ -313,12 +313,12 @@ end
313313
function complete_methods(ex_org::Expr)
314314
args_ex = DataType[]
315315
func, found = get_value(ex_org.args[1], Main)
316-
!found && return UTF8String[]
316+
!found && return String[]
317317
for ex in ex_org.args[2:end]
318318
val, found = get_type(ex, Main)
319319
push!(args_ex, val)
320320
end
321-
out = UTF8String[]
321+
out = String[]
322322
t_in = Tuple{Core.Typeof(func), args_ex...} # Input types
323323
na = length(args_ex)+1
324324
for method in methods(func)
@@ -341,7 +341,7 @@ const bslash_separators = [whitespace_chars..., "\"'`"...]
341341

342342
# Aux function to detect whether we're right after a
343343
# using or import keyword
344-
function afterusing(string::ByteString, startpos::Int)
344+
function afterusing(string::String, startpos::Int)
345345
(isempty(string) || startpos == 0) && return false
346346
str = string[1:prevind(string,startpos)]
347347
isempty(str) && return false
@@ -376,7 +376,7 @@ function bslash_completions(string, pos)
376376
return (true, (sort!(collect(latex_names)), slashpos:pos, true))
377377
end
378378
end
379-
return (false, (UTF8String[], 0:-1, false))
379+
return (false, (String[], 0:-1, false))
380380
end
381381

382382
function completions(string, pos)
@@ -404,7 +404,7 @@ function completions(string, pos)
404404
ok && return ret
405405

406406
# Make sure that only bslash_completions is working on strings
407-
inc_tag==:string && return UTF8String[], 0:-1, false
407+
inc_tag==:string && return String[], 0:-1, false
408408

409409
if inc_tag == :other && should_method_complete(partial)
410410
frange, method_name_end = find_start_brace(partial)
@@ -415,14 +415,14 @@ function completions(string, pos)
415415
return complete_methods(ex), start(frange):method_name_end, false
416416
end
417417
elseif inc_tag == :comment
418-
return UTF8String[], 0:-1, false
418+
return String[], 0:-1, false
419419
end
420420

421421
dotpos = rsearch(string, '.', pos)
422422
startpos = nextind(string, rsearch(string, non_identifier_chars, pos))
423423

424424
ffunc = (mod,x)->true
425-
suggestions = UTF8String[]
425+
suggestions = String[]
426426
comp_keywords = true
427427
if afterusing(string, startpos)
428428
# We're right after using or import. Let's look only for packages
@@ -500,10 +500,10 @@ function shell_completions(string, pos)
500500
try
501501
args, last_parse = Base.shell_parse(scs, true)
502502
catch
503-
return UTF8String[], 0:-1, false
503+
return String[], 0:-1, false
504504
end
505505
# Now look at the last thing we parsed
506-
isempty(args.args[end].args) && return UTF8String[], 0:-1, false
506+
isempty(args.args[end].args) && return String[], 0:-1, false
507507
arg = args.args[end].args[end]
508508
if all(s -> isa(s, AbstractString), args.args[end].args)
509509
# Treat this as a path
@@ -525,7 +525,7 @@ function shell_completions(string, pos)
525525
range += first(r) - 1
526526
return ret, range, true
527527
end
528-
return UTF8String[], 0:-1, false
528+
return String[], 0:-1, false
529529
end
530530

531531
end # module

base/Terminals.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ type TerminalBuffer <: UnixTerminal
100100
end
101101

102102
type TTYTerminal <: UnixTerminal
103-
term_type::ASCIIString
103+
term_type::String
104104
in_stream::Base.TTY
105105
out_stream::Base.TTY
106106
err_stream::Base.TTY

0 commit comments

Comments
 (0)