Skip to content

Commit 3e28d85

Browse files
rename String => AbstractString
1 parent 53254c2 commit 3e28d85

Some content is hidden

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

115 files changed

+942
-936
lines changed

NEWS.md

+2
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ Library improvements
9797

9898
* OpenBLAS 64-bit (ILP64) interface is now compiled with a `64_` suffix ([#8734]) to avoid conflicts with external libraries using a 32-bit BLAS ([#4923]).
9999

100+
* `String` has been renamed to `AbstractString`.
101+
100102
Deprecated or removed
101103
---------------------
102104

base/LineEdit.jl

+3-3
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ function _clear_input_area(terminal, state::InputAreaState)
183183
end
184184

185185
prompt_string(s::PromptState) = s.p.prompt
186-
prompt_string(s::String) = s
186+
prompt_string(s::AbstractString) = s
187187

188188
refresh_multi_line(termbuf::TerminalBuffer, s::PromptState) = s.ias =
189189
refresh_multi_line(termbuf, terminal(s), buffer(s), s.ias, s, indent = s.indent)
@@ -457,7 +457,7 @@ end
457457

458458
# splice! for IOBuffer: convert from 0-indexed positions, update the size,
459459
# and keep the cursor position stable with the text
460-
function splice_buffer!{T<:Integer}(buf::IOBuffer, r::UnitRange{T}, ins::String = "")
460+
function splice_buffer!{T<:Integer}(buf::IOBuffer, r::UnitRange{T}, ins::AbstractString = "")
461461
pos = position(buf)
462462
if !isempty(r) && pos in r
463463
seek(buf, first(r))
@@ -652,7 +652,7 @@ write_prompt(terminal, s::ASCIIString) = write(terminal, s)
652652

653653
normalize_key(key::Char) = string(key)
654654
normalize_key(key::Integer) = normalize_key(char(key))
655-
function normalize_key(key::String)
655+
function normalize_key(key::AbstractString)
656656
'\0' in key && error("Matching \\0 not currently supported.")
657657
buf = IOBuffer()
658658
i = start(key)

base/REPL.jl

+11-11
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ function eval_user_input(ast::ANY, backend::REPLBackend)
6767
end
6868
end
6969

70-
function parse_input_line(s::String)
70+
function parse_input_line(s::AbstractString)
7171
# s = bytestring(s)
7272
# (expr, pos) = parse(s, 1)
7373
# (ex, pos) = ccall(:jl_parse_string, Any,
@@ -232,11 +232,11 @@ end
232232
type LineEditREPL <: AbstractREPL
233233
t::TextTerminal
234234
hascolor::Bool
235-
prompt_color::String
236-
input_color::String
237-
answer_color::String
238-
shell_color::String
239-
help_color::String
235+
prompt_color::AbstractString
236+
input_color::AbstractString
237+
answer_color::AbstractString
238+
shell_color::AbstractString
239+
help_color::AbstractString
240240
no_history_file::Bool
241241
in_shell::Bool
242242
in_help::Bool
@@ -298,7 +298,7 @@ end
298298

299299

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

314314
const invalid_history_message = """
@@ -836,9 +836,9 @@ end
836836

837837
type StreamREPL <: AbstractREPL
838838
stream::IO
839-
prompt_color::String
840-
input_color::String
841-
answer_color::String
839+
prompt_color::AbstractString
840+
input_color::AbstractString
841+
answer_color::AbstractString
842842
waserror::Bool
843843
StreamREPL(stream,pc,ic,ac) = new(stream,pc,ic,ac,false)
844844
end

base/REPLCompletions.jl

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ function completes_global(x, name)
88
return beginswith(x, name) && !('#' in x)
99
end
1010

11-
function filtered_mod_names(ffunc::Function, mod::Module, name::String, all::Bool=false, imported::Bool=false)
11+
function filtered_mod_names(ffunc::Function, mod::Module, name::AbstractString, all::Bool=false, imported::Bool=false)
1212
ssyms = names(mod, all, imported)
1313
filter!(ffunc, ssyms)
1414
syms = UTF8String[string(s) for s in ssyms]
@@ -107,7 +107,7 @@ function complete_keyword(s::ByteString)
107107
sorted_keywords[r]
108108
end
109109

110-
function complete_path(path::String, pos)
110+
function complete_path(path::AbstractString, pos)
111111
dir, prefix = splitdir(path)
112112
local files
113113
try
@@ -133,7 +133,7 @@ function complete_path(path::String, pos)
133133
matches, (nextind(path, pos-sizeof(prefix))):pos, length(matches) > 0
134134
end
135135

136-
function complete_methods(input::String)
136+
function complete_methods(input::AbstractString)
137137
tokens = split(input, '.')
138138
fn = Main
139139
for token in tokens
@@ -254,7 +254,7 @@ function shell_completions(string, pos)
254254
# Now look at the last thing we parsed
255255
isempty(args.args[end].args) && return UTF8String[], 0:-1, false
256256
arg = args.args[end].args[end]
257-
if all(map(s -> isa(s, String), args.args[end].args))
257+
if all(map(s -> isa(s, AbstractString), args.args[end].args))
258258
# Treat this as a path (perhaps give a list of comands in the future as well?)
259259
return complete_path(join(args.args[end].args), pos)
260260
elseif isexpr(arg, :escape) && (isexpr(arg.args[1], :incomplete) || isexpr(arg.args[1], :error))

base/Terminals.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ write(t::UnixTerminal, p::Ptr{Uint8}) = write(t.out_stream, p)
187187
write(t::UnixTerminal, p::Ptr{Uint8}, x::Integer) = write(t.out_stream, p, x)
188188
write(t::UnixTerminal, x::Uint8) = write(t.out_stream, x)
189189
read{T,N}(t::UnixTerminal, x::Array{T,N}) = read(t.in_stream, x)
190-
readuntil(t::UnixTerminal, s::String) = readuntil(t.in_stream, s)
190+
readuntil(t::UnixTerminal, s::AbstractString) = readuntil(t.in_stream, s)
191191
readuntil(t::UnixTerminal, c::Char) = readuntil(t.in_stream, c)
192192
readuntil(t::UnixTerminal, s) = readuntil(t.in_stream, s)
193193
read(t::UnixTerminal, ::Type{Uint8}) = read(t.in_stream, Uint8)

base/ascii.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,4 +117,4 @@ function convert(::Type{ASCIIString}, a::Array{Uint8,1}, invalids_as::ASCIIStrin
117117
end
118118
convert(ASCIIString, a)
119119
end
120-
convert(::Type{ASCIIString}, s::String) = ascii(bytestring(s))
120+
convert(::Type{ASCIIString}, s::AbstractString) = ascii(bytestring(s))

base/base.jl

+9-9
Original file line numberDiff line numberDiff line change
@@ -59,36 +59,36 @@ cconvert(T, x) = convert(T, x)
5959
# use the code in ccall.cpp to safely allocate temporary pointer arrays
6060
cconvert{T}(::Type{Ptr{Ptr{T}}}, a::Array) = a
6161
# convert strings to ByteString to pass as pointers
62-
cconvert{P<:Union(Int8,Uint8)}(::Type{Ptr{P}}, s::String) = bytestring(s)
62+
cconvert{P<:Union(Int8,Uint8)}(::Type{Ptr{P}}, s::AbstractString) = bytestring(s)
6363

6464
reinterpret{T,S}(::Type{T}, x::S) = box(T,unbox(S,x))
6565

6666
abstract IO
6767

6868
type ErrorException <: Exception
69-
msg::String
69+
msg::AbstractString
7070
end
7171

7272
type SystemError <: Exception
73-
prefix::String
73+
prefix::AbstractString
7474
errnum::Int32
75-
SystemError(p::String, e::Integer) = new(p, int32(e))
76-
SystemError(p::String) = new(p, errno())
75+
SystemError(p::AbstractString, e::Integer) = new(p, int32(e))
76+
SystemError(p::AbstractString) = new(p, errno())
7777
end
7878

7979
type TypeError <: Exception
8080
func::Symbol
81-
context::String
81+
context::AbstractString
8282
expected::Type
8383
got
8484
end
8585

8686
type ParseError <: Exception
87-
msg::String
87+
msg::AbstractString
8888
end
8989

9090
type ArgumentError <: Exception
91-
msg::String
91+
msg::AbstractString
9292
end
9393

9494
#type UnboundError <: Exception
@@ -100,7 +100,7 @@ type KeyError <: Exception
100100
end
101101

102102
type LoadError <: Exception
103-
file::String
103+
file::AbstractString
104104
line::Int
105105
error
106106
end

base/boot.jl

+4-4
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ export
128128
Int32, Int64, Int128, Ptr, Real, Signed, Uint, Uint8, Uint16, Uint32,
129129
Uint64, Uint128, Unsigned,
130130
# string types
131-
Char, ASCIIString, ByteString, DirectIndexString, String, UTF8String,
131+
Char, ASCIIString, ByteString, DirectIndexString, AbstractString, UTF8String,
132132
# errors
133133
BoundsError, DivideError, DomainError, Exception,
134134
InexactError, InterruptException, MemoryError, OverflowError,
@@ -214,8 +214,8 @@ type UndefVarError <: Exception
214214
end
215215
type InterruptException <: Exception end
216216

217-
abstract String
218-
abstract DirectIndexString <: String
217+
abstract AbstractString
218+
abstract DirectIndexString <: AbstractString
219219

220220
type SymbolNode
221221
name::Symbol
@@ -233,7 +233,7 @@ immutable ASCIIString <: DirectIndexString
233233
data::Array{Uint8,1}
234234
end
235235

236-
immutable UTF8String <: String
236+
immutable UTF8String <: AbstractString
237237
data::Array{Uint8,1}
238238
end
239239

base/c.jl

+6-6
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,23 @@ const RTLD_NOLOAD = 0x00000010
1212
const RTLD_DEEPBIND = 0x00000020
1313
const RTLD_FIRST = 0x00000040
1414

15-
function dlsym(hnd::Ptr, s::Union(Symbol,String))
15+
function dlsym(hnd::Ptr, s::Union(Symbol,AbstractString))
1616
hnd == C_NULL && error("NULL library handle")
1717
ccall(:jl_dlsym, Ptr{Void}, (Ptr{Void}, Ptr{Uint8}), hnd, s)
1818
end
1919

20-
function dlsym_e(hnd::Ptr, s::Union(Symbol,String))
20+
function dlsym_e(hnd::Ptr, s::Union(Symbol,AbstractString))
2121
hnd == C_NULL && error("NULL library handle")
2222
ccall(:jl_dlsym_e, Ptr{Void}, (Ptr{Void}, Ptr{Uint8}), hnd, s)
2323
end
2424

2525
dlopen(s::Symbol, flags::Integer = RTLD_LAZY | RTLD_DEEPBIND) =
2626
dlopen(string(s), flags)
2727

28-
dlopen(s::String, flags::Integer = RTLD_LAZY | RTLD_DEEPBIND) =
28+
dlopen(s::AbstractString, flags::Integer = RTLD_LAZY | RTLD_DEEPBIND) =
2929
ccall(:jl_load_dynamic_library, Ptr{Void}, (Ptr{Uint8},Uint32), s, flags)
3030

31-
dlopen_e(s::String, flags::Integer = RTLD_LAZY | RTLD_DEEPBIND) =
31+
dlopen_e(s::AbstractString, flags::Integer = RTLD_LAZY | RTLD_DEEPBIND) =
3232
ccall(:jl_load_dynamic_library_e, Ptr{Void}, (Ptr{Uint8},Uint32), s, flags)
3333

3434
dlopen_e(s::Symbol, flags::Integer = RTLD_LAZY | RTLD_DEEPBIND) =
@@ -112,11 +112,11 @@ function find_library{T<:ByteString, S<:ByteString}(libnames::Array{T,1}, extrap
112112
return ""
113113
end
114114

115-
function ccallable(f::Function, rt::Type, argt::(Type...), name::Union(String,Symbol)=string(f))
115+
function ccallable(f::Function, rt::Type, argt::(Type...), name::Union(AbstractString,Symbol)=string(f))
116116
ccall(:jl_extern_c, Void, (Any, Any, Any, Ptr{Uint8}), f, rt, argt, name)
117117
end
118118

119-
function ccallable(f::Function, argt::(Type...), name::Union(String,Symbol)=string(f))
119+
function ccallable(f::Function, argt::(Type...), name::Union(AbstractString,Symbol)=string(f))
120120
ccall(:jl_extern_c, Void, (Any, Ptr{Void}, Any, Ptr{Uint8}), f, C_NULL, argt, name)
121121
end
122122

base/client.jl

+5-5
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ function repl_cmd(cmd)
6565
nothing
6666
end
6767

68-
function repl_hook(input::String)
68+
function repl_hook(input::AbstractString)
6969
Expr(:call, :(Base.repl_cmd),
7070
macroexpand(Expr(:macrocall,symbol("@cmd"),input)))
7171
end
@@ -129,7 +129,7 @@ end
129129

130130
_repl_start = Condition()
131131

132-
function parse_input_line(s::String)
132+
function parse_input_line(s::AbstractString)
133133
# s = bytestring(s)
134134
# (expr, pos) = parse(s, 1)
135135
# (ex, pos) = ccall(:jl_parse_string, Any,
@@ -169,7 +169,7 @@ function incomplete_tag(ex::Expr)
169169
end
170170

171171
# try to include() a file, ignoring if not found
172-
try_include(path::String) = isfile(path) && include(path)
172+
try_include(path::AbstractString) = isfile(path) && include(path)
173173

174174
function init_bind_addr(args::Vector{UTF8String})
175175
# Treat --bind-to in a position independent manner in ARGS since
@@ -335,8 +335,8 @@ function load_juliarc()
335335
try_include(abspath(homedir(),".juliarc.jl"))
336336
end
337337

338-
function load_machine_file(path::String)
339-
machines = String[]
338+
function load_machine_file(path::AbstractString)
339+
machines = AbstractString[]
340340
for line in split(readall(path),'\n'; keep=false)
341341
s = split(line,'*'; keep=false)
342342
if length(s) > 1

0 commit comments

Comments
 (0)