diff --git a/base/LineEdit.jl b/base/LineEdit.jl index 8b3ae98afcb0a..8f3e513560cbc 100644 --- a/base/LineEdit.jl +++ b/base/LineEdit.jl @@ -834,29 +834,30 @@ function keymap{D<:Dict}(keymaps::Array{D}) end const escape_defaults = merge!( - {char(i) => nothing for i=[1:26, 28:31]}, # Ignore control characters by default - { # And ignore other escape sequences by default - "\e*" => nothing, - "\e[*" => nothing, - # Also ignore extended escape sequences - # TODO: Support ranges of characters - "\e[1**" => nothing, - "\e[2**" => nothing, - "\e[3**" => nothing, - "\e[4**" => nothing, - "\e[5**" => nothing, - "\e[6**" => nothing, - "\e[1~" => "\e[H", - "\e[4~" => "\e[F", - "\e[7~" => "\e[H", - "\e[8~" => "\e[F", - "\eOA" => "\e[A", - "\eOB" => "\e[B", - "\eOC" => "\e[C", - "\eOD" => "\e[D", - "\eOH" => "\e[H", - "\eOF" => "\e[F", -}) + (Any=>Any)[char(i) => nothing for i=[1:26, 28:31]], # Ignore control characters by default + (Any=>Any)[ # And ignore other escape sequences by default + "\e*" => nothing, + "\e[*" => nothing, + # Also ignore extended escape sequences + # TODO: Support ranges of characters + "\e[1**" => nothing, + "\e[2**" => nothing, + "\e[3**" => nothing, + "\e[4**" => nothing, + "\e[5**" => nothing, + "\e[6**" => nothing, + "\e[1~" => "\e[H", + "\e[4~" => "\e[F", + "\e[7~" => "\e[H", + "\e[8~" => "\e[F", + "\eOA" => "\e[A", + "\eOB" => "\e[B", + "\eOC" => "\e[C", + "\eOD" => "\e[D", + "\eOH" => "\e[H", + "\eOF" => "\e[F", + ] +) function write_response_buffer(s::PromptState, data) offset = s.input_buffer.ptr @@ -997,7 +998,7 @@ end function setup_search_keymap(hp) p = HistoryPrompt(hp) - pkeymap = { + pkeymap = (Any=>Any)[ "^R" => (s,data,c)->(history_set_backward(data, true); history_next_result(s, data)), "^S" => (s,data,c)->(history_set_backward(data, false); history_next_result(s, data)), '\r' => (s,o...)->accept_result(s, p), @@ -1066,12 +1067,12 @@ function setup_search_keymap(hp) edit_insert(data.query_buffer, input); update_display_buffer(s, data) end, "*" => (s,data,c)->(edit_insert(data.query_buffer, c); update_display_buffer(s, data)) - } + ] p.keymap_func = keymap([pkeymap, escape_defaults]) - skeymap = { + skeymap = (Any=>Any)[ "^R" => (s,o...)->(enter_search(s, p, true)), "^S" => (s,o...)->(enter_search(s, p, false)), - } + ] (p, skeymap) end @@ -1118,7 +1119,7 @@ function commit_line(s) end const default_keymap = -{ +(Any=>Any)[ # Tab '\t' => (s,o...)->begin buf = buffer(s) @@ -1226,9 +1227,9 @@ const default_keymap = edit_insert(s, input) end, "^T" => (s,o...)->edit_transpose(s), -} +] -const history_keymap = { +const history_keymap = (Any=>Any)[ "^P" => (s,o...)->(history_prev(s, mode(s).hist)), "^N" => (s,o...)->(history_next(s, mode(s).hist)), # Up Arrow @@ -1239,7 +1240,7 @@ const history_keymap = { "\e[5~" => (s,o...)->(history_prev(s, mode(s).hist)), # Page Down "\e[6~" => (s,o...)->(history_next(s, mode(s).hist)) -} +] function deactivate(p::Union(Prompt,HistoryPrompt), s::Union(SearchState,PromptState), termbuf) clear_input_area(termbuf, s) diff --git a/base/REPL.jl b/base/REPL.jl index ed1bef5a664f3..33c5327bf2d27 100644 --- a/base/REPL.jl +++ b/base/REPL.jl @@ -50,7 +50,7 @@ function eval_user_input(ast::ANY, backend::REPLBackend) ans = backend.ans # note: value wrapped in a non-syntax value to avoid evaluating # possibly-invalid syntax (issue #6763). - eval(Main, :(ans = $({ans})[1])) + eval(Main, :(ans = $(Any[ans])[1])) value = eval(Main, ast) backend.ans = value put!(backend.response_channel, (value, nothing)) @@ -704,7 +704,7 @@ function setup_interface(repl::LineEditREPL; hascolor = repl.hascolor, extra_rep extra_repl_keymap = [extra_repl_keymap] end - const repl_keymap = { + const repl_keymap = (Any=>Any)[ ';' => function (s,o...) if isempty(s) || position(LineEdit.buffer(s)) == 0 buf = copy(LineEdit.buffer(s)) @@ -775,14 +775,14 @@ function setup_interface(repl::LineEditREPL; hascolor = repl.hascolor, extra_rep end end end, - } + ] a = Dict{Any,Any}[hkeymap, repl_keymap, LineEdit.history_keymap, LineEdit.default_keymap, LineEdit.escape_defaults] prepend!(a, extra_repl_keymap) julia_prompt.keymap_func = LineEdit.keymap(a) - const mode_keymap = { + const mode_keymap = (Any=>Any)[ '\b' => function (s,o...) if isempty(s) || position(LineEdit.buffer(s)) == 0 buf = copy(LineEdit.buffer(s)) @@ -801,7 +801,7 @@ function setup_interface(repl::LineEditREPL; hascolor = repl.hascolor, extra_rep transition(s, :reset) LineEdit.refresh_line(s) end - } + ] b = Dict{Any,Any}[hkeymap, mode_keymap, LineEdit.history_keymap, LineEdit.default_keymap, LineEdit.escape_defaults] prepend!(b, extra_repl_keymap) diff --git a/base/abstractarray.jl b/base/abstractarray.jl index 107eb87dd0170..f810a0186a83a 100644 --- a/base/abstractarray.jl +++ b/base/abstractarray.jl @@ -1182,7 +1182,7 @@ end ## # generic map on any iterator function map(f::Callable, iters...) - result = {} + result = [] len = length(iters) states = [start(iters[idx]) for idx in 1:len] nxtvals = cell(len) diff --git a/base/base.jl b/base/base.jl index 03ff452ff4951..26a38bf55ddd0 100644 --- a/base/base.jl +++ b/base/base.jl @@ -175,7 +175,7 @@ function length_checked_equal(args...) n end -map(f::Callable, a::Array{Any,1}) = { f(a[i]) for i=1:length(a) } +map(f::Callable, a::Array{Any,1}) = Any[ f(a[i]) for i=1:length(a) ] macro thunk(ex); :(()->$(esc(ex))); end macro L_str(s); s; end diff --git a/base/client.jl b/base/client.jl index c3c05477d9c93..755af62a89df3 100644 --- a/base/client.jl +++ b/base/client.jl @@ -3,7 +3,7 @@ const ARGS = UTF8String[] -const text_colors = { +const text_colors = (Any=>Any)[ :black => "\033[1m\033[30m", :red => "\033[1m\033[31m", :green => "\033[1m\033[32m", @@ -14,7 +14,7 @@ const text_colors = { :white => "\033[1m\033[37m", :normal => "\033[0m", :bold => "\033[1m", -} +] have_color = false @unix_only default_color_answer = text_colors[:bold] @@ -70,7 +70,7 @@ function repl_hook(input::String) macroexpand(Expr(:macrocall,symbol("@cmd"),input))) end -display_error(er) = display_error(er, {}) +display_error(er) = display_error(er, []) function display_error(er, bt) with_output_color(:red, STDERR) do io print(io, "ERROR: ") @@ -420,7 +420,7 @@ function _start() ccall(:uv_atexit_hook, Void, ()) end -const atexit_hooks = {} +const atexit_hooks = [] atexit(f::Function) = (unshift!(atexit_hooks, f); nothing) diff --git a/base/combinatorics.jl b/base/combinatorics.jl index dba483b35393e..f1b8afc7bac11 100644 --- a/base/combinatorics.jl +++ b/base/combinatorics.jl @@ -463,7 +463,7 @@ function nextsetpartition(s::AbstractVector, a, b, n, m) filter!(x->!isempty(x), temp) end - if isempty(s); return ({s}, ([1], Int[], n, 1)); end + if isempty(s); return ([s], ([1], Int[], n, 1)); end part = makeparts(s,a,m) diff --git a/base/constants.jl b/base/constants.jl index 2616f251a62b3..95003e41213db 100644 --- a/base/constants.jl +++ b/base/constants.jl @@ -19,7 +19,7 @@ convert{T<:Integer}(::Type{Rational{T}}, x::MathConst) = convert(Rational{T}, fl hash(x::MathConst, h::Uint) = hash(object_id(x), h) -(x::MathConst) = -float64(x) -for op in {:+, :-, :*, :/, :^} +for op in Symbol[:+, :-, :*, :/, :^] @eval $op(x::MathConst, y::MathConst) = $op(float64(x),float64(y)) end diff --git a/base/darray.jl b/base/darray.jl index 2685c5fb635f0..70428e627c427 100644 --- a/base/darray.jl +++ b/base/darray.jl @@ -272,7 +272,7 @@ function setindex!(a::Array, s::SubDArray, I::UnitRange{Int}...) offs = [isa(J[i],Int) ? J[i]-1 : first(J[i])-1 for i=1:n] @sync begin for i = 1:length(d.chunks) - K_c = {d.indexes[i]...} + K_c = Any[d.indexes[i]...] K = [ intersect(J[j],K_c[j]) for j=1:n ] if !any(isempty, K) idxs = [ I[j][K[j]-offs[j]] for j=1:n ] @@ -302,7 +302,7 @@ map(f::Callable, d::DArray) = DArray(I->map(f, localpart(d)), d) reduce(f::Function, d::DArray) = mapreduce(fetch, f, - { @spawnat p reduce(f, localpart(d)) for p in procs(d) }) + Any[ @spawnat p reduce(f, localpart(d)) for p in procs(d) ]) function map!(f::Callable, d::DArray) diff --git a/base/dates/io.jl b/base/dates/io.jl index 4df40407d2e8d..e865bc790c611 100644 --- a/base/dates/io.jl +++ b/base/dates/io.jl @@ -62,7 +62,7 @@ duplicates(slots) = any(map(x->count(y->x.period==y.period,slots),slots) .> 1) function DateFormat(f::String,locale::String="english") slots = Slot[] - trans = {} + trans = [] begtran = match(r"^.*?(?=[ymuUdHMSsEe])",f).match ss = split(f,r"^.*?(?=[ymuUdHMSsEe])") s = split(begtran == "" ? ss[1] : ss[2],r"[^ymuUdHMSsEe]+|(?<=([ymuUdHMSsEe])(?!\1))") @@ -182,4 +182,4 @@ function format(y::AbstractArray{Date},df::DateFormat=ISODateFormat) end function format(y::AbstractArray{DateTime},df::DateFormat=ISODateTimeFormat) return reshape([Dates.format(y[i],df) for i in 1:length(y)], size(y)) -end \ No newline at end of file +end diff --git a/base/deprecated.jl b/base/deprecated.jl index 466e270d5b389..da24b40926d77 100644 --- a/base/deprecated.jl +++ b/base/deprecated.jl @@ -108,7 +108,7 @@ eval(Sys, :(@deprecate shlib_list dllist)) @deprecate put put! @deprecate take take! -@deprecate Set(a, b...) Set({a, b...}) +@deprecate Set(a, b...) Set([a, b...]) # for a bit of backwards compatibility IntSet(xs::Integer...) = (s=IntSet(); for a in xs; push!(s,a); end; s) Set{T<:Number}(xs::T...) = Set{T}(xs) diff --git a/base/expr.jl b/base/expr.jl index 0f716b7d928e1..6b2c80c816365 100644 --- a/base/expr.jl +++ b/base/expr.jl @@ -72,7 +72,7 @@ _inline(arg) = arg ## some macro utilities ## -find_vars(e) = find_vars(e, {}) +find_vars(e) = find_vars(e, []) function find_vars(e, lst) if isa(e,Symbol) if current_module()===Main && isdefined(e) diff --git a/base/help.jl b/base/help.jl index 0401826285d34..594ce5ae65ac6 100644 --- a/base/help.jl +++ b/base/help.jl @@ -48,11 +48,11 @@ function init_help() mfunc = func end if !haskey(FUNCTION_DICT, mfunc) - FUNCTION_DICT[mfunc] = {} + FUNCTION_DICT[mfunc] = [] end push!(FUNCTION_DICT[mfunc], desc) if !haskey(MODULE_DICT, func) - MODULE_DICT[func] = {} + MODULE_DICT[func] = [] end if !in(mod, MODULE_DICT[func]) push!(MODULE_DICT[func], mod) @@ -94,7 +94,7 @@ function help(io::IO, fname::String, obj=0) found = true elseif haskey(MODULE_DICT, fname) allmods = MODULE_DICT[fname] - alldesc = {} + alldesc = [] for mod in allmods mfname = isempty(mod) ? fname : mod * "." * fname if isgeneric(obj) diff --git a/base/inference.jl b/base/inference.jl index 0ecb096029962..739b636673ab2 100644 --- a/base/inference.jl +++ b/base/inference.jl @@ -367,7 +367,7 @@ const getfield_tfunc = function (A, s0, name) return R else return limit_type_depth(R, 0, true, - filter!(x->isa(x,TypeVar), {s.parameters...})) + filter!(x->isa(x,TypeVar), Any[s.parameters...])) end end end @@ -1353,7 +1353,7 @@ function typeinf(linfo::LambdaStaticData,atypes::Tuple,sparams::Tuple, def, cop) rec = false toprec = false - s = { () for i=1:n } + s = Any[ () for i=1:n ] # initial types s[1] = ObjectIdDict() for v in vars @@ -1412,7 +1412,7 @@ function typeinf(linfo::LambdaStaticData,atypes::Tuple,sparams::Tuple, def, cop) # exception handlers cur_hand = () - handler_at = { () for i=1:n } + handler_at = Any[ () for i=1:n ] push!(W,1) # initial set of pc @@ -1573,7 +1573,7 @@ function typeinf(linfo::LambdaStaticData,atypes::Tuple,sparams::Tuple, def, cop) if !redo if is(def.tfunc,()) - def.tfunc = {} + def.tfunc = [] end tfarr = def.tfunc::Array{Any,1} idx = -1 @@ -1698,7 +1698,7 @@ function type_annotate(ast::Expr, states::Array{Any,1}, sv::ANY, rettype::ANY, for arg in args decls[arg] = states[1][arg] end - closures = {} + closures = [] body = ast.args[3].args::Array{Any,1} for i=1:length(body) st_i = states[i] @@ -1916,7 +1916,7 @@ function exprtype(x::ANY) end function without_linenums(a::Array{Any,1}) - l = {} + l = [] for x in a if (isa(x,Expr) && is(x.head,:line)) || isa(x,LineNumberNode) else @@ -1926,9 +1926,11 @@ function without_linenums(a::Array{Any,1}) l end +# known affect-free calls (also effect-free) +const _pure_builtins = Any[tuple, tupleref, tuplelen, fieldtype, apply_type, is, isa, typeof, typeassert] -const _pure_builtins = {tuple, tupleref, tuplelen, fieldtype, apply_type, is, isa, typeof, typeassert} # known affect-free calls (also effect-free) -const _pure_builtins_volatile = {getfield, arrayref} # known effect-free calls (might not be affect-free) +# known effect-free calls (might not be affect-free) +const _pure_builtins_volatile = Any[getfield, arrayref] function is_pure_builtin(f) if contains_is(_pure_builtins, f) @@ -2128,7 +2130,7 @@ function inlineable(f, e::Expr, atypes, sv, enclosing_ast) sp = meth[2]::Tuple sp = tuple(sp..., linfo.sparams...) - spvals = { sp[i] for i in 2:2:length(sp) } + spvals = Any[ sp[i] for i in 2:2:length(sp) ] for i=1:length(spvals) if isa(spvals[i], TypeVar) return NF @@ -2185,27 +2187,27 @@ function inlineable(f, e::Expr, atypes, sv, enclosing_ast) numarg = length(argexprs) newnames = unique_names(ast,numarg) sp = () - spvals = {} + spvals = [] meth = (methargs, sp) - locals = {} + locals = [] newcall = Expr(:call, e.args[1]) newcall.typ = ty for i = 1:numarg name = newnames[i] argtype = exprtype(argexprs[i]) argtype = typeintersect(argtype,Any) # remove Undef - push!(locals, {name,argtype,0}) + push!(locals, Any[name,argtype,0]) push!(newcall.args, argtype===Any ? name : SymbolNode(name, argtype)) end - body.args = {Expr(:return, newcall)} - ast = Expr(:lambda, newnames, {{}, locals, {}}, body) + body.args = Any[Expr(:return, newcall)] + ast = Expr(:lambda, newnames, Any[[], locals, []], body) need_mod_annotate = false else return NF end end - spnames = { sp[i].name for i=1:2:length(sp) } + spnames = Any[ sp[i].name for i=1:2:length(sp) ] enc_vinflist = enclosing_ast.args[2][2]::Array{Any,1} enc_locllist = enclosing_ast.args[2][1]::Array{Any,1} locllist = ast.args[2][1]::Array{Any,1} @@ -2237,7 +2239,7 @@ function inlineable(f, e::Expr, atypes, sv, enclosing_ast) for vi in vinflist if vi[1] === vaname && vi[2] != 0 islocal = true - push!(enc_vinflist, {vnew, vi[2], vi[3]}) + push!(enc_vinflist, Any[vnew, vi[2], vi[3]]) end end if islocal @@ -2248,7 +2250,7 @@ function inlineable(f, e::Expr, atypes, sv, enclosing_ast) else # construct tuple-forming expression for argument tail vararg = mk_tuplecall(argexprs[na:end]) - argexprs = {argexprs[1:(na-1)]..., vararg} + argexprs = Any[argexprs[1:(na-1)]..., vararg] isva = true end elseif na != length(argexprs) @@ -2275,7 +2277,7 @@ function inlineable(f, e::Expr, atypes, sv, enclosing_ast) push!(enc_locllist, vnew) for vi in vinflist if vi[1] === localval - push!(enc_vinflist, {vnew, vi[2], vi[3]}) + push!(enc_vinflist, Any[vnew, vi[2], vi[3]]) end end end @@ -2294,7 +2296,7 @@ function inlineable(f, e::Expr, atypes, sv, enclosing_ast) end # see if each argument occurs only once in the body expression - stmts = {} + stmts = [] stmts_free = true # true = all entries of stmts are effect_free # when 1 method matches the inferred types, there is still a chance @@ -2562,7 +2564,7 @@ function inlining_pass(e::Expr, sv, ast) return (e,()) end arg1 = eargs[1] - stmts = {} + stmts = [] if e.head === :body i = 1 while i <= length(eargs) @@ -2657,10 +2659,10 @@ function inlining_pass(e::Expr, sv, ast) if isa(a1,basenumtype) || ((isa(a1,Symbol) || isa(a1,SymbolNode)) && exprtype(a1) <: basenumtype) if e.args[3]==2 - e.args = {TopNode(:*), a1, a1} + e.args = Any[TopNode(:*), a1, a1] f = * elseif e.args[3]==3 - e.args = {TopNode(:*), a1, a1, a1} + e.args = Any[TopNode(:*), a1, a1, a1] f = * end end @@ -2701,16 +2703,16 @@ function inlining_pass(e::Expr, sv, ast) # apply(f,tuple(x,y,...)) => f(x,y,...) newargs[i-2] = aarg.args[2:end] elseif isa(aarg, Tuple) - newargs[i-2] = { QuoteNode(x) for x in aarg } + newargs[i-2] = Any[ QuoteNode(x) for x in aarg ] elseif isa(t,Tuple) && !isvatuple(t) && effect_free(aarg,sv,true) # apply(f,t::(x,y)) => f(t[1],t[2]) - newargs[i-2] = { mk_tupleref(aarg,j,t[j]) for j=1:length(t) } + newargs[i-2] = Any[ mk_tupleref(aarg,j,t[j]) for j=1:length(t) ] else # not all args expandable return (e,stmts) end end - e.args = [{e.args[2]}, newargs...] + e.args = [Any[e.args[2]], newargs...] # now try to inline the simplified call @@ -2729,17 +2731,17 @@ function inlining_pass(e::Expr, sv, ast) end function add_variable(ast, name, typ, is_sa) - vinf = {name,typ,2+16*is_sa} + vinf = Any[name, typ, 2+16*is_sa] locllist = ast.args[2][1]::Array{Any,1} vinflist = ast.args[2][2]::Array{Any,1} push!(locllist, name) push!(vinflist, vinf) end -const some_names = {:_var0, :_var1, :_var2, :_var3, :_var4, :_var5, :_var6, - :_var7, :_var8, :_var9, :_var10, :_var11, :_var12, - :_var13, :_var14, :_var15, :_var16, :_var17, :_var18, - :_var19, :_var20, :_var21, :_var22, :_var23, :_var24} +const some_names = Symbol[:_var0, :_var1, :_var2, :_var3, :_var4, :_var5, :_var6, + :_var7, :_var8, :_var9, :_var10, :_var11, :_var12, + :_var13, :_var14, :_var15, :_var16, :_var17, :_var18, + :_var19, :_var20, :_var21, :_var22, :_var23, :_var24] function contains_is1(vinflist::Array{Any,1}, x::Symbol) for y in vinflist if is(y[1],x) @@ -2779,7 +2781,7 @@ function unique_name(ast1, ast2) end function unique_names(ast, n) - ns = {} + ns = [] locllist = ast.args[2][2]::Array{Any,1} for g in some_names if !contains_is1(locllist, g) @@ -2856,7 +2858,7 @@ function remove_redundant_temp_vars(ast, sa) # everywhere later in the function delete_var!(ast, v) - sym_replace(ast.args[3], {v}, {}, {init}, {}) + sym_replace(ast.args[3], [v], [], [init], []) end end end @@ -3056,7 +3058,7 @@ function replace_tupleref!(ast, e::ANY, tupname, vals, sv, i0) end function code_typed(f::Callable, types::(Type...)) - asts = {} + asts = [] for x in _methods(f,types,-1) linfo = func_for_method(x[3],types) (tree, ty) = typeinf(linfo, x[1], x[2]) @@ -3070,7 +3072,7 @@ function code_typed(f::Callable, types::(Type...)) end function return_types(f::Callable, types) - rt = {} + rt = [] for x in _methods(f,types,-1) linfo = func_for_method(x[3],types) (tree, ty) = typeinf(linfo, x[1], x[2]) diff --git a/base/latex_symbols.jl b/base/latex_symbols.jl index a6c359227ddbb..05ab63eaa2f38 100644 --- a/base/latex_symbols.jl +++ b/base/latex_symbols.jl @@ -7,7 +7,7 @@ #= using LightXML xdoc = parse_file("unicode.xml") -latexsym = {} +latexsym = [] Ls = Set() for c in child_nodes(root(xdoc)) if name(c) == "character" && is_elementnode(c) diff --git a/base/loading.jl b/base/loading.jl index 760370c512e5a..9ed95e98ee3e2 100644 --- a/base/loading.jl +++ b/base/loading.jl @@ -47,7 +47,7 @@ function require(name::String) path == nothing && error("$name not found") if myid() == 1 && toplevel_load - refs = { @spawnat p _require(path) for p in filter(x->x!=1, procs()) } + refs = Any[ @spawnat p _require(path) for p in filter(x->x!=1, procs()) ] _require(path) for r in refs; wait(r); end else @@ -77,7 +77,7 @@ function reload(name::String) path == nothing && error("$name not found") refs = nothing if myid() == 1 && toplevel_load - refs = { @spawnat p reload_path(path) for p in filter(x->x!=1, procs()) } + refs = Any[ @spawnat p reload_path(path) for p in filter(x->x!=1, procs()) ] end last = toplevel_load toplevel_load = false diff --git a/base/math.jl b/base/math.jl index 0df6fa18b805a..af02839e0216f 100644 --- a/base/math.jl +++ b/base/math.jl @@ -57,7 +57,7 @@ end macro evalpoly(z, p...) a = :($(esc(p[end]))) b = :($(esc(p[end-1]))) - as = {} + as = [] for i = length(p)-2:-1:1 ai = symbol(string("a", i)) push!(as, :($ai = $a)) diff --git a/base/multi.jl b/base/multi.jl index 3f25cc2546291..102feb3ff1562 100644 --- a/base/multi.jl +++ b/base/multi.jl @@ -93,7 +93,7 @@ type Worker config::Dict Worker(host::String, port::Integer, sock::TCPSocket, id::Int) = - new(bytestring(host), uint16(port), sock, IOBuffer(), {}, {}, id, false) + new(bytestring(host), uint16(port), sock, IOBuffer(), [], [], id, false) end Worker(host::String, port::Integer, sock::TCPSocket) = Worker(host, port, sock, 0) @@ -216,7 +216,7 @@ type ProcessGroup ProcessGroup(w::Array{Any,1}) = new("pg-default", w, Dict()) end -const PGRP = ProcessGroup({}) +const PGRP = ProcessGroup([]) get_bind_addr(pid::Integer) = get_bind_addr(worker_from_id(pid)) function get_bind_addr(w::Union(Worker, LocalProcess)) @@ -374,8 +374,8 @@ function deregister_worker(pg, pid) push!(map_del_wrkr, pid) # delete this worker from our RemoteRef client sets - ids = {} - tonotify = {} + ids = [] + tonotify = [] for (id,rv) in pg.refs if in(pid,rv.clientset) push!(ids, id) @@ -991,7 +991,7 @@ read_cb_response(host::String, port::Integer, config::Dict) = (nothing, host, po function start_cluster_workers(np::Integer, config::Dict, manager::ClusterManager, resp_arr::Array, launched_ntfy::Condition) # Get the cluster manager to launch the instance - instance_sets = {} + instance_sets = [] instances_ntfy = Condition() t = @schedule launch(manager, np, config, instance_sets, instances_ntfy) @@ -1117,7 +1117,7 @@ function launch(manager::LocalManager, np::Integer, config::Dict, resp_arr::Arra for i in 1:np io, pobj = open(detach(`$(dir)/$(exename) $exeflags --bind-to $(LPROC.bind_addr)`), "r") io_objs[i] = io - configs[i] = merge(config, {:process => pobj}) + configs[i] = merge(config, (Any=>Any)[:process => pobj]) end # ...and then read the host:port info. This optimizes overall start times. @@ -1207,11 +1207,11 @@ function launch_on_machine(manager::SSHManager, config::Dict, resp_arr::Array, m maxp = div(maxp,2) + 1 # Since the tunnel will also take up one ssh connection end - ios_to_check = {} + ios_to_check = [] t_check=time() while cnt > 0 - ios_to_check2 = {} + ios_to_check2 = [] for io in ios_to_check if nb_available(io) == 0 push!(ios_to_check2, io) @@ -1279,13 +1279,14 @@ function addprocs_internal(np::Integer; exename=(ccall(:jl_is_debugbuild,Cint,())==0?"./julia":"./julia-debug"), sshflags::Cmd=``, manager=LocalManager(), exeflags=``, max_parallel=10) - config={:dir=>dir, :exename=>exename, :exeflags=>`$exeflags --worker`, :tunnel=>tunnel, :sshflags=>sshflags, :max_parallel=>max_parallel} + config=(Any=>Any)[:dir=>dir, :exename=>exename, :exeflags=>`$exeflags --worker`, + :tunnel=>tunnel, :sshflags=>sshflags, :max_parallel=>max_parallel] disable_threaded_libs() ret = Array(Int, 0) rr_join = Array(RemoteRef, 0) - resp_arr = {} + resp_arr = [] c = Condition() t = @schedule start_cluster_workers(np, config, manager, resp_arr, c) @@ -1394,7 +1395,7 @@ end function pmap_static(f, lsts...) np = nprocs() n = length(lsts[1]) - { remotecall(PGRP.workers[(i-1)%np+1].id, f, map(L->L[i], lsts)...) for i = 1:n } + Any[ remotecall(PGRP.workers[(i-1)%np+1].id, f, map(L->L[i], lsts)...) for i = 1:n ] end pmap(f) = f() @@ -1410,7 +1411,7 @@ function pmap(f, lsts...; err_retry=true, err_stop=false) results = Dict{Int,Any}() - retryqueue = {} + retryqueue = [] task_in_err = false is_task_in_error() = task_in_err set_task_in_error() = (task_in_err = true) diff --git a/base/multidimensional.jl b/base/multidimensional.jl index 4a6f6c22276cf..a12554d20dc41 100644 --- a/base/multidimensional.jl +++ b/base/multidimensional.jl @@ -475,7 +475,7 @@ end ## permutedims -for (V, PT, BT) in {((:N,), BitArray, BitArray), ((:T,:N), Array, StridedArray)} +for (V, PT, BT) in [((:N,), BitArray, BitArray), ((:T,:N), Array, StridedArray)] @eval @ngenerate N typeof(P) function permutedims!{$(V...)}(P::$PT{$(V...)}, B::$BT{$(V...)}, perm) dimsB = size(B) length(perm) == N || error("expected permutation of size $N, but length(perm)=$(length(perm))") diff --git a/base/pkg/entry.jl b/base/pkg/entry.jl index 7482a9ef85ec2..bc4b01173ea0b 100644 --- a/base/pkg/entry.jl +++ b/base/pkg/entry.jl @@ -392,7 +392,7 @@ function resolve( isempty(changes) && return info("No packages to install, update or remove") # prefetch phase isolates network activity, nothing to roll back - missing = {} + missing = [] for (pkg,(ver1,ver2)) in changes vers = ASCIIString[] ver1 !== nothing && push!(vers,Git.head(dir=pkg)) @@ -410,7 +410,7 @@ function resolve( end # try applying changes, roll back everything if anything fails - changed = {} + changed = [] try for (pkg,(ver1,ver2)) in changes if ver1 === nothing diff --git a/base/pkg/generate.jl b/base/pkg/generate.jl index 56f1047755894..a295b6f937cfb 100644 --- a/base/pkg/generate.jl +++ b/base/pkg/generate.jl @@ -34,7 +34,7 @@ function package( authors::Union(String,Array) = "", years::Union(Int,String) = copyright_year(), user::String = github_user(), - config::Dict = {}, + config::Dict = Dict(), ) isnew = !ispath(pkg) try diff --git a/base/pkg/github.jl b/base/pkg/github.jl index cc32239a366f2..e2c9a7902c8e1 100644 --- a/base/pkg/github.jl +++ b/base/pkg/github.jl @@ -3,11 +3,11 @@ module GitHub import Main, ..Git, ..Dir const AUTH_NOTE = "Julia Package Manager" -const AUTH_DATA = { +const AUTH_DATA = (Any=>Any)[ "scopes" => ["repo"], "note" => AUTH_NOTE, "note_url" => "http://docs.julialang.org/en/latest/manual/packages/", -} +] function user() if !success(`git config --global github.user`) diff --git a/base/printf.jl b/base/printf.jl index 9d717deeb9238..80be8ff8bcdd2 100644 --- a/base/printf.jl +++ b/base/printf.jl @@ -7,7 +7,7 @@ const SmallFloatingPoint = Union(Float64,Float32,Float16) const SmallNumber = Union(SmallFloatingPoint,Base.Signed64,Base.Unsigned64,Uint128,Int128) function gen(s::String) - args = {} + args = [] blk = Expr(:block, :(local neg, pt, len, exp, do_out, args)) for x in parse(s) if isa(x,String) @@ -34,7 +34,7 @@ end function parse(s::String) # parse format string in to stings and format tuples - list = {} + list = [] i = j = start(s) while !done(s,j) c, k = next(s,j) diff --git a/base/process.jl b/base/process.jl index 28cb13e1ceb6a..17370b8a9a288 100644 --- a/base/process.jl +++ b/base/process.jl @@ -206,9 +206,8 @@ function _jl_spawn(cmd::Ptr{Uint8}, argv::Ptr{Ptr{Uint8}}, loop::Ptr{Void}, pp:: proc = c_malloc(_sizeof_uv_process) error = ccall(:jl_spawn, Int32, (Ptr{Uint8}, Ptr{Ptr{Uint8}}, Ptr{Void}, Ptr{Void}, Any, Int32, - Ptr{Void}, Int32, Ptr{Void}, Int32, Ptr{Void}, - Int32, Ptr{Ptr{Uint8}}, Ptr{Uint8}), - cmd, argv, loop, proc, pp, uvtype(in), + Ptr{Void}, Int32, Ptr{Void}, Int32, Ptr{Void}, Int32, Ptr{Ptr{Uint8}}, Ptr{Uint8}), + cmd, argv, loop, proc, pp, uvtype(in), uvhandle(in), uvtype(out), uvhandle(out), uvtype(err), uvhandle(err), pp.cmd.detach, pp.cmd.env === nothing ? C_NULL : pp.cmd.env, isempty(pp.cmd.dir) ? C_NULL : pp.cmd.dir) if error != 0 diff --git a/base/reflection.jl b/base/reflection.jl index 2317722a480ed..d3aef01b41008 100644 --- a/base/reflection.jl +++ b/base/reflection.jl @@ -84,7 +84,7 @@ end subtypes(m::Module, x::DataType) = sort(collect(_subtypes(m, x)), by=string) subtypes(x::DataType) = subtypes(Main, x) -subtypetree(x::DataType, level=-1) = (level == 0 ? (x, {}) : (x, {subtypetree(y, level-1) for y in subtypes(x)})) +subtypetree(x::DataType, level=-1) = (level == 0 ? (x, []) : (x, Any[subtypetree(y, level-1) for y in subtypes(x)])) # function reflection isgeneric(f::ANY) = (isa(f,Function)||isa(f,DataType)) && isa(f.env,MethodTable) @@ -93,7 +93,7 @@ function_name(f::Function) = isgeneric(f) ? f.env.name : (:anonymous) code_lowered(f::Callable,t::(Type...)) = map(m->uncompressed_ast(m.func.code), methods(f,t)) methods(f::ANY,t::ANY) = Any[m[3] for m in _methods(f,t,-1)] -_methods(f::ANY,t::ANY,lim) = _methods(f,{(t::Tuple)...},length(t::Tuple),lim,{}) +_methods(f::ANY,t::ANY,lim) = _methods(f, Any[(t::Tuple)...], length(t::Tuple), lim, []) function _methods(f::ANY,t::Array,i,lim::Integer,matching::Array{Any,1}) if i == 0 new = ccall(:jl_matching_methods, Any, (Any,Any,Int32), f, tuple(t...), lim) diff --git a/base/replutil.jl b/base/replutil.jl index 4fbdcbc0c6242..b41e556ff86c8 100644 --- a/base/replutil.jl +++ b/base/replutil.jl @@ -75,7 +75,7 @@ function showerror(io::IO, e, bt) end end -showerror(io::IO, e::LoadError) = showerror(io, e, {}) +showerror(io::IO, e::LoadError) = showerror(io, e, []) function showerror(io::IO, e::LoadError, bt) showerror(io, e.error, bt) print(io, "\nwhile loading $(e.file), in expression starting on line $(e.line)") @@ -132,7 +132,7 @@ function showerror(io::IO, e::MethodError) end end # Check for row vectors used where a column vector is intended. - vec_args = {} + vec_args = [] hasrows = false for arg in e.args isrow = isa(arg,AbstractArray) && ndims(arg)==2 && size(arg,1)==1 diff --git a/base/serialize.jl b/base/serialize.jl index 76e029b9bf8ce..b8b3bf1a35cd9 100644 --- a/base/serialize.jl +++ b/base/serialize.jl @@ -11,7 +11,8 @@ const ser_tag = ObjectIdDict() const deser_tag = ObjectIdDict() let i = 2 global ser_tag, deser_tag - for t = {Symbol, Int8, Uint8, Int16, Uint16, Int32, Uint32, + for t = Any[ + Symbol, Int8, Uint8, Int16, Uint16, Int32, Uint32, Int64, Uint64, Int128, Uint128, Float32, Float64, Char, Ptr, DataType, UnionType, Function, Tuple, Array, Expr, LongSymbol, LongTuple, LongExpr, @@ -35,7 +36,7 @@ let i = 2 :reserved17, :reserved18, :reserved19, :reserved20, false, true, nothing, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, - 28, 29, 30, 31, 32} + 28, 29, 30, 31, 32] ser_tag[t] = int32(i) deser_tag[int32(i)] = t i += 1 @@ -241,7 +242,7 @@ function serialize(s, linfo::LambdaStaticData) if isdefined(linfo.def, :roots) serialize(s, linfo.def.roots) else - serialize(s, {}) + serialize(s, []) end serialize(s, linfo.sparams) serialize(s, linfo.inferred) @@ -482,7 +483,7 @@ function deserialize_expr(s, len) hd = deserialize(s)::Symbol ty = deserialize(s) e = Expr(hd) - e.args = { deserialize(s) for i=1:len } + e.args = Any[ deserialize(s) for i=1:len ] e.typ = ty e end @@ -553,7 +554,7 @@ function deserialize(s, t::DataType) f3 = deserialize(s) return ccall(:jl_new_struct, Any, (Any,Any...), t, f1, f2, f3) else - flds = { deserialize(s) for i = 1:nf } + flds = Any[ deserialize(s) for i = 1:nf ] return ccall(:jl_new_structv, Any, (Any,Ptr{Void},Uint32), t, flds, nf) end diff --git a/base/sharedarray.jl b/base/sharedarray.jl index d3433a3167e7d..74139edc0bba5 100644 --- a/base/sharedarray.jl +++ b/base/sharedarray.jl @@ -273,7 +273,7 @@ map(f::Callable, S::SharedArray) = (S2 = similar(S); S2[:] = S[:]; map!(f, S2); reduce(f::Function, S::SharedArray) = mapreduce(fetch, f, - { @spawnat p reduce(f, S.loc_subarr_1d) for p in procs(S) }) + Any[ @spawnat p reduce(f, S.loc_subarr_1d) for p in procs(S) ]) function map!(f::Callable, S::SharedArray) diff --git a/base/show.jl b/base/show.jl index 6673ec25c504e..2c0de40c9b727 100644 --- a/base/show.jl +++ b/base/show.jl @@ -300,19 +300,19 @@ function show_block(io::IO, head, args::Vector, body, indent::Int) show_list(io, args, ", ", indent) ind = is(head, :module) || is(head, :baremodule) ? indent : indent + indent_width - exs = (is_expr(body, :block) || is_expr(body, :body)) ? body.args : {body} + exs = (is_expr(body, :block) || is_expr(body, :body)) ? body.args : Any[body] for ex in exs if !is_linenumber(ex); print(io, '\n', " "^ind); end show_unquoted(io, ex, ind) end print(io, '\n', " "^indent) end -show_block(io::IO,head, block,i::Int) = show_block(io,head,{}, block,i) +show_block(io::IO,head, block,i::Int) = show_block(io,head, [], block,i) function show_block(io::IO, head, arg, block, i::Int) if is_expr(arg, :block) show_block(io, head, arg.args, block, i) else - show_block(io, head, {arg}, block, i) + show_block(io, head, Any[arg], block, i) end end @@ -849,7 +849,7 @@ function alignment( rows::AbstractVector, cols::AbstractVector, cols_if_complete::Integer, cols_otherwise::Integer, sep::Integer ) - a = {} + a = [] for j in cols l = r = 0 for i in rows diff --git a/base/sort.jl b/base/sort.jl index deff7d69ac7a8..7431ab0d04c29 100644 --- a/base/sort.jl +++ b/base/sort.jl @@ -212,7 +212,7 @@ end searchsorted{T<:Real}(a::Range{T}, x::Real, o::DirectOrdering) = searchsortedfirst(a,x,o):searchsortedlast(a,x,o) -for s in {:searchsortedfirst, :searchsortedlast, :searchsorted} +for s in [:searchsortedfirst, :searchsortedlast, :searchsorted] @eval begin $s(v::AbstractVector, x, o::Ordering) = $s(v,x,1,length(v),o) $s(v::AbstractVector, x; diff --git a/base/stat.jl b/base/stat.jl index 122393f153333..06ed6157d1145 100644 --- a/base/stat.jl +++ b/base/stat.jl @@ -81,7 +81,7 @@ operm(st::StatStruct) = uint8(st.mode ) & 0x7 # mode predicate methods for file names -for f in { +for f in Symbol[ :ispath :isfifo :ischardev @@ -99,7 +99,7 @@ for f in { :uperm :gperm :operm -} +] @eval ($f)(path...) = ($f)(stat(path...)) end diff --git a/base/string.jl b/base/string.jl index 3139307e35c85..854d2e5dad970 100644 --- a/base/string.jl +++ b/base/string.jl @@ -1018,7 +1018,7 @@ function unindent(s::String, indent::Int) end function triplequoted(args...) - sx = { isa(arg,ByteString) ? arg : esc(arg) for arg in args } + sx = Any[ isa(arg,ByteString) ? arg : esc(arg) for arg in args ] indent = 0 rlines = split(RevString(sx[end]), '\n'; limit=2) @@ -1067,13 +1067,13 @@ macro mstr(s...); triplequoted(s...); end function shell_parse(raw::String, interp::Bool) s = strip(raw) last_parse = 0:-1 - isempty(s) && return interp ? (Expr(:tuple,:()),last_parse) : ({},last_parse) + isempty(s) && return interp ? (Expr(:tuple,:()),last_parse) : ([],last_parse) in_single_quotes = false in_double_quotes = false - args = {} - arg = {} + args = [] + arg = [] i = start(s) j = i @@ -1083,9 +1083,9 @@ function shell_parse(raw::String, interp::Bool) end end function append_arg() - if isempty(arg); arg = {"",}; end + if isempty(arg); arg = Any["",]; end push!(args, arg) - arg = {} + arg = [] end while !done(s,j) diff --git a/base/task.jl b/base/task.jl index f486b762939cc..0e5c84a987ad9 100644 --- a/base/task.jl +++ b/base/task.jl @@ -181,7 +181,7 @@ isempty(::Task) = error("isempty not defined for Tasks") type Condition waitq::Vector{Any} - Condition() = new({}) + Condition() = new([]) end function wait(c::Condition) @@ -298,7 +298,7 @@ end ## dynamically-scoped waiting for multiple items -sync_begin() = task_local_storage(:SPAWNS, ({}, get(task_local_storage(), :SPAWNS, ()))) +sync_begin() = task_local_storage(:SPAWNS, ([], get(task_local_storage(), :SPAWNS, ()))) function sync_end() spawns = get(task_local_storage(), :SPAWNS, ()) diff --git a/base/test.jl b/base/test.jl index 08e69b42f85e9..70e28bb59adeb 100644 --- a/base/test.jl +++ b/base/test.jl @@ -36,7 +36,7 @@ with_handler(f::Function, handler) = import Base.showerror -showerror(io::IO, r::Error) = showerror(io, r, {}) +showerror(io::IO, r::Error) = showerror(io, r, []) function showerror(io::IO, r::Error, bt) println(io, "test error in expression: $(r.expr)") showerror(io, r.err, r.backtrace) diff --git a/examples/preduce.jl b/examples/preduce.jl index f0d4cbd45a4d1..0479f3c0b5f30 100644 --- a/examples/preduce.jl +++ b/examples/preduce.jl @@ -4,7 +4,7 @@ importall Base # sum a vector using a tree on top of local reductions. function sum(v::DArray) P = procs(v) - nodeval = { RemoteRef(p) for p=P } + nodeval = [RemoteRef(p) for p=P] answer = RemoteRef() np = numel(P) @@ -31,7 +31,7 @@ end function reduce(f, v::DArray) mapreduce(fetch, f, - { @spawnat p reduce(f,localpart(v)) for p = procs(v) }) + [ @spawnat p reduce(f,localpart(v)) for p = procs(v) ]) end # possibly-useful abstraction: diff --git a/examples/staged.jl b/examples/staged.jl index a2325378c32e7..51aee8a1cc310 100644 --- a/examples/staged.jl +++ b/examples/staged.jl @@ -1,5 +1,5 @@ function add_method(gf, an, at, body) - argexs = { Expr(symbol("::"), an[i], at[i]) for i=1:length(an) } + argexs = [Expr(symbol("::"), an[i], at[i]) for i=1:length(an)] def = quote let __F__=($gf) function __F__($(argexs...)) @@ -32,7 +32,7 @@ macro staged(fdef) ($argtypes) = typeof(tuple($(argnames...))) if !method_exists($gengf, $argtypes) ($genbody) = apply(($expander), ($argtypes)) - add_method($gengf, {$(qargnames...)}, + add_method($gengf, Any[$(qargnames...)], $argtypes, $genbody) end return ($gengf)($(argnames...)) diff --git a/examples/wordcount.jl b/examples/wordcount.jl index b4912e227d39e..968e7d37d0c5e 100644 --- a/examples/wordcount.jl +++ b/examples/wordcount.jl @@ -46,8 +46,8 @@ function parallel_wordcount(text) lines=split(text,'\n',false) np=nprocs() unitsize=ceil(length(lines)/np) - wcounts={} - rrefs={} + wcounts=[] + rrefs=[] # spawn procs for i=1:np first=unitsize*(i-1)+1 diff --git a/test/arrayops.jl b/test/arrayops.jl index 0d1116a70239b..3aefceb4c3cb2 100644 --- a/test/arrayops.jl +++ b/test/arrayops.jl @@ -224,7 +224,7 @@ let end ## arrays as dequeues -l = {1} +l = Any[1] push!(l,2,3,8) @test l[1]==1 && l[2]==2 && l[3]==3 && l[4]==8 v = pop!(l) @@ -349,7 +349,7 @@ p = permutedims(s, [2,1]) ## ipermutedims ## -tensors = {rand(1,2,3,4),rand(2,2,2,2),rand(5,6,5,6),rand(1,1,1,1)} +tensors = Any[rand(1,2,3,4),rand(2,2,2,2),rand(5,6,5,6),rand(1,1,1,1)] for i = tensors perm = randperm(4) @test isequal(i,ipermutedims(permutedims(i,perm),perm)) @@ -545,7 +545,7 @@ begin @test R[8, 8, 8] == 8 A = rand(4,4) - for s in {A[1:2:4, 1:2:4], sub(A, 1:2:4, 1:2:4)} + for s in Any[A[1:2:4, 1:2:4], sub(A, 1:2:4, 1:2:4)] c = cumsum(s, 1) @test c[1,1] == A[1,1] @test c[2,1] == A[1,1]+A[3,1] @@ -771,9 +771,9 @@ rt = Base.return_types(fill!, (Array{Int32, 3}, Uint8)) @test length(rt) == 1 && rt[1] == Array{Int32, 3} # splice! -for idx in {1, 2, 5, 9, 10, 1:0, 2:1, 1:1, 2:2, 1:2, 2:4, 9:8, 10:9, 9:9, 10:10, - 8:9, 9:10, 6:9, 7:10} - for repl in {[], [11], [11,22], [11,22,33,44,55]} +for idx in Any[1, 2, 5, 9, 10, 1:0, 2:1, 1:1, 2:2, 1:2, 2:4, 9:8, 10:9, 9:9, 10:10, + 8:9, 9:10, 6:9, 7:10] + for repl in Any[[], [11], [11,22], [11,22,33,44,55]] a = [1:10]; acopy = copy(a) @test splice!(a, idx, repl) == acopy[idx] @test a == [acopy[1:(first(idx)-1)], repl, acopy[(last(idx)+1):end]] @@ -781,8 +781,8 @@ for idx in {1, 2, 5, 9, 10, 1:0, 2:1, 1:1, 2:2, 1:2, 2:4, 9:8, 10:9, 9:9, 10:10, end # deleteat! -for idx in {1, 2, 5, 9, 10, 1:0, 2:1, 1:1, 2:2, 1:2, 2:4, 9:8, 10:9, 9:9, 10:10, - 8:9, 9:10, 6:9, 7:10} +for idx in Any[1, 2, 5, 9, 10, 1:0, 2:1, 1:1, 2:2, 1:2, 2:4, 9:8, 10:9, 9:9, 10:10, + 8:9, 9:10, 6:9, 7:10] a = [1:10]; acopy = copy(a) @test deleteat!(a, idx) == [acopy[1:(first(idx)-1)], acopy[(last(idx)+1):end]] end @@ -864,14 +864,14 @@ Nmax = 3 # TODO: go up to CARTESIAN_DIMS+2 (currently this exposes problems) for N = 1:Nmax #indexing with (Range1, Range1, Range1) args = ntuple(N, d->Range1{Int}) - @test Base.return_types(getindex, tuple(Array{Float32, N}, args...)) == {Array{Float32, N}} - @test Base.return_types(getindex, tuple(BitArray{N}, args...)) == {BitArray{N}} - @test Base.return_types(setindex!, tuple(Array{Float32, N}, Array{Int, 1}, args...)) == {Array{Float32, N}} + @test Base.return_types(getindex, tuple(Array{Float32, N}, args...)) == [Array{Float32, N}] + @test Base.return_types(getindex, tuple(BitArray{N}, args...)) == Any[BitArray{N}] + @test Base.return_types(setindex!, tuple(Array{Float32, N}, Array{Int, 1}, args...)) == [Array{Float32, N}] # Indexing with (Range1, Range1, Float64) args = ntuple(N, d->d 1 && @test Base.return_types(getindex, tuple(Array{Float32, N}, args...)) == {Array{Float32, N-1}} - N > 1 && @test Base.return_types(getindex, tuple(BitArray{N}, args...)) == {BitArray{N-1}} - N > 1 && @test Base.return_types(setindex!, tuple(Array{Float32, N}, Array{Int, 1}, args...)) == {Array{Float32, N}} + N > 1 && @test Base.return_types(getindex, tuple(Array{Float32, N}, args...)) == [Array{Float32, N-1}] + N > 1 && @test Base.return_types(getindex, tuple(BitArray{N}, args...)) == [BitArray{N-1}] + N > 1 && @test Base.return_types(setindex!, tuple(Array{Float32, N}, Array{Int, 1}, args...)) == [Array{Float32, N}] end # issue #6645 (32-bit) @@ -885,7 +885,7 @@ end @test size([]') == (1,0) # issue #6996 -@test { 1 2; 3 4 }' == { 1 2; 3 4 }.' +@test Any[ 1 2; 3 4 ]' == Any[ 1 2; 3 4 ].' # map with promotion (issue #6541) @test map(join, ["z", "я"]) == ["z", "я"] diff --git a/test/bitarray.jl b/test/bitarray.jl index 6795a0b031b9c..1b3d8e1b2194c 100644 --- a/test/bitarray.jl +++ b/test/bitarray.jl @@ -651,10 +651,10 @@ cf1 = complex(f1) @check_bit_operation (.-)(u1, b2) Matrix{Uint8} @check_bit_operation (.*)(u1, b2) Matrix{Uint8} -for (x1,t1) = {(f1, Float64), - (ci1, Complex{Int}), - (cu1, Complex{Uint8}), - (cf1, Complex128)} +for (x1,t1) = [(f1, Float64), + (ci1, Complex{Int}), + (cu1, Complex{Uint8}), + (cf1, Complex128)] @check_bit_operation (.+)(x1, b2) Matrix{t1} @check_bit_operation (.-)(x1, b2) Matrix{t1} @check_bit_operation (.*)(x1, b2) Matrix{t1} @@ -837,7 +837,7 @@ timesofar("datamove") ## countnz & find ## -for m = 0:v1, b1 in {randbool(m), trues(m), falses(m)} +for m = 0:v1, b1 in Any[randbool(m), trues(m), falses(m)] @check_bit_operation countnz(b1) Int @check_bit_operation findfirst(b1) Int diff --git a/test/blas.jl b/test/blas.jl index db0438ccf2d2f..ee014fab4d434 100644 --- a/test/blas.jl +++ b/test/blas.jl @@ -1,6 +1,6 @@ import Base.LinAlg ## BLAS tests - testing the interface code to BLAS routines -for elty in (Float32, Float64, Complex64, Complex128) +for elty in [Float32, Float64, Complex64, Complex128] o4 = ones(elty, 4) z4 = zeros(elty, 4) diff --git a/test/collections.jl b/test/collections.jl index e88475b03c3b9..e9bd48608579b 100644 --- a/test/collections.jl +++ b/test/collections.jl @@ -36,7 +36,7 @@ end for i=10000:20000 @test h[i]==i+1 end -h = {"a" => 3} +h = (Any=>Any)["a" => 3] @test h["a"] == 3 h["a","b"] = 4 @test h["a","b"] == h[("a","b")] == 4 @@ -54,7 +54,7 @@ let @test get_KeyError end -_d = {"a"=>0} +_d = (Any=>Any)["a"=>0] @test isa([k for k in filter(x->length(x)==1, collect(keys(_d)))], Vector{Any}) # issue #1821 @@ -100,10 +100,10 @@ begin end @test isequal(Dict(), Dict()) -@test isequal({1 => 1}, {1 => 1}) -@test !isequal({1 => 1}, {}) -@test !isequal({1 => 1}, {1 => 2}) -@test !isequal({1 => 1}, {2 => 1}) +@test isequal((Any=>Any)[1 => 1], (Any=>Any)[1 => 1]) +@test !isequal((Any=>Any)[1 => 1], Dict()) +@test !isequal((Any=>Any)[1 => 1], (Any=>Any)[1 => 2]) +@test !isequal((Any=>Any)[1 => 1], (Any=>Any)[2 => 1]) # Generate some data to populate dicts to be compared data_in = [ (rand(1:1000), randstring(2)) for _ in 1:1001 ] @@ -144,14 +144,12 @@ d4[1001] = randstring(3) # Here is what currently happens when dictionaries of different types # are compared. This is not necessarily desirable. These tests are # descriptive rather than proscriptive. -@test !isequal({1 => 2}, {"dog" => "bone"}) +@test !isequal((Any=>Any)[1 => 2], (Any=>Any)["dog" => "bone"]) @test isequal(Dict{Int, Int}(), Dict{String, String}()) # get! (get with default values assigned to the given location) -let f(x) = x^2, - d = {8=>19}, - def = {} +let f(x) = x^2, d = (Any=>Any)[8=>19] @test get!(d, 8, 5) == 19 @test get!(d, 19, 2) == 2 @@ -168,7 +166,7 @@ let f(x) = x^2, f(4) end == 16 - @test d == {8=>19, 19=>2, 42=>4} + @test d == (Any=>Any)[8=>19, 19=>2, 42=>4] end # show @@ -206,9 +204,8 @@ end # issue #2540 -d = {x => 1 - for x in ['a', 'b', 'c']} -@test d == {'a'=>1, 'b'=>1, 'c'=> 1} +d = (Any=>Any)[x => 1 for x in ['a', 'b', 'c']] +@test d == (Any=>Any)['a'=>1, 'b'=>1, 'c'=> 1] # issue #2629 d = (String => String)[ a => "foo" for a in ["a","b","c"]] @@ -234,7 +231,7 @@ end @test isempty(Set()) @test !isempty(Set([1])) @test !isempty(Set(["banana", "apple"])) -@test !isempty(Set({1, 1:10, "pear"})) +@test !isempty(Set([1, 1:10, "pear"])) # ordering @test Set() < Set([1]) @@ -284,7 +281,7 @@ data_out = collect(s) @test is(typeof(Set{Int}([3])), Set{Int}) # eltype -@test is(eltype(Set({1,"hello"})), Any) +@test is(eltype(Set([1,"hello"])), Any) @test is(eltype(Set{String}()), String) # no duplicates @@ -437,8 +434,8 @@ s3 = Set{ASCIIString}(["baz"]) # isequal @test isequal(Set(), Set()) @test !isequal(Set(), Set(1)) -@test isequal(Set{Any}({1,2}), Set{Int}([1,2])) -@test !isequal(Set{Any}({1,2}), Set{Int}([1,2,3])) +@test isequal(Set{Any}(Any[1,2]), Set{Int}([1,2])) +@test !isequal(Set{Any}(Any[1,2]), Set{Int}([1,2,3])) # Comparison of unrelated types seems rather inconsistent diff --git a/test/combinatorics.jl b/test/combinatorics.jl index 8846e8eb6c848..e5ab41021043c 100644 --- a/test/combinatorics.jl +++ b/test/combinatorics.jl @@ -10,17 +10,18 @@ a = randcycle(10) @test ipermute!(permute!([1:10], a),a) == [1:10] @test collect(combinations("abc",2)) == ["ab","ac","bc"] @test collect(permutations("abc")) == ["abc","acb","bac","bca","cab","cba"] -@test collect(filter(x->(iseven(x[1])),permutations([1,2,3]))) == {[2,1,3],[2,3,1]} -@test collect(filter(x->(iseven(x[3])),permutations([1,2,3]))) == {[1,3,2],[3,1,2]} -@test collect(filter(x->(iseven(x[1])),combinations([1,2,3],2))) == {[2,3]} -@test collect(partitions(4)) == {[4], [3,1], [2,2], [2,1,1], [1,1,1,1]} -@test collect(partitions(8,3)) == {[6,1,1], [5,2,1], [4,3,1], [4,2,2], [3,3,2]} -@test collect(partitions(8, 1)) == {[8]} -@test collect(partitions(8, 9)) == {} -@test collect(partitions([1,2,3])) == {{[1,2,3]}, {[1,2],[3]}, {[1,3],[2]}, {[1],[2,3]}, {[1],[2],[3]}} -@test collect(partitions([1,2,3,4],3)) == {{[1,2],[3],[4]}, {[1,3],[2],[4]}, {[1],[2,3],[4]}, {[1,4],[2],[3]}, {[1],[2,4],[3]},{[1],[2],[3,4]}} -@test collect(partitions([1,2,3,4],1)) == {{[1, 2, 3, 4]}} -@test collect(partitions([1,2,3,4],5)) == {} +@test collect(filter(x->(iseven(x[1])),permutations([1,2,3]))) == Any[[2,1,3],[2,3,1]] +@test collect(filter(x->(iseven(x[3])),permutations([1,2,3]))) == Any[[1,3,2],[3,1,2]] +@test collect(filter(x->(iseven(x[1])),combinations([1,2,3],2))) == Any[[2,3]] +@test collect(partitions(4)) == Any[[4], [3,1], [2,2], [2,1,1], [1,1,1,1]] +@test collect(partitions(8,3)) == Any[[6,1,1], [5,2,1], [4,3,1], [4,2,2], [3,3,2]] +@test collect(partitions(8, 1)) == Any[[8]] +@test collect(partitions(8, 9)) == [] +@test collect(partitions([1,2,3])) == Any[Any[[1,2,3]], Any[[1,2],[3]], Any[[1,3],[2]], Any[[1],[2,3]], Any[[1],[2],[3]]] +@test collect(partitions([1,2,3,4],3)) == Any[Any[[1,2],[3],[4]], Any[[1,3],[2],[4]], Any[[1],[2,3],[4]], + Any[[1,4],[2],[3]], Any[[1],[2,4],[3]], Any[[1],[2],[3,4]]] +@test collect(partitions([1,2,3,4],1)) == Any[Any[[1, 2, 3, 4]]] +@test collect(partitions([1,2,3,4],5)) == [] @test length(collect(partitions(30))) == length(partitions(30)) @test length(collect(partitions(90,4))) == length(partitions(90,4)) diff --git a/test/core.jl b/test/core.jl index b3c1f61bfd615..8fb58a4fc3c9a 100644 --- a/test/core.jl +++ b/test/core.jl @@ -466,7 +466,7 @@ begin function mytype(vec) convert(Vector{(ASCIIString, DataType)}, vec) end - some_data = {("a", Int32), ("b", Int32)} + some_data = Any[("a", Int32), ("b", Int32)] @test isa(mytype(some_data),Vector{(ASCIIString, DataType)}) end @@ -558,8 +558,8 @@ function test7307(a, ret) end return a end -@test test7307({}, true) == {"inner","outer"} -@test test7307({}, false) == {"inner","outer"} +@test test7307([], true) == ["inner","outer"] +@test test7307([], false) == ["inner","outer"] # issue #8277 function test8277(a) @@ -575,7 +575,7 @@ function test8277(a) end end end -let a = {} +let a = [] test8277(a) @test length(a) == 1 end @@ -867,7 +867,10 @@ end # issue #2098 let - i2098() = (c={2.0};[1:1:c[1]]) + i2098() = begin + c = Any[2.0] + [1:1:c[1]] + end @test isequal(i2098(), [1.0,2.0]) end @@ -1001,7 +1004,7 @@ end function f3471(y) convert(Array{typeof(y[1]),1}, y) end -@test isa(f3471({1.0,2.0}), Vector{Float64}) +@test isa(f3471(Any[1.0,2.0]), Vector{Float64}) # issue #3729 typealias A3729{B} Vector{Vector{B}} @@ -1106,7 +1109,7 @@ type MyType4154{T} a2 end -foo4154(x) = MyType4154(x, {}) +foo4154(x) = MyType4154(x, []) h4154() = typeof(foo4154(rand(2,2,2))) g4154() = typeof(foo4154(rand(2,2,2,2,2,2,2,2,2))) @@ -1381,14 +1384,14 @@ cnvt{S, T, N}(::Type{Array{S, N}}, x::Array{T, N}) = convert(Array{S}, x) function tighttypes!(adf) T = Bottom - tt = {Int} + tt = Any[Int] for t in tt T = typejoin(T, t) end cnvt(Vector{T}, adf[1]) end -@test isequal(tighttypes!({Any[1.0,2.0]}), [1,2]) +@test isequal(tighttypes!(Any[Any[1.0,2.0],]), [1,2]) # issue #5142 bitstype 64 Int5142 @@ -1521,7 +1524,7 @@ for (str, tag) in ["" => :none, "\"" => :string, "#=" => :comment, "'" => :char, "let;" => :block, "for i=1;" => :block, "function f();" => :block, "f() do x;" => :block, "module X;" => :block, "type X;" => :block, "immutable X;" => :block, "(" => :other, "[" => :other, - "{" => :other, "begin" => :other, "quote" => :other, + "begin" => :other, "quote" => :other, "let" => :other, "for" => :other, "function" => :other, "f() do" => :other, "module" => :other, "type" => :other, "immutable" => :other] @@ -1534,7 +1537,7 @@ macro m6031(x); x; end @test (@m6031 [2,4,6])[2] == 4 # issue #6050 -@test Base.getfield_tfunc({nothing,QuoteNode(:vals)}, +@test Base.getfield_tfunc([nothing, QuoteNode(:vals)], Dict{Int64,(Range1{Int64},Range1{Int64})}, :vals) == Array{(Range1{Int64},Range1{Int64}),1} @@ -1795,12 +1798,12 @@ end # issue #5154 let - v = {} + v = [] for i=1:3, j=1:3 push!(v, (i, j)) i == 1 && j == 2 && break end - @test v == {(1,1), (1,2)} + @test v == Any[(1,1), (1,2)] end # addition of ¬ (\neg) parsing @@ -1825,7 +1828,7 @@ i7652() @test a7652.a == 3 # issue #7679 -@test map(f->f(), { ()->i for i=1:3 }) == {1,2,3} +@test map(f->f(), Any[ ()->i for i=1:3 ]) == Any[1,2,3] # issue #7810 type Foo7810{T<:AbstractVector} diff --git a/test/dates/ranges.jl b/test/dates/ranges.jl index cd23202d7e97f..5366d8acfec56 100644 --- a/test/dates/ranges.jl +++ b/test/dates/ranges.jl @@ -249,8 +249,8 @@ dr18 = typemax(Dates.DateTime):Dates.Month(-100000):typemin(Dates.DateTime) dr19 = typemax(Dates.DateTime):Dates.Year(-1000000):typemin(Dates.DateTime) dr20 = typemin(Dates.DateTime):Dates.Day(2):typemax(Dates.DateTime) -drs = {dr,dr1,dr2,dr3,dr4,dr5,dr6,dr7,dr8,dr9,dr10, - dr11,dr12,dr13,dr14,dr15,dr16,dr17,dr18,dr19,dr20} +drs = Any[dr,dr1,dr2,dr3,dr4,dr5,dr6,dr7,dr8,dr9,dr10, + dr11,dr12,dr13,dr14,dr15,dr16,dr17,dr18,dr19,dr20] drs2 = map(x->Dates.Date(first(x)):step(x):Dates.Date(last(x)),drs) @test map(length,drs) == map(x->size(x)[1],drs) @@ -330,8 +330,8 @@ dr18 = typemax(Dates.Date):Dates.Month(-100000):typemin(Dates.Date) dr19 = typemax(Dates.Date):Dates.Year(-1000000):typemin(Dates.Date) dr20 = typemin(Dates.Date):Dates.Day(2):typemax(Dates.Date) -drs = {dr,dr1,dr2,dr3,dr4,dr5,dr6,dr7,dr8,dr9,dr10, - dr11,dr12,dr13,dr14,dr15,dr16,dr17,dr18,dr19,dr20} +drs = Any[dr,dr1,dr2,dr3,dr4,dr5,dr6,dr7,dr8,dr9,dr10, + dr11,dr12,dr13,dr14,dr15,dr16,dr17,dr18,dr19,dr20] @test map(length,drs) == map(x->size(x)[1],drs) @test all(map(x->findin(x,x)==[1:length(x)],drs[1:4])) @@ -490,4 +490,4 @@ testmonthranges2(100000) # Issue 5 lastdaysofmonth = [Dates.Date(2014,i,Dates.daysinmonth(2014,i)) for i=1:12] -@test [Date(2014,1,31):Dates.Month(1):Date(2015)] == lastdaysofmonth \ No newline at end of file +@test [Date(2014,1,31):Dates.Month(1):Date(2015)] == lastdaysofmonth diff --git a/test/functional.jl b/test/functional.jl index 4afe89609bce9..dc2110605b106 100644 --- a/test/functional.jl +++ b/test/functional.jl @@ -34,22 +34,22 @@ end # zip and filter iterators # issue #4718 -@test collect(filter(x->x[1], zip([true, false, true, false],"abcd"))) == {(true,'a'),(true,'c')} +@test collect(filter(x->x[1], zip([true, false, true, false],"abcd"))) == [(true,'a'),(true,'c')] # enumerate (issue #6284) -let b = IOBuffer("1\n2\n3\n"), a = {} +let b = IOBuffer("1\n2\n3\n"), a = [] for (i,x) in enumerate(eachline(b)) push!(a, (i,x)) end - @test a == {(1,"1\n"),(2,"2\n"),(3,"3\n")} + @test a == [(1,"1\n"),(2,"2\n"),(3,"3\n")] end # zip eachline (issue #7369) let zeb = IOBuffer("1\n2\n3\n4\n5\n"), letters = ['a', 'b', 'c', 'd', 'e'], - res = {} + res = [] for (number, letter) in zip(eachline(zeb), letters) push!(res, (int(strip(number)), letter)) end - @test res == {(1, 'a'), (2, 'b'), (3, 'c'), (4, 'd'), (5, 'e')} + @test res == [(1, 'a'), (2, 'b'), (3, 'c'), (4, 'd'), (5, 'e')] end diff --git a/test/hashing.jl b/test/hashing.jl index 6bb0f1bff3ad7..9d93a0de84a32 100644 --- a/test/hashing.jl +++ b/test/hashing.jl @@ -1,9 +1,9 @@ -types = { +types = Any[ Bool, Char, Int8, Uint8, Int16, Uint16, Int32, Uint32, Int64, Uint64, Float32, Float64, Rational{Int8}, Rational{Uint8}, Rational{Int16}, Rational{Uint16}, Rational{Int32}, Rational{Uint32}, Rational{Int64}, Rational{Uint64} -} +] vals = [ typemin(Int64), -int64(maxintfloat(Float64))+Int64[-4:1], @@ -49,17 +49,19 @@ for T=types, S=types, x=vals end # hashing collections (e.g. issue #6870) -vals = {[1,2,3,4], [1 3;2 4], {1,2,3,4}, [1,3,2,4], - [1,0], [true,false], bitpack([true,false]), - Set([1,2,3,4]), - Set([1:10]), # these lead to different key orders - Set([7,9,4,10,2,3,5,8,6,1]), # - [42 => 101, 77 => 93], {42 => 101, 77 => 93}, - (1,2,3,4), (1.0,2.0,3.0,4.0), (1,3,2,4), - ("a","b"), (SubString("a",1,1), SubString("b",1,1)), - # issue #6900 - [x => x for x in 1:10], - [7=>7,9=>9,4=>4,10=>10,2=>2,3=>3,8=>8,5=>5,6=>6,1=>1]} +vals = Any[ + [1,2,3,4], [1 3;2 4], Any[1,2,3,4], [1,3,2,4], + [1,0], [true,false], bitpack([true,false]), + Set([1,2,3,4]), + Set([1:10]), # these lead to different key orders + Set([7,9,4,10,2,3,5,8,6,1]), # + [42 => 101, 77 => 93], (Any=>Any)[42 => 101, 77 => 93], + (1,2,3,4), (1.0,2.0,3.0,4.0), (1,3,2,4), + ("a","b"), (SubString("a",1,1), SubString("b",1,1)), + # issue #6900 + [x => x for x in 1:10], + [7=>7,9=>9,4=>4,10=>10,2=>2,3=>3,8=>8,5=>5,6=>6,1=>1] +] for a in vals, b in vals @test isequal(a,b) == (hash(a)==hash(b)) diff --git a/test/keywordargs.jl b/test/keywordargs.jl index b313238e753b6..75c50ab980bd9 100644 --- a/test/keywordargs.jl +++ b/test/keywordargs.jl @@ -66,7 +66,7 @@ opkwf1(a=0,b=1;k=2) = (a,b,k) @test isequal(opkwf1(k=8), ( 0, 1,8)) # dictionaries as keywords -@test kwf1(4; {:hundreds=>9, :tens=>5}...) == 954 +@test kwf1(4; (Any=>Any)[:hundreds=>9, :tens=>5]...) == 954 # with inner function let @@ -85,14 +85,14 @@ extravagant_args(x,y=0,rest...;color="blue",kw...) = @test isequal(extravagant_args(1), (1,0,(),"blue",86)) @test isequal(extravagant_args(1;hundreds=7), (1,0,(),"blue",786)) -@test isequal(extravagant_args(1,2,3;{:color=>"red", :hundreds=>3}...), +@test isequal(extravagant_args(1,2,3;[:color=>"red", :hundreds=>3]...), (1,2,(3,),"red",386)) # passing empty kw container to function with no kwargs -@test sin(1.0) == sin(1.0;{}...) +@test sin(1.0) == sin(1.0; Dict()...) # passing junk kw container -@test_throws BoundsError extravagant_args(1; {[]}...) +@test_throws BoundsError extravagant_args(1; Any[[]]...) # keyword args with static parmeters kwf6{T}(x; k::T=1) = T @@ -173,7 +173,7 @@ function test4974(;kwargs...) end end -@test test4974(a=1) == (2, {(:a,1)}) +@test test4974(a=1) == (2, [(:a, 1)]) # issue #7704, computed keywords @test kwf1(1; (:tens, 2)) == 21 diff --git a/test/linalg3.jl b/test/linalg3.jl index 0dc8fd70660fd..25df2eae2d74b 100644 --- a/test/linalg3.jl +++ b/test/linalg3.jl @@ -200,7 +200,7 @@ Ai = int(ceil(Ar*100)) @test isequal(scale(BigFloat[1.0], 2.0f0im), Complex{BigFloat}[2.0im]) # issue #6450 -@test dot({1.0,2.0},{3.5,4.5}) === 12.5 +@test dot(Any[1.0,2.0], Any[3.5,4.5]) === 12.5 # issue #7181 A = [ 1 5 9 diff --git a/test/linalg4.jl b/test/linalg4.jl index 8580b715cad05..de75998bced49 100644 --- a/test/linalg4.jl +++ b/test/linalg4.jl @@ -26,8 +26,10 @@ end n=12 #Size of matrix problem to test #Issue #7647: test xsyevr, xheevr, xstevr drivers -for Mi7647 in {Symmetric(diagm([1.0:3.0])), Hermitian(diagm([1.0:3.0])), - Hermitian(diagm(complex([1.0:3.0]))), SymTridiagonal([1.0:3.0], zeros(2))} +for Mi7647 in (Symmetric(diagm([1.0:3.0])), + Hermitian(diagm([1.0:3.0])), + Hermitian(diagm(complex([1.0:3.0]))), + SymTridiagonal([1.0:3.0], zeros(2))) debug && println("Eigenvalues in interval for $(typeof(Mi7647))") @test eigmin(Mi7647) == eigvals(Mi7647, 0.5, 1.5)[1] == 1.0 @test eigmax(Mi7647) == eigvals(Mi7647, 2.5, 3.5)[1] == 3.0 diff --git a/test/lineedit.jl b/test/lineedit.jl index 60efd42db265f..b566f26efea53 100644 --- a/test/lineedit.jl +++ b/test/lineedit.jl @@ -3,23 +3,23 @@ using TestHelpers a_foo = 0 -const foo_keymap = { +const foo_keymap = (Char=>Function)[ 'a' => (o...)->(global a_foo; a_foo += 1) -} +] b_foo = 0 -const foo2_keymap = { +const foo2_keymap = (Char=>Function)[ 'b' => (o...)->(global b_foo; b_foo += 1) -} +] a_bar = 0 b_bar = 0 -const bar_keymap = { +const bar_keymap = (Char=>Function)[ 'a' => (o...)->(global a_bar; a_bar += 1), 'b' => (o...)->(global b_bar; b_bar += 1) -} +] test1_func = LineEdit.keymap([foo_keymap]) diff --git a/test/numbers.jl b/test/numbers.jl index c5ac9bc5e759f..391be483b7f5b 100644 --- a/test/numbers.jl +++ b/test/numbers.jl @@ -800,20 +800,20 @@ end @test (Complex(1,2)/Complex(2.5,3.0))*Complex(2.5,3.0) == Complex(1,2) @test 0.7 < real(sqrt(Complex(0,1))) < 0.707107 -for T in {Int8,Int16,Int32,Int64,Int128} +for T in [Int8, Int16, Int32, Int64, Int128] @test abs(typemin(T)) == -typemin(T) - #for x in {typemin(T),convert(T,-1),zero(T),one(T),typemax(T)} + #for x in (typemin(T),convert(T,-1),zero(T),one(T),typemax(T)) # @test signed(unsigned(x)) == x #end end -#for T in {Uint8,Uint16,Uint32,Uint64,Uint128}, -# x in {typemin(T),one(T),typemax(T)} +#for T in (Uint8,Uint16,Uint32,Uint64,Uint128) +# x in (typemin(T),one(T),typemax(T)) # @test unsigned(signed(x)) == x #end -for S = {Int8, Int16, Int32, Int64}, - U = {Uint8, Uint16, Uint32, Uint64} +for S = [Int8, Int16, Int32, Int64], + U = [Uint8, Uint16, Uint32, Uint64] @test !(-one(S) == typemax(U)) @test -one(S) != typemax(U) @test -one(S) < typemax(U) @@ -821,7 +821,7 @@ for S = {Int8, Int16, Int32, Int64}, end # check type of constructed rationals -int_types = {Int8, Uint8, Int16, Uint16, Int32, Uint32, Int64, Uint64} +int_types = [Int8, Uint8, Int16, Uint16, Int32, Uint32, Int64, Uint64] for N = int_types, D = int_types T = promote_type(N,D) @test typeof(convert(N,2)//convert(D,3)) <: Rational{T} @@ -831,9 +831,9 @@ end @test typeof(convert(Rational{Integer},1)) === Rational{Integer} # check type of constructed complexes -real_types = {Int8, Uint8, Int16, Uint16, Int32, Uint32, Int64, Uint64, Float32, Float64, +real_types = [Int8, Uint8, Int16, Uint16, Int32, Uint32, Int64, Uint64, Float32, Float64, Rational{Int8}, Rational{Uint8}, Rational{Int16}, Rational{Uint16}, - Rational{Int32}, Rational{Uint32}, Rational{Int64}, Rational{Uint64}} + Rational{Int32}, Rational{Uint32}, Rational{Int64}, Rational{Uint64}] for A = real_types, B = real_types T = promote_type(A,B) @test typeof(Complex(convert(A,2),convert(B,3))) <: Complex{T} @@ -844,15 +844,15 @@ end @test_throws MethodError complex(1,2) > complex(0,0) # div, fld, cld, rem, mod -for yr = { +for yr = Any[ 1:6, 0.25:0.25:6.0, 1//4:1//4:6//1 -}, xr = { +], xr = Any[ 0:6, 0.0:0.25:6.0, 0//1:1//4:6//1 -} +] for y = yr, x = xr # check basic div functionality if 0 <= x < 1y @@ -1133,10 +1133,10 @@ end @test cld(typemin(Int64)+3,-2) == 4611686018427387903 @test cld(typemin(Int64)+3,-7) == 1317624576693539401 -for x={typemin(Int64), -typemax(Int64), -typemax(Int64)+1, -typemax(Int64)+2, - typemax(Int64)-2, typemax(Int64)-1, typemax(Int64), - typemax(Uint64)-1, typemax(Uint64)-2, typemax(Uint64)}, - y={-7,-2,-1,1,2,7} +for x=Any[typemin(Int64), -typemax(Int64), -typemax(Int64)+1, -typemax(Int64)+2, + typemax(Int64)-2, typemax(Int64)-1, typemax(Int64), + typemax(Uint64)-1, typemax(Uint64)-2, typemax(Uint64)], + y=[-7,-2,-1,1,2,7] if x >= 0 @test div(unsigned(x),y) == unsigned(div(x,y)) @test fld(unsigned(x),y) == unsigned(fld(x,y)) diff --git a/test/parallel.jl b/test/parallel.jl index d072a14dd0145..02003bca5c6a5 100644 --- a/test/parallel.jl +++ b/test/parallel.jl @@ -204,11 +204,11 @@ if haskey(ENV, "PTEST_FULL") end # issue #7727 -let A = {}, B = {} +let A = [], B = [] t = @task produce(11) @sync begin @async for x in t; push!(A,x); end @async for x in t; push!(B,x); end end - @test (A == {11}) != (B == {11}) + @test (A == [11]) != (B == [11]) end diff --git a/test/perf/perfutil.jl b/test/perf/perfutil.jl index 4f80ceb6e54d2..ce4798ceee77e 100644 --- a/test/perf/perfutil.jl +++ b/test/perf/perfutil.jl @@ -38,7 +38,7 @@ function submit_to_codespeed(vals,name,desc,unit,test_group,lessisbetter=true) csdata["lessisbetter"] = lessisbetter println( "$name: $(mean(vals))" ) - ret = post( "http://$codespeed_host/result/add/json/", {"json" => json([csdata])} ) + ret = post( "http://$codespeed_host/result/add/json/", Dict(["json", json([csdata])])) println( json([csdata]) ) if ret.http_code != 200 && ret.http_code != 202 error("Error submitting $name [HTTP code $(ret.http_code)], dumping headers and text: $(ret.headers)\n$(bytestring(ret.body))\n\n") diff --git a/test/perf/shootout/meteor_contest.jl b/test/perf/shootout/meteor_contest.jl index 43a0c73c5f69c..9d4c761399dbe 100644 --- a/test/perf/shootout/meteor_contest.jl +++ b/test/perf/shootout/meteor_contest.jl @@ -15,17 +15,17 @@ const W = 3 const SW = 4 const SE = 5 -const rotate = {E => NE, NE => NW, NW => W, W => SW, SW => SE, SE => E} -const flip = {E => W, NE => NW, NW => NE, W => E, SW => SE, SE => SW} +const rotate = (Int=>Int)[E => NE, NE => NW, NW => W, W => SW, SW => SE, SE => E] +const flip = (Int=>Int)[E => W, NE => NW, NW => NE, W => E, SW => SE, SE => SW] -const move = { +const move = (Int=>Function)[ E => (x, y) -> (x + 1, y), W => (x, y) -> (x - 1, y), NE => (x, y) -> (x + y%2, y - 1), NW => (x, y) -> (x + y%2 - 1, y - 1), SE => (x, y) -> (x + y%2, y + 1), SW => (x, y) -> (x + y%2 - 1, y + 1) -} +] const pieces = ( (E, E, E, SE), diff --git a/test/perf/shootout/revcomp.jl b/test/perf/shootout/revcomp.jl index 2624c1db12134..20160c5fb22d3 100644 --- a/test/perf/shootout/revcomp.jl +++ b/test/perf/shootout/revcomp.jl @@ -6,7 +6,7 @@ # FIXME(davekong) Is there support in Julia for doing more efficient IO and # handling of byte arrays? -const revcompdata = { +const revcompdata = (Char=>Char)[ 'A'=> 'T', 'a'=> 'T', 'C'=> 'G', 'c'=> 'G', 'G'=> 'C', 'g'=> 'C', @@ -23,7 +23,7 @@ const revcompdata = { 'D'=> 'H', 'd'=> 'H', 'B'=> 'V', 'b'=> 'V', 'N'=> 'N', 'n'=> 'N', -} +] function print_buff(b) br = reverse(b) diff --git a/test/perf/sparse/perf.jl b/test/perf/sparse/perf.jl index 5b05a02a5692a..addf9b8ada905 100644 --- a/test/perf/sparse/perf.jl +++ b/test/perf/sparse/perf.jl @@ -10,33 +10,33 @@ med = 10^4 large = 10^5 huge = 10^6 # # 1 entry per line -# ss = {} +# ss = [] # push!(ss, sprand(small, small, 1e-3)) # #push!(ss, sprand(med, med, 1e-4)) # push!(ss, sprand(large, large, 1e-5)) # 10 entries per line -ts = {} +ts = [] push!(ts, sprand(small, small, 1e-2)) #push!(ts, sprand(med, med, 1e-3)) push!(ts, sprand(large, large, 1e-4)) # 100 entries per line -us = {} +us = [] push!(us, sprand(small, small, 1e-1)) #push!(us, sprand(med, med, 1e-2)) push!(us, sprand(large, large, 1e-3)) #push!(us, sprand(huge, huge, 1e-4)) # # 1000 entries per line -# vs = {} +# vs = [] # push!(vs, sprand(small, small, 1.0)) # #push!(vs, sprand(med, med, 1e-1)) # push!(vs, sprand(large, large, 1e-2)) # #push!(vs, sprand(huge, huge, 1e-3)) ## using uint32 (works up to 10^9) -uus = {} +uus = [] for u in us push!(uus, SparseMatrixCSC(u.m, u.n, uint32(u.colptr), uint32(u.rowval), u.nzval)) end diff --git a/test/ranges.jl b/test/ranges.jl index b72f30c458497..6b95d0e401c55 100644 --- a/test/ranges.jl +++ b/test/ranges.jl @@ -116,7 +116,7 @@ r = (-4*int64(maxintfloat(is(Int,Int32) ? Float32 : Float64))):5 @test_throws BoundsError (0:2:10)[7:7] # indexing with negative ranges (#8351) -for a={3:6, 0:2:10}, b={0:1, 2:-1:0} +for a=Range[3:6, 0:2:10], b=Range[0:1, 2:-1:0] @test_throws BoundsError a[b] end @@ -265,8 +265,8 @@ end # comparing and hashing ranges let - Rs = {1:2, int32(1:3:17), int64(1:3:17), 1:0, 17:-3:0, - 0.0:0.1:1.0, float32(0.0:0.1:1.0)} + Rs = Range[1:2, int32(1:3:17), int64(1:3:17), 1:0, 17:-3:0, + 0.0:0.1:1.0, float32(0.0:0.1:1.0)] for r in Rs ar = collect(r) @test r != ar diff --git a/test/readdlm.jl b/test/readdlm.jl index 01904cdead1f3..890f2794a01bd 100644 --- a/test/readdlm.jl +++ b/test/readdlm.jl @@ -23,8 +23,8 @@ isequaldlm(m1, m2, t) = isequal(m1, m2) && (eltype(m1) == eltype(m2) == t) @test size(readdlm(IOBuffer("1\t 2 3 4\n1 2 3\n"))) == (2,4) @test size(readdlm(IOBuffer("1,,2,3,4\n1,2,3\n"), ',')) == (2,5) -let result1 = reshape({"", "", "", "", "", "", 1.0, 1.0, "", "", "", "", "", 1.0, 2.0, "", 3.0, "", "", "", "", "", 4.0, "", "", ""}, 2, 13), - result2 = reshape({1.0, 1.0, 2.0, 1.0, 3.0, "", 4.0, ""}, 2, 4) +let result1 = reshape(Any["", "", "", "", "", "", 1.0, 1.0, "", "", "", "", "", 1.0, 2.0, "", 3.0, "", "", "", "", "", 4.0, "", "", ""], 2, 13), + result2 = reshape(Any[1.0, 1.0, 2.0, 1.0, 3.0, "", 4.0, ""], 2, 4) @test isequaldlm(readdlm(IOBuffer(",,,1,,,,2,3,,,4,\n,,,1,,,1\n"), ','), result1, Any) @test isequaldlm(readdlm(IOBuffer(" 1 2 3 4 \n 1 1\n")), result2, Any) @@ -32,11 +32,11 @@ let result1 = reshape({"", "", "", "", "", "", 1.0, 1.0, "", "", "", "", "", 1.0 @test isequaldlm(readdlm(IOBuffer("1 2\n3 4 \n")), [[1.0, 3.0] [2.0, 4.0]], Float64) end -let result1 = reshape({"", "", "", "", "", "", "भारत", 1.0, "", "", "", "", "", 1.0, 2.0, "", 3.0, "", "", "", "", "", 4.0, "", "", ""}, 2, 13) +let result1 = reshape(Any["", "", "", "", "", "", "भारत", 1.0, "", "", "", "", "", 1.0, 2.0, "", 3.0, "", "", "", "", "", 4.0, "", "", ""], 2, 13) @test isequaldlm(readdlm(IOBuffer(",,,भारत,,,,2,3,,,4,\n,,,1,,,1\n"), ',') , result1, Any) end -let result1 = reshape({1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, ""}, 2, 4) +let result1 = reshape(Any[1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, ""], 2, 4) @test isequaldlm(readdlm(IOBuffer("1\t 2 3 4\n1 2 3")), result1, Any) @test isequaldlm(readdlm(IOBuffer("1\t 2 3 4\n1 2 3 ")), result1, Any) @test isequaldlm(readdlm(IOBuffer("1\t 2 3 4\n1 2 3\n")), result1, Any) @@ -46,22 +46,23 @@ let result1 = reshape({1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, ""}, 2, 4) @test isequaldlm(readdlm(IOBuffer("1,2,3,\"4\"\r\n1,2,3\r\n"), ','), result1, Any) end -let result1 = reshape({"abc", "hello", "def,ghi", " \"quote\" ", "new\nline", "world"}, 2, 3), - result2 = reshape({"abc", "line\"", "\"hello\"", "\"def", "", "\" \"\"quote\"\" \"", "ghi\"", "", "world", "\"new", "", ""}, 3, 4) +let result1 = reshape(Any["abc", "hello", "def,ghi", " \"quote\" ", "new\nline", "world"], 2, 3), + result2 = reshape(Any["abc", "line\"", "\"hello\"", "\"def", "", "\" \"\"quote\"\" \"", "ghi\"", "", "world", "\"new", "", ""], 3, 4) @test isequaldlm(readdlm(IOBuffer("abc,\"def,ghi\",\"new\nline\"\n\"hello\",\" \"\"quote\"\" \",world"), ','), result1, Any) @test isequaldlm(readdlm(IOBuffer("abc,\"def,ghi\",\"new\nline\"\n\"hello\",\" \"\"quote\"\" \",world"), ',', quotes=false), result2, Any) end -let result1 = reshape({"t", "c", "", "c"}, 2, 2), - result2 = reshape({"t", "\"c", "t", "c"}, 2, 2) +let result1 = reshape(Any["t", "c", "", "c"], 2, 2), + result2 = reshape(Any["t", "\"c", "t", "c"], 2, 2) @test isequaldlm(readdlm(IOBuffer("t \n\"c\" c")), result1, Any) @test isequaldlm(readdlm(IOBuffer("t t \n\"\"\"c\" c")), result2, Any) end -@test isequaldlm(readcsv(IOBuffer("\n1,2,3\n4,5,6\n\n\n"), skipblanks=false), reshape({"",1.0,4.0,"","","",2.0,5.0,"","","",3.0,6.0,"",""}, 5, 3), Any) +@test isequaldlm(readcsv(IOBuffer("\n1,2,3\n4,5,6\n\n\n"), skipblanks=false), + reshape(Any["",1.0,4.0,"","","",2.0,5.0,"","","",3.0,6.0,"",""], 5, 3), Any) @test isequaldlm(readcsv(IOBuffer("\n1,2,3\n4,5,6\n\n\n"), skipblanks=true), reshape([1.0,4.0,2.0,5.0,3.0,6.0], 2, 3), Float64) -@test isequaldlm(readcsv(IOBuffer("1,2\n\n4,5"), skipblanks=false), reshape({1.0,"",4.0,2.0,"",5.0}, 3, 2), Any) +@test isequaldlm(readcsv(IOBuffer("1,2\n\n4,5"), skipblanks=false), reshape(Any[1.0,"",4.0,2.0,"",5.0], 3, 2), Any) @test isequaldlm(readcsv(IOBuffer("1,2\n\n4,5"), skipblanks=true), reshape([1.0,4.0,2.0,5.0], 2, 2), Float64) let x = randbool(5, 10), io = IOBuffer() diff --git a/test/reducedim.jl b/test/reducedim.jl index 0a894a39a3c09..42031c2a95f1d 100644 --- a/test/reducedim.jl +++ b/test/reducedim.jl @@ -14,9 +14,9 @@ safe_maxabs{T}(A::Array{T}, region) = safe_mapslices(maximum, abs(A), region) safe_minabs{T}(A::Array{T}, region) = safe_mapslices(minimum, abs(A), region) Areduc = rand(3, 4, 5, 6) -for region in { +for region in Any[ 1, 2, 3, 4, 5, (1, 2), (1, 3), (1, 4), (2, 3), (2, 4), (3, 4), - (1, 2, 3), (1, 3, 4), (2, 3, 4), (1, 2, 3, 4)} + (1, 2, 3), (1, 3, 4), (2, 3, 4), (1, 2, 3, 4)] # println("region = $region") r = fill(NaN, Base.reduced_dims(size(Areduc), region)) @test_approx_eq sum!(r, Areduc) safe_sum(Areduc, region) @@ -88,5 +88,5 @@ A = [1.0 3.0 6.0; # issue #6672 @test sum(Real[1 2 3; 4 5.3 7.1], 2) == reshape([6, 16.4], 2, 1) @test std(FloatingPoint[1,2,3], 1) == [1.0] -@test sum({1 2;3 4},1) == [4 6] +@test sum(Any[1 2;3 4],1) == [4 6] @test sum(Vector{Int}[[1,2],[4,3]], 1)[1] == [5,5] diff --git a/test/resolve.jl b/test/resolve.jl index d22ee631476b5..7d80c5f2667a3 100644 --- a/test/resolve.jl +++ b/test/resolve.jl @@ -95,7 +95,7 @@ function sanity_tst(deps_data, expected_result) end return true end -sanity_tst(deps_data) = sanity_tst(deps_data, {}) +sanity_tst(deps_data) = sanity_tst(deps_data, []) function resolve_tst(deps_data, reqs_data) deps = deps_from_data(deps_data) @@ -109,371 +109,371 @@ function resolve_tst(deps_data, reqs_data) end ## DEPENDENCY SCHEME 1: TWO PACKAGES, DAG -deps_data = { - {"A", v"1", "B", v"1"}, - {"A", v"2", "B", v"2"}, - {"B", v"1"}, - {"B", v"2"} -} +deps_data = Any[ + ["A", v"1", "B", v"1"], + ["A", v"2", "B", v"2"], + ["B", v"1"], + ["B", v"2"] +] @test sanity_tst(deps_data) # require just B -reqs_data = { - {"B"} -} +reqs_data = Any[ + ["B"] +] want = resolve_tst(deps_data, reqs_data) @test want == ["B"=>v"2"] # require just A: must bring in B -reqs_data = { - {"A"} -} +reqs_data = Any[ + ["A"] +] want = resolve_tst(deps_data, reqs_data) @test want == ["A"=>v"2", "B"=>v"2"] ## DEPENDENCY SCHEME 2: TWO PACKAGES, CYCLIC -deps_data = { - {"A", v"1", "B", v"2"}, - {"A", v"2", "B", v"1"}, - {"B", v"1", "A", v"2"}, - {"B", v"2", "A", v"1"} -} +deps_data = Any[ + ["A", v"1", "B", v"2"], + ["A", v"2", "B", v"1"], + ["B", v"1", "A", v"2"], + ["B", v"2", "A", v"1"] +] @test sanity_tst(deps_data) # require just A -reqs_data = { - {"A"} -} +reqs_data = Any[ + ["A"] +] want = resolve_tst(deps_data, reqs_data) @test want == ["A"=>v"2", "B"=>v"2"] # require just B, force lower version -reqs_data = { - {"B", v"1", v"2"} -} +reqs_data = Any[ + ["B", v"1", v"2"] +] want = resolve_tst(deps_data, reqs_data) @test want == ["A"=>v"2", "B"=>v"1"] # require just A, force lower version -reqs_data = { - {"A", v"1", v"2"} -} +reqs_data = Any[ + ["A", v"1", v"2"] +] want = resolve_tst(deps_data, reqs_data) @test want == ["A"=>v"1", "B"=>v"2"] ## DEPENDENCY SCHEME 3: THREE PACKAGES, CYCLIC, TWO MUTUALLY EXCLUSIVE SOLUTIONS -deps_data = { - {"A", v"1", "B", v"2"}, - {"A", v"2", "B", v"1", v"2"}, - {"B", v"1", "C", v"2"}, - {"B", v"2", "C", v"1", v"2"}, - {"C", v"1", "A", v"1", v"2"}, - {"C", v"2", "A", v"2"} -} +deps_data = Any[ + ["A", v"1", "B", v"2"], + ["A", v"2", "B", v"1", v"2"], + ["B", v"1", "C", v"2"], + ["B", v"2", "C", v"1", v"2"], + ["C", v"1", "A", v"1", v"2"], + ["C", v"2", "A", v"2"] +] @test sanity_tst(deps_data) # require just A (must choose solution which has the highest version for A) -reqs_data = { - {"A"} -} +reqs_data = Any[ + ["A"] +] want = resolve_tst(deps_data, reqs_data) @test want == ["A"=>v"2", "B"=>v"1", "C"=>v"2"] # require just B (must choose solution which has the highest version for B) -reqs_data = { - {"B"} -} +reqs_data = Any[ + ["B"] +] want = resolve_tst(deps_data, reqs_data) @test want == ["A"=>v"1", "B"=>v"2", "C"=>v"1"] # require just A, force lower version -reqs_data = { - {"A", v"1", v"2"} -} +reqs_data = Any[ + ["A", v"1", v"2"] +] want = resolve_tst(deps_data, reqs_data) @test want == ["A"=>v"1", "B"=>v"2", "C"=>v"1"] # require A and C, incompatible versions -reqs_data = { - {"A", v"1", v"2"}, - {"C", v"2"} -} +reqs_data = Any[ + ["A", v"1", v"2"], + ["C", v"2"] +] @test_throws ErrorException resolve_tst(deps_data, reqs_data) ## DEPENDENCY SCHEME 4: TWO PACKAGES, DAG, WITH TRIVIAL INCONSISTENCY -deps_data = { - {"A", v"1", "B", v"2"}, - {"B", v"1"} -} +deps_data = Any[ + ["A", v"1", "B", v"2"], + ["B", v"1"] +] -@test sanity_tst(deps_data, {("A", v"1")}) +@test sanity_tst(deps_data, [("A", v"1")]) # require B (must not give errors) -reqs_data = { - {"B"} -} +reqs_data = Any[ + ["B"] +] want = resolve_tst(deps_data, reqs_data) @test want == ["B"=>v"1"] ## DEPENDENCY SCHEME 5: THREE PACKAGES, DAG, WITH IMPLICIT INCONSISTENCY -deps_data = { - {"A", v"1", "B", v"2"}, - {"A", v"1", "C", v"2"}, - {"A", v"2", "B", v"1", v"2"}, - {"A", v"2", "C", v"1", v"2"}, - {"B", v"1", "C", v"2"}, - {"B", v"2", "C", v"2"}, - {"C", v"1"}, - {"C", v"2"} -} - -@test sanity_tst(deps_data, {("A", v"2")}) +deps_data = Any[ + ["A", v"1", "B", v"2"], + ["A", v"1", "C", v"2"], + ["A", v"2", "B", v"1", v"2"], + ["A", v"2", "C", v"1", v"2"], + ["B", v"1", "C", v"2"], + ["B", v"2", "C", v"2"], + ["C", v"1"], + ["C", v"2"] +] + +@test sanity_tst(deps_data, [("A", v"2")]) # require A, any version (must use the highest non-inconsistent) -reqs_data = { - {"A"} -} +reqs_data = Any[ + ["A"] +] want = resolve_tst(deps_data, reqs_data) @test want == ["A"=>v"1", "B"=>v"2", "C"=>v"2"] # require A, force highest version (impossible) -reqs_data = { - {"A", v"2"} -} +reqs_data = Any[ + ["A", v"2"] +] @test_throws ErrorException resolve_tst(deps_data, reqs_data) ## DEPENDENCY SCHEME 6: TWO PACKAGES, CYCLIC, TOTALLY INCONSISTENT -deps_data = { - {"A", v"1", "B", v"2"}, - {"A", v"2", "B", v"1", v"2"}, - {"B", v"1", "A", v"1", v"2"}, - {"B", v"2", "A", v"2"} -} +deps_data = Any[ + ["A", v"1", "B", v"2"], + ["A", v"2", "B", v"1", v"2"], + ["B", v"1", "A", v"1", v"2"], + ["B", v"2", "A", v"2"] +] -@test sanity_tst(deps_data, {("A", v"1"), ("A", v"2"), - ("B", v"1"), ("B", v"2")}) +@test sanity_tst(deps_data, [("A", v"1"), ("A", v"2"), + ("B", v"1"), ("B", v"2")]) # require A (impossible) -reqs_data = { - {"A"} -} +reqs_data = Any[ + ["A"] +] @test_throws ErrorException resolve_tst(deps_data, reqs_data) # require B (impossible) -reqs_data = { - {"B"} -} +reqs_data = Any[ + ["B"] +] @test_throws ErrorException resolve_tst(deps_data, reqs_data) ## DEPENDENCY SCHEME 7: THREE PACKAGES, CYCLIC, WITH INCONSISTENCY -deps_data = { - {"A", v"1", "B", v"1", v"2"}, - {"A", v"2", "B", v"2"}, - {"B", v"1", "C", v"1", v"2"}, - {"B", v"2", "C", v"2"}, - {"C", v"1", "A", v"2"}, - {"C", v"2", "A", v"2"}, -} - -@test sanity_tst(deps_data, {("A", v"1"), ("B", v"1"), - ("C", v"1")}) +deps_data = Any[ + ["A", v"1", "B", v"1", v"2"], + ["A", v"2", "B", v"2"], + ["B", v"1", "C", v"1", v"2"], + ["B", v"2", "C", v"2"], + ["C", v"1", "A", v"2"], + ["C", v"2", "A", v"2"], +] + +@test sanity_tst(deps_data, [("A", v"1"), ("B", v"1"), + ("C", v"1")]) # require A -reqs_data = { - {"A"} -} +reqs_data = Any[ + ["A"] +] want = resolve_tst(deps_data, reqs_data) @test want == ["A"=>v"2", "B"=>v"2", "C"=>v"2"] # require C -reqs_data = { - {"C"} -} +reqs_data = Any[ + ["C"] +] want = resolve_tst(deps_data, reqs_data) @test want == ["A"=>v"2", "B"=>v"2", "C"=>v"2"] # require C, lowest version (impossible) -reqs_data = { - {"C", v"1", v"2"} -} +reqs_data = Any[ + ["C", v"1", v"2"] +] @test_throws ErrorException resolve_tst(deps_data, reqs_data) ## DEPENDENCY SCHEME 8: THREE PACKAGES, CYCLIC, TOTALLY INCONSISTENT -deps_data = { - {"A", v"1", "B", v"1", v"2"}, - {"A", v"2", "B", v"2"}, - {"B", v"1", "C", v"1", v"2"}, - {"B", v"2", "C", v"2"}, - {"C", v"1", "A", v"2"}, - {"C", v"2", "A", v"1", v"2"}, -} - -@test sanity_tst(deps_data, {("A", v"1"), ("A", v"2"), +deps_data = Any[ + ["A", v"1", "B", v"1", v"2"], + ["A", v"2", "B", v"2"], + ["B", v"1", "C", v"1", v"2"], + ["B", v"2", "C", v"2"], + ["C", v"1", "A", v"2"], + ["C", v"2", "A", v"1", v"2"], +] + +@test sanity_tst(deps_data, [("A", v"1"), ("A", v"2"), ("B", v"1"), ("B", v"2"), - ("C", v"1"), ("C", v"2")}) + ("C", v"1"), ("C", v"2")]) # require A (impossible) -reqs_data = { - {"A"} -} +reqs_data = Any[ + ["A"] +] @test_throws ErrorException resolve_tst(deps_data, reqs_data) # require B (impossible) -reqs_data = { - {"B"} -} +reqs_data = Any[ + ["B"] +] @test_throws ErrorException resolve_tst(deps_data, reqs_data) # require C (impossible) -reqs_data = { - {"C"} -} +reqs_data = Any[ + ["C"] +] @test_throws ErrorException resolve_tst(deps_data, reqs_data) ## DEPENDENCY SCHEME 9: SIX PACKAGES, DAG -deps_data = { - {"A", v"1"}, - {"A", v"2"}, - {"A", v"3"}, - {"B", v"1", "A", v"1", v"2"}, - {"B", v"2", "A"}, - {"C", v"1", "A", v"2", v"3"}, - {"C", v"2", "A", v"2"}, - {"D", v"1", "B", v"1"}, - {"D", v"2", "B", v"2"}, - {"E", v"1", "D"}, - {"F", v"1", "A", v"1", v"3"}, - {"F", v"1", "E"}, - {"F", v"2", "C", v"2"}, - {"F", v"2", "E"}, -} +deps_data = Any[ + ["A", v"1"], + ["A", v"2"], + ["A", v"3"], + ["B", v"1", "A", v"1", v"2"], + ["B", v"2", "A"], + ["C", v"1", "A", v"2", v"3"], + ["C", v"2", "A", v"2"], + ["D", v"1", "B", v"1"], + ["D", v"2", "B", v"2"], + ["E", v"1", "D"], + ["F", v"1", "A", v"1", v"3"], + ["F", v"1", "E"], + ["F", v"2", "C", v"2"], + ["F", v"2", "E"], +] @test sanity_tst(deps_data) # require just F -reqs_data = { - {"F"} -} +reqs_data = Any[ + ["F"] +] want = resolve_tst(deps_data, reqs_data) @test want == ["A"=>v"3", "B"=>v"2", "C"=>v"2", "D"=>v"2", "E"=>v"1", "F"=>v"2"] # require just F, lower version -reqs_data = { - {"F", v"1", v"2"} -} +reqs_data = Any[ + ["F", v"1", v"2"] +] want = resolve_tst(deps_data, reqs_data) @test want == ["A"=>v"2", "B"=>v"2", "D"=>v"2", "E"=>v"1", "F"=>v"1"] # require F and B; force lower B version -> must bring down F, A, and D versions too -reqs_data = { - {"F"}, - {"B", v"1", v"2"} -} +reqs_data = Any[ + ["F"], + ["B", v"1", v"2"] +] want = resolve_tst(deps_data, reqs_data) @test want == ["A"=>v"1", "B"=>v"1", "D"=>v"1", "E"=>v"1", "F"=>v"1"] # require F and D; force lower D version -> must not bring down F version -reqs_data = { - {"F"}, - {"D", v"1", v"2"} -} +reqs_data = Any[ + ["F"], + ["D", v"1", v"2"] +] want = resolve_tst(deps_data, reqs_data) @test want == ["A"=>v"3", "B"=>v"2", "C"=>v"2", "D"=>v"1", "E"=>v"1", "F"=>v"2"] # require F and C; force lower C version -> must bring down F and A versions -reqs_data = { - {"F"}, - {"C", v"1", v"2"} -} +reqs_data = Any[ + ["F"], + ["C", v"1", v"2"] +] want = resolve_tst(deps_data, reqs_data) @test want == ["A"=>v"2", "B"=>v"2", "C"=>v"1", "D"=>v"2", "E"=>v"1", "F"=>v"1"] ## DEPENDENCY SCHEME 10: SIX PACKAGES, DAG, WITH PRERELEASE/BUILD VERSIONS -deps_data = { - {"A", v"1"}, - {"A", v"2-rc.1"}, - {"A", v"2-rc.1+bld"}, - {"A", v"2"}, - {"A", v"2.1.0"}, - {"B", v"1", "A", v"1", v"2-"}, - {"B", v"1.0.1-beta", "A", v"2-rc"}, - {"B", v"1.0.1", "A"}, - {"C", v"1", "A", v"2-", v"2.1"}, - {"C", v"1+BLD", "A", v"2-rc.1", v"2.1"}, - {"C", v"2", "A", v"2-rc.1"}, - {"D", v"1", "B", v"1"}, - {"D", v"2", "B", v"1.0.1-"}, - {"E", v"1-plztst", "D"}, - {"E", v"1", "D"}, - {"F", v"1.1", "A", v"1", v"2.1"}, - {"F", v"1.1", "E", v"1"}, - {"F", v"2-rc.1", "A", v"2-", v"2.1"}, - {"F", v"2-rc.1", "C", v"1"}, - {"F", v"2-rc.1", "E"}, - {"F", v"2-rc.2", "A", v"2-", v"2.1"}, - {"F", v"2-rc.2", "C", v"2"}, - {"F", v"2-rc.2", "E"}, - {"F", v"2", "C", v"2"}, - {"F", v"2", "E"}, -} +deps_data = Any[ + ["A", v"1"], + ["A", v"2-rc.1"], + ["A", v"2-rc.1+bld"], + ["A", v"2"], + ["A", v"2.1.0"], + ["B", v"1", "A", v"1", v"2-"], + ["B", v"1.0.1-beta", "A", v"2-rc"], + ["B", v"1.0.1", "A"], + ["C", v"1", "A", v"2-", v"2.1"], + ["C", v"1+BLD", "A", v"2-rc.1", v"2.1"], + ["C", v"2", "A", v"2-rc.1"], + ["D", v"1", "B", v"1"], + ["D", v"2", "B", v"1.0.1-"], + ["E", v"1-plztst", "D"], + ["E", v"1", "D"], + ["F", v"1.1", "A", v"1", v"2.1"], + ["F", v"1.1", "E", v"1"], + ["F", v"2-rc.1", "A", v"2-", v"2.1"], + ["F", v"2-rc.1", "C", v"1"], + ["F", v"2-rc.1", "E"], + ["F", v"2-rc.2", "A", v"2-", v"2.1"], + ["F", v"2-rc.2", "C", v"2"], + ["F", v"2-rc.2", "E"], + ["F", v"2", "C", v"2"], + ["F", v"2", "E"], +] @test sanity_tst(deps_data) # require just F -reqs_data = { - {"F"} -} +reqs_data = Any[ + ["F"] +] want = resolve_tst(deps_data, reqs_data) @test want == ["A"=>v"2.1", "B"=>v"1.0.1", "C"=>v"2", "D"=>v"2", "E"=>v"1", "F"=>v"2"] # require just F, lower version -reqs_data = { - {"F", v"1", v"2-"} -} +reqs_data = Any[ + ["F", v"1", v"2-"] +] want = resolve_tst(deps_data, reqs_data) @test want == ["A"=>v"2", "B"=>v"1.0.1", "D"=>v"2", "E"=>v"1", "F"=>v"1.1"] # require F and B; force lower B version -> must bring down F, A, and D versions too -reqs_data = { - {"F"}, - {"B", v"1", v"1.0.1-"} -} +reqs_data = Any[ + ["F"], + ["B", v"1", v"1.0.1-"] +] want = resolve_tst(deps_data, reqs_data) @test want == ["A"=>v"1", "B"=>v"1", "D"=>v"1", "E"=>v"1", "F"=>v"1.1"] # require F and D; force lower D version -> must not bring down F version -reqs_data = { - {"F"}, - {"D", v"1", v"2"} -} +reqs_data = Any[ + ["F"], + ["D", v"1", v"2"] +] want = resolve_tst(deps_data, reqs_data) @test want == ["A"=>v"2.1", "B"=>v"1.0.1", "C"=>v"2", "D"=>v"1", "E"=>v"1", "F"=>v"2"] # require F and C; force lower C version -> must bring down F and A versions -reqs_data = { - {"F"}, - {"C", v"1", v"2"} -} +reqs_data = Any[ + ["F"], + ["C", v"1", v"2"] +] want = resolve_tst(deps_data, reqs_data) @test want == ["A"=>v"2", "B"=>v"1.0.1", "C"=>v"1+BLD", "D"=>v"2", "E"=>v"1", "F"=>v"2-rc.1"] diff --git a/test/runtests.jl b/test/runtests.jl index 6d51abeaf638c..9663b6095aadd 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -2,7 +2,7 @@ testnames = [ "linalg", "core", "keywordargs", "numbers", "strings", "dates", "collections", "hashing", "remote", "iobuffer", "arrayops", "reduce", "reducedim", - "simdloop", "blas", "fft", "dsp", "sparse", "bitarray", "random", "math", + "simdloop", "blas", "fft", "dsp", "sparse", "bitarray", "math", "functional", "bigint", "sorting", "statistics", "spawn", "backtrace", "priorityqueue", "arpack", "file", "suitesparse", "version", "resolve", "pollfd", "mpfr", "broadcast", "complex", "socket", diff --git a/test/simdloop.jl b/test/simdloop.jl index 713f664d9288c..4b54965db45d5 100644 --- a/test/simdloop.jl +++ b/test/simdloop.jl @@ -23,9 +23,9 @@ function simd_loop_with_multiple_reductions(x, y, z) (s,t) end -for T in {Int32,Int64,Float32,Float64} +for T in [Int32,Int64,Float32,Float64] # Try various lengths to make sure "remainder loop" works - for n in {0,1,2,3,4,255,256,257} + for n in [0,1,2,3,4,255,256,257] # Dataset chosen so that results will be exact with only 24 bits of mantissa a = convert(Array{T},[2*j+1 for j in 1:n]) b = convert(Array{T},[3*j+2 for j in 1:n]) diff --git a/test/sorting.jl b/test/sorting.jl index 2335f8025d28a..ca93d88b7d7f2 100644 --- a/test/sorting.jl +++ b/test/sorting.jl @@ -7,7 +7,7 @@ @test select([3,6,30,1,9],3) == 6 @test select([3,6,30,1,9],3:4) == [6,9] let a=[1:10] - for r in {2:4, 1:2, 10:10, 4:2, 2:1, 4:-1:2, 2:-1:1, 10:-1:10, 4:1:3, 1:2:8, 10:-3:1} + for r in Any[2:4, 1:2, 10:10, 4:2, 2:1, 4:-1:2, 2:-1:1, 10:-1:10, 4:1:3, 1:2:8, 10:-3:1] @test select(a, r) == [r] @test select(a, r, rev=true) == (11 .- [r]) end @@ -26,7 +26,7 @@ end @test searchsorted([1:5, 1:5, 1:5], 1, 6, 10, Base.Order.Forward) == 6:6 @test searchsorted(ones(15), 1, 6, 10, Base.Order.Forward) == 6:10 -for (rg,I) in {(49:57,47:59), (1:2:17,-1:19), (-3:0.5:2,-5:.5:4)} +for (rg,I) in [(49:57,47:59), (1:2:17,-1:19), (-3:0.5:2,-5:.5:4)] rg_r = reverse(rg) rgv, rgv_r = [rg], [rg_r] for i = I diff --git a/test/sparse.jl b/test/sparse.jl index 74b772a393f0b..1ca32e3c095a4 100644 --- a/test/sparse.jl +++ b/test/sparse.jl @@ -212,7 +212,7 @@ end @test 4 <= mean(sprb45nnzs) <= 16 # issue #5853, sparse diff -for i=1:2, a={[1 2 3], [1 2 3]', eye(3)} +for i=1:2, a=Any[[1 2 3], [1 2 3]', eye(3)] @test all(diff(sparse(a),i) == diff(a,i)) end diff --git a/test/strings.jl b/test/strings.jl index 810935020530c..b1d6f27cfb6e4 100644 --- a/test/strings.jl +++ b/test/strings.jl @@ -1,5 +1,5 @@ # string escaping & unescaping -cx = { +cx = Any[ 0x00000000 '\0' "\\0" 0x00000001 '\x01' "\\x01" 0x00000006 '\x06' "\\x06" @@ -49,7 +49,7 @@ cx = { 0x000fffff '\Ufffff' "\\Ufffff" 0x00100000 '\U100000' "\\U100000" 0x0010ffff '\U10ffff' "\\U10ffff" -} +] for i = 1:size(cx,1) @test cx[i,1] == cx[i,2] @@ -63,8 +63,8 @@ for i = 1:size(cx,1) end end -for i = 0:0x7f, p = {"","\0","x","xxx","\x7f","\uFF","\uFFF", - "\uFFFF","\U10000","\U10FFF","\U10FFFF"} +for i = 0:0x7f, p = ["","\0","x","xxx","\x7f","\uFF","\uFFF", + "\uFFFF","\U10000","\U10FFF","\U10FFFF"] c = char(i) cp = string(c,p) op = string(char(div(i,8)), oct(i%8), p) @@ -252,7 +252,7 @@ astr = "Hello, world.\n" u8str = "∀ ε > 0, ∃ δ > 0: |x-y| < δ ⇒ |f(x)-f(y)| < ε" # ascii search -for str in {astr, Base.GenericString(astr)} +for str in [astr, Base.GenericString(astr)] @test search(str, 'x') == 0 @test search(str, '\0') == 0 @test search(str, '\u80') == 0 @@ -269,7 +269,7 @@ for str in {astr, Base.GenericString(astr)} end # ascii rsearch -for str in {astr} +for str in [astr] @test rsearch(str, 'x') == 0 @test rsearch(str, '\0') == 0 @test rsearch(str, '\u80') == 0 @@ -287,7 +287,7 @@ for str in {astr} end # utf-8 search -for str in {u8str, Base.GenericString(u8str)} +for str in (u8str, Base.GenericString(u8str)) @test search(str, 'z') == 0 @test search(str, '\0') == 0 @test search(str, '\u80') == 0 @@ -308,7 +308,7 @@ for str in {u8str, Base.GenericString(u8str)} end # utf-8 rsearch -for str in {u8str} +for str in [u8str] @test rsearch(str, 'z') == 0 @test rsearch(str, '\0') == 0 @test rsearch(str, '\u80') == 0 @@ -902,14 +902,14 @@ bin_val = hex2bytes("07bf") # multi @test (@sprintf "%s %f %9.5f %d %d %d %d%d%d%d" [1:6]... [7,8,9,10]...) == "1 2.000000 3.00000 4 5 6 78910" # comprehension -@test (@sprintf "%s %s %s %d %d %d %f %f %f" {10^x+y for x=1:3,y=1:3 }...) == "11 101 1001 12 102 1002 13.000000 103.000000 1003.000000" +@test (@sprintf "%s %s %s %d %d %d %f %f %f" Any[10^x+y for x=1:3,y=1:3 ]...) == "11 101 1001 12 102 1002 13.000000 103.000000 1003.000000" # issue #4183 @test split(SubString(ascii("x"), 2, 0), "y") == String[""] @test split(SubString(utf8("x"), 2, 0), "y") == String[""] # issue #4586 -@test rsplit(RevString("ailuj"),'l') == {"ju","ia"} +@test rsplit(RevString("ailuj"),'l') == ["ju","ia"] @test float64(RevString("64")) === 46.0 # issue #6772