Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFC, WIP: highlander #14383

Closed
wants to merge 12 commits into from
10 changes: 5 additions & 5 deletions base/LineEdit.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type MIState
current_mode
aborted::Bool
mode_state
kill_buffer::ByteString
kill_buffer::String
previous_key::Array{Char,1}
key_repeats::Int
end
Expand Down Expand Up @@ -624,7 +624,7 @@ function write_prompt(terminal, p::Prompt)
write(terminal, Base.text_colors[:normal])
write(terminal, suffix)
end
write_prompt(terminal, s::ByteString) = write(terminal, s)
write_prompt(terminal, s::String) = write(terminal, s)

### Keymap Support

Expand Down Expand Up @@ -703,11 +703,11 @@ end
# This is different from the default eager redirect, which only looks at the current and lower
# layers of the stack.
immutable KeyAlias
seq::ASCIIString
seq::String
KeyAlias(seq) = new(normalize_key(seq))
end

match_input(k::Function, s, term, cs, keymap) = (update_key_repeats(s, cs); return keymap_fcn(k, ByteString(cs)))
match_input(k::Function, s, term, cs, keymap) = (update_key_repeats(s, cs); return keymap_fcn(k, String(cs)))
match_input(k::Void, s, term, cs, keymap) = (s,p) -> return :ok
match_input(k::KeyAlias, s, term, cs, keymap) = match_input(keymap, s, IOBuffer(k.seq), Char[], keymap)
function match_input(k::Dict, s, term=terminal(s), cs=Char[], keymap = k)
Expand Down Expand Up @@ -1013,7 +1013,7 @@ init_state(terminal, p::HistoryPrompt) = SearchState(terminal, p, true, IOBuffer
type PrefixSearchState <: ModeState
terminal
histprompt
prefix::ByteString
prefix::String
response_buffer::IOBuffer
ias::InputAreaState
indent::Int
Expand Down
2 changes: 1 addition & 1 deletion base/REPL.jl
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ function hist_from_file(hp, file)
error(munged_history_message, countlines)
line[1] != '\t' &&
error(invalid_history_message, repr(line[1]), " at line ", countlines)
lines = UTF8String[]
lines = String[]
while !isempty(line)
push!(lines, chomp(line[2:end]))
eof(file) && break
Expand Down
40 changes: 20 additions & 20 deletions base/REPLCompletions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ end
function filtered_mod_names(ffunc::Function, mod::Module, name::AbstractString, all::Bool=false, imported::Bool=false)
ssyms = names(mod, all, imported)
filter!(ffunc, ssyms)
syms = UTF8String[string(s) for s in ssyms]
syms = String[string(s) for s in ssyms]
filter!(x->completes_global(x, name), syms)
end

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

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

function complete_keyword(s::ByteString)
function complete_keyword(s::String)
const sorted_keywords = [
"abstract", "baremodule", "begin", "bitstype", "break", "catch", "ccall",
"const", "continue", "do", "else", "elseif", "end", "export", "false",
Expand Down Expand Up @@ -117,13 +117,13 @@ function complete_path(path::AbstractString, pos; use_envpath=false)
elseif isdir(dir)
files = readdir(dir)
else
return UTF8String[], 0:-1, false
return String[], 0:-1, false
end
catch
return UTF8String[], 0:-1, false
return String[], 0:-1, false
end

matches = Set{UTF8String}()
matches = Set{String}()
for file in files
if startswith(file, prefix)
id = try isdir(joinpath(dir, file)) catch; false end
Expand Down Expand Up @@ -174,7 +174,7 @@ function complete_path(path::AbstractString, pos; use_envpath=false)
end
end

matchList = UTF8String[replace(s, r"\s", "\\ ") for s in matches]
matchList = String[replace(s, r"\s", "\\ ") for s in matches]
startpos = pos - endof(prefix) + 1 - length(matchall(r" ", prefix))
# The pos - endof(prefix) + 1 is correct due to `endof(prefix)-endof(prefix)==0`,
# hence we need to add one to get the first index. This is also correct when considering
Expand Down Expand Up @@ -289,7 +289,7 @@ function get_type_call(expr::Expr)
(tree, return_type) = Core.Inference.typeinf(linfo, m[1], m[2])
return return_type, true
end
# Returns the return type. example: get_type(:(Base.strip("",' ')),Main) returns (ASCIIString,true)
# Returns the return type. example: get_type(:(Base.strip("",' ')),Main) returns (String,true)
function get_type(sym::Expr, fn)
sym=expand(sym)
val, found = get_value(sym, fn)
Expand All @@ -313,12 +313,12 @@ end
function complete_methods(ex_org::Expr)
args_ex = DataType[]
func, found = get_value(ex_org.args[1], Main)
!found && return UTF8String[]
!found && return String[]
for ex in ex_org.args[2:end]
val, found = get_type(ex, Main)
push!(args_ex, val)
end
out = UTF8String[]
out = String[]
t_in = Tuple{Core.Typeof(func), args_ex...} # Input types
na = length(args_ex)+1
for method in methods(func)
Expand All @@ -337,7 +337,7 @@ const whitespace_chars = [" \t\n\r"...]

# Aux function to detect whether we're right after a
# using or import keyword
function afterusing(string::ByteString, startpos::Int)
function afterusing(string::String, startpos::Int)
(isempty(string) || startpos == 0) && return false
str = string[1:prevind(string,startpos)]
isempty(str) && return false
Expand Down Expand Up @@ -372,7 +372,7 @@ function bslash_completions(string, pos)
return (true, (sort!(collect(latex_names)), slashpos:pos, true))
end
end
return (false, (UTF8String[], 0:-1, false))
return (false, (String[], 0:-1, false))
end

function completions(string, pos)
Expand Down Expand Up @@ -400,7 +400,7 @@ function completions(string, pos)
ok && return ret

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

if inc_tag == :other && should_method_complete(partial)
frange, method_name_end = find_start_brace(partial)
Expand All @@ -411,14 +411,14 @@ function completions(string, pos)
return complete_methods(ex), start(frange):method_name_end, false
end
elseif inc_tag == :comment
return UTF8String[], 0:-1, false
return String[], 0:-1, false
end

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

ffunc = (mod,x)->true
suggestions = UTF8String[]
suggestions = String[]
comp_keywords = true
if afterusing(string, startpos)
# We're right after using or import. Let's look only for packages
Expand Down Expand Up @@ -496,10 +496,10 @@ function shell_completions(string, pos)
try
args, last_parse = Base.shell_parse(scs, true)
catch
return UTF8String[], 0:-1, false
return String[], 0:-1, false
end
# Now look at the last thing we parsed
isempty(args.args[end].args) && return UTF8String[], 0:-1, false
isempty(args.args[end].args) && return String[], 0:-1, false
arg = args.args[end].args[end]
if all(s -> isa(s, AbstractString), args.args[end].args)
# Treat this as a path
Expand All @@ -521,7 +521,7 @@ function shell_completions(string, pos)
range += first(r) - 1
return ret, range, true
end
return UTF8String[], 0:-1, false
return String[], 0:-1, false
end

end # module
2 changes: 1 addition & 1 deletion base/Terminals.jl
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ type TerminalBuffer <: UnixTerminal
end

type TTYTerminal <: UnixTerminal
term_type::ASCIIString
term_type::String
in_stream::Base.TTY
out_stream::Base.TTY
err_stream::Base.TTY
Expand Down
141 changes: 0 additions & 141 deletions base/ascii.jl

This file was deleted.

5 changes: 3 additions & 2 deletions base/atomics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ function atomic_min! end
unsafe_convert{T}(::Type{Ptr{T}}, x::Atomic{T}) = convert(Ptr{T}, pointer_from_objref(x))
setindex!{T}(x::Atomic{T}, v) = setindex!(x, convert(T, v))

const llvmtypes = Dict{Type, ASCIIString}(
const llvmtypes = Dict(
Bool => "i1",
Int8 => "i8", UInt8 => "i8",
Int16 => "i16", UInt16 => "i16",
Expand All @@ -192,7 +192,8 @@ const llvmtypes = Dict{Type, ASCIIString}(
Int128 => "i128", UInt128 => "i128",
Float16 => "i16", # half
Float32 => "float",
Float64 => "double")
Float64 => "double",
)
inttype{T<:Integer}(::Type{T}) = T
inttype(::Type{Float16}) = Int16
inttype(::Type{Float32}) = Int32
Expand Down
2 changes: 0 additions & 2 deletions base/base.jl
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,6 @@ finalize(o::ANY) = ccall(:jl_finalize, Void, (Any,), o)
gc(full::Bool=true) = ccall(:jl_gc_collect, Void, (Cint,), full)
gc_enable(on::Bool) = ccall(:jl_gc_enable, Cint, (Cint,), on)!=0

bytestring(str::ByteString) = str

identity(x) = x

# used by { } syntax
Expand Down
Loading