Codebase list julia / ce2b391
New upstream version 1.0.1 Mo Zhou 5 years ago
172 changed file(s) with 3081 addition(s) and 2445 deletion(s). Raw diff Collapse all Expand all
7979 BUILDOPTS="$BUILDOPTS USE_BINARYBUILDER_LLVM=1 LLVM_CONFIG=$TRAVIS_BUILD_DIR/usr/tools/llvm-config LLVM_SIZE=$TRAVIS_BUILD_DIR/usr/tools/llvm-size";
8080 BUILDOPTS="$BUILDOPTS VERBOSE=1 USE_BLAS64=0 SUITESPARSE_INC=-I$(brew --prefix suite-sparse-julia)/include FORCE_ASSERTIONS=1";
8181 BUILDOPTS="$BUILDOPTS LIBBLAS=-lopenblas LIBBLASNAME=libopenblas LIBLAPACK=-lopenblas LIBLAPACKNAME=libopenblas";
82 for lib in SUITESPARSE BLAS LAPACK GMP MPFR PCRE LIBUNWIND; do
82 for lib in SUITESPARSE BLAS LAPACK GMP MPFR LIBUNWIND; do
8383 BUILDOPTS="$BUILDOPTS USE_SYSTEM_$lib=1";
8484 done;
8585 export LDFLAGS="-L$(brew --prefix openblas-julia)/lib -L$(brew --prefix suite-sparse-julia)/lib";
205205 $$(build_private_libdir)/sys$1-o.a $$(build_private_libdir)/sys$1-bc.a : $$(build_private_libdir)/sys$1-%.a : $$(build_private_libdir)/sys.ji
206206 @$$(call PRINT_JULIA, cd $$(JULIAHOME)/base && \
207207 if ! $$(call spawn,$3) $2 -C "$$(JULIA_CPU_TARGET)" --output-$$* $$(call cygpath_w,$$@).tmp $$(JULIA_SYSIMG_BUILD_FLAGS) \
208 --startup-file=no --warn-overwrite=yes --sysimage $$(call cygpath_w,$$<) $$(call cygpath_w,$$(JULIAHOME)/contrib/generate_precompile.jl) $$(call cygpath_w,$$<); then \
208 --startup-file=no --warn-overwrite=yes --sysimage $$(call cygpath_w,$$<) $$(call cygpath_w,$$(JULIAHOME)/contrib/generate_precompile.jl); then \
209209 echo '*** This error is usually fixed by running `make clean`. If the error persists$$(COMMA) try `make cleanall`. ***'; \
210210 false; \
211211 fi )
2222
2323 Additionally, rather than sticking with the default command prompt, you may want
2424 to use a different terminal emulator program, such as
25 [Conemu](https://code.google.com/p/conemu-maximus5/) or [Mintty](
25 [Conemu](https://conemu.github.io/) or [Mintty](
2626 https://github.com/mintty/mintty) (note that running Julia on Mintty needs a
2727 copy of `stty.exe` in your `%PATH%` to work properly). Alternatively, you may
2828 prefer the features of a more full-function IDE, such as [Juno](http://junolab.org),
0 1.0.0
0 1.0.1
4343
4444 julia> f(apple)
4545 "I'm a Fruit with value: 1"
46
47 julia> Fruit(1)
48 apple::Fruit = 1
4649 ```
4750
4851 Values can also be specified inside a `begin` block, e.g.
99102 length(s.args) == 2 && isa(s.args[1], Symbol)
100103 i = Core.eval(__module__, s.args[2]) # allow exprs, e.g. uint128"1"
101104 if !isa(i, Integer)
102 throw(ArgumentError("invalid value for Enum $typename, $s=$i; values must be integers"))
105 throw(ArgumentError("invalid value for Enum $typename, $s; values must be integers"))
103106 end
104107 i = convert(basetype, i)
105108 s = s.args[1]
225225 <=(l::AbstractSet, r::AbstractSet) = l ⊆ r
226226
227227 function issubset(l, r)
228
229 rlen = length(r)
230 #This threshold was empirically determined by repeatedly
231 #sampling using these two methods.
232 lenthresh = 70
233
234 if rlen > lenthresh && !isa(r, AbstractSet)
235 return issubset(l, Set(r))
228 if haslength(r)
229 rlen = length(r)
230 #This threshold was empirically determined by repeatedly
231 #sampling using these two methods (see #26198)
232 lenthresh = 70
233
234 if rlen > lenthresh && !isa(r, AbstractSet)
235 return issubset(l, Set(r))
236 end
236237 end
237238
238239 for elt in l
190190 accumulate(op, A; dims::Integer, [init])
191191
192192 Cumulative operation `op` along the dimension `dims` of `A` (providing `dims` is optional
193 for vectors). An inital value `init` may optionally be privided by a keyword argument. See
193 for vectors). An initial value `init` may optionally be provided by a keyword argument. See
194194 also [`accumulate!`](@ref) to use a preallocated output array, both for performance and
195195 to control the precision of the output (e.g. to avoid overflow). For common operations
196196 there are specialized variants of `accumulate`, see: [`cumsum`](@ref), [`cumprod`](@ref)
887887 ```
888888
889889 Use [`push!`](@ref) to add individual items to `collection` which are not already
890 themselves in another collection. The result is of the preceding example is equivalent to
890 themselves in another collection. The result of the preceding example is equivalent to
891891 `push!([1, 2, 3], 4, 5, 6)`.
892892 """
893893 function append!(a::Array{<:Any,1}, items::AbstractVector)
712712 Note that `dest` is only used to store the result, and does not supply
713713 arguments to `f` unless it is also listed in the `As`,
714714 as in `broadcast!(f, A, A, B)` to perform `A[:] = broadcast(f, A, B)`.
715
716 # Examples
717 ```jldoctest
718 julia> A = [1.0; 0.0]; B = [0.0; 0.0];
719
720 julia> broadcast!(+, B, A, (0, -2.0));
721
722 julia> B
723 2-element Array{Float64,1}:
724 1.0
725 -2.0
726
727 julia> A
728 2-element Array{Float64,1}:
729 1.0
730 0.0
731
732 julia> broadcast!(+, A, A, (0, -2.0));
733
734 julia> A
735 2-element Array{Float64,1}:
736 1.0
737 -2.0
738 ```
715739 """
716740 broadcast!(f::Tf, dest, As::Vararg{Any,N}) where {Tf,N} = (materialize!(dest, broadcasted(f, As...)); dest)
717741
3131 end
3232 end
3333
34 If you want just a post-expression, supply `nothing` for the pre-expression. Using
34 If you want just a post-expression, supply [`nothing`](@ref) for the pre-expression. Using
3535 parentheses and semicolons, you can supply multi-statement expressions.
3636 """
3737 macro nloops(N, itersym, rangeexpr, args...)
5555 # If it's intended to simulate `cd`, it should instead be doing
5656 # more nearly `cd $dir && printf %s \$PWD` (with appropriate quoting),
5757 # since shell `cd` does more than just `echo` the result.
58 dir = read(`$shell -c "printf %s $(shell_escape_posixly(dir))"`, String)
58 dir = read(`$shell -c "printf '%s' $(shell_escape_posixly(dir))"`, String)
5959 end
6060 cd(dir)
6161 end
5454 rettype = Bottom
5555 edgecycle = false
5656 edges = Any[]
57 nonbot = 0 # the index of the only non-Bottom inference result if > 0
58 seen = 0 # number of signatures actually inferred
5759 for i in 1:napplicable
5860 match = applicable[i]::SimpleVector
5961 method = match[3]::Method
6062 sig = match[1]
6163 sigtuple = unwrap_unionall(sig)::DataType
6264 splitunions = false
65 this_rt = Bottom
6366 # TODO: splitunions = 1 < countunionsplit(sigtuple.parameters) * napplicable <= sv.params.MAX_UNION_SPLITTING
6467 # currently this triggers a bug in inference recursion detection
6568 if splitunions
7073 push!(edges, edge)
7174 end
7275 edgecycle |= edgecycle1::Bool
73 rettype = tmerge(rettype, rt)
74 rettype === Any && break
75 end
76 rettype === Any && break
76 this_rt = tmerge(this_rt, rt)
77 this_rt === Any && break
78 end
7779 else
78 rt, edgecycle, edge = abstract_call_method(method, sig, match[2]::SimpleVector, sv)
80 this_rt, edgecycle, edge = abstract_call_method(method, sig, match[2]::SimpleVector, sv)
7981 if edge !== nothing
8082 push!(edges, edge)
8183 end
82 rettype = tmerge(rettype, rt)
83 rettype === Any && break
84 end
85 end
86 if napplicable == 1 && !edgecycle && isa(rettype, Type) && sv.params.ipo_constant_propagation
84 end
85 if this_rt !== Bottom
86 if nonbot === 0
87 nonbot = i
88 else
89 nonbot = -1
90 end
91 end
92 seen += 1
93 rettype = tmerge(rettype, this_rt)
94 rettype === Any && break
95 end
96 # try constant propagation if only 1 method is inferred to non-Bottom
97 if nonbot > 0 && seen == napplicable && !edgecycle && isa(rettype, Type) && sv.params.ipo_constant_propagation
8798 # if there's a possibility we could constant-propagate a better result
8899 # (hopefully without doing too much work), try to do that now
89100 # TODO: it feels like this could be better integrated into abstract_call_method / typeinf_edge
90 const_rettype = abstract_call_method_with_const_args(f, argtypes, applicable[1]::SimpleVector, sv)
101 const_rettype = abstract_call_method_with_const_args(f, argtypes, applicable[nonbot]::SimpleVector, sv)
91102 if const_rettype ⊑ rettype
92103 # use the better result, if it's a refinement of rettype
93104 rettype = const_rettype
326326 bb_idx = 1
327327 new_nodes = code.new_nodes
328328 if any(i -> !isassigned(code.new_nodes, i), 1:length(code.new_nodes))
329 printstyled(io, :red, "ERROR: New node array has unset entry\n")
329 printstyled(io, "ERROR: New node array has unset entry\n", color=:red)
330330 new_nodes = new_nodes[filter(i -> isassigned(code.new_nodes, i), 1:length(code.new_nodes))]
331331 end
332332 for nn in new_nodes
353353 if !isassigned(stmts, idx)
354354 # This is invalid, but do something useful rather
355355 # than erroring, to make debugging easier
356 printstyled(io, :red, "#UNDEF\n")
356 printstyled(io, "#UNDEF\n", color=:red)
357357 continue
358358 end
359359 stmt = stmts[idx]
494494 if !isassigned(stmts, idx)
495495 # This is invalid, but do something useful rather
496496 # than erroring, to make debugging easier
497 printstyled(io, :red, "#UNDEF\n")
497 printstyled(io, "#UNDEF\n", color=:red)
498498 continue
499499 end
500500 stmt = stmts[idx]
536536 sv = s00.val
537537 end
538538 if isa(name, Const)
539 (isa(sv, Module) && isa(name.val, Symbol)) || return false
540 (isa(name.val, Symbol) || isa(name.val, Int)) || return false
539 if !isa(name.val, Symbol)
540 isa(sv, Module) && return false
541 isa(name.val, Int) || return false
542 end
541543 return isdefined(sv, name.val)
542544 end
543545 if bounds_check_disabled && !isa(sv, Module)
10551057 length(argtypes) == 1 || return false
10561058 return sizeof_nothrow(argtypes[1])
10571059 elseif f === Core.kwfunc
1058 length(argtypes) == 2 || return false
1060 length(argtypes) == 1 || return false
10591061 return isa(rt, Const)
10601062 end
10611063 return false
411411 for loop_b = (false, true)
412412 for i = (lt + 1):(loop_b ? lbr : lar)
413413 ti = unwrapva(loop_b ? bp[i] : ap[i])
414 while ti isa TypeVar
415 ti = ti.ub
416 end
414417 # compare (ti <-> tail), (wrapper ti <-> tail), (ti <-> wrapper tail), then (wrapper ti <-> wrapper tail)
415418 # until we find the first element that contains the other in the pair
416419 # TODO: this result would be more stable (and more associative and more commutative)
121121 end
122122
123123 function code_for_method(method::Method, @nospecialize(atypes), sparams::SimpleVector, world::UInt, preexisting::Bool=false)
124 if world < min_world(method)
124 if world < min_world(method) || world > max_world(method)
125125 return nothing
126126 end
127127 if isdefined(method, :generator) && !isdispatchtuple(atypes)
280280 ismacro ? macroname(x) : x
281281 # Call overloading, e.g. `(a::A)(b) = b` or `function (a::A)(b) b end` should document `A(b)`
282282 elseif (isexpr(x, :function) || isexpr(x, :(=))) && isexpr(x.args[1], :call) && isexpr(x.args[1].args[1], :(::))
283 return astname(x.args[1].args[1].args[2], ismacro)
283 return astname(x.args[1].args[1].args[end], ismacro)
284284 else
285285 n = isexpr(x, (:module, :struct)) ? 2 : 1
286286 astname(x.args[n], ismacro)
259259 """
260260 const
261261
262 `const` is used to declare global variables which are also constant. In almost all code
262 `const` is used to declare global variables whose values will not change. In almost all code
263263 (and particularly performance sensitive code) global variables should be declared
264264 constant in this way.
265265
274274
275275 Note that `const` only applies to one `=` operation, therefore `const x = y = 1`
276276 declares `x` to be constant but not `y`. On the other hand, `const x = const y = 1`
277 declares both `x` and `y` as constants.
278
279 Note that "constant-ness" is not enforced inside containers, so if `x` is an array or
280 dictionary (for example) you can still add and remove elements.
281
282 Technically, you can even redefine `const` variables, although this will generate a
283 warning from the compiler. The only strict requirement is that the *type* of the
284 variable does not change, which is why `const` variables are much faster than regular
285 globals.
277 declares both `x` and `y` constant.
278
279 Note that "constant-ness" does not extend into mutable containers; only the
280 association between a variable and its value is constant.
281 If `x` is an array or dictionary (for example) you can still modify, add, or remove elements.
282
283 In some cases changing the value of a `const` variable gives a warning instead of
284 an error.
285 However, this can produce unpredictable behavior or corrupt the state of your program,
286 and so should be avoided.
287 This feature is intended only for convenience during interactive use.
286288 """
287289 kw"const"
288290
854856 WrappedException(msg)
855857
856858 Generic type for `Exception`s wrapping another `Exception`, such as `LoadError` and
857 `InitError`. Those exceptions contain information about the the root cause of an
859 `InitError`. Those exceptions contain information about the root cause of an
858860 exception. Subtypes define a field `error` containing the causing `Exception`.
859861 """
860862 Core.WrappedException
10811083 applicable(f, args...) -> Bool
10821084
10831085 Determine whether the given generic function has a method applicable to the given arguments.
1086
1087 See also [`hasmethod`](@ref).
10841088
10851089 # Examples
10861090 ```jldoctest
11
22 # file downloading
33
4 downloadcmd = nothing
54 if Sys.iswindows()
6 downloadcmd = "powershell"
75 function download(url::AbstractString, filename::AbstractString)
86 ps = "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe"
97 tls12 = "[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12"
2422 end
2523 else
2624 function download(url::AbstractString, filename::AbstractString)
27 global downloadcmd
28 if downloadcmd === nothing
29 for checkcmd in ("curl", "wget", "fetch")
30 try
31 # Sys.which() will throw() if it can't find `checkcmd`
32 Sys.which(checkcmd)
33 downloadcmd = checkcmd
34 break
35 catch
36 end
37 end
38 end
39 if downloadcmd == "wget"
25 if Sys.which("curl") !== nothing
26 run(`curl -g -L -f -o $filename $url`)
27 elseif Sys.which("wget") !== nothing
4028 try
4129 run(`wget -O $filename $url`)
4230 catch
43 rm(filename) # wget always creates a file
31 rm(filename, force=true) # wget always creates a file
4432 rethrow()
4533 end
46 elseif downloadcmd == "curl"
47 run(`curl -g -L -f -o $filename $url`)
48 elseif downloadcmd == "fetch"
34 elseif Sys.which("fetch") !== nothing
4935 run(`fetch -f $filename $url`)
5036 else
5137 error("no download agent available; install curl, wget, or fetch")
431431 end
432432 if ex.world < min_world(method)
433433 print(iob, " (method too new to be called from this world context.)")
434 elseif ex.world > max_world(method)
435 print(iob, " (method deleted before this world age.)")
434436 end
435437 # TODO: indicate if it's in the wrong world
436438 push!(lines, (buf, right_matches))
7878 @specialize
7979
8080 Reset the specialization hint for an argument back to the default.
81 For details, see [`@specialize`](@ref).
81 For details, see [`@nospecialize`](@ref).
8282 """
8383 macro specialize(vars...)
8484 if nfields(vars) === 1
263263 end
264264 typename(union::UnionAll) = typename(union.body)
265265
266 convert(::Type{T}, x::T) where {T<:Tuple{Any, Vararg{Any}}} = x
267 convert(::Type{Tuple{}}, x::Tuple{Any, Vararg{Any}}) = throw(MethodError(convert, (Tuple{}, x)))
268 convert(::Type{T}, x::Tuple{Any, Vararg{Any}}) where {T<:Tuple} =
266 const AtLeast1 = Tuple{Any, Vararg{Any}}
267
268 # converting to empty tuple type
269 convert(::Type{Tuple{}}, ::Tuple{}) = ()
270 convert(::Type{Tuple{}}, x::AtLeast1) = throw(MethodError(convert, (Tuple{}, x)))
271
272 # converting to tuple types with at least one element
273 convert(::Type{T}, x::T) where {T<:AtLeast1} = x
274 convert(::Type{T}, x::AtLeast1) where {T<:AtLeast1} =
269275 (convert(tuple_type_head(T), x[1]), convert(tuple_type_tail(T), tail(x))...)
276
277 # converting to Vararg tuple types
278 convert(::Type{Tuple{Vararg{V}}}, x::Tuple{Vararg{V}}) where {V} = x
279 convert(T::Type{Tuple{Vararg{V}}}, x::Tuple) where {V} =
280 (convert(tuple_type_head(T), x[1]), convert(T, tail(x))...)
270281
271282 # TODO: the following definitions are equivalent (behaviorally) to the above method
272283 # I think they may be faster / more efficient for inference,
794805 iterate(iter [, state]) -> Union{Nothing, Tuple{Any, Any}}
795806
796807 Advance the iterator to obtain the next element. If no elements
797 remain, nothing should be returned. Otherwise, a 2-tuple of the
808 remain, `nothing` should be returned. Otherwise, a 2-tuple of the
798809 next element and the new iteration state should be returned.
799810 """
800811 function iterate end
316316 """
317317 cp(src::AbstractString, dst::AbstractString; force::Bool=false, follow_symlinks::Bool=false)
318318
319 Copy the file, link, or directory from `src` to `dest`.
319 Copy the file, link, or directory from `src` to `dst`.
320320 `force=true` will first remove an existing `dst`.
321321
322322 If `follow_symlinks=false`, and `src` is a symbolic link, `dst` will be created as a
125125 IteratorEltype(::Type{Generator{I,T}}) where {I,T} = EltypeUnknown()
126126
127127 IteratorEltype(::Type{Any}) = EltypeUnknown()
128 IteratorEltype(::Type{Union{}}) = EltypeUnknown()
486486
487487 divrem(x::BigInt, y::BigInt) = MPZ.tdiv_qr(x, y)
488488
489 cmp(x::BigInt, y::BigInt) = MPZ.cmp(x, y)
490 cmp(x::BigInt, y::ClongMax) = MPZ.cmp_si(x, y)
491 cmp(x::BigInt, y::CulongMax) = MPZ.cmp_ui(x, y)
489 cmp(x::BigInt, y::BigInt) = sign(MPZ.cmp(x, y))
490 cmp(x::BigInt, y::ClongMax) = sign(MPZ.cmp_si(x, y))
491 cmp(x::BigInt, y::CulongMax) = sign(MPZ.cmp_ui(x, y))
492492 cmp(x::BigInt, y::Integer) = cmp(x, big(y))
493493 cmp(x::Integer, y::BigInt) = -cmp(y, x)
494494
495 cmp(x::BigInt, y::CdoubleMax) = isnan(y) ? -1 : MPZ.cmp_d(x, y)
495 cmp(x::BigInt, y::CdoubleMax) = isnan(y) ? -1 : sign(MPZ.cmp_d(x, y))
496496 cmp(x::CdoubleMax, y::BigInt) = -cmp(y, x)
497497
498498 isqrt(x::BigInt) = MPZ.sqrt(x)
1212 ## Traits for array types ##
1313
1414 abstract type IndexStyle end
15 """
16 IndexLinear()
17
18 Subtype of [`IndexStyle`](@ref) used to describe arrays which
19 are optimally indexed by one linear index.
20
21 A linear indexing style uses one integer to describe the position in the array
22 (even if it's a multidimensional array) and column-major
23 ordering is used to access the elements. For example,
24 if `A` were a `(2, 3)` custom matrix type with linear indexing,
25 and we referenced `A[5]` (using linear style), this would
26 be equivalent to referencing `A[1, 3]` (since `2*1 + 3 = 5`).
27 See also [`IndexCartesian`](@ref).
28 """
1529 struct IndexLinear <: IndexStyle end
30 """
31 IndexCartesian()
32
33 Subtype of [`IndexStyle`](@ref) used to describe arrays which
34 are optimally indexed by a Cartesian index.
35
36 A cartesian indexing style uses multiple integers/indices to describe the position in the array.
37 For example, if `A` were a `(2, 3, 4)` custom matrix type with cartesian indexing,
38 we could reference `A[2, 1, 3]` and Julia would automatically convert this into the
39 correct location in the underlying memory. See also [`IndexLinear`](@ref).
40 """
1641 struct IndexCartesian <: IndexStyle end
1742
1843 """
2045 IndexStyle(typeof(A))
2146
2247 `IndexStyle` specifies the "native indexing style" for array `A`. When
23 you define a new `AbstractArray` type, you can choose to implement
24 either linear indexing or cartesian indexing. If you decide to
25 implement linear indexing, then you must set this trait for your array
48 you define a new [`AbstractArray`](@ref) type, you can choose to implement
49 either linear indexing (with [`IndexLinear`](@ref)) or cartesian indexing.
50 If you decide to implement linear indexing, then you must set this trait for your array
2651 type:
2752
2853 Base.IndexStyle(::Type{<:MyArray}) = IndexLinear()
2954
30 The default is `IndexCartesian()`.
55 The default is [`IndexCartesian()`](@ref).
3156
3257 Julia's internal indexing machinery will automatically (and invisibly)
3358 convert all indexing operations into the preferred style. This allows users
329354
330355 LinearIndices(inds::CartesianIndices) -> R
331356 LinearIndices(sz::Dims) -> R
332 LinearIndices(istart:istop, jstart:jstop, ...) -> R
357 LinearIndices((istart:istop, jstart:jstop, ...)) -> R
333358
334359 Return a `LinearIndices` array with the specified shape or [`axes`](@ref).
335360
137137 unsafe_string(Base.JLOptions().project) :
138138 get(ENV, "JULIA_PROJECT", nothing))
139139 HOME_PROJECT[] =
140 project == nothing ? nothing :
140141 project == "" ? nothing :
141 project == "@." ? current_project() : project
142 project == "@." ? current_project() : abspath(project)
142143 append!(empty!(LOAD_PATH), paths)
143144 end
144145
578578 @big_str str
579579 @big_str(str)
580580
581 `@big_str` parses a string into a BigInt
582 Throws an `ArgumentError` if the string is not a valid integer
583 Removes all underscores `_` from the string
581 Parse a string into a [`BigInt`](@ref) or [`BigFloat`](@ref),
582 and throw an `ArgumentError` if the string is not a valid number.
583 For integers `_` is allowed in the string as a separator.
584
585 # Examples
586 ```jldoctest
587 julia> big"123_456"
588 123456
589
590 julia> big"7891.5"
591 7.8915e+03
592 ```
584593 """
585594 macro big_str(s)
586595 if '_' in s
439439 return d
440440 end
441441
442 ndigits0znb(x::Unsigned, b::Integer) = ndigits0znb(signed(x), b)
442 # do first division before conversion with signed here, which can otherwise overflow
443 ndigits0znb(x::Unsigned, b::Integer) = ndigits0znb(-signed(fld(x, -b)), b) + (x != 0)
443444 ndigits0znb(x::Bool, b::Integer) = x % Int
444445
445446 # The suffix "pb" stands for "positive base"
542543 i = neg + max(pad,sizeof(x)<<3-leading_zeros(x))
543544 a = StringVector(i)
544545 while i > neg
545 a[i] = '0'+(x&0x1)
546 @inbounds a[i] = 48+(x&0x1)
546547 x >>= 1
547548 i -= 1
548549 end
549 if neg; a[1]='-'; end
550 if neg; @inbounds a[1]=0x2d; end
550551 String(a)
551552 end
552553
554555 i = neg + max(pad,div((sizeof(x)<<3)-leading_zeros(x)+2,3))
555556 a = StringVector(i)
556557 while i > neg
557 a[i] = '0'+(x&0x7)
558 @inbounds a[i] = 48+(x&0x7)
558559 x >>= 3
559560 i -= 1
560561 end
561 if neg; a[1]='-'; end
562 if neg; @inbounds a[1]=0x2d; end
562563 String(a)
563564 end
564565
566567 i = neg + ndigits(x, base=10, pad=pad)
567568 a = StringVector(i)
568569 while i > neg
569 a[i] = '0'+rem(x,10)
570 @inbounds a[i] = 48+rem(x,10)
570571 x = oftype(x,div(x,10))
571572 i -= 1
572573 end
573 if neg; a[1]='-'; end
574 if neg; @inbounds a[1]=0x2d; end
574575 String(a)
575576 end
576577
579580 a = StringVector(i)
580581 while i > neg
581582 d = x & 0xf
582 a[i] = '0'+d+39*(d>9)
583 @inbounds a[i] = 48+d+39*(d>9)
583584 x >>= 4
584585 i -= 1
585586 end
586 if neg; a[1]='-'; end
587 if neg; @inbounds a[1]=0x2d; end
587588 String(a)
588589 end
589590
164164 throw(EOFError())
165165 end
166166 nothing
167 end
168
169 function read(from::GenericIOBuffer, T::Union{Type{Int16},Type{UInt16},Type{Int32},Type{UInt32},Type{Int64},Type{UInt64},Type{Int128},Type{UInt128},Type{Float16},Type{Float32},Type{Float64}})
170 from.readable || throw(ArgumentError("read failed, IOBuffer is not readable"))
171 avail = bytesavailable(from)
172 nb = sizeof(T)
173 if nb > avail
174 throw(EOFError())
175 end
176 GC.@preserve from begin
177 ptr::Ptr{T} = pointer(from.data, from.ptr)
178 x = unsafe_load(ptr)
179 end
180 from.ptr += nb
181 return x
167182 end
168183
169184 function read_sub(from::GenericIOBuffer, a::AbstractArray{T}, offs, nel) where T
400400 function read(s::IOStream, T::Union{Type{Int16},Type{UInt16},Type{Int32},Type{UInt32},Type{Int64},Type{UInt64}})
401401 return ccall(:jl_ios_get_nbyte_int, UInt64, (Ptr{Cvoid}, Csize_t), s.ios, sizeof(T)) % T
402402 end
403
404 read(s::IOStream, ::Type{Float16}) = reinterpret(Float16, read(s, Int16))
405 read(s::IOStream, ::Type{Float32}) = reinterpret(Float32, read(s, Int32))
406 read(s::IOStream, ::Type{Float64}) = reinterpret(Float64, read(s, Int64))
403407 end
404408
405409 function unsafe_read(s::IOStream, p::Ptr{UInt8}, nb::UInt)
180180 for `A`, while `enumerate` always counts from 1 regardless of the indices
181181 of `A`.
182182
183 Specifying `IndexLinear()` ensures that `i` will be an integer;
184 specifying `IndexCartesian()` ensures that `i` will be a
185 `CartesianIndex`; specifying `IndexStyle(A)` chooses whichever has
183 Specifying [`IndexLinear()`](@ref) ensures that `i` will be an integer;
184 specifying [`IndexCartesian()`](@ref) ensures that `i` will be a
185 [`CartesianIndex`](@ref); specifying `IndexStyle(A)` chooses whichever has
186186 been defined as the native indexing style for array `A`.
187187
188188 Mutation of the bounds of the underlying array will invalidate this iterator.
879879 flatten_iteratorsize(::Union{HasShape, HasLength}, ::Type{<:NTuple{N,Any}}) where {N} = HasLength()
880880 flatten_iteratorsize(::Union{HasShape, HasLength}, ::Type{<:Tuple}) = SizeUnknown()
881881 flatten_iteratorsize(::Union{HasShape, HasLength}, ::Type{<:Number}) = HasLength()
882 flatten_iteratorsize(::Union{HasShape, HasLength}, ::Type{Union{}}) = SizeUnknown()
882883 flatten_iteratorsize(a, b) = SizeUnknown()
883884
884885 _flatten_iteratorsize(sz, ::EltypeUnknown, I) = SizeUnknown()
253253
254254 Return the path of `m.jl` file that was used to `import` module `m`,
255255 or `nothing` if `m` was not imported from a package.
256
257 Use [`dirname`](@ref) to get the directory part and [`basename`](@ref)
258 to get the file name part of the path.
256259 """
257260 function pathof(m::Module)
258261 pkgid = get(Base.module_keys, m, nothing)
815818 if where.uuid === nothing
816819 throw(ArgumentError("""
817820 Package $mod not found in current path:
818 - Run `Pkg.add($(repr(String(mod))))` to install the $mod package.
821 - Run `import Pkg; Pkg.add($(repr(String(mod))))` to install the $mod package.
819822 """))
820823 else
821824 s = """
495495 current_logger()
496496
497497 Return the logger for the current task, or the global logger if none is
498 is attached to the task.
498 attached to the task.
499499 """
500500 current_logger() = current_logstate().logger
501501
2626
2727 using .Base: IEEEFloat
2828
29 @noinline function throw_complex_domainerror(f, x)
29 @noinline function throw_complex_domainerror(f::Symbol, x)
3030 throw(DomainError(x, string("$f will only return a complex result if called with a ",
3131 "complex argument. Try $f(Complex(x)).")))
3232 end
197197 0.5
198198
199199 julia> log(-2, 3)
200 ERROR: DomainError with log:
201 -2.0 will only return a complex result if called with a complex argument. Try -2.0(Complex(x)).
200 ERROR: DomainError with -2.0:
201 log will only return a complex result if called with a complex argument. Try log(Complex(x)).
202202 Stacktrace:
203 [1] throw_complex_domainerror(::Float64, ::Symbol) at ./math.jl:31
203 [1] throw_complex_domainerror(::Symbol, ::Float64) at ./math.jl:31
204204 [...]
205205
206206 julia> log(2, -3)
207 ERROR: DomainError with log:
208 -3.0 will only return a complex result if called with a complex argument. Try -3.0(Complex(x)).
207 ERROR: DomainError with -3.0:
208 log will only return a complex result if called with a complex argument. Try log(Complex(x)).
209209 Stacktrace:
210 [1] throw_complex_domainerror(::Float64, ::Symbol) at ./math.jl:31
210 [1] throw_complex_domainerror(::Symbol, ::Float64) at ./math.jl:31
211211 [...]
212212 ```
213213
392392
393393 Compute the natural logarithm of `x`. Throws [`DomainError`](@ref) for negative
394394 [`Real`](@ref) arguments. Use complex negative arguments to obtain complex results.
395
396 # Examples
397 ```jldoctest; filter = r"Stacktrace:(\\n \\[[0-9]+\\].*)*"
398 julia> log(2)
399 0.6931471805599453
400
401 julia> log(-3)
402 ERROR: DomainError with -3.0:
403 log will only return a complex result if called with a complex argument. Try log(Complex(x)).
404 Stacktrace:
405 [1] throw_complex_domainerror(::Symbol, ::Float64) at ./math.jl:31
406 [...]
407 ```
395408 """
396409 log(x::Number)
397410
458471 0.0
459472
460473 julia> log1p(-2)
461 ERROR: DomainError with log1p:
462 -2.0 will only return a complex result if called with a complex argument. Try -2.0(Complex(x)).
474 ERROR: DomainError with -2.0:
475 log1p will only return a complex result if called with a complex argument. Try log1p(Complex(x)).
463476 Stacktrace:
464 [1] throw_complex_domainerror(::Float64, ::Symbol) at ./math.jl:31
477 [1] throw_complex_domainerror(::Symbol, ::Float64) at ./math.jl:31
465478 [...]
466479 ```
467480 """
708721 without any intermediate rounding.
709722
710723 - if `r == RoundNearest`, then the result is exact, and in the interval
711 ``[-|y|/2, |y|/2]``.
724 ``[-|y|/2, |y|/2]``. See also [`RoundNearest`](@ref).
712725
713726 - if `r == RoundToZero` (default), then the result is exact, and in the interval
714 ``[0, |y|)`` if `x` is positive, or ``(-|y|, 0]`` otherwise.
727 ``[0, |y|)`` if `x` is positive, or ``(-|y|, 0]`` otherwise. See also [`RoundToZero`](@ref).
715728
716729 - if `r == RoundDown`, then the result is in the interval ``[0, y)`` if `y` is positive, or
717730 ``(y, 0]`` otherwise. The result may not be exact if `x` and `y` have different signs, and
718 `abs(x) < abs(y)`.
731 `abs(x) < abs(y)`. See also[`RoundDown`](@ref).
719732
720733 - if `r == RoundUp`, then the result is in the interval `(-y,0]` if `y` is positive, or
721734 `[0,-y)` otherwise. The result may not be exact if `x` and `y` have the same sign, and
722 `abs(x) < abs(y)`.
735 `abs(x) < abs(y)`. See also [`RoundUp`](@ref).
723736
724737 """
725738 rem(x, y, ::RoundingMode{:ToZero}) = rem(x,y)
819832 2π, and so will give a more accurate result than `rem(x,2π,r)`
820833
821834 - if `r == RoundNearest`, then the result is in the interval ``[-π, π]``. This will generally
822 be the most accurate result.
835 be the most accurate result. See also [`RoundNearest`](@ref).
823836
824837 - if `r == RoundToZero`, then the result is in the interval ``[0, 2π]`` if `x` is positive,.
825 or ``[-2π, 0]`` otherwise.
838 or ``[-2π, 0]`` otherwise. See also [`RoundToZero`](@ref).
826839
827840 - if `r == RoundDown`, then the result is in the interval ``[0, 2π]``.
828
841 See also [`RoundDown`](@ref).
829842 - if `r == RoundUp`, then the result is in the interval ``[-2π, 0]``.
843 See also [`RoundUp`](@ref).
830844
831845 # Examples
832846 ```jldoctest
7575
7676 function kwarg_decl(m::Method, kwtype::DataType)
7777 sig = rewrap_unionall(Tuple{kwtype, Any, unwrap_unionall(m.sig).parameters...}, m.sig)
78 kwli = ccall(:jl_methtable_lookup, Any, (Any, Any, UInt), kwtype.name.mt, sig, typemax(UInt))
78 kwli = ccall(:jl_methtable_lookup, Any, (Any, Any, UInt), kwtype.name.mt, sig, max_world(m))
7979 if kwli !== nothing
8080 kwli = kwli::Method
8181 src = uncompressed_ast(kwli)
155155 # Iteration
156156 """
157157 CartesianIndices(sz::Dims) -> R
158 CartesianIndices(istart:istop, jstart:jstop, ...) -> R
158 CartesianIndices((istart:istop, jstart:jstop, ...)) -> R
159159
160160 Define a region `R` spanning a multidimensional rectangular range
161161 of integer indices. These are most commonly encountered in the
4242 false
4343 ```
4444 """
45 showable(::MIME{mime}, x) where {mime} = hasmethod(show, Tuple{IO, MIME{mime}, typeof(x)})
46 showable(m::AbstractString, x) = showable(MIME(m), x)
45 showable(::MIME{mime}, @nospecialize x) where {mime} = hasmethod(show, Tuple{IO, MIME{mime}, typeof(x)})
46 showable(m::AbstractString, @nospecialize x) = showable(MIME(m), x)
4747
4848 """
4949 show(io, mime, x)
174174 abstract type AbstractDisplay end
175175
176176 # it is convenient to accept strings instead of ::MIME
177 display(d::AbstractDisplay, mime::AbstractString, x) = display(d, MIME(mime), x)
178 display(mime::AbstractString, x) = display(MIME(mime), x)
177 display(d::AbstractDisplay, mime::AbstractString, @nospecialize x) = display(d, MIME(mime), x)
178 display(mime::AbstractString, @nospecialize x) = display(MIME(mime), x)
179179
180180 """
181181 displayable(mime) -> Bool
200200 struct TextDisplay <: AbstractDisplay
201201 io::IO
202202 end
203 display(d::TextDisplay, M::MIME"text/plain", x) = show(d.io, M, x)
204 display(d::TextDisplay, x) = display(d, MIME"text/plain"(), x)
203 display(d::TextDisplay, M::MIME"text/plain", @nospecialize x) = show(d.io, M, x)
204 display(d::TextDisplay, @nospecialize x) = display(d, MIME"text/plain"(), x)
205205
206206 # if you explicitly call display("text/foo", x), it should work on a TextDisplay:
207207 displayable(d::TextDisplay, M::MIME) = istextmime(M)
208 function display(d::TextDisplay, M::MIME, x)
208 function display(d::TextDisplay, M::MIME, @nospecialize x)
209209 displayable(d, M) || throw(MethodError(display, (d, M, x)))
210210 show(d.io, M, x)
211211 end
253253 pushdisplay(TextDisplay(stdout))
254254 end
255255
256 xdisplayable(D::AbstractDisplay, args...) = applicable(display, D, args...)
256 xdisplayable(D::AbstractDisplay, @nospecialize args...) = applicable(display, D, args...)
257257
258258 """
259259 display(x)
279279 `x::AbstractString` (for MIME types with text-based storage, such as text/html or
280280 application/postscript) or `x::Vector{UInt8}` (for binary MIME types).
281281 """
282 function display(x)
282 function display(@nospecialize x)
283283 for i = length(displays):-1:1
284284 if xdisplayable(displays[i], x)
285285 try
293293 throw(MethodError(display, (x,)))
294294 end
295295
296 function display(m::MIME, x)
296 function display(m::MIME, @nospecialize x)
297297 for i = length(displays):-1:1
298298 if xdisplayable(displays[i], m, x)
299299 try
338338 several times, and the backend may choose to defer the display until
339339 (for example) the next interactive prompt.
340340 """
341 function redisplay(x)
341 function redisplay(@nospecialize x)
342342 for i = length(displays):-1:1
343343 if xdisplayable(displays[i], x)
344344 try
352352 throw(MethodError(redisplay, (x,)))
353353 end
354354
355 function redisplay(m::Union{MIME,AbstractString}, x)
355 function redisplay(m::Union{MIME,AbstractString}, @nospecialize x)
356356 for i = length(displays):-1:1
357357 if xdisplayable(displays[i], m, x)
358358 try
367367 end
368368
369369 # default redisplay is simply to call display
370 redisplay(d::AbstractDisplay, x) = display(d, x)
371 redisplay(d::AbstractDisplay, m::Union{MIME,AbstractString}, x) = display(d, m, x)
370 redisplay(d::AbstractDisplay, @nospecialize x) = display(d, x)
371 redisplay(d::AbstractDisplay, m::Union{MIME,AbstractString}, @nospecialize x) = display(d, m, x)
372372
373373 ###########################################################################
374374
105105 return nothing
106106 end
107107
108 base = convert(T,base)
109 m::T = div(typemax(T)-base+1,base)
108 base = convert(T, base)
109 m::T = div(typemax(T) - base + 1, base)
110110 n::T = 0
111111 a::Int = base <= 36 ? 10 : 36
112 _0 = UInt32('0')
113 _9 = UInt32('9')
114 _A = UInt32('A')
115 _a = UInt32('a')
116 _Z = UInt32('Z')
117 _z = UInt32('z')
112118 while n <= m
113 d::T = '0' <= c <= '9' ? c-'0' :
114 'A' <= c <= 'Z' ? c-'A'+10 :
115 'a' <= c <= 'z' ? c-'a'+a : base
119 _c = UInt32(c)
120 d::T = _0 <= _c <= _9 ? _c-_0 :
121 _A <= _c <= _Z ? _c-_A+ UInt32(10) :
122 _a <= _c <= _z ? _c-_a+a : base
116123 if d >= base
117124 raise && throw(ArgumentError("invalid base $base digit $(repr(c)) in $(repr(SubString(s,startpos,endpos)))"))
118125 return nothing
128135 end
129136 (T <: Signed) && (n *= sgn)
130137 while !isspace(c)
131 d::T = '0' <= c <= '9' ? c-'0' :
132 'A' <= c <= 'Z' ? c-'A'+10 :
133 'a' <= c <= 'z' ? c-'a'+a : base
138 _c = UInt32(c)
139 d::T = _0 <= _c <= _9 ? _c-_0 :
140 _A <= _c <= _Z ? _c-_A+ UInt32(10) :
141 _a <= _c <= _z ? _c-_a+a : base
134142 if d >= base
135143 raise && throw(ArgumentError("invalid base $base digit $(repr(c)) in $(repr(SubString(s,startpos,endpos)))"))
136144 return nothing
862862 @handle_zero x digits
863863 pt = i = div((sizeof(x)<<3)-leading_zeros(x)+2,3)
864864 while i > 0
865 digits[i] = '0'+(x&0x7)
865 digits[i] = 48+(x&0x7)
866866 x >>= 3
867867 i -= 1
868868 end
875875 pt = i = div((sizeof(x)<<3)-leading_zeros(x)+5,3)
876876 digits = DIGITSs[Threads.threadid()]
877877 while i > 0
878 digits[i] = '0'+(x&0x7)
878 digits[i] = 48+(x&0x7)
879879 x >>= 3
880880 i -= 1
881881 end
888888 @handle_zero x digits
889889 pt = i = Base.ndigits0z(x)
890890 while i > 0
891 digits[i] = '0'+rem(x,10)
891 digits[i] = 48+rem(x,10)
892892 x = div(x,10)
893893 i -= 1
894894 end
624624 return ret
625625 end
626626
627 """
628 read(command::Cmd)
629
630 Run `command` and return the resulting output as an array of bytes.
631 """
627632 function read(cmd::AbstractCmd)
628633 procs = open(cmd, "r", devnull)
629634 bytes = read(procs.out)
631636 return bytes
632637 end
633638
639 """
640 read(command::Cmd, String)
641
642 Run `command` and return the resulting output as a `String`.
643 """
634644 read(cmd::AbstractCmd, ::Type{String}) = String(read(cmd))
635645
636646 """
1313 typejoin(@nospecialize(t), ts...) = (@_pure_meta; typejoin(t, typejoin(ts...)))
1414 function typejoin(@nospecialize(a), @nospecialize(b))
1515 @_pure_meta
16 if a <: b
16 if isa(a, TypeVar)
17 return typejoin(a.ub, b)
18 elseif isa(b, TypeVar)
19 return typejoin(a, b.ub)
20 elseif a <: b
1721 return b
1822 elseif b <: a
1923 return a
2125 return UnionAll(a.var, typejoin(a.body, b))
2226 elseif isa(b, UnionAll)
2327 return UnionAll(b.var, typejoin(a, b.body))
24 elseif isa(a, TypeVar)
25 return typejoin(a.ub, b)
26 elseif isa(b, TypeVar)
27 return typejoin(a, b.ub)
2828 elseif isa(a, Union)
2929 return typejoin(typejoin(a.a, a.b), b)
3030 elseif isa(b, Union)
179179 mapreduce(f, op, itr; [init])
180180
181181 Apply function `f` to each element in `itr`, and then reduce the result using the binary
182 function `op`. If provided, `init` must be a neutral element for `op` that will be returne
182 function `op`. If provided, `init` must be a neutral element for `op` that will be returned
183183 for empty collections. It is unspecified whether `init` is used for non-empty collections.
184184 In general, it will be necessary to provide `init` to work with empty collections.
185185
10071007 Determine whether the given generic function has a method matching the given
10081008 `Tuple` of argument types with the upper bound of world age given by `world`.
10091009
1010 See also [`applicable`](@ref).
1011
10101012 # Examples
10111013 ```jldoctest
10121014 julia> hasmethod(length, Tuple{Array})
11001102 has_bottom_parameter(::Any) = false
11011103
11021104 min_world(m::Method) = reinterpret(UInt, m.min_world)
1103 max_world(m::Method) = typemax(UInt)
1105 max_world(m::Method) = reinterpret(UInt, m.max_world)
11041106 min_world(m::Core.MethodInstance) = reinterpret(UInt, m.min_world)
11051107 max_world(m::Core.MethodInstance) = reinterpret(UInt, m.max_world)
11061108
66 const DEFAULT_COMPILER_OPTS = PCRE.UTF | PCRE.NO_UTF_CHECK | PCRE.ALT_BSUX | PCRE.UCP
77 const DEFAULT_MATCH_OPTS = PCRE.NO_UTF_CHECK
88
9 """
10 Regex(pattern[, flags])
11
12 A type representing a regular expression. `Regex` objects can be used to match strings
13 with [`match`](@ref).
14
15 `Regex` objects can be created using the [`@r_str`](@ref) string macro. The
16 `Regex(pattern[, flags])` constructor is usually used if the `pattern` string needs
17 to be interpolated. See the documentation of the string macro for details on flags.
18 """
919 mutable struct Regex
1020 pattern::String
1121 compile_options::UInt32
7989 - `a` disables `UCP` mode (enables ASCII mode). By default `\\B`, `\\b`, `\\D`, `\\d`, `\\S`,
8090 `\\s`, `\\W`, `\\w`, etc. match based on Unicode character properties. With this option,
8191 these sequences only match ASCII characters.
92
93 See `Regex` if interpolation is needed.
8294
8395 # Examples
8496 ```jldoctest
102102 inds = _to_subscript_indices(a, i)
103103 _getindex_ra(a, inds[1], tail(inds))
104104 end
105
106 @inline _memcpy!(dst, src, n) = ccall(:memcpy, Cvoid, (Ptr{UInt8}, Ptr{UInt8}, Csize_t), dst, src, n)
105107
106108 @inline @propagate_inbounds function _getindex_ra(a::ReinterpretArray{T,N,S}, i1::Int, tailinds::TT) where {T,N,S,TT}
107109 # Make sure to match the scalar reinterpret if that is applicable
122124 # once it knows the data layout
123125 while nbytes_copied < sizeof(T)
124126 s[] = a.parent[ind_start + i, tailinds...]
125 while nbytes_copied < sizeof(T) && sidx < sizeof(S)
126 unsafe_store!(tptr, unsafe_load(sptr, sidx + 1), nbytes_copied + 1)
127 sidx += 1
128 nbytes_copied += 1
129 end
127 nb = min(sizeof(S) - sidx, sizeof(T)-nbytes_copied)
128 _memcpy!(tptr + nbytes_copied, sptr + sidx, nb)
129 nbytes_copied += nb
130130 sidx = 0
131131 i += 1
132132 end
172172 # element from the original array and overwrite the relevant parts
173173 if sidx != 0
174174 s[] = a.parent[ind_start + i, tailinds...]
175 while nbytes_copied < sizeof(T) && sidx < sizeof(S)
176 unsafe_store!(sptr, unsafe_load(tptr, nbytes_copied + 1), sidx + 1)
177 sidx += 1
178 nbytes_copied += 1
179 end
175 nb = min(sizeof(S) - sidx, sizeof(T))
176 _memcpy!(sptr + sidx, tptr, nb)
177 nbytes_copied += nb
180178 a.parent[ind_start + i, tailinds...] = s[]
181179 i += 1
182180 sidx = 0
183181 end
184182 # Deal with the main body of elements
185183 while nbytes_copied < sizeof(T) && (sizeof(T) - nbytes_copied) > sizeof(S)
186 while nbytes_copied < sizeof(T) && sidx < sizeof(S)
187 unsafe_store!(sptr, unsafe_load(tptr, nbytes_copied + 1), sidx + 1)
188 sidx += 1
189 nbytes_copied += 1
190 end
184 nb = min(sizeof(S), sizeof(T) - nbytes_copied)
185 _memcpy!(sptr, tptr + nbytes_copied, nb)
186 nbytes_copied += nb
191187 a.parent[ind_start + i, tailinds...] = s[]
192188 i += 1
193 sidx = 0
194189 end
195190 # Deal with trailing partial elements
196191 if nbytes_copied < sizeof(T)
197192 s[] = a.parent[ind_start + i, tailinds...]
198 while nbytes_copied < sizeof(T) && sidx < sizeof(S)
199 unsafe_store!(sptr, unsafe_load(tptr, nbytes_copied + 1), sidx + 1)
200 sidx += 1
201 nbytes_copied += 1
202 end
193 nb = min(sizeof(S), sizeof(T) - nbytes_copied)
194 _memcpy!(sptr, tptr + nbytes_copied, nb)
203195 a.parent[ind_start + i, tailinds...] = s[]
204196 end
205197 end
221221 I = ind2sub_rs(axes(A.parent), A.mi, i)
222222 _unsafe_getindex_rs(parent(A), I)
223223 end
224 _unsafe_getindex_rs(A, i::Integer) = (@inbounds ret = A[i]; ret)
224 @inline _unsafe_getindex_rs(A, i::Integer) = (@inbounds ret = A[i]; ret)
225225 @inline _unsafe_getindex_rs(A, I) = (@inbounds ret = A[I...]; ret)
226226
227227 @inline function setindex!(A::ReshapedArrayLF, val, index::Int)
6565 rehash!(s::Set) = (rehash!(s.dict); s)
6666
6767 iterate(s::Set, i...) = iterate(KeySet(s.dict), i...)
68
69 # In case the size(s) is smaller than size(t) its more efficient to iterate through
70 # elements of s instead and only delete the ones also contained in t.
71 # The threshold for this decision boils down to a tradeoff between
72 # size(s) * cost(in() + delete!()) ≶ size(t) * cost(delete!())
73 # Empirical observations on Ints point towards a threshold of 0.8.
74 # To be on the safe side (e.g. cost(in) >>> cost(delete!) ) a
75 # conservative threshold of 0.5 was chosen.
76 function setdiff!(s::Set, t::Set)
77 if 2 * length(s) < length(t)
78 for x in s
79 x in t && delete!(s, x)
80 end
81 else
82 for x in t
83 delete!(s, x)
84 end
85 end
86 return s
87 end
6888
6989 """
7090 unique(itr)
369369 struct QuickSortAlg <: Algorithm end
370370 struct MergeSortAlg <: Algorithm end
371371
372 """
373 PartialQuickSort{T <: Union{Int,OrdinalRange}}
374
375 Indicate that a sorting function should use the partial quick sort
376 algorithm. Partial quick sort returns the smallest `k` elements sorted from smallest
377 to largest, finding them and sorting them using [`QuickSort`](@ref).
378
379 Characteristics:
380 * *not stable*: does not preserve the ordering of elements which
381 compare equal (e.g. "a" and "A" in a sort of letters which
382 ignores case).
383 * *in-place* in memory.
384 * *divide-and-conquer*: sort strategy similar to [`MergeSort`](@ref).
385 """
372386 struct PartialQuickSort{T <: Union{Int,OrdinalRange}} <: Algorithm
373387 k::T
374388 end
378392 Base.first(a::PartialQuickSort) = first(a.k)
379393 Base.last(a::PartialQuickSort) = last(a.k)
380394
395 """
396 InsertionSort
397
398 Indicate that a sorting function should use the insertion sort
399 algorithm. Insertion sort traverses the collection one element
400 at a time, inserting each element into its correct, sorted position in
401 the output list.
402
403 Characteristics:
404 * *stable*: preserves the ordering of elements which
405 compare equal (e.g. "a" and "A" in a sort of letters
406 which ignores case).
407 * *in-place* in memory.
408 * *quadratic performance* in the number of elements to be sorted:
409 it is well-suited to small collections but should not be used for large ones.
410 """
381411 const InsertionSort = InsertionSortAlg()
412 """
413 QuickSort
414
415 Indicate that a sorting function should use the quick sort
416 algorithm, which is *not* stable.
417
418 Characteristics:
419 * *not stable*: does not preserve the ordering of elements which
420 compare equal (e.g. "a" and "A" in a sort of letters which
421 ignores case).
422 * *in-place* in memory.
423 * *divide-and-conquer*: sort strategy similar to [`MergeSort`](@ref).
424 * *good performance* for large collections.
425 """
382426 const QuickSort = QuickSortAlg()
427 """
428 MergeSort
429
430 Indicate that a sorting function should use the merge sort
431 algorithm. Merge sort divides the collection into
432 subcollections and repeatedly merges them, sorting each
433 subcollection at each step, until the entire
434 collection has been recombined in sorted form.
435
436 Characteristics:
437 * *stable*: preserves the ordering of elements which compare
438 equal (e.g. "a" and "A" in a sort of letters which ignores
439 case).
440 * *not in-place* in memory.
441 * *divide-and-conquer* sort strategy.
442 """
383443 const MergeSort = MergeSortAlg()
384444
385445 const DEFAULT_UNSTABLE = QuickSort
281281 elseif isnan(x)
282282 NaN
283283 else
284 throw_complex_domainerror(x, :log)
284 throw_complex_domainerror(:log, x)
285285 end
286286 end
287287
317317 elseif isnan(x)
318318 NaN32
319319 else
320 throw_complex_domainerror(x, :log)
320 throw_complex_domainerror(:log, x)
321321 end
322322 end
323323
352352 elseif isnan(x)
353353 NaN
354354 else
355 throw_complex_domainerror(x, :log1p)
355 throw_complex_domainerror(:log1p, x)
356356 end
357357 end
358358
385385 elseif isnan(x)
386386 NaN32
387387 else
388 throw_complex_domainerror(x, :log1p)
388 throw_complex_domainerror(:log1p, x)
389389 end
390390 end
391391
207207 end
208208
209209 """
210 rem_pio2_kernel(x, xhp)
210 rem_pio2_kernel(x)
211211
212212 Return the remainder of `x` modulo π/2 as a double-double pair, along with a `k`
213213 such that ``k \\mod 3 == K \\mod 3`` where ``K*π/2 = x - rem``. Note, that it is
1010 The representation used by `print` includes minimal formatting and tries to
1111 avoid Julia-specific details.
1212
13 Printing `nothing` is deprecated and will throw an error in the future.
13 Printing `nothing` is not allowed and throws an error.
1414
1515 # Examples
1616 ```jldoctest
8080
8181 The optional keyword argument `context` can be set to `:key=>value` pair
8282 or an `IO` or [`IOContext`](@ref) object whose attributes are used for the I/O
83 stream passed to `f`. The optional `sizehint` is a suggersted (in bytes)
83 stream passed to `f`. The optional `sizehint` is a suggested size (in bytes)
8484 to allocate for the buffer used to write the string.
8585
8686 # Examples
102102 String(resize!(s.data, s.size))
103103 end
104104
105 tostr_sizehint(x) = 0
105 tostr_sizehint(x) = 8
106106 tostr_sizehint(x::AbstractString) = lastindex(x)
107107 tostr_sizehint(x::Float64) = 20
108108 tostr_sizehint(x::Float32) = 12
109109
110 function print_to_string(xs...; env=nothing)
110 function print_to_string(xs...)
111111 if isempty(xs)
112112 return ""
113113 end
114 siz = 0
115 for x in xs
116 siz += tostr_sizehint(x)
117 end
114118 # specialized for performance reasons
115 s = IOBuffer(sizehint=tostr_sizehint(xs[1]))
116 if env !== nothing
117 env_io = IOContext(s, env)
118 for x in xs
119 print(env_io, x)
120 end
121 else
122 for x in xs
123 print(s, x)
124 end
119 s = IOBuffer(sizehint=siz)
120 for x in xs
121 print(s, x)
125122 end
126123 String(resize!(s.data, s.size))
127124 end
128125
129 string_with_env(env, xs...) = print_to_string(xs...; env=env)
126 function string_with_env(env, xs...)
127 if isempty(xs)
128 return ""
129 end
130 siz = 0
131 for x in xs
132 siz += tostr_sizehint(x)
133 end
134 # specialized for performance reasons
135 s = IOBuffer(sizehint=siz)
136 env_io = IOContext(s, env)
137 for x in xs
138 print(env_io, x)
139 end
140 String(resize!(s.data, s.size))
141 end
130142
131143 """
132144 string(xs...)
133145
134 Create a string from any values using the [`print`](@ref) function.
146 Create a string from any values, except `nothing`, using the [`print`](@ref) function.
135147
136148 # Examples
137149 ```jldoctest
222234 Join an array of `strings` into a single string, inserting the given delimiter between
223235 adjacent strings. If `last` is given, it will be used instead of `delim` between the last
224236 two strings. If `io` is given, the result is written to `io` rather than returned as
225 as a `String`. For example,
237 as a `String`.
226238
227239 # Examples
228240 ```jldoctest
141141 end
142142 end
143143
144 function string(a::Union{String, SubString{String}}...)
145 if length(a) == 1
146 return String(a[1])
147 end
144 string(a::String) = String(a)
145 string(a::SubString{String}) = String(a)
146
147 function string(a::Union{Char, String, SubString{String}}...)
148148 n = 0
149 for str in a
150 n += sizeof(str)
149 for v in a
150 if v isa Char
151 n += codelen(v)
152 else
153 n += sizeof(v)
154 end
151155 end
152156 out = _string_n(n)
153157 offs = 1
154 for str in a
155 unsafe_copyto!(pointer(out,offs), pointer(str), sizeof(str))
156 offs += sizeof(str)
158 for v in a
159 if v isa Char
160 x = bswap(reinterpret(UInt32, v))
161 for j in 1:codelen(v)
162 unsafe_store!(pointer(out, offs), x % UInt8)
163 offs += 1
164 x >>= 8
165 end
166 else
167 unsafe_copyto!(pointer(out,offs), pointer(v), sizeof(v))
168 offs += sizeof(v)
169 end
157170 end
158171 return out
159172 end
6565 """
6666 parentindices(A)
6767
68 From an array view `A`, returns the corresponding indices in the parent.
68 Return the indices in the [`parent`](@ref) which correspond to the array view `A`.
69
70 # Examples
71 ```jldoctest
72 julia> A = [1 2; 3 4];
73
74 julia> V = view(A, 1, :)
75 2-element view(::Array{Int64,2}, 1, :) with eltype Int64:
76 1
77 2
78
79 julia> parentindices(V)
80 (1, Base.Slice(Base.OneTo(2)))
81 ```
6982 """
7083 parentindices(a::AbstractArray) = map(OneTo, size(a))
7184
3737
3838 ## iterating ##
3939
40 iterate(t::Tuple, i::Int=1) = length(t) < i ? nothing : (t[i], i+1)
40 iterate(t::Tuple, i::Int=1) = 1 <= i <= length(t) ? (@inbounds t[i], i+1) : nothing
4141
4242 keys(@nospecialize t::Tuple) = OneTo(length(t))
4343
5656
5757 # this allows partial evaluation of bounded sequences of next() calls on tuples,
5858 # while reducing to plain next() for arbitrary iterables.
59 indexed_iterate(t::Tuple, i::Int, state=1) = (@_inline_meta; (t[i], i+1))
59 indexed_iterate(t::Tuple, i::Int, state=1) = (@_inline_meta; (getfield(t, i), i+1))
6060 indexed_iterate(a::Array, i::Int, state=1) = (@_inline_meta; (a[i], i+1))
6161 function indexed_iterate(I, i)
6262 x = iterate(I)
331331 asF64(x::AbstractFloat) = Float64(x)
332332 asF64(x::Tuple{AbstractFloat,AbstractFloat}) = Float64(x[1]) + Float64(x[2])
333333
334 # Defined to prevent splatting in the function below which here has a performance impact
335 _TP(x) = TwicePrecision{Float64}(x)
336 _TP(x::Tuple{Any, Any}) = TwicePrecision{Float64}(x[1], x[2])
334337 function steprangelen_hp(::Type{Float64}, ref::F_or_FF,
335338 step::F_or_FF, nb::Integer,
336339 len::Integer, offset::Integer)
337 StepRangeLen(TwicePrecision{Float64}(ref...),
338 twiceprecision(TwicePrecision{Float64}(step...), nb), Int(len), offset)
340 StepRangeLen(_TP(ref),
341 twiceprecision(_TP(step), nb), Int(len), offset)
339342 end
340343
341344 function steprangelen_hp(::Type{T}, ref::F_or_FF,
353356
354357 # Construct range for rational start=start_n/den, step=step_n/den
355358 function floatrange(::Type{T}, start_n::Integer, step_n::Integer, len::Integer, den::Integer) where T
356 if len < 2
359 if len < 2 || step_n == 0
357360 return steprangelen_hp(T, (start_n, den), (step_n, den), 0, Int(len), 1)
358361 end
359362 # index of smallest-magnitude value
475475 write(s, c)
476476 end
477477 end
478 return s
478 return seekstart(s)
479479 end
480480 else
481481 function getpass(input::TTY, output::IO, prompt::AbstractString)
00 # This file is a part of Julia. License is MIT: https://julialang.org/license
11
2 """
3 Represents a Universally Unique Identifier (UUID).
4 Can be built from one `UInt128` (all byte values), two `UInt64`, or four `UInt32`.
5 Conversion from a string will check the UUID validity.
6 """
27 struct UUID
38 value::UInt128
49 end
712 (UInt128(u[3]) << 32) | UInt128(u[4]))
813
914 function convert(::Type{NTuple{2, UInt64}}, uuid::UUID)
10 uuid = uuid.value
11 hi = UInt64((uuid >> 64) & 0xffffffffffffffff)
12 lo = UInt64(uuid & 0xffffffffffffffff)
15 bytes = uuid.value
16 hi = UInt64((bytes >> 64) & 0xffffffffffffffff)
17 lo = UInt64(bytes & 0xffffffffffffffff)
1318 return (hi, lo)
1419 end
1520
1621 function convert(::Type{NTuple{4, UInt32}}, uuid::UUID)
17 uuid = uuid.value
18 hh = UInt32((uuid >> 96) & 0xffffffff)
19 hl = UInt32((uuid >> 64) & 0xffffffff)
20 lh = UInt32((uuid >> 32) & 0xffffffff)
21 ll = UInt32(uuid & 0xffffffff)
22 bytes = uuid.value
23 hh = UInt32((bytes >> 96) & 0xffffffff)
24 hl = UInt32((bytes >> 64) & 0xffffffff)
25 lh = UInt32((bytes >> 32) & 0xffffffff)
26 ll = UInt32(bytes & 0xffffffff)
2227 return (hh, hl, lh, ll)
2328 end
2429
77 Base.reinit_stdio()
88 end
99 Base.include(@__MODULE__, joinpath(Sys.BINDIR, "..", "share", "julia", "test", "testhelpers", "FakePTYs.jl"))
10 import .FakePTYs: with_fake_pty
10 import .FakePTYs: open_fake_pty
1111
1212 CTRL_C = '\x03'
1313 UP_ARROW = "\e[A"
4242 precompile_script *= Pkg.precompile_script
4343 end
4444
45 push!(LOAD_PATH, Sys.STDLIB)
46 using Sockets
47 Sockets.__init__()
48 using Libdl
49 empty!(LOAD_PATH)
50
4551 function generate_precompile_statements()
4652 start_time = time()
4753
6167 empty!(DEPOT_PATH)
6268 end
6369
64 # Create a staging area where all the loaded packages are available
65 PrecompileStagingArea = Module()
66 for (_pkgid, _mod) in Base.loaded_modules
67 if !(_pkgid.name in ("Main", "Core", "Base"))
68 eval(PrecompileStagingArea, :($(Symbol(_mod)) = $_mod))
70 print("Generating precompile statements...")
71 sysimg = Base.unsafe_string(Base.JLOptions().image_file)
72 mktemp() do precompile_file, _
73 # Run a repl process and replay our script
74 repl_output_buffer = IOBuffer()
75 @static if Sys.iswindows()
76 # Fake being cygwin
77 pipename = """\\\\?\\pipe\\cygwin-$("0"^16)-pty10-abcdef"""
78 server = listen(pipename)
79 slave = connect(pipename)
80 @assert ccall(:jl_ispty, Cint, (Ptr{Cvoid},), slave.handle) == 1
81 master = accept(server)
82 else
83 slave, master = open_fake_pty()
6984 end
70 end
71
72 # TODO: Implement REPL replayer for Windows
73 @static if !Sys.iswindows()
74 print("Generating precompile statements...")
75 sysimg = isempty(ARGS) ? joinpath(dirname(Sys.BINDIR), "lib", "julia", "sys.ji") : ARGS[1]
76
77 mktemp() do precompile_file, _
78 # Run a repl process and replay our script
79 stdout_accumulator, stderr_accumulator = IOBuffer(), IOBuffer()
80 with_fake_pty() do slave, master
81 with_fake_pty() do slave_err, master_err
82 done = false
83 withenv("JULIA_HISTORY" => tempname(), "JULIA_PROJECT" => nothing,
84 "TERM" => "") do
85 p = run(`$(julia_cmd()) -O0 --trace-compile=$precompile_file --sysimage $sysimg
86 --startup-file=no --color=yes`,
87 slave, slave, slave_err; wait=false)
88 readuntil(master, "julia>", keep=true)
89 for (tty, accumulator) in (master => stdout_accumulator,
90 master_err => stderr_accumulator)
91 @async begin
92 while true
93 done && break
94 write(accumulator, readavailable(tty))
95 end
96 end
85 done = false
86 withenv("JULIA_HISTORY" => tempname(), "JULIA_PROJECT" => nothing,
87 "TERM" => "") do
88 if have_repl
89 p = run(`$(julia_cmd()) -O0 --trace-compile=$precompile_file --sysimage $sysimg
90 --compile=all --startup-file=no --color=yes
91 -e 'import REPL; REPL.Terminals.is_precompiling[] = true'
92 -i`,
93 slave, slave, slave; wait=false)
94 readuntil(master, "julia>", keep=true)
95 t = @async begin
96 while true
97 sleep(0.5)
98 s = String(readavailable(master))
99 write(repl_output_buffer, s)
100 if occursin("__PRECOMPILE_END__", s)
101 break
97102 end
98 if have_repl
99 for l in split(precompile_script, '\n'; keepempty=false)
100 write(master, l, '\n')
101 end
102 end
103 write(master, "exit()\n")
104 wait(p)
105 done = true
106103 end
107104 end
105 if have_repl
106 for l in split(precompile_script, '\n'; keepempty=false)
107 write(master, l, '\n')
108 end
109 end
110 write(master, "print(\"__PRECOMPILE\", \"_END__\")", '\n')
111 wait(t)
112
113 # TODO Figure out why exit() on Windows doesn't exit the process
114 if Sys.iswindows()
115 print(master, "ccall(:_exit, Cvoid, (Cint,), 0)\n")
116 else
117 write(master, "exit()\n")
118 readuntil(master, "exit()\r\e[13C\r\n")
119 # @assert bytesavailable(master) == 0
120 end
121 wait(p)
122 else
123 # Is this even needed or is this already recorded just from starting this process?
124 p = run(`$(julia_cmd()) -O0 --trace-compile=$precompile_file --sysimage $sysimg
125 --compile=all --startup-file=no
126 -e0`)
108127 end
128 end
129 close(master)
109130
110 # Check what the REPL displayed
111 # stdout_output = String(take!(stdout_accumulator))
112 # println(stdout_output)
131 # Check what the REPL displayed
132 # repl_output = String(take!(repl_output_buffer))
133 # println(repl_output)
113134
114 # Extract the precompile statements from stderr
115 statements = Set{String}()
116 for statement in split(read(precompile_file, String), '\n')
117 occursin("Main.", statement) && continue
118 push!(statements, statement)
135 # Extract the precompile statements from stderr
136 statements = Set{String}()
137 for statement in split(read(precompile_file, String), '\n')
138 occursin("Main.", statement) && continue
139 push!(statements, statement)
140 end
141
142 if have_repl
143 # Seems like a reasonable number right now, adjust as needed
144 # comment out if debugging script
145 @assert length(statements) > 700
146 end
147
148 # Create a staging area where all the loaded packages are available
149 PrecompileStagingArea = Module()
150 for (_pkgid, _mod) in Base.loaded_modules
151 if !(_pkgid.name in ("Main", "Core", "Base"))
152 eval(PrecompileStagingArea, :($(Symbol(_mod)) = $_mod))
119153 end
154 end
120155
121 # Load the precompile statements
122 statements_ordered = join(sort(collect(statements)), '\n')
123 # println(statements_ordered)
124 if have_repl
125 # Seems like a reasonable number right now, adjust as needed
126 @assert length(statements) > 700
156 # Execute the collected precompile statements
157 include_time = @elapsed for statement in sort(collect(statements))
158 # println(statement)
159 # Work around #28808
160 occursin("\"YYYY-mm-dd\\THH:MM:SS\"", statement) && continue
161 try
162 Base.include_string(PrecompileStagingArea, statement)
163 catch ex
164 @error "Failed to precompile $statement"
165 rethrow(ex)
127166 end
128
129 Base.include_string(PrecompileStagingArea, statements_ordered)
130 print(" $(length(statements)) generated in ")
131 Base.time_print((time() - start_time) * 10^9)
132 println()
133167 end
168 print(" $(length(statements)) generated in ")
169 tot_time = time() - start_time
170 Base.time_print(tot_time * 10^9)
171 print(" (overhead "); Base.time_print((tot_time - include_time) * 10^9); println(")")
134172 end
135
136 # Fall back to explicit list on Windows, might as well include them
137 # for everyone though
138 Base.include(PrecompileStagingArea, "precompile_explicit.jl")
139173
140174 return
141175 end
+0
-732
contrib/precompile_explicit.jl less more
0 # This file is a part of Julia. License is MIT: https://julialang.org/license
1
2 # Steps to regenerate this file:
3 # 1. Remove all `precompile` calls
4 # 2. Rebuild system image
5 # 3. Start julia with `--trace-compile=precompiles.txt and do some stuff
6 # 5. Run `grep -v '#[0-9]' precompiles.txt >> contrib/precompile_explicit.jl`
7 # (filters out closures, which might have different generated names in different environments)
8 # This list is only used on Windows, otherwise precompile statements are generated dynamically.
9
10 precompile(Tuple{Type{Array{Base.StackTraces.StackFrame, 1}}, UndefInitializer, Int64})
11 precompile(Tuple{Type{Array{Union{Nothing, String}, 1}}, UndefInitializer, Int64})
12 precompile(Tuple{Type{Base.CoreLogging.LogState}, Logging.ConsoleLogger})
13 precompile(Tuple{Type{Base.Dict{Any, Any}}})
14 precompile(Tuple{Type{Base.Dict{Any, Int64}}})
15 precompile(Tuple{Type{Base.Dict{Char, Any}}})
16 precompile(Tuple{Type{Base.Dict{Symbol, Any}}, Base.Pair{Symbol, REPL.LineEdit.Prompt}, Base.Pair{Symbol, REPL.LineEdit.Prompt}, Base.Pair{Symbol, REPL.LineEdit.Prompt}})
17 precompile(Tuple{Type{Base.Dict{Symbol, Any}}, Base.Pair{Symbol, REPL.LineEdit.Prompt}, Vararg{Base.Pair{Symbol, REPL.LineEdit.Prompt}, N} where N})
18 precompile(Tuple{Type{Base.Dict{Symbol, Any}}})
19 precompile(Tuple{Type{Base.GC_Diff}, Base.GC_Num, Base.GC_Num})
20 precompile(Tuple{Type{Base.Generator{I, F} where F where I}, typeof(Base.names), Array{Any, 1}})
21 precompile(Tuple{Type{Base.IOContext{IO_t} where IO_t<:IO}, Base.GenericIOBuffer{Array{UInt8, 1}}, Base.IOStream})
22 precompile(Tuple{Type{Base.IOContext{IO_t} where IO_t<:IO}, REPL.Terminals.TTYTerminal, Base.Pair{Symbol, Bool}})
23 precompile(Tuple{Type{Base.InterpreterIP}, Core.CodeInfo, Ptr{Nothing}})
24 precompile(Tuple{Type{Base.IteratorSize}, Array{Any, 1}})
25 precompile(Tuple{Type{Base.LinearIndices{N, R} where R<:Tuple{Vararg{Base.AbstractUnitRange{Int64}, N}} where N}, Array{Method, 1}})
26 precompile(Tuple{Type{Base.MIME{Symbol("text/plain")}}})
27 precompile(Tuple{Type{Base.Multimedia.TextDisplay}, Base.TTY})
28 precompile(Tuple{Type{Base.Order.Perm{O, V} where V<:(AbstractArray{T, 1} where T) where O<:Base.Order.Ordering}, Base.Order.ForwardOrdering, Array{Tuple{Float64, Int64}, 1}})
29 precompile(Tuple{Type{Base.Pair{A, B} where B where A}, Base.PkgId, UInt64})
30 precompile(Tuple{Type{Base.Pair{A, B} where B where A}, Int64, Int64})
31 precompile(Tuple{Type{Base.PkgId}, String})
32 precompile(Tuple{Type{Base.StackTraces.StackFrame}, Symbol, Symbol, Int64, Core.CodeInfo, Bool, Bool, Int64})
33 precompile(Tuple{Type{Base.StackTraces.StackFrame}, Symbol, Symbol, Int64, Core.MethodInstance, Bool, Bool, Ptr{Nothing}})
34 precompile(Tuple{Type{Base.StackTraces.StackFrame}, Symbol, Symbol, Int64, Nothing, Bool, Bool, Ptr{Nothing}})
35 precompile(Tuple{Type{Base.SubString{T} where T<:AbstractString}, String, Int64})
36 precompile(Tuple{Type{Base.Val{2}}})
37 precompile(Tuple{Type{Base.Val{3}}})
38 precompile(Tuple{Type{Logging.ConsoleLogger}, Base.IOStream})
39 precompile(Tuple{Type{Logging.ConsoleLogger}, Base.TTY})
40 precompile(Tuple{Type{Markdown.Header{1}}, Array{Any, 1}})
41 precompile(Tuple{Type{Markdown.MD}, Markdown.MD, Markdown.MD})
42 precompile(Tuple{Type{NamedTuple{(), T} where T<:Tuple}, Tuple{}})
43 precompile(Tuple{Type{NamedTuple{(:bold, :color), Tuple{Bool, Symbol}}}, Tuple{Bool, Symbol}})
44 precompile(Tuple{Type{NamedTuple{(:bold, :color), T} where T<:Tuple}, Tuple{Bool, Symbol}})
45 precompile(Tuple{Type{NamedTuple{(:create,), T} where T<:Tuple}, Tuple{Bool}})
46 precompile(Tuple{Type{NamedTuple{(:merge,), T} where T<:Tuple}, Tuple{Bool}})
47 precompile(Tuple{Type{NamedTuple{(:prompt_prefix, :prompt_suffix, :complete, :sticky), Tuple{String, String, Pkg.REPLMode.PkgCompletionProvider, Bool}}}, Tuple{String, String, Pkg.REPLMode.PkgCompletionProvider, Bool}})
48 precompile(Tuple{Type{NamedTuple{(:prompt_prefix, :prompt_suffix, :complete, :sticky), T} where T<:Tuple}, Tuple{String, String, Pkg.REPLMode.PkgCompletionProvider, Bool}})
49 precompile(Tuple{Type{NamedTuple{(:prompt_prefix, :prompt_suffix, :repl, :complete, :on_enter), Tuple{String, typeof(Base.input_color), REPL.LineEditREPL, REPL.REPLCompletionProvider, typeof(REPL.return_callback)}}}, Tuple{String, typeof(Base.input_color), REPL.LineEditREPL, REPL.REPLCompletionProvider, typeof(REPL.return_callback)}})
50 precompile(Tuple{Type{NamedTuple{(:prompt_prefix, :prompt_suffix, :repl, :complete, :on_enter), T} where T<:Tuple}, Tuple{String, typeof(Base.input_color), REPL.LineEditREPL, REPL.REPLCompletionProvider, typeof(REPL.return_callback)}})
51 precompile(Tuple{Type{NamedTuple{(:stderr,), Tuple{Base.IOStream}}}, Tuple{Base.IOStream}})
52 precompile(Tuple{Type{REPL.LineEditREPL}, REPL.Terminals.TTYTerminal, Bool, Bool})
53 precompile(Tuple{Type{REPL.LineEditREPL}, REPL.Terminals.TTYTerminal, Bool, String, String, String, String, String, Bool, Bool, Bool, Bool})
54 precompile(Tuple{Type{REPL.REPLDisplay{R} where R<:REPL.AbstractREPL}, REPL.LineEditREPL})
55 precompile(Tuple{Type{REPL.Terminals.TTYTerminal}, String, Base.PipeEndpoint, Base.TTY, Base.IOStream})
56 precompile(Tuple{Type{REPL.Terminals.TTYTerminal}, String, Base.TTY, Base.TTY, Base.IOStream})
57 precompile(Tuple{Type{REPL.Terminals.TTYTerminal}, String, Base.TTY, Base.TTY, Base.TTY})
58 precompile(Tuple{Type{String}, Array{UInt8, 1}})
59 precompile(Tuple{Type{UInt32}, UInt8})
60 precompile(Tuple{Type{UnionAll}, TypeVar, Any})
61 precompile(Tuple{getfield(Base, Symbol("#@time")), LineNumberNode, Module, Expr})
62 precompile(Tuple{getfield(Base, Symbol("#kw##_spawn")), NamedTuple{(:chain,), Tuple{Nothing}}, typeof(Base._spawn), Base.Cmd, Tuple{Base.Pipe, Base.TTY, Base.IOStream}})
63 precompile(Tuple{getfield(Base, Symbol("#kw##pipeline")), NamedTuple{(:stderr,), Tuple{Base.IOStream}}, typeof(Base.pipeline), Base.Cmd})
64 precompile(Tuple{getfield(Base, Symbol("#kw##printstyled")), NamedTuple{(:bold, :color), Tuple{Bool, Symbol}}, typeof(Base.printstyled), Base.IOContext{Base.GenericIOBuffer{Array{UInt8, 1}}}, String, String})
65 precompile(Tuple{getfield(Base, Symbol("#kw##printstyled")), NamedTuple{(:bold, :color), Tuple{Bool, Symbol}}, typeof(Base.printstyled), Base.IOContext{Base.GenericIOBuffer{Array{UInt8, 1}}}, String})
66 precompile(Tuple{getfield(Base, Symbol("#kw##printstyled")), NamedTuple{(:bold, :color), Tuple{Bool, Symbol}}, typeof(Base.printstyled), REPL.Terminals.TTYTerminal, String})
67 precompile(Tuple{getfield(Base, Symbol("#kw##printstyled")), NamedTuple{(:color,), Tuple{Symbol}}, typeof(Base.printstyled), Base.IOContext{Base.GenericIOBuffer{Array{UInt8, 1}}}, String})
68 precompile(Tuple{getfield(Base, Symbol("#kw##show_trace_entry")), NamedTuple{(:prefix,), Tuple{String}}, typeof(Base.show_trace_entry), Base.IOContext{REPL.Terminals.TTYTerminal}, Base.StackTraces.StackFrame, Int64})
69 precompile(Tuple{getfield(Base, Symbol("#kw##sort!")), NamedTuple{(:by,), Tuple{typeof(REPL.REPLCompletions.completion_text)}}, typeof(Base.sort!), Array{REPL.REPLCompletions.Completion, 1}})
70 precompile(Tuple{getfield(Base, Symbol("#kw##with_output_color")), NamedTuple{(:bold,), Tuple{Bool}}, typeof(Base.with_output_color), typeof(Base.print), Symbol, Base.IOContext{Base.GenericIOBuffer{Array{UInt8, 1}}}, String, String})
71 precompile(Tuple{getfield(Base.Cartesian, Symbol("#@ncall")), LineNumberNode, Module, Int64, Symbol, Symbol, Expr})
72 precompile(Tuple{getfield(Base.Cartesian, Symbol("#@nexprs")), LineNumberNode, Module, Int64, Expr})
73 precompile(Tuple{getfield(Base.Meta, Symbol("#kw##parse")), NamedTuple{(:raise, :depwarn), Tuple{Bool, Bool}}, typeof(Base.Meta.parse), String, Int64})
74 precompile(Tuple{getfield(Core, Symbol("#@doc")), LineNumberNode, Module, Symbol})
75 precompile(Tuple{getfield(Core, Symbol("#kw#Type")), NamedTuple{(:prompt_prefix, :prompt_suffix, :complete, :sticky), Tuple{String, String, Pkg.REPLMode.PkgCompletionProvider, Bool}}, Type{REPL.LineEdit.Prompt}, typeof(Pkg.REPLMode.promptf)})
76 precompile(Tuple{getfield(Core, Symbol("#kw#Type")), NamedTuple{(:prompt_prefix, :prompt_suffix, :repl, :complete, :on_enter), Tuple{String, typeof(Base.input_color), REPL.LineEditREPL, REPL.REPLCompletionProvider, typeof(REPL.return_callback)}}, Type{REPL.LineEdit.Prompt}, String})
77 precompile(Tuple{getfield(REPL, Symbol("#@repl")), LineNumberNode, Module, Base.TTY, Symbol})
78 precompile(Tuple{getfield(REPL, Symbol("#kw##printmatches")), NamedTuple{(:cols,), Tuple{Int64}}, typeof(REPL.printmatches), Base.TTY, String, Array{String, 1}})
79 precompile(Tuple{getfield(REPL.LineEdit, Symbol("#kw##add_nested_key!")), NamedTuple{(:override,), Tuple{Bool}}, typeof(REPL.LineEdit.add_nested_key!), Base.Dict{Char, Any}, Char, Function})
80 precompile(Tuple{getfield(REPL.LineEdit, Symbol("#kw##refresh_multi_line")), NamedTuple{(:beeping,), Tuple{Bool}}, typeof(REPL.LineEdit.refresh_multi_line), REPL.Terminals.TTYTerminal, REPL.LineEdit.PromptState})
81 precompile(Tuple{typeof(Base.:(!=)), Char, Char})
82 precompile(Tuple{typeof(Base.:(!=)), Int64, Int64})
83 precompile(Tuple{typeof(Base.:(!=)), Int8, Int64})
84 precompile(Tuple{typeof(Base.:(!=)), Nothing, Nothing})
85 precompile(Tuple{typeof(Base.:(!=)), REPL.LineEdit.Prompt, Nothing})
86 precompile(Tuple{typeof(Base.:(!=)), String, Nothing})
87 precompile(Tuple{typeof(Base.:(!=)), String, String})
88 precompile(Tuple{typeof(Base.:(!=)), UInt8, UInt8})
89 precompile(Tuple{typeof(Base.:(*)), Base.SubString{String}, String})
90 precompile(Tuple{typeof(Base.:(+)), Int64, Bool})
91 precompile(Tuple{typeof(Base.:(<<)), UInt32, Int64})
92 precompile(Tuple{typeof(Base.:(<=)), Int64, Int64})
93 precompile(Tuple{typeof(Base.:(==)), Base.Multimedia.TextDisplay, REPL.REPLDisplay{REPL.LineEditREPL}})
94 precompile(Tuple{typeof(Base.:(==)), Int8, Int64})
95 precompile(Tuple{typeof(Base.:(==)), Module, Module})
96 precompile(Tuple{typeof(Base.:(==)), Nothing, String})
97 precompile(Tuple{typeof(Base.:(==)), REPL.REPLDisplay{REPL.LineEditREPL}, REPL.REPLDisplay{REPL.LineEditREPL}})
98 precompile(Tuple{typeof(Base.:(>)), UInt64, Int64})
99 precompile(Tuple{typeof(Base.:(^)), Char, Int64})
100 precompile(Tuple{typeof(Base.:(|>)), Array{Any, 1}, typeof(Base.unique)})
101 precompile(Tuple{typeof(Base.:(|>)), Array{Any, 1}, typeof(REPL.filtervalid)})
102 precompile(Tuple{typeof(Base.CoreLogging.global_logger), Logging.ConsoleLogger})
103 precompile(Tuple{typeof(Base.CoreLogging.global_logger)})
104 precompile(Tuple{typeof(Base.CoreLogging.logmsg_shim), Int64, String, Nothing, Symbol, Symbol, Symbol, Int64, Array{Any, 1}})
105 precompile(Tuple{typeof(Base.Docs.catdoc), Markdown.MD, Markdown.MD})
106 precompile(Tuple{typeof(Base.Docs.doc), Base.Docs.Binding, Type{Union{}}})
107 precompile(Tuple{typeof(Base.Docs.doc), Base.Docs.Binding})
108 precompile(Tuple{typeof(Base.Docs.docm), LineNumberNode, Module, Symbol})
109 precompile(Tuple{typeof(Base.Docs.formatdoc), Base.GenericIOBuffer{Array{UInt8, 1}}, Base.Docs.DocStr, String})
110 precompile(Tuple{typeof(Base.Filesystem.basename), String})
111 precompile(Tuple{typeof(Base.Filesystem.isdir), String})
112 precompile(Tuple{typeof(Base.Filesystem.pwd)})
113 precompile(Tuple{typeof(Base.Filesystem.splitdir), String})
114 precompile(Tuple{typeof(Base.Filesystem.splitext), String})
115 precompile(Tuple{typeof(Base.Meta.isexpr), Symbol, Symbol, Int64})
116 precompile(Tuple{typeof(Base.Meta.parse), String})
117 precompile(Tuple{typeof(Base.Multimedia.display), Int64})
118 precompile(Tuple{typeof(Base.Multimedia.display), Markdown.MD})
119 precompile(Tuple{typeof(Base.Multimedia.display), REPL.REPLDisplay{REPL.LineEditREPL}, Array{Float64, 1}})
120 precompile(Tuple{typeof(Base.Multimedia.display), REPL.REPLDisplay{REPL.LineEditREPL}, Array{Float64, 2}})
121 precompile(Tuple{typeof(Base.Multimedia.display), REPL.REPLDisplay{REPL.LineEditREPL}, Array{Int64, 1}})
122 precompile(Tuple{typeof(Base.Multimedia.display), REPL.REPLDisplay{REPL.LineEditREPL}, Float64})
123 precompile(Tuple{typeof(Base.Multimedia.display), REPL.REPLDisplay{REPL.LineEditREPL}, Int64})
124 precompile(Tuple{typeof(Base.Multimedia.display), REPL.REPLDisplay{REPL.LineEditREPL}, Markdown.MD})
125 precompile(Tuple{typeof(Base.Multimedia.display), REPL.REPLDisplay{REPL.LineEditREPL}, String})
126 precompile(Tuple{typeof(Base.Multimedia.pushdisplay), REPL.REPLDisplay{REPL.LineEditREPL}})
127 precompile(Tuple{typeof(Base.Order.ord), typeof(Base.isless), typeof(Base.identity), Nothing, Base.Order.ForwardOrdering})
128 precompile(Tuple{typeof(Base.Printf.decode_dec), Base.TTY, Float64, String, Int64, Int64, Char})
129 precompile(Tuple{typeof(Base.StackTraces.lookup), Base.InterpreterIP})
130 precompile(Tuple{typeof(Base.Unicode.textwidth), String})
131 precompile(Tuple{typeof(Base.__atreplinit), REPL.LineEditREPL})
132 precompile(Tuple{typeof(Base.__precompile__)})
133 precompile(Tuple{typeof(Base._atexit)})
134 precompile(Tuple{typeof(Base._compute_eltype), Type{Tuple{Int64, String}}})
135 precompile(Tuple{typeof(Base._iterate), Base.Dict{Symbol, Any}, Int64})
136 precompile(Tuple{typeof(Base._promote_typejoin), Type{Int64}, Type{String}})
137 precompile(Tuple{typeof(Base._promote_typejoin), Type{Nothing}, Type{String}})
138 precompile(Tuple{typeof(Base._promote_typejoin), Type{Union{}}, Type{Int64}})
139 precompile(Tuple{typeof(Base._reformat_bt), Array{Ptr{Nothing}, 1}, Array{Any, 1}})
140 precompile(Tuple{typeof(Base._similar_for), Array{Any, 1}, Type{String}, Base.Generator{Array{Any, 1}, typeof(Base.string)}, Base.HasShape{1}})
141 precompile(Tuple{typeof(Base._similar_for), Array{Base.Docs.DocStr, 1}, Type{Markdown.MD}, Base.Generator{Array{Base.Docs.DocStr, 1}, typeof(Base.Docs.parsedoc)}, Base.HasShape{1}})
142 precompile(Tuple{typeof(Base._similar_for), Array{Union{Ptr{Nothing}, Base.InterpreterIP}, 1}, Type{Array{Base.StackTraces.StackFrame, 1}}, Base.Generator{Array{Union{Ptr{Nothing}, Base.InterpreterIP}, 1}, typeof(Base.StackTraces.lookup)}, Base.HasShape{1}})
143 precompile(Tuple{typeof(Base._spawn), Base.CmdRedirect, Tuple{Base.Pipe, Base.TTY, Base.IOStream}})
144 precompile(Tuple{typeof(Base._start)})
145 precompile(Tuple{typeof(Base._typed_vcat), Type{Any}, Tuple{Array{Symbol, 1}, Array{Symbol, 1}, Array{Symbol, 1}, Array{Symbol, 1}, Array{String, 1}}})
146 precompile(Tuple{typeof(Base._uv_hook_close), Base.PipeEndpoint})
147 precompile(Tuple{typeof(Base._uv_hook_close), Base.Process})
148 precompile(Tuple{typeof(Base._uv_hook_close), Base.Timer})
149 precompile(Tuple{typeof(Base.alignment), Base.IOContext{REPL.Terminals.TTYTerminal}, Array{Float64, 1}, Base.OneTo{Int64}, Base.OneTo{Int64}, Int64, Int64, Int64})
150 precompile(Tuple{typeof(Base.alignment), Base.IOContext{REPL.Terminals.TTYTerminal}, Array{Float64, 2}, Base.OneTo{Int64}, Base.OneTo{Int64}, Int64, Int64, Int64})
151 precompile(Tuple{typeof(Base.alignment), Base.IOContext{REPL.Terminals.TTYTerminal}, Array{Int64, 1}, Base.OneTo{Int64}, Base.OneTo{Int64}, Int64, Int64, Int64})
152 precompile(Tuple{typeof(Base.alloc_buf_hook), Base.PipeEndpoint, UInt64})
153 precompile(Tuple{typeof(Base.alloc_buf_hook), Base.TTY, UInt64})
154 precompile(Tuple{typeof(Base.append!), Array{String, 1}, Array{String, 1}})
155 precompile(Tuple{typeof(Base.arg_gen), Base.Cmd})
156 precompile(Tuple{typeof(Base.arg_gen), String})
157 precompile(Tuple{typeof(Base.axes), Array{Any, 1}})
158 precompile(Tuple{typeof(Base.bytesavailable), Base.GenericIOBuffer{Array{UInt8, 1}}})
159 precompile(Tuple{typeof(Base.catch_backtrace)})
160 precompile(Tuple{typeof(Base.check_open), Base.TTY})
161 precompile(Tuple{typeof(Base.close), Base.Pipe})
162 precompile(Tuple{typeof(Base.collect_similar), Array{Any, 1}, Base.Generator{Array{Any, 1}, typeof(Base.names)}})
163 precompile(Tuple{typeof(Base.collect_to_with_first!), Array{Array{Base.StackTraces.StackFrame, 1}, 1}, Array{Base.StackTraces.StackFrame, 1}, Base.Generator{Array{Union{Ptr{Nothing}, Base.InterpreterIP}, 1}, typeof(Base.StackTraces.lookup)}, Int64})
164 precompile(Tuple{typeof(Base.collect_to_with_first!), Array{Markdown.MD, 1}, Markdown.MD, Base.Generator{Array{Base.Docs.DocStr, 1}, typeof(Base.Docs.parsedoc)}, Int64})
165 precompile(Tuple{typeof(Base.collect_to_with_first!), Array{String, 1}, String, Base.Generator{Array{Any, 1}, typeof(Base.string)}, Int64})
166 precompile(Tuple{typeof(Base.collect_to_with_first!), Array{String, 1}, String, Base.Generator{Array{REPL.REPLCompletions.Completion, 1}, typeof(REPL.REPLCompletions.completion_text)}, Int64})
167 precompile(Tuple{typeof(Base.convert), Type{Array{String, 1}}, Array{Any, 1}})
168 precompile(Tuple{typeof(Base.convert), Type{Base.Dict{Char, V} where V}, Base.Dict{Char, Any}})
169 precompile(Tuple{typeof(Base.convert), Type{Base.Dict{K, V} where V where K}, Base.Dict{String, Any}})
170 precompile(Tuple{typeof(Base.convert), Type{Base.GenericIOBuffer{Array{UInt8, 1}}}, Base.GenericIOBuffer{Array{UInt8, 1}}})
171 precompile(Tuple{typeof(Base.convert), Type{Bool}, Bool})
172 precompile(Tuple{typeof(Base.convert), Type{Int64}, Int64})
173 precompile(Tuple{typeof(Base.convert), Type{Ptr{Nothing}}, Ptr{Nothing}})
174 precompile(Tuple{typeof(Base.convert), Type{Ptr{Nothing}}, Ptr{UInt8}})
175 precompile(Tuple{typeof(Base.convert), Type{REPL.LineEdit.InputAreaState}, REPL.LineEdit.InputAreaState})
176 precompile(Tuple{typeof(Base.convert), Type{REPL.LineEdit.MIState}, REPL.LineEdit.MIState})
177 precompile(Tuple{typeof(Base.convert), Type{REPL.LineEdit.Prompt}, REPL.LineEdit.Prompt})
178 precompile(Tuple{typeof(Base.convert), Type{Union{Base.UUID, Bool}}, Bool})
179 precompile(Tuple{typeof(Base.convert), Type{Union{Function, String}}, String})
180 precompile(Tuple{typeof(Base.convert), Type{Union{Nothing, REPL.LineEdit.Prompt}}, REPL.LineEdit.Prompt})
181 precompile(Tuple{typeof(Base.convert), Type{Union{Nothing, Type{T} where T}}, Nothing})
182 precompile(Tuple{typeof(Base.copy), Array{Any, 1}})
183 precompile(Tuple{typeof(Base.copy), Base.GenericIOBuffer{Array{UInt8, 1}}})
184 precompile(Tuple{typeof(Base.copymutable), Array{String, 1}})
185 precompile(Tuple{typeof(Base.copyto!), Array{Union{Nothing, String}, 1}, Int64, Array{Nothing, 1}, Int64, Int64})
186 precompile(Tuple{typeof(Base.delete!), Base.Set{Any}, Char})
187 precompile(Tuple{typeof(Base.diff_names), Tuple{Symbol, Symbol, Symbol, Symbol, Symbol}, Tuple{Symbol, Symbol, Symbol, Symbol, Symbol, Symbol, Symbol, Symbol, Symbol}})
188 precompile(Tuple{typeof(Base.diff_names), Tuple{Symbol, Symbol, Symbol}, Tuple{Symbol, Symbol, Symbol, Symbol, Symbol}})
189 precompile(Tuple{typeof(Base.diff_names), Tuple{Symbol}, Tuple{Symbol, Symbol, Symbol, Symbol, Symbol, Symbol, Symbol}})
190 precompile(Tuple{typeof(Base.diff_names), Tuple{Symbol}, Tuple{Symbol}})
191 precompile(Tuple{typeof(Base.display_error), REPL.Terminals.TTYTerminal, ErrorException, Array{Union{Ptr{Nothing}, Base.InterpreterIP}, 1}})
192 precompile(Tuple{typeof(Base.display_error), REPL.Terminals.TTYTerminal, MethodError, Array{Union{Ptr{Nothing}, Base.InterpreterIP}, 1}})
193 precompile(Tuple{typeof(Base.display_error), REPL.Terminals.TTYTerminal, UndefVarError, Array{Union{Ptr{Nothing}, Base.InterpreterIP}, 1}})
194 precompile(Tuple{typeof(Base.displaysize), Base.IOStream})
195 precompile(Tuple{typeof(Base.displaysize), Base.TTY})
196 precompile(Tuple{typeof(Base.displaysize), REPL.Terminals.TTYTerminal})
197 precompile(Tuple{typeof(Base.divrem), Int64, Int64})
198 precompile(Tuple{typeof(Base.eachline), String})
199 precompile(Tuple{typeof(Base.empty!), Array{Base.Pair{Base.PkgId, UInt64}, 1}})
200 precompile(Tuple{typeof(Base.ensure_rescheduled), Task})
201 precompile(Tuple{typeof(Base.eof), Base.PipeEndpoint})
202 precompile(Tuple{typeof(Base.eof), Base.TTY})
203 precompile(Tuple{typeof(Base.error), String})
204 precompile(Tuple{typeof(Base.findlast), String, String})
205 precompile(Tuple{typeof(Base.findprev), Base.Fix2{typeof(Base.in), Array{Char, 1}}, String, Int64})
206 precompile(Tuple{typeof(Base.findprev), String, String, Int64})
207 precompile(Tuple{typeof(Base.first), Base.OneTo{Int64}})
208 precompile(Tuple{typeof(Base.first), Base.UnitRange{Int64}})
209 precompile(Tuple{typeof(Base.firstindex), String})
210 precompile(Tuple{typeof(Base.flush), Base.IOStream})
211 precompile(Tuple{typeof(Base.gc_alloc_count), Base.GC_Diff})
212 precompile(Tuple{typeof(Base.gc_num)})
213 precompile(Tuple{typeof(Base.get), Base.Dict{Char, Any}, Char, Nothing})
214 precompile(Tuple{typeof(Base.getindex), Array{AbstractString, 1}, Base.UnitRange{Int64}})
215 precompile(Tuple{typeof(Base.getindex), Array{AbstractString, 1}, Int64})
216 precompile(Tuple{typeof(Base.getindex), Array{Any, 1}, Int32})
217 precompile(Tuple{typeof(Base.getindex), Array{Int32, 1}, UInt64})
218 precompile(Tuple{typeof(Base.getindex), Array{String, 1}, Int64})
219 precompile(Tuple{typeof(Base.getindex), Array{UInt8, 1}, Int64})
220 precompile(Tuple{typeof(Base.getindex), Base.Dict{Any, Any}, Char})
221 precompile(Tuple{typeof(Base.getindex), Base.Dict{String, Any}, String})
222 precompile(Tuple{typeof(Base.getindex), Base.Dict{Symbol, Any}, Symbol})
223 precompile(Tuple{typeof(Base.getindex), Core.SimpleVector, Base.UnitRange{Int64}})
224 precompile(Tuple{typeof(Base.getindex), String, Base.UnitRange{Int64}})
225 precompile(Tuple{typeof(Base.getindex), Tuple{Base.GenericIOBuffer{Array{UInt8, 1}}, Int64}, Int64})
226 precompile(Tuple{typeof(Base.getindex), Tuple{Base.StackTraces.StackFrame, Int64}, Int64})
227 precompile(Tuple{typeof(Base.getindex), Tuple{Int64, Int64}, Int64})
228 precompile(Tuple{typeof(Base.getindex), Tuple{Symbol, Symbol, Symbol}, Base.UnitRange{Int64}})
229 precompile(Tuple{typeof(Base.getindex), Tuple{Symbol}, Base.UnitRange{Int64}})
230 precompile(Tuple{typeof(Base.getindex), Tuple{Symbol}, Int64})
231 precompile(Tuple{typeof(Base.getproperty), Base.CoreLogging.LogState, Symbol})
232 precompile(Tuple{typeof(Base.getproperty), Base.GC_Diff, Symbol})
233 precompile(Tuple{typeof(Base.getproperty), Base.GenericIOBuffer{Array{UInt8, 1}}, Symbol})
234 precompile(Tuple{typeof(Base.getproperty), Base.Process, Symbol})
235 precompile(Tuple{typeof(Base.getproperty), Base.StackTraces.StackFrame, Symbol})
236 precompile(Tuple{typeof(Base.getproperty), Core.CodeInfo, Symbol})
237 precompile(Tuple{typeof(Base.getproperty), Core.LineInfoNode, Symbol})
238 precompile(Tuple{typeof(Base.getproperty), Core.MethodTable, Symbol})
239 precompile(Tuple{typeof(Base.getproperty), Method, Symbol})
240 precompile(Tuple{typeof(Base.getproperty), REPL.LineEdit.HistoryPrompt, Symbol})
241 precompile(Tuple{typeof(Base.getproperty), REPL.LineEdit.ModalInterface, Symbol})
242 precompile(Tuple{typeof(Base.getproperty), REPL.LineEdit.PrefixHistoryPrompt, Symbol})
243 precompile(Tuple{typeof(Base.getproperty), REPL.LineEdit.PrefixSearchState, Symbol})
244 precompile(Tuple{typeof(Base.getproperty), REPL.LineEdit.Prompt, Symbol})
245 precompile(Tuple{typeof(Base.getproperty), REPL.LineEdit.PromptState, Symbol})
246 precompile(Tuple{typeof(Base.getproperty), REPL.LineEdit.SearchState, Symbol})
247 precompile(Tuple{typeof(Base.getproperty), REPL.LineEditREPL, Symbol})
248 precompile(Tuple{typeof(Base.getproperty), REPL.Options, Symbol})
249 precompile(Tuple{typeof(Base.getproperty), REPL.REPLHistoryProvider, Symbol})
250 precompile(Tuple{typeof(Base.getproperty), REPL.Terminals.TTYTerminal, Symbol})
251 precompile(Tuple{typeof(Base.haskey), Base.Dict{String, Any}, String})
252 precompile(Tuple{typeof(Base.haskey), Base.Dict{Symbol, Any}, Symbol})
253 precompile(Tuple{typeof(Base.haskey), Base.Dict{Symbol, Function}, Symbol})
254 precompile(Tuple{typeof(Base.haskey), Base.IdDict{Any, Any}, Base.Docs.Binding})
255 precompile(Tuple{typeof(Base.hvcat), Tuple{Int64, Int64}, Float64, Float64, Float64, Float64})
256 precompile(Tuple{typeof(Base.identity), Char})
257 precompile(Tuple{typeof(Base.in), Char, Tuple{Char, Char, Char}})
258 precompile(Tuple{typeof(Base.in), String, Base.Set{Any}})
259 precompile(Tuple{typeof(Base.in), String, Tuple{String, String}})
260 precompile(Tuple{typeof(Base.in), Symbol, Base.Set{Any}})
261 precompile(Tuple{typeof(Base.incomplete_tag), Symbol})
262 precompile(Tuple{typeof(Base.indexed_iterate), Base.Pair{String, String}, Int64, Int64})
263 precompile(Tuple{typeof(Base.indexed_iterate), Base.Pair{String, String}, Int64})
264 precompile(Tuple{typeof(Base.indexed_iterate), Tuple{ArgumentError, Array{Union{Ptr{Nothing}, Base.InterpreterIP}, 1}}, Int64, Int64})
265 precompile(Tuple{typeof(Base.indexed_iterate), Tuple{ArgumentError, Array{Union{Ptr{Nothing}, Base.InterpreterIP}, 1}}, Int64})
266 precompile(Tuple{typeof(Base.indexed_iterate), Tuple{Array{Float64, 1}, Nothing}, Int64, Int64})
267 precompile(Tuple{typeof(Base.indexed_iterate), Tuple{Array{Float64, 1}, Nothing}, Int64})
268 precompile(Tuple{typeof(Base.indexed_iterate), Tuple{Array{Float64, 2}, Nothing}, Int64, Int64})
269 precompile(Tuple{typeof(Base.indexed_iterate), Tuple{Array{Float64, 2}, Nothing}, Int64})
270 precompile(Tuple{typeof(Base.indexed_iterate), Tuple{Array{Int64, 1}, Nothing}, Int64, Int64})
271 precompile(Tuple{typeof(Base.indexed_iterate), Tuple{Array{Int64, 1}, Nothing}, Int64})
272 precompile(Tuple{typeof(Base.indexed_iterate), Tuple{Array{String, 1}, String, Bool}, Int64, Int64})
273 precompile(Tuple{typeof(Base.indexed_iterate), Tuple{Array{String, 1}, String, Bool}, Int64})
274 precompile(Tuple{typeof(Base.indexed_iterate), Tuple{Base.GenericIOBuffer{Array{UInt8, 1}}, Bool, Bool}, Int64, Int64})
275 precompile(Tuple{typeof(Base.indexed_iterate), Tuple{Base.GenericIOBuffer{Array{UInt8, 1}}, Bool, Bool}, Int64})
276 precompile(Tuple{typeof(Base.indexed_iterate), Tuple{Base.StackTraces.StackFrame, Int64}, Int64, Int64})
277 precompile(Tuple{typeof(Base.indexed_iterate), Tuple{Base.StackTraces.StackFrame, Int64}, Int64})
278 precompile(Tuple{typeof(Base.indexed_iterate), Tuple{ErrorException, Array{Union{Ptr{Nothing}, Base.InterpreterIP}, 1}}, Int64, Int64})
279 precompile(Tuple{typeof(Base.indexed_iterate), Tuple{ErrorException, Array{Union{Ptr{Nothing}, Base.InterpreterIP}, 1}}, Int64})
280 precompile(Tuple{typeof(Base.indexed_iterate), Tuple{Expr, Int64}, Int64, Int64})
281 precompile(Tuple{typeof(Base.indexed_iterate), Tuple{Expr, Int64}, Int64})
282 precompile(Tuple{typeof(Base.indexed_iterate), Tuple{Float64, Nothing}, Int64, Int64})
283 precompile(Tuple{typeof(Base.indexed_iterate), Tuple{Float64, Nothing}, Int64})
284 precompile(Tuple{typeof(Base.indexed_iterate), Tuple{Int64, Nothing}, Int64, Int64})
285 precompile(Tuple{typeof(Base.indexed_iterate), Tuple{Int64, Nothing}, Int64})
286 precompile(Tuple{typeof(Base.indexed_iterate), Tuple{Markdown.MD, Nothing}, Int64, Int64})
287 precompile(Tuple{typeof(Base.indexed_iterate), Tuple{Markdown.MD, Nothing}, Int64})
288 precompile(Tuple{typeof(Base.indexed_iterate), Tuple{MethodError, Array{Union{Ptr{Nothing}, Base.InterpreterIP}, 1}}, Int64, Int64})
289 precompile(Tuple{typeof(Base.indexed_iterate), Tuple{MethodError, Array{Union{Ptr{Nothing}, Base.InterpreterIP}, 1}}, Int64})
290 precompile(Tuple{typeof(Base.indexed_iterate), Tuple{Nothing, Nothing}, Int64, Int64})
291 precompile(Tuple{typeof(Base.indexed_iterate), Tuple{Nothing, Nothing}, Int64})
292 precompile(Tuple{typeof(Base.indexed_iterate), Tuple{String, Nothing}, Int64, Int64})
293 precompile(Tuple{typeof(Base.indexed_iterate), Tuple{String, Nothing}, Int64})
294 precompile(Tuple{typeof(Base.indexed_iterate), Tuple{Symbol, String, String}, Int64, Int64})
295 precompile(Tuple{typeof(Base.indexed_iterate), Tuple{Symbol, String, String}, Int64})
296 precompile(Tuple{typeof(Base.indexed_iterate), Tuple{UndefVarError, Array{Union{Ptr{Nothing}, Base.InterpreterIP}, 1}}, Int64, Int64})
297 precompile(Tuple{typeof(Base.indexed_iterate), Tuple{UndefVarError, Array{Union{Ptr{Nothing}, Base.InterpreterIP}, 1}}, Int64})
298 precompile(Tuple{typeof(Base.init_stdio), Ptr{Nothing}})
299 precompile(Tuple{typeof(Base.isempty), Array{Base.Docs.DocStr, 1}})
300 precompile(Tuple{typeof(Base.isempty), Array{String, 1}})
301 precompile(Tuple{typeof(Base.isempty), Core.SimpleVector})
302 precompile(Tuple{typeof(Base.isempty), NamedTuple{(), Tuple{}}})
303 precompile(Tuple{typeof(Base.isempty), Nothing})
304 precompile(Tuple{typeof(Base.isempty), REPL.LineEdit.PromptState})
305 precompile(Tuple{typeof(Base.isempty), String})
306 precompile(Tuple{typeof(Base.isequal), REPL.LineEdit.Prompt, REPL.LineEdit.Prompt})
307 precompile(Tuple{typeof(Base.isequal), String, Symbol})
308 precompile(Tuple{typeof(Base.issingletontype), Type{Base.Regex}})
309 precompile(Tuple{typeof(Base.iterate), Array{AbstractString, 1}, Int64})
310 precompile(Tuple{typeof(Base.iterate), Array{AbstractString, 1}})
311 precompile(Tuple{typeof(Base.iterate), Array{Base.StackTraces.StackFrame, 1}, Int64})
312 precompile(Tuple{typeof(Base.iterate), Array{Base.StackTraces.StackFrame, 1}})
313 precompile(Tuple{typeof(Base.iterate), Array{REPL.LineEdit.TextInterface, 1}, Int64})
314 precompile(Tuple{typeof(Base.iterate), Array{REPL.LineEdit.TextInterface, 1}})
315 precompile(Tuple{typeof(Base.iterate), Base.Dict{String, String}, Int64})
316 precompile(Tuple{typeof(Base.iterate), Base.Dict{String, String}})
317 precompile(Tuple{typeof(Base.iterate), Base.OneTo{Int64}, Int64})
318 precompile(Tuple{typeof(Base.iterate), Base.OneTo{Int64}})
319 precompile(Tuple{typeof(Base.iterate), Nothing})
320 precompile(Tuple{typeof(Base.iterate), Tuple{Int64, Int64}, Int64})
321 precompile(Tuple{typeof(Base.iterate), Tuple{Int64, Int64}})
322 precompile(Tuple{typeof(Base.last), Base.OneTo{Int64}})
323 precompile(Tuple{typeof(Base.lastindex), Array{AbstractString, 1}})
324 precompile(Tuple{typeof(Base.lastindex), Array{String, 1}})
325 precompile(Tuple{typeof(Base.lastindex), Core.SimpleVector})
326 precompile(Tuple{typeof(Base.lastindex), String})
327 precompile(Tuple{typeof(Base.lastindex), Tuple{Symbol}})
328 precompile(Tuple{typeof(Base.leading_ones), UInt8})
329 precompile(Tuple{typeof(Base.length), Array{AbstractString, 1}})
330 precompile(Tuple{typeof(Base.length), Array{Int32, 1}})
331 precompile(Tuple{typeof(Base.length), Array{Symbol, 1}})
332 precompile(Tuple{typeof(Base.length), Tuple{DataType, DataType}})
333 precompile(Tuple{typeof(Base.map), typeof(Base.names), Array{Any, 1}})
334 precompile(Tuple{typeof(Base.merge), Base.Dict{String, Any}, Base.Dict{String, Any}})
335 precompile(Tuple{typeof(Base.merge), NamedTuple{(), Tuple{}}, NamedTuple{(), Tuple{}}})
336 precompile(Tuple{typeof(Base.min), Int64, Int64})
337 precompile(Tuple{typeof(Base.nextind), String, Int64})
338 precompile(Tuple{typeof(Base.occursin), Base.Regex, Base.SubString{String}})
339 precompile(Tuple{typeof(Base.occursin), String, String})
340 precompile(Tuple{typeof(Base.open), Base.CmdRedirect, String, Base.TTY})
341 precompile(Tuple{typeof(Base.open), String, String})
342 precompile(Tuple{typeof(Base.poptask)})
343 precompile(Tuple{typeof(Base.position), Base.GenericIOBuffer{Array{UInt8, 1}}})
344 precompile(Tuple{typeof(Base.precompilableerror), LoadError, Bool})
345 precompile(Tuple{typeof(Base.preserve_handle), Base.Timer})
346 precompile(Tuple{typeof(Base.prevind), String, Int64})
347 precompile(Tuple{typeof(Base.print), Base.GenericIOBuffer{Array{UInt8, 1}}, Base.UUID})
348 precompile(Tuple{typeof(Base.print), Base.GenericIOBuffer{Array{UInt8, 1}}, String, Base.SubString{String}, String})
349 precompile(Tuple{typeof(Base.print), Base.GenericIOBuffer{Array{UInt8, 1}}, String, String, String, String, String, String, String})
350 precompile(Tuple{typeof(Base.print), Base.GenericIOBuffer{Array{UInt8, 1}}, Type{Int64}})
351 precompile(Tuple{typeof(Base.print), Base.IOContext{Base.GenericIOBuffer{Array{UInt8, 1}}}, Base.SubString{String}})
352 precompile(Tuple{typeof(Base.print), Base.IOContext{Base.GenericIOBuffer{Array{UInt8, 1}}}, Char, String, String})
353 precompile(Tuple{typeof(Base.print), Base.IOContext{Base.GenericIOBuffer{Array{UInt8, 1}}}, Char})
354 precompile(Tuple{typeof(Base.print), Base.IOContext{Base.GenericIOBuffer{Array{UInt8, 1}}}, Module, String, Symbol})
355 precompile(Tuple{typeof(Base.print), Base.IOContext{Base.GenericIOBuffer{Array{UInt8, 1}}}, String, String})
356 precompile(Tuple{typeof(Base.print), Base.IOContext{Base.GenericIOBuffer{Array{UInt8, 1}}}, String, Symbol, String, Int32})
357 precompile(Tuple{typeof(Base.print), Base.IOContext{Base.GenericIOBuffer{Array{UInt8, 1}}}, String, Symbol})
358 precompile(Tuple{typeof(Base.print), Base.IOContext{Base.GenericIOBuffer{Array{UInt8, 1}}}, String})
359 precompile(Tuple{typeof(Base.print), Base.IOContext{Base.GenericIOBuffer{Array{UInt8, 1}}}, Symbol})
360 precompile(Tuple{typeof(Base.print), Base.IOContext{REPL.Terminals.TTYTerminal}, Char, String, String})
361 precompile(Tuple{typeof(Base.print), Base.IOContext{REPL.Terminals.TTYTerminal}, Char})
362 precompile(Tuple{typeof(Base.print), Base.IOContext{REPL.Terminals.TTYTerminal}, String, String, String, String})
363 precompile(Tuple{typeof(Base.print), Base.IOContext{REPL.Terminals.TTYTerminal}, String, Type{Module}})
364 precompile(Tuple{typeof(Base.print), Base.IOContext{REPL.Terminals.TTYTerminal}, String})
365 precompile(Tuple{typeof(Base.print), Base.IOContext{REPL.Terminals.TTYTerminal}, Type{Module}})
366 precompile(Tuple{typeof(Base.print), Base.IOStream, Char})
367 precompile(Tuple{typeof(Base.print), Base.IOStream, String})
368 precompile(Tuple{typeof(Base.print), Base.TTY, Char})
369 precompile(Tuple{typeof(Base.print), Base.TTY, String})
370 precompile(Tuple{typeof(Base.print), REPL.Terminals.TTYTerminal, String})
371 precompile(Tuple{typeof(Base.print_matrix_row), Base.IOContext{REPL.Terminals.TTYTerminal}, Array{Float64, 1}, Array{Tuple{Int64, Int64}, 1}, Int64, Base.OneTo{Int64}, String})
372 precompile(Tuple{typeof(Base.print_matrix_row), Base.IOContext{REPL.Terminals.TTYTerminal}, Array{Float64, 2}, Array{Tuple{Int64, Int64}, 1}, Int64, Base.OneTo{Int64}, String})
373 precompile(Tuple{typeof(Base.print_matrix_row), Base.IOContext{REPL.Terminals.TTYTerminal}, Array{Int64, 1}, Array{Tuple{Int64, Int64}, 1}, Int64, Base.OneTo{Int64}, String})
374 precompile(Tuple{typeof(Base.print_to_string), Type{Any}})
375 precompile(Tuple{typeof(Base.println), Base.TTY})
376 precompile(Tuple{typeof(Base.println), REPL.Terminals.TTYTerminal})
377 precompile(Tuple{typeof(Base.println), String})
378 precompile(Tuple{typeof(Base.promote_eltype), Array{Symbol, 1}, Array{String, 1}})
379 precompile(Tuple{typeof(Base.promote_eltype), Array{Symbol, 1}, Array{Symbol, 1}, Array{Symbol, 1}, Array{Symbol, 1}, Array{Symbol, 1}, Array{String, 1}})
380 precompile(Tuple{typeof(Base.push!), Array{Base.Docs.DocStr, 1}, Base.Docs.DocStr})
381 precompile(Tuple{typeof(Base.push!), Array{Base.Docs.MultiDoc, 1}, Base.Docs.MultiDoc})
382 precompile(Tuple{typeof(Base.push!), Array{Base.Pair{Base.PkgId, UInt64}, 1}, Base.Pair{Base.PkgId, UInt64}})
383 precompile(Tuple{typeof(Base.push!), Array{Char, 1}, Char})
384 precompile(Tuple{typeof(Base.push!), Array{Symbol, 1}, Symbol})
385 precompile(Tuple{typeof(Base.push!), Array{Tuple{String, Int64}, 1}, Tuple{String, Int64}})
386 precompile(Tuple{typeof(Base.push!), Base.Set{Any}, Char})
387 precompile(Tuple{typeof(Base.push!), Base.Set{Any}, Tuple{Module, String, Float64}})
388 precompile(Tuple{typeof(Base.push!), Base.Set{REPL.REPLCompletions.Completion}, REPL.REPLCompletions.PackageCompletion})
389 precompile(Tuple{typeof(Base.push!), Base.Set{String}, Base.SubString{String}})
390 precompile(Tuple{typeof(Base.put!), Base.Channel{Any}, Tuple{ArgumentError, Array{Union{Ptr{Nothing}, Base.InterpreterIP}, 1}}})
391 precompile(Tuple{typeof(Base.put!), Base.Channel{Any}, Tuple{Array{Float64, 1}, Nothing}})
392 precompile(Tuple{typeof(Base.put!), Base.Channel{Any}, Tuple{Array{Float64, 2}, Nothing}})
393 precompile(Tuple{typeof(Base.put!), Base.Channel{Any}, Tuple{Array{Int64, 1}, Nothing}})
394 precompile(Tuple{typeof(Base.put!), Base.Channel{Any}, Tuple{ErrorException, Array{Union{Ptr{Nothing}, Base.InterpreterIP}, 1}}})
395 precompile(Tuple{typeof(Base.put!), Base.Channel{Any}, Tuple{Float64, Nothing}})
396 precompile(Tuple{typeof(Base.put!), Base.Channel{Any}, Tuple{Int64, Nothing}})
397 precompile(Tuple{typeof(Base.put!), Base.Channel{Any}, Tuple{Markdown.MD, Nothing}})
398 precompile(Tuple{typeof(Base.put!), Base.Channel{Any}, Tuple{MethodError, Array{Union{Ptr{Nothing}, Base.InterpreterIP}, 1}}})
399 precompile(Tuple{typeof(Base.put!), Base.Channel{Any}, Tuple{Nothing, Nothing}})
400 precompile(Tuple{typeof(Base.put!), Base.Channel{Any}, Tuple{String, Nothing}})
401 precompile(Tuple{typeof(Base.put!), Base.Channel{Any}, Tuple{UndefVarError, Array{Union{Ptr{Nothing}, Base.InterpreterIP}, 1}}})
402 precompile(Tuple{typeof(Base.rand), Int64, Int64})
403 precompile(Tuple{typeof(Base.rand), Int64})
404 precompile(Tuple{typeof(Base.rand), Random.RandomDevice, Type{UInt32}, Int64})
405 precompile(Tuple{typeof(Base.rand)})
406 precompile(Tuple{typeof(Base.read!), Base.GenericIOBuffer{Array{UInt8, 1}}, Array{UInt8, 1}})
407 precompile(Tuple{typeof(Base.read), Base.TTY, Type{UInt8}})
408 precompile(Tuple{typeof(Base.readuntil), Base.PipeEndpoint, Char})
409 precompile(Tuple{typeof(Base.readuntil), Base.TTY, String})
410 precompile(Tuple{typeof(Base.readuntil), REPL.Terminals.TTYTerminal, String})
411 precompile(Tuple{typeof(Base.reinterpret), Type{Char}, UInt32})
412 precompile(Tuple{typeof(Base.replace), Base.SubString{String}, Base.Pair{Base.Regex, String}})
413 precompile(Tuple{typeof(Base.resize!), Array{Tuple{String, Int64}, 1}, Int64})
414 precompile(Tuple{typeof(Base.rethrow)})
415 precompile(Tuple{typeof(Base.seek), Base.GenericIOBuffer{Array{UInt8, 1}}, Int64})
416 precompile(Tuple{typeof(Base.setindex!), Array{Any, 1}, Array{String, 1}, Base.UnitRange{Int64}})
417 precompile(Tuple{typeof(Base.setindex!), Array{Any, 1}, Array{Symbol, 1}, Base.UnitRange{Int64}})
418 precompile(Tuple{typeof(Base.setindex!), Array{Base.StackTraces.StackFrame, 1}, Base.StackTraces.StackFrame, Int64})
419 precompile(Tuple{typeof(Base.setindex!), Array{Method, 1}, Method, Int64})
420 precompile(Tuple{typeof(Base.setindex!), Array{String, 1}, String, Int64})
421 precompile(Tuple{typeof(Base.setindex!), Array{Symbol, 1}, Symbol, Int64})
422 precompile(Tuple{typeof(Base.setindex!), Array{Union{Nothing, String}, 1}, String, Int64})
423 precompile(Tuple{typeof(Base.setindex!), Base.Dict{Any, Any}, Char, Char})
424 precompile(Tuple{typeof(Base.setindex!), Base.Dict{Any, Any}, Char, String})
425 precompile(Tuple{typeof(Base.setindex!), Base.Dict{Any, Any}, Module, Symbol})
426 precompile(Tuple{typeof(Base.setindex!), Base.Dict{Any, Any}, Type{Union{}}, Symbol})
427 precompile(Tuple{typeof(Base.setindex!), Base.Dict{Symbol, Any}, REPL.LineEdit.Prompt, Symbol})
428 precompile(Tuple{typeof(Base.setindex!), Base.RefValue{Bool}, Bool})
429 precompile(Tuple{typeof(Base.setproperty!), Base.Iterators.Stateful{Tuple{String, String}, Any}, Symbol, Tuple{String, Int64}})
430 precompile(Tuple{typeof(Base.setproperty!), Base.Process, Symbol, Ptr{Nothing}})
431 precompile(Tuple{typeof(Base.setproperty!), Base.Process, Symbol, Symbol})
432 precompile(Tuple{typeof(Base.setproperty!), REPL.LineEdit.MIState, Symbol, Symbol})
433 precompile(Tuple{typeof(Base.setproperty!), REPL.LineEdit.PrefixHistoryPrompt, Symbol, REPL.LineEdit.Prompt})
434 precompile(Tuple{typeof(Base.setproperty!), REPL.LineEdit.PrefixSearchState, Symbol, Int64})
435 precompile(Tuple{typeof(Base.setproperty!), REPL.LineEdit.PrefixSearchState, Symbol, REPL.LineEdit.MIState})
436 precompile(Tuple{typeof(Base.setproperty!), REPL.LineEdit.PrefixSearchState, Symbol, REPL.LineEdit.Prompt})
437 precompile(Tuple{typeof(Base.setproperty!), REPL.LineEdit.PrefixSearchState, Symbol, String})
438 precompile(Tuple{typeof(Base.setproperty!), REPL.LineEdit.Prompt, Symbol, Base.Dict{Char, Any}})
439 precompile(Tuple{typeof(Base.setproperty!), REPL.LineEdit.PromptState, Symbol, Base.GenericIOBuffer{Array{UInt8, 1}}})
440 precompile(Tuple{typeof(Base.setproperty!), REPL.LineEdit.PromptState, Symbol, REPL.LineEdit.InputAreaState})
441 precompile(Tuple{typeof(Base.setproperty!), REPL.LineEdit.SearchState, Symbol, Bool})
442 precompile(Tuple{typeof(Base.setproperty!), REPL.LineEdit.SearchState, Symbol, REPL.LineEdit.Prompt})
443 precompile(Tuple{typeof(Base.setproperty!), REPL.LineEditREPL, Symbol, Bool})
444 precompile(Tuple{typeof(Base.setproperty!), REPL.REPLHistoryProvider, Symbol, Base.GenericIOBuffer{Array{UInt8, 1}}})
445 precompile(Tuple{typeof(Base.setproperty!), REPL.REPLHistoryProvider, Symbol, REPL.LineEdit.Prompt})
446 precompile(Tuple{typeof(Base.show), Base.GenericIOBuffer{Array{UInt8, 1}}, Array{String, 1}})
447 precompile(Tuple{typeof(Base.show), Base.GenericIOBuffer{Array{UInt8, 1}}, String})
448 precompile(Tuple{typeof(Base.show), Base.GenericIOBuffer{Array{UInt8, 1}}, Type{Any}})
449 precompile(Tuple{typeof(Base.show), Base.GenericIOBuffer{Array{UInt8, 1}}, UInt64})
450 precompile(Tuple{typeof(Base.show), Base.IOContext{Base.GenericIOBuffer{Array{UInt8, 1}}}, Array{Any, 1}})
451 precompile(Tuple{typeof(Base.show), Base.IOContext{Base.GenericIOBuffer{Array{UInt8, 1}}}, Int64})
452 precompile(Tuple{typeof(Base.show), Base.IOContext{Base.GenericIOBuffer{Array{UInt8, 1}}}, String})
453 precompile(Tuple{typeof(Base.show), Base.IOContext{REPL.Terminals.TTYTerminal}, Base.MIME{Symbol("text/plain")}, Array{Float64, 1}})
454 precompile(Tuple{typeof(Base.show), Base.IOContext{REPL.Terminals.TTYTerminal}, Base.MIME{Symbol("text/plain")}, Array{Float64, 2}})
455 precompile(Tuple{typeof(Base.show), Base.IOContext{REPL.Terminals.TTYTerminal}, Base.MIME{Symbol("text/plain")}, Array{Int64, 1}})
456 precompile(Tuple{typeof(Base.show), Base.IOContext{REPL.Terminals.TTYTerminal}, Base.MIME{Symbol("text/plain")}, Float64})
457 precompile(Tuple{typeof(Base.show), Base.IOContext{REPL.Terminals.TTYTerminal}, Base.MIME{Symbol("text/plain")}, Int64})
458 precompile(Tuple{typeof(Base.show), Base.IOContext{REPL.Terminals.TTYTerminal}, Base.MIME{Symbol("text/plain")}, Markdown.MD})
459 precompile(Tuple{typeof(Base.show), Base.IOContext{REPL.Terminals.TTYTerminal}, Base.MIME{Symbol("text/plain")}, String})
460 precompile(Tuple{typeof(Base.show), Base.IOContext{REPL.Terminals.TTYTerminal}, Int64})
461 precompile(Tuple{typeof(Base.show), Base.IOContext{REPL.Terminals.TTYTerminal}, Type{Module}})
462 precompile(Tuple{typeof(Base.show_datatype), Base.IOContext{REPL.Terminals.TTYTerminal}, Type{Module}})
463 precompile(Tuple{typeof(Base.show_tuple_as_call), Base.IOContext{REPL.Terminals.TTYTerminal}, Symbol, Type{Tuple{typeof(Base.require), Module, Symbol}}})
464 precompile(Tuple{typeof(Base.showerror), Base.IOContext{REPL.Terminals.TTYTerminal}, ArgumentError, Array{Union{Ptr{Nothing}, Base.InterpreterIP}, 1}})
465 precompile(Tuple{typeof(Base.showerror), Base.IOContext{REPL.Terminals.TTYTerminal}, ErrorException, Array{Union{Ptr{Nothing}, Base.InterpreterIP}, 1}})
466 precompile(Tuple{typeof(Base.showerror), Base.IOContext{REPL.Terminals.TTYTerminal}, MethodError, Array{Union{Ptr{Nothing}, Base.InterpreterIP}, 1}})
467 precompile(Tuple{typeof(Base.showerror), Base.IOContext{REPL.Terminals.TTYTerminal}, UndefVarError, Array{Union{Ptr{Nothing}, Base.InterpreterIP}, 1}})
468 precompile(Tuple{typeof(Base.similar), Array{Any, 1}, Type{Nothing}, Tuple{Base.OneTo{Int64}}})
469 precompile(Tuple{typeof(Base.similar), Array{Base.Docs.DocStr, 1}, Type{Markdown.MD}, Tuple{Base.OneTo{Int64}}})
470 precompile(Tuple{typeof(Base.similar), Array{REPL.REPLCompletions.Completion, 1}, Type{String}, Tuple{Base.OneTo{Int64}}})
471 precompile(Tuple{typeof(Base.similar), Array{Union{Ptr{Nothing}, Base.InterpreterIP}, 1}, Type{Array{Base.StackTraces.StackFrame, 1}}, Tuple{Base.OneTo{Int64}}})
472 precompile(Tuple{typeof(Base.similar), Type{Array{Method, N} where N}, Tuple{Base.OneTo{Int64}}})
473 precompile(Tuple{typeof(Base.sizeof), String})
474 precompile(Tuple{typeof(Base.skip_deleted_floor!), Base.Dict{Symbol, Any}})
475 precompile(Tuple{typeof(Base.sort!), Array{Int64, 1}, Base.Sort.QuickSortAlg, Base.Order.Perm{Base.Order.ForwardOrdering, Array{Tuple{Float64, Int64}, 1}}})
476 precompile(Tuple{typeof(Base.startswith), Base.SubString{String}, String})
477 precompile(Tuple{typeof(Base.startswith), String, Char})
478 precompile(Tuple{typeof(Base.stream_wait), Base.Timer, Base.Condition})
479 precompile(Tuple{typeof(Base.string), String, Nothing, String, String, String, Int64})
480 precompile(Tuple{typeof(Base.string), String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, Base.VersionNumber, String, String, String, String, String, String, String, String, String, String, String, String, String, String})
481 precompile(Tuple{typeof(Base.string), String, Type{Int64}})
482 precompile(Tuple{typeof(Base.string), Type{Any}})
483 precompile(Tuple{typeof(Base.strip), String})
484 precompile(Tuple{typeof(Base.take!), Base.Channel{Any}})
485 precompile(Tuple{typeof(Base.take!), Base.GenericIOBuffer{Array{UInt8, 1}}})
486 precompile(Tuple{typeof(Base.task_done_hook), Task})
487 precompile(Tuple{typeof(Base.time_print), UInt64, Int64, Int64, Int64})
488 precompile(Tuple{typeof(Base.truncate), Base.GenericIOBuffer{Array{UInt8, 1}}, Int64})
489 precompile(Tuple{typeof(Base.try_yieldto), typeof(Base.ensure_rescheduled), Base.RefValue{Task}})
490 precompile(Tuple{typeof(Base.tuple_type_head), Type{Tuple{Vararg{Int64, N}} where N}})
491 precompile(Tuple{typeof(Base.tuple_type_tail), Type{Tuple{Vararg{Int64, N}} where N}})
492 precompile(Tuple{typeof(Base.typed_vcat), Type{Any}, Array{Symbol, 1}, Array{Symbol, 1}, Array{Symbol, 1}, Array{Symbol, 1}, Array{Symbol, 1}, Array{String, 1}})
493 precompile(Tuple{typeof(Base.typeinfo_eltype), Type{Any}})
494 precompile(Tuple{typeof(Base.typesof), Int64, Int64})
495 precompile(Tuple{typeof(Base.unique), Array{Any, 1}})
496 precompile(Tuple{typeof(Base.unlock), Base.Threads.RecursiveTatasLock})
497 precompile(Tuple{typeof(Base.unpreserve_handle), Base.Timer})
498 precompile(Tuple{typeof(Base.unsafe_convert), Type{Ptr{Int64}}, Base.Threads.Atomic{Int64}})
499 precompile(Tuple{typeof(Base.unsafe_convert), Type{Ptr{Nothing}}, Ptr{Nothing}})
500 precompile(Tuple{typeof(Base.unsafe_convert), Type{Ptr{UInt64}}, Base.Threads.Atomic{UInt64}})
501 precompile(Tuple{typeof(Base.unsafe_write), Base.Pipe, Ptr{UInt8}, UInt64})
502 precompile(Tuple{typeof(Base.unsafe_write), Base.TTY, Ptr{UInt8}, Int32})
503 precompile(Tuple{typeof(Base.unsafe_write), Base.TTY, Ptr{UInt8}, UInt64})
504 precompile(Tuple{typeof(Base.uvfinalize), Base.PipeEndpoint})
505 precompile(Tuple{typeof(Base.uvfinalize), Base.Process})
506 precompile(Tuple{typeof(Base.uvfinalize), Base.TTY})
507 precompile(Tuple{typeof(Base.uvfinalize), Base.Timer})
508 precompile(Tuple{typeof(Base.vcat), Array{Any, 1}, String, String})
509 precompile(Tuple{typeof(Base.vcat), Array{Base.StackTraces.StackFrame, 1}, Array{Base.StackTraces.StackFrame, 1}, Array{Base.StackTraces.StackFrame, 1}, Array{Base.StackTraces.StackFrame, 1}, Array{Base.StackTraces.StackFrame, 1}, Array{Base.StackTraces.StackFrame, 1}, Array{Base.StackTraces.StackFrame, 1}, Array{Base.StackTraces.StackFrame, 1}, Array{Base.StackTraces.StackFrame, 1}, Array{Base.StackTraces.StackFrame, 1}, Array{Base.StackTraces.StackFrame, 1}, Array{Base.StackTraces.StackFrame, 1}})
510 precompile(Tuple{typeof(Base.vcat), Array{Symbol, 1}, Array{Symbol, 1}, Array{Symbol, 1}, Array{Symbol, 1}, Array{Symbol, 1}, Array{String, 1}})
511 precompile(Tuple{typeof(Base.vcat), Markdown.MD, Markdown.MD})
512 precompile(Tuple{typeof(Base.vcat), Markdown.MD})
513 precompile(Tuple{typeof(Base.vect), Symbol, Vararg{Symbol, N} where N})
514 precompile(Tuple{typeof(Base.wait), Base.Condition})
515 precompile(Tuple{typeof(Base.wait), Base.Timer})
516 precompile(Tuple{typeof(Base.wait)})
517 precompile(Tuple{typeof(Base.write), Base.GenericIOBuffer{Array{UInt8, 1}}, String})
518 precompile(Tuple{typeof(Base.write), Base.IOStream, Array{UInt8, 1}})
519 precompile(Tuple{typeof(Base.write), Base.Pipe, String})
520 precompile(Tuple{typeof(Base.write), Base.Process, String})
521 precompile(Tuple{typeof(Base.write), Base.TTY, Char})
522 precompile(Tuple{typeof(Base.write), Base.TTY, String})
523 precompile(Tuple{typeof(Base.write), Base.TTY, UInt8})
524 precompile(Tuple{typeof(Base.write), REPL.Terminals.TTYTerminal, String})
525 precompile(Tuple{typeof(Base.write), REPL.Terminals.TerminalBuffer, Base.Missing})
526 precompile(Tuple{typeof(Base.write), REPL.Terminals.TerminalBuffer, String})
527 precompile(Tuple{typeof(Core.Compiler.:(!=)), Type{Any}, Core.Compiler.Const})
528 precompile(Tuple{typeof(Core.Compiler.getindex), Array{DataType, 1}, Int64})
529 precompile(Tuple{typeof(Core.Compiler.getindex), Tuple{Array{Bool, 0}}, Int64})
530 precompile(Tuple{typeof(Core.Compiler.getindex), Tuple{Array{String, 1}}, Int64})
531 precompile(Tuple{typeof(Core.Compiler.getindex), Tuple{Base.Broadcast.DefaultArrayStyle{0}, typeof(Base.identity), Int64}, Int64})
532 precompile(Tuple{typeof(Core.Compiler.getindex), Tuple{Base.Colon}, Int64})
533 precompile(Tuple{typeof(Core.Compiler.getindex), Tuple{Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, typeof(Base.invokelatest), typeof(Base.Multimedia.display)}, Int64})
534 precompile(Tuple{typeof(Core.Compiler.getindex), Tuple{Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, typeof(Base.invokelatest), typeof(Base.__atreplinit)}, Int64})
535 precompile(Tuple{typeof(Core.Compiler.getindex), Tuple{Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, typeof(Base.invokelatest), typeof(Base.display_error)}, Int64})
536 precompile(Tuple{typeof(Core.Compiler.getindex), Tuple{Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, typeof(Base.invokelatest), typeof(Base.show)}, Int64})
537 precompile(Tuple{typeof(Core.Compiler.getindex), Tuple{Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, typeof(Base.invokelatest), typeof(REPL.helpmode)}, Int64})
538 precompile(Tuple{typeof(Core.Compiler.getindex), Tuple{Base.Val{1}, Union}, Int64})
539 precompile(Tuple{typeof(Core.Compiler.getindex), Tuple{Char, Char}, Int64})
540 precompile(Tuple{typeof(Core.Compiler.getindex), Tuple{Core.Compiler.IndexLinear, Array{Bool, 0}}, Int64})
541 precompile(Tuple{typeof(Core.Compiler.getindex), Tuple{Nothing, Nothing}, Int64})
542 precompile(Tuple{typeof(Core.Compiler.getindex), Tuple{Nothing, typeof(Base.replace), Nothing}, Int64})
543 precompile(Tuple{typeof(Core.Compiler.getindex), Tuple{QuoteNode, Int64}, Int64})
544 precompile(Tuple{typeof(Core.Compiler.getindex), Tuple{String, Int64}, Int64})
545 precompile(Tuple{typeof(Core.Compiler.getindex), Tuple{Symbol, Bool}, Int64})
546 precompile(Tuple{typeof(Core.Compiler.getindex), Tuple{Symbol, GlobalRef}, Int64})
547 precompile(Tuple{typeof(Core.Compiler.getindex), Tuple{typeof(Base.:(*)), Int64}, Int64})
548 precompile(Tuple{typeof(Core.Compiler.getindex), Tuple{typeof(Base.Multimedia.display), Int64}, Int64})
549 precompile(Tuple{typeof(Core.Compiler.getindex), Tuple{typeof(Base.convert), Int64}, Int64})
550 precompile(Tuple{typeof(Core.Compiler.getindex), Tuple{typeof(Base.convert), typeof(Base.getindex), typeof(Base.setindex!)}, Int64})
551 precompile(Tuple{typeof(Core.Compiler.getindex), Tuple{typeof(Base.getindex), typeof(Base.setindex!)}, Int64})
552 precompile(Tuple{typeof(Core.Compiler.getindex), Tuple{typeof(Base.open_flags)}, Int64})
553 precompile(Tuple{typeof(Core.Compiler.getindex), Tuple{typeof(Base.setindex!)}, Int64})
554 precompile(Tuple{typeof(Core.Compiler.getindex), Type{Any}, Core.SSAValue, Char, Core.SSAValue})
555 precompile(Tuple{typeof(Core.Compiler.getindex), Type{Any}, Core.SSAValue, Core.Compiler.Argument, Core.Compiler.Argument, Core.SSAValue, Core.SSAValue})
556 precompile(Tuple{typeof(Core.Compiler.getindex), Type{Any}, Core.SSAValue, Core.SSAValue, Int64, Core.SSAValue, Core.SSAValue})
557 precompile(Tuple{typeof(Core.Compiler.getindex), Type{Any}, Core.SSAValue, Core.SSAValue, String, Core.SSAValue})
558 precompile(Tuple{typeof(Core.Compiler.getindex), Type{Any}, Core.SSAValue, Int64, Core.SSAValue})
559 precompile(Tuple{typeof(Core.Compiler.getindex), Type{Any}, Core.SSAValue, UInt8, Core.SSAValue})
560 precompile(Tuple{typeof(Core.Compiler.getindex), Type{Any}, Tuple{Symbol}, Tuple{Symbol, Symbol, Symbol, Symbol, Symbol, Symbol, Symbol}})
561 precompile(Tuple{typeof(Core.Compiler.getindex), Type{Any}, getfield(Markdown, Symbol("#kw##print_wrapped")), Core.SSAValue, Core.SSAValue, Core.SSAValue, Core.Compiler.Argument, Core.SSAValue})
562 precompile(Tuple{typeof(Core.Compiler.instanceof_tfunc), Any})
563 precompile(Tuple{typeof(Core.Compiler.length), Tuple{Array{Bool, 0}}})
564 precompile(Tuple{typeof(Core.Compiler.length), Tuple{Array{String, 1}}})
565 precompile(Tuple{typeof(Core.Compiler.length), Tuple{Base.Broadcast.DefaultArrayStyle{0}, typeof(Base.identity), Int64}})
566 precompile(Tuple{typeof(Core.Compiler.length), Tuple{Base.Colon}})
567 precompile(Tuple{typeof(Core.Compiler.length), Tuple{Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, typeof(Base.invokelatest), typeof(Base.Multimedia.display)}})
568 precompile(Tuple{typeof(Core.Compiler.length), Tuple{Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, typeof(Base.invokelatest), typeof(Base.__atreplinit)}})
569 precompile(Tuple{typeof(Core.Compiler.length), Tuple{Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, typeof(Base.invokelatest), typeof(Base.display_error)}})
570 precompile(Tuple{typeof(Core.Compiler.length), Tuple{Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, typeof(Base.invokelatest), typeof(Base.show)}})
571 precompile(Tuple{typeof(Core.Compiler.length), Tuple{Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, typeof(Base.invokelatest), typeof(REPL.helpmode)}})
572 precompile(Tuple{typeof(Core.Compiler.length), Tuple{Base.Val{1}, Union}})
573 precompile(Tuple{typeof(Core.Compiler.length), Tuple{Char, Char}})
574 precompile(Tuple{typeof(Core.Compiler.length), Tuple{Core.Compiler.IndexLinear, Array{Bool, 0}}})
575 precompile(Tuple{typeof(Core.Compiler.length), Tuple{Nothing, Nothing}})
576 precompile(Tuple{typeof(Core.Compiler.length), Tuple{Nothing, typeof(Base.replace), Nothing}})
577 precompile(Tuple{typeof(Core.Compiler.length), Tuple{Symbol, Bool}})
578 precompile(Tuple{typeof(Core.Compiler.length), Tuple{Symbol, GlobalRef}})
579 precompile(Tuple{typeof(Core.Compiler.length), Tuple{typeof(Base.:(*)), Int64}})
580 precompile(Tuple{typeof(Core.Compiler.length), Tuple{typeof(Base.open_flags)}})
581 precompile(Tuple{typeof(Core.Compiler.rewrap_unionall), Any, Any})
582 precompile(Tuple{typeof(Core.Compiler.vect), Type{typeof(typeassert)}})
583 precompile(Tuple{typeof(Distributed.flush_gc_msgs), Distributed.Worker})
584 precompile(Tuple{typeof(Distributed.flush_gc_msgs)})
585 precompile(Tuple{typeof(Distributed.terminate_all_workers)})
586 precompile(Tuple{typeof(LibGit2.ensure_initialized)})
587 precompile(Tuple{typeof(LibGit2.initialize)})
588 precompile(Tuple{typeof(Logging.__init__)})
589 precompile(Tuple{typeof(Logging.default_metafmt), Base.CoreLogging.LogLevel, Module, Symbol, Symbol, String, Int64})
590 precompile(Tuple{typeof(Logging.default_metafmt), Base.CoreLogging.LogLevel, Nothing, Symbol, Symbol, String, Int64})
591 precompile(Tuple{typeof(Markdown.ansi_length), Base.SubString{String}})
592 precompile(Tuple{typeof(Markdown.ansi_length), String})
593 precompile(Tuple{typeof(Markdown.footnote_link), Base.GenericIOBuffer{Array{UInt8, 1}}, Markdown.MD})
594 precompile(Tuple{typeof(Markdown.link), Base.GenericIOBuffer{Array{UInt8, 1}}, Markdown.MD})
595 precompile(Tuple{typeof(Markdown.term), Base.IOContext{REPL.Terminals.TTYTerminal}, Markdown.Code, Int64})
596 precompile(Tuple{typeof(Markdown.term), Base.IOContext{REPL.Terminals.TTYTerminal}, Markdown.Header{1}, Int64})
597 precompile(Tuple{typeof(Markdown.term), Base.IOContext{REPL.Terminals.TTYTerminal}, Markdown.HorizontalRule, Int64})
598 precompile(Tuple{typeof(Markdown.term), Base.IOContext{REPL.Terminals.TTYTerminal}, Markdown.MD, Int64})
599 precompile(Tuple{typeof(Markdown.term), Base.IOContext{REPL.Terminals.TTYTerminal}, Markdown.Paragraph, Int64})
600 precompile(Tuple{typeof(Markdown.terminline), Base.IOContext{Base.GenericIOBuffer{Array{UInt8, 1}}}, Array{Any, 1}})
601 precompile(Tuple{typeof(Markdown.terminline), Base.IOContext{Base.GenericIOBuffer{Array{UInt8, 1}}}, Markdown.Code})
602 precompile(Tuple{typeof(Markdown.terminline), Base.IOContext{Base.GenericIOBuffer{Array{UInt8, 1}}}, Markdown.Link})
603 precompile(Tuple{typeof(Markdown.terminline), Base.IOContext{Base.GenericIOBuffer{Array{UInt8, 1}}}, String})
604 precompile(Tuple{typeof(Markdown.terminline_string), Base.IOContext{Base.GenericIOBuffer{Array{UInt8, 1}}}, Array{Any, 1}})
605 precompile(Tuple{typeof(Markdown.terminline_string), Base.IOContext{REPL.Terminals.TTYTerminal}, Array{Any, 1}})
606 precompile(Tuple{typeof(Pkg.REPLMode.create_mode), REPL.LineEditREPL, REPL.LineEdit.Prompt})
607 precompile(Tuple{typeof(Pkg.REPLMode.repl_init), REPL.LineEditREPL})
608 precompile(Tuple{typeof(REPL.LineEdit.accept_result), REPL.LineEdit.MIState, REPL.LineEdit.PrefixHistoryPrompt})
609 precompile(Tuple{typeof(REPL.LineEdit.activate), REPL.LineEdit.HistoryPrompt, REPL.LineEdit.SearchState, REPL.Terminals.TerminalBuffer, REPL.Terminals.TTYTerminal})
610 precompile(Tuple{typeof(REPL.LineEdit.activate), REPL.LineEdit.PrefixHistoryPrompt, REPL.LineEdit.PrefixSearchState, REPL.Terminals.TerminalBuffer, REPL.Terminals.TTYTerminal})
611 precompile(Tuple{typeof(REPL.LineEdit.activate), REPL.LineEdit.Prompt, REPL.LineEdit.MIState, REPL.Terminals.TTYTerminal, REPL.Terminals.TTYTerminal})
612 precompile(Tuple{typeof(REPL.LineEdit.activate), REPL.LineEdit.Prompt, REPL.LineEdit.PromptState, REPL.Terminals.TTYTerminal, REPL.Terminals.TTYTerminal})
613 precompile(Tuple{typeof(REPL.LineEdit.activate), REPL.LineEdit.Prompt, REPL.LineEdit.PromptState, REPL.Terminals.TerminalBuffer, REPL.Terminals.TTYTerminal})
614 precompile(Tuple{typeof(REPL.LineEdit.activate_region), REPL.LineEdit.MIState, Symbol})
615 precompile(Tuple{typeof(REPL.LineEdit.buffer), REPL.LineEdit.MIState})
616 precompile(Tuple{typeof(REPL.LineEdit.buffer), REPL.LineEdit.PromptState})
617 precompile(Tuple{typeof(REPL.LineEdit.cancel_beep), REPL.LineEdit.MIState})
618 precompile(Tuple{typeof(REPL.LineEdit.cancel_beep), REPL.LineEdit.PrefixSearchState})
619 precompile(Tuple{typeof(REPL.LineEdit.cancel_beep), REPL.LineEdit.PromptState})
620 precompile(Tuple{typeof(REPL.LineEdit.cancel_beep), REPL.LineEdit.SearchState})
621 precompile(Tuple{typeof(REPL.LineEdit.commit_changes), REPL.Terminals.TTYTerminal, REPL.Terminals.TerminalBuffer})
622 precompile(Tuple{typeof(REPL.LineEdit.common_prefix), Array{String, 1}})
623 precompile(Tuple{typeof(REPL.LineEdit.complete_line), REPL.LineEdit.PromptState, Int64})
624 precompile(Tuple{typeof(REPL.LineEdit.complete_line), REPL.REPLCompletionProvider, REPL.LineEdit.PromptState})
625 precompile(Tuple{typeof(REPL.LineEdit.deactivate), REPL.LineEdit.HistoryPrompt, REPL.LineEdit.SearchState, REPL.Terminals.TerminalBuffer, REPL.Terminals.TTYTerminal})
626 precompile(Tuple{typeof(REPL.LineEdit.deactivate), REPL.LineEdit.PrefixHistoryPrompt, REPL.LineEdit.PrefixSearchState, REPL.Terminals.TerminalBuffer, REPL.Terminals.TTYTerminal})
627 precompile(Tuple{typeof(REPL.LineEdit.deactivate), REPL.LineEdit.Prompt, REPL.LineEdit.PromptState, REPL.Terminals.TerminalBuffer, REPL.Terminals.TTYTerminal})
628 precompile(Tuple{typeof(REPL.LineEdit.deactivate_region), REPL.LineEdit.MIState})
629 precompile(Tuple{typeof(REPL.LineEdit.deactivate_region), REPL.LineEdit.PromptState})
630 precompile(Tuple{typeof(REPL.LineEdit.default_enter_cb), REPL.LineEdit.PromptState})
631 precompile(Tuple{typeof(REPL.LineEdit.edit_abort), REPL.LineEdit.MIState})
632 precompile(Tuple{typeof(REPL.LineEdit.edit_backspace), REPL.LineEdit.PromptState, Bool, Bool})
633 precompile(Tuple{typeof(REPL.LineEdit.edit_delete), Base.GenericIOBuffer{Array{UInt8, 1}}})
634 precompile(Tuple{typeof(REPL.LineEdit.edit_delete), REPL.LineEdit.MIState})
635 precompile(Tuple{typeof(REPL.LineEdit.edit_insert), Base.GenericIOBuffer{Array{UInt8, 1}}, Base.SubString{String}})
636 precompile(Tuple{typeof(REPL.LineEdit.edit_splice!), REPL.LineEdit.PromptState, Base.Pair{Int64, Int64}, String})
637 precompile(Tuple{typeof(REPL.LineEdit.eval), Module, Expr})
638 precompile(Tuple{typeof(REPL.LineEdit.history_next_prefix), REPL.LineEdit.PrefixSearchState, REPL.REPLHistoryProvider, String})
639 precompile(Tuple{typeof(REPL.LineEdit.history_prev_prefix), REPL.LineEdit.PrefixSearchState, REPL.REPLHistoryProvider, String})
640 precompile(Tuple{typeof(REPL.LineEdit.init_state), REPL.Terminals.TTYTerminal, REPL.LineEdit.HistoryPrompt})
641 precompile(Tuple{typeof(REPL.LineEdit.init_state), REPL.Terminals.TTYTerminal, REPL.LineEdit.ModalInterface})
642 precompile(Tuple{typeof(REPL.LineEdit.init_state), REPL.Terminals.TTYTerminal, REPL.LineEdit.PrefixHistoryPrompt})
643 precompile(Tuple{typeof(REPL.LineEdit.is_region_active), REPL.LineEdit.MIState})
644 precompile(Tuple{typeof(REPL.LineEdit.keymap), REPL.LineEdit.PrefixSearchState, REPL.LineEdit.PrefixHistoryPrompt})
645 precompile(Tuple{typeof(REPL.LineEdit.keymap), REPL.LineEdit.SearchState, REPL.LineEdit.HistoryPrompt})
646 precompile(Tuple{typeof(REPL.LineEdit.keymap_data), REPL.LineEdit.PrefixSearchState, REPL.LineEdit.PrefixHistoryPrompt})
647 precompile(Tuple{typeof(REPL.LineEdit.keymap_data), REPL.LineEdit.SearchState, REPL.LineEdit.HistoryPrompt})
648 precompile(Tuple{typeof(REPL.LineEdit.match_input), Base.Dict{Char, Any}, REPL.LineEdit.MIState, Base.GenericIOBuffer{Array{UInt8, 1}}})
649 precompile(Tuple{typeof(REPL.LineEdit.match_input), Base.Dict{Char, Any}, REPL.LineEdit.MIState, REPL.Terminals.TTYTerminal, Array{Char, 1}, Base.Dict{Char, Any}})
650 precompile(Tuple{typeof(REPL.LineEdit.match_input), Base.Dict{Char, Any}, REPL.LineEdit.MIState})
651 precompile(Tuple{typeof(REPL.LineEdit.match_input), Function, REPL.LineEdit.MIState, REPL.Terminals.TTYTerminal, Array{Char, 1}, Base.Dict{Char, Any}})
652 precompile(Tuple{typeof(REPL.LineEdit.mode), REPL.LineEdit.PromptState})
653 precompile(Tuple{typeof(REPL.LineEdit.options), REPL.LineEdit.MIState})
654 precompile(Tuple{typeof(REPL.LineEdit.options), REPL.LineEdit.PromptState})
655 precompile(Tuple{typeof(REPL.LineEdit.pop_undo), REPL.LineEdit.MIState})
656 precompile(Tuple{typeof(REPL.LineEdit.prompt_string), typeof(Base.input_color)})
657 precompile(Tuple{typeof(REPL.LineEdit.push_undo), REPL.LineEdit.MIState})
658 precompile(Tuple{typeof(REPL.LineEdit.refresh_multi_line), REPL.LineEdit.MIState})
659 precompile(Tuple{typeof(REPL.LineEdit.refresh_multi_line), REPL.LineEdit.PromptState})
660 precompile(Tuple{typeof(REPL.LineEdit.refresh_multi_line), REPL.Terminals.TTYTerminal, REPL.LineEdit.PrefixSearchState})
661 precompile(Tuple{typeof(REPL.LineEdit.refresh_multi_line), REPL.Terminals.TTYTerminal, REPL.LineEdit.PromptState})
662 precompile(Tuple{typeof(REPL.LineEdit.refresh_multi_line), REPL.Terminals.TTYTerminal, REPL.LineEdit.SearchState})
663 precompile(Tuple{typeof(REPL.LineEdit.refresh_multi_line), REPL.Terminals.TerminalBuffer, REPL.Terminals.TTYTerminal, Base.GenericIOBuffer{Array{UInt8, 1}}, REPL.LineEdit.InputAreaState, String})
664 precompile(Tuple{typeof(REPL.LineEdit.refresh_multi_line), REPL.Terminals.TerminalBuffer, REPL.Terminals.TTYTerminal, REPL.LineEdit.PrefixSearchState})
665 precompile(Tuple{typeof(REPL.LineEdit.refresh_multi_line), REPL.Terminals.TerminalBuffer, REPL.Terminals.TTYTerminal, REPL.LineEdit.PromptState})
666 precompile(Tuple{typeof(REPL.LineEdit.region_active), REPL.LineEdit.MIState})
667 precompile(Tuple{typeof(REPL.LineEdit.replace_line), REPL.LineEdit.MIState, String})
668 precompile(Tuple{typeof(REPL.LineEdit.replace_line), REPL.LineEdit.PromptState, Base.GenericIOBuffer{Array{UInt8, 1}}})
669 precompile(Tuple{typeof(REPL.LineEdit.reset_state), REPL.LineEdit.MIState})
670 precompile(Tuple{typeof(REPL.LineEdit.reset_state), REPL.LineEdit.PrefixSearchState})
671 precompile(Tuple{typeof(REPL.LineEdit.reset_state), REPL.LineEdit.PromptState})
672 precompile(Tuple{typeof(REPL.LineEdit.reset_state), REPL.LineEdit.SearchState})
673 precompile(Tuple{typeof(REPL.LineEdit.reset_state), REPL.REPLHistoryProvider})
674 precompile(Tuple{typeof(REPL.LineEdit.run_interface), REPL.Terminals.TTYTerminal, REPL.LineEdit.ModalInterface, REPL.LineEdit.MIState})
675 precompile(Tuple{typeof(REPL.LineEdit.set_action!), REPL.LineEdit.MIState, Symbol})
676 precompile(Tuple{typeof(REPL.LineEdit.setmark), REPL.LineEdit.MIState, Bool})
677 precompile(Tuple{typeof(REPL.LineEdit.setup_prefix_keymap), REPL.REPLHistoryProvider, REPL.LineEdit.Prompt})
678 precompile(Tuple{typeof(REPL.LineEdit.setup_search_keymap), REPL.REPLHistoryProvider})
679 precompile(Tuple{typeof(REPL.LineEdit.show_completions), REPL.LineEdit.PromptState, Array{String, 1}})
680 precompile(Tuple{typeof(REPL.LineEdit.terminal), REPL.LineEdit.MIState})
681 precompile(Tuple{typeof(REPL.LineEdit.terminal), REPL.LineEdit.PrefixSearchState})
682 precompile(Tuple{typeof(REPL.LineEdit.terminal), REPL.LineEdit.PromptState})
683 precompile(Tuple{typeof(REPL.LineEdit.terminal), REPL.LineEdit.SearchState})
684 precompile(Tuple{typeof(REPL.REPLCompletions.completion_text), REPL.REPLCompletions.PackageCompletion})
685 precompile(Tuple{typeof(REPL.REPLCompletions.completions), String, Int64, Module})
686 precompile(Tuple{typeof(REPL.REPLCompletions.get_type), Symbol, Module})
687 precompile(Tuple{typeof(REPL.REPLCompletions.get_value), Symbol, Module})
688 precompile(Tuple{typeof(REPL.Terminals.beep), REPL.LineEdit.MIState})
689 precompile(Tuple{typeof(REPL.Terminals.beep), REPL.LineEdit.PromptState, Float64, Float64, Float64})
690 precompile(Tuple{typeof(REPL.Terminals.beep), REPL.LineEdit.SearchState})
691 precompile(Tuple{typeof(REPL.Terminals.cmove_col), REPL.Terminals.TTYTerminal, Int64})
692 precompile(Tuple{typeof(REPL.Terminals.cmove_down), REPL.Terminals.TTYTerminal, Int64})
693 precompile(Tuple{typeof(REPL.Terminals.hascolor), REPL.Terminals.TTYTerminal})
694 precompile(Tuple{typeof(REPL.Terminals.width), REPL.Terminals.TTYTerminal})
695 precompile(Tuple{typeof(Base.banner), REPL.Terminals.TTYTerminal})
696 precompile(Tuple{typeof(REPL.ends_with_semicolon), String})
697 precompile(Tuple{typeof(REPL.eval), Module, Expr})
698 precompile(Tuple{typeof(REPL.eval), Module, String})
699 precompile(Tuple{typeof(REPL.eval_user_input), Any, REPL.REPLBackend})
700 precompile(Tuple{typeof(REPL.eval_user_input), Expr, REPL.REPLBackend})
701 precompile(Tuple{typeof(REPL.filtervalid), Array{Any, 1}})
702 precompile(Tuple{typeof(REPL.fuzzysort), String, Array{String, 1}})
703 precompile(Tuple{typeof(REPL.helpmode), Base.TTY, String})
704 precompile(Tuple{typeof(REPL.helpmode), String})
705 precompile(Tuple{typeof(REPL.hist_from_file), REPL.REPLHistoryProvider, Base.IOStream, String})
706 precompile(Tuple{typeof(REPL.insert_hlines), Base.TTY, Markdown.MD})
707 precompile(Tuple{typeof(REPL.lookup_doc), Symbol})
708 precompile(Tuple{typeof(REPL.mode_idx), REPL.REPLHistoryProvider, REPL.LineEdit.Prompt})
709 precompile(Tuple{typeof(REPL.prepare_next), REPL.LineEditREPL})
710 precompile(Tuple{typeof(REPL.print_response), REPL.LineEditREPL, ArgumentError, Array{Union{Ptr{Nothing}, Base.InterpreterIP}, 1}, Bool, Bool})
711 precompile(Tuple{typeof(REPL.print_response), REPL.LineEditREPL, Markdown.MD, Nothing, Bool, Bool})
712 precompile(Tuple{typeof(REPL.print_response), REPL.Terminals.TTYTerminal, ArgumentError, Array{Union{Ptr{Nothing}, Base.InterpreterIP}, 1}, Bool, Bool, Nothing})
713 precompile(Tuple{typeof(REPL.print_response), REPL.Terminals.TTYTerminal, Markdown.MD, Nothing, Bool, Bool, Nothing})
714 precompile(Tuple{typeof(REPL.repl), Base.TTY, Symbol})
715 precompile(Tuple{typeof(REPL.repl_latex), Base.TTY, String})
716 precompile(Tuple{typeof(REPL.repl_search), Base.TTY, String})
717 precompile(Tuple{typeof(REPL.reset), REPL.LineEditREPL})
718 precompile(Tuple{typeof(REPL.return_callback), REPL.LineEdit.PromptState})
719 precompile(Tuple{typeof(REPL.run_repl), REPL.LineEditREPL, typeof(x->nothing)})
720 precompile(Tuple{typeof(REPL.send_to_backend), Expr, Base.Channel{Any}, Base.Channel{Any}})
721 precompile(Tuple{typeof(REPL.send_to_backend), Expr, REPL.REPLBackendRef})
722 precompile(Tuple{typeof(REPL.send_to_backend), String, Base.Channel{Any}, Base.Channel{Any}})
723 precompile(Tuple{typeof(REPL.send_to_backend), String, REPL.REPLBackendRef})
724 precompile(Tuple{typeof(REPL.send_to_backend), Symbol, Base.Channel{Any}, Base.Channel{Any}})
725 precompile(Tuple{typeof(REPL.send_to_backend), Symbol, REPL.REPLBackendRef})
726 precompile(Tuple{typeof(REPL.setup_interface), REPL.LineEditREPL, Bool, Array{Base.Dict{Any, Any}, 1}})
727 precompile(Tuple{typeof(REPL.setup_interface), REPL.LineEditREPL, Bool, Base.Dict{Any, Any}})
728 precompile(Tuple{typeof(REPL.setup_interface), REPL.LineEditREPL})
729 precompile(Tuple{typeof(REPL.start_repl_backend), Base.Channel{Any}, Base.Channel{Any}})
730 precompile(Tuple{typeof(Random.__init__)})
731 precompile(Tuple{typeof(eval), Module, Expr})
506506 $(eval $(call LLVM_PATCH,llvm-D50010-VNCoercion-ni))
507507 $(eval $(call LLVM_PATCH,llvm-D50167-scev-umin))
508508 $(eval $(call LLVM_PATCH,llvm-windows-race))
509 $(eval $(call LLVM_PATCH,llvm-rL326967-aligned-load)) # remove for 7.0
509510 endif # LLVM_VER
510511
511512 # Remove hardcoded OS X requirements in compilter-rt cmake build
0 commit b398d8e1fa5a5a914957fa22d0a64db97f6c265e
1 Author: Craig Topper <craig.topper@intel.com>
2 Date: Thu Mar 8 00:21:17 2018 +0000
3
4 [X86] Fix some isel patterns that used aligned vector load instructions with unaligned predicates.
5
6 These patterns weren't checking the alignment of the load, but were using the aligned instructions. This will cause a GP fault if the data isn't aligned.
7
8 I believe these were introduced in r312450.
9
10 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@326967 91177308-0d34-0410-b5e6-96231b3b80d8
11
12 diff --git a/lib/Target/X86/X86InstrVecCompiler.td b/lib/Target/X86/X86InstrVecCompiler.td
13 index db3dfe56531..50c7763a2c3 100644
14 --- a/lib/Target/X86/X86InstrVecCompiler.td
15 +++ b/lib/Target/X86/X86InstrVecCompiler.td
16 @@ -261,10 +261,10 @@ let Predicates = [HasVLX] in {
17 // will zero the upper bits.
18 // TODO: Is there a safe way to detect whether the producing instruction
19 // already zeroed the upper bits?
20 -multiclass subvector_zero_lowering<string MoveStr, RegisterClass RC,
21 - ValueType DstTy, ValueType SrcTy,
22 - ValueType ZeroTy, PatFrag memop,
23 - SubRegIndex SubIdx> {
24 +multiclass subvector_zero_lowering<string MoveStr, string LoadStr,
25 + RegisterClass RC, ValueType DstTy,
26 + ValueType SrcTy, ValueType ZeroTy,
27 + PatFrag memop, SubRegIndex SubIdx> {
28 def : Pat<(DstTy (insert_subvector (bitconvert (ZeroTy immAllZerosV)),
29 (SrcTy RC:$src), (iPTR 0))),
30 (SUBREG_TO_REG (i64 0),
31 @@ -274,91 +274,91 @@ multiclass subvector_zero_lowering<string MoveStr, RegisterClass RC,
32 (SrcTy (bitconvert (memop addr:$src))),
33 (iPTR 0))),
34 (SUBREG_TO_REG (i64 0),
35 - (!cast<Instruction>("VMOV"#MoveStr#"rm") addr:$src), SubIdx)>;
36 + (!cast<Instruction>("VMOV"#LoadStr#"rm") addr:$src), SubIdx)>;
37 }
38
39 let Predicates = [HasAVX, NoVLX] in {
40 - defm : subvector_zero_lowering<"APD", VR128, v4f64, v2f64, v8i32, loadv2f64,
41 - sub_xmm>;
42 - defm : subvector_zero_lowering<"APS", VR128, v8f32, v4f32, v8i32, loadv4f32,
43 - sub_xmm>;
44 - defm : subvector_zero_lowering<"DQA", VR128, v4i64, v2i64, v8i32, loadv2i64,
45 - sub_xmm>;
46 - defm : subvector_zero_lowering<"DQA", VR128, v8i32, v4i32, v8i32, loadv2i64,
47 - sub_xmm>;
48 - defm : subvector_zero_lowering<"DQA", VR128, v16i16, v8i16, v8i32, loadv2i64,
49 - sub_xmm>;
50 - defm : subvector_zero_lowering<"DQA", VR128, v32i8, v16i8, v8i32, loadv2i64,
51 - sub_xmm>;
52 -}
53 -
54 -let Predicates = [HasVLX] in {
55 - defm : subvector_zero_lowering<"APDZ128", VR128X, v4f64, v2f64, v8i32,
56 + defm : subvector_zero_lowering<"APD", "UPD", VR128, v4f64, v2f64, v8i32,
57 loadv2f64, sub_xmm>;
58 - defm : subvector_zero_lowering<"APSZ128", VR128X, v8f32, v4f32, v8i32,
59 + defm : subvector_zero_lowering<"APS", "UPS", VR128, v8f32, v4f32, v8i32,
60 loadv4f32, sub_xmm>;
61 - defm : subvector_zero_lowering<"DQA64Z128", VR128X, v4i64, v2i64, v8i32,
62 + defm : subvector_zero_lowering<"DQA", "DQU", VR128, v4i64, v2i64, v8i32,
63 loadv2i64, sub_xmm>;
64 - defm : subvector_zero_lowering<"DQA64Z128", VR128X, v8i32, v4i32, v8i32,
65 + defm : subvector_zero_lowering<"DQA", "DQU", VR128, v8i32, v4i32, v8i32,
66 loadv2i64, sub_xmm>;
67 - defm : subvector_zero_lowering<"DQA64Z128", VR128X, v16i16, v8i16, v8i32,
68 + defm : subvector_zero_lowering<"DQA", "DQU", VR128, v16i16, v8i16, v8i32,
69 loadv2i64, sub_xmm>;
70 - defm : subvector_zero_lowering<"DQA64Z128", VR128X, v32i8, v16i8, v8i32,
71 - loadv2i64, sub_xmm>;
72 -
73 - defm : subvector_zero_lowering<"APDZ128", VR128X, v8f64, v2f64, v16i32,
74 - loadv2f64, sub_xmm>;
75 - defm : subvector_zero_lowering<"APSZ128", VR128X, v16f32, v4f32, v16i32,
76 - loadv4f32, sub_xmm>;
77 - defm : subvector_zero_lowering<"DQA64Z128", VR128X, v8i64, v2i64, v16i32,
78 - loadv2i64, sub_xmm>;
79 - defm : subvector_zero_lowering<"DQA64Z128", VR128X, v16i32, v4i32, v16i32,
80 - loadv2i64, sub_xmm>;
81 - defm : subvector_zero_lowering<"DQA64Z128", VR128X, v32i16, v8i16, v16i32,
82 - loadv2i64, sub_xmm>;
83 - defm : subvector_zero_lowering<"DQA64Z128", VR128X, v64i8, v16i8, v16i32,
84 + defm : subvector_zero_lowering<"DQA", "DQU", VR128, v32i8, v16i8, v8i32,
85 loadv2i64, sub_xmm>;
86 +}
87
88 - defm : subvector_zero_lowering<"APDZ256", VR256X, v8f64, v4f64, v16i32,
89 - loadv4f64, sub_ymm>;
90 - defm : subvector_zero_lowering<"APSZ256", VR256X, v16f32, v8f32, v16i32,
91 - loadv8f32, sub_ymm>;
92 - defm : subvector_zero_lowering<"DQA64Z256", VR256X, v8i64, v4i64, v16i32,
93 - loadv4i64, sub_ymm>;
94 - defm : subvector_zero_lowering<"DQA64Z256", VR256X, v16i32, v8i32, v16i32,
95 - loadv4i64, sub_ymm>;
96 - defm : subvector_zero_lowering<"DQA64Z256", VR256X, v32i16, v16i16, v16i32,
97 - loadv4i64, sub_ymm>;
98 - defm : subvector_zero_lowering<"DQA64Z256", VR256X, v64i8, v32i8, v16i32,
99 - loadv4i64, sub_ymm>;
100 +let Predicates = [HasVLX] in {
101 + defm : subvector_zero_lowering<"APDZ128", "UPDZ128", VR128X, v4f64,
102 + v2f64, v8i32, loadv2f64, sub_xmm>;
103 + defm : subvector_zero_lowering<"APSZ128", "UPSZ128", VR128X, v8f32,
104 + v4f32, v8i32, loadv4f32, sub_xmm>;
105 + defm : subvector_zero_lowering<"DQA64Z128", "DQU64Z128", VR128X, v4i64,
106 + v2i64, v8i32, loadv2i64, sub_xmm>;
107 + defm : subvector_zero_lowering<"DQA64Z128", "DQU64Z128", VR128X, v8i32,
108 + v4i32, v8i32, loadv2i64, sub_xmm>;
109 + defm : subvector_zero_lowering<"DQA64Z128", "DQU64Z128", VR128X, v16i16,
110 + v8i16, v8i32, loadv2i64, sub_xmm>;
111 + defm : subvector_zero_lowering<"DQA64Z128", "DQU64Z128", VR128X, v32i8,
112 + v16i8, v8i32, loadv2i64, sub_xmm>;
113 +
114 + defm : subvector_zero_lowering<"APDZ128", "UPDZ128", VR128X, v8f64,
115 + v2f64, v16i32, loadv2f64, sub_xmm>;
116 + defm : subvector_zero_lowering<"APSZ128", "UPSZ128", VR128X, v16f32,
117 + v4f32, v16i32, loadv4f32, sub_xmm>;
118 + defm : subvector_zero_lowering<"DQA64Z128", "DQU64Z128", VR128X, v8i64,
119 + v2i64, v16i32, loadv2i64, sub_xmm>;
120 + defm : subvector_zero_lowering<"DQA64Z128", "DQU64Z128", VR128X, v16i32,
121 + v4i32, v16i32, loadv2i64, sub_xmm>;
122 + defm : subvector_zero_lowering<"DQA64Z128", "DQU64Z128", VR128X, v32i16,
123 + v8i16, v16i32, loadv2i64, sub_xmm>;
124 + defm : subvector_zero_lowering<"DQA64Z128", "DQU64Z128", VR128X, v64i8,
125 + v16i8, v16i32, loadv2i64, sub_xmm>;
126 +
127 + defm : subvector_zero_lowering<"APDZ256", "UPDZ256", VR256X, v8f64,
128 + v4f64, v16i32, loadv4f64, sub_ymm>;
129 + defm : subvector_zero_lowering<"APSZ256", "UPDZ256", VR256X, v16f32,
130 + v8f32, v16i32, loadv8f32, sub_ymm>;
131 + defm : subvector_zero_lowering<"DQA64Z256", "DQU64Z256", VR256X, v8i64,
132 + v4i64, v16i32, loadv4i64, sub_ymm>;
133 + defm : subvector_zero_lowering<"DQA64Z256", "DQU64Z256", VR256X, v16i32,
134 + v8i32, v16i32, loadv4i64, sub_ymm>;
135 + defm : subvector_zero_lowering<"DQA64Z256", "DQU64Z256", VR256X, v32i16,
136 + v16i16, v16i32, loadv4i64, sub_ymm>;
137 + defm : subvector_zero_lowering<"DQA64Z256", "DQU64Z256", VR256X, v64i8,
138 + v32i8, v16i32, loadv4i64, sub_ymm>;
139 }
140
141 let Predicates = [HasAVX512, NoVLX] in {
142 - defm : subvector_zero_lowering<"APD", VR128, v8f64, v2f64, v16i32, loadv2f64,
143 - sub_xmm>;
144 - defm : subvector_zero_lowering<"APS", VR128, v16f32, v4f32, v16i32, loadv4f32,
145 - sub_xmm>;
146 - defm : subvector_zero_lowering<"DQA", VR128, v8i64, v2i64, v16i32, loadv2i64,
147 - sub_xmm>;
148 - defm : subvector_zero_lowering<"DQA", VR128, v16i32, v4i32, v16i32, loadv2i64,
149 - sub_xmm>;
150 - defm : subvector_zero_lowering<"DQA", VR128, v32i16, v8i16, v16i32, loadv2i64,
151 - sub_xmm>;
152 - defm : subvector_zero_lowering<"DQA", VR128, v64i8, v16i8, v16i32, loadv2i64,
153 - sub_xmm>;
154 -
155 - defm : subvector_zero_lowering<"APDY", VR256, v8f64, v4f64, v16i32,
156 - loadv4f64, sub_ymm>;
157 - defm : subvector_zero_lowering<"APSY", VR256, v16f32, v8f32, v16i32,
158 - loadv8f32, sub_ymm>;
159 - defm : subvector_zero_lowering<"DQAY", VR256, v8i64, v4i64, v16i32,
160 - loadv4i64, sub_ymm>;
161 - defm : subvector_zero_lowering<"DQAY", VR256, v16i32, v8i32, v16i32,
162 - loadv4i64, sub_ymm>;
163 - defm : subvector_zero_lowering<"DQAY", VR256, v32i16, v16i16, v16i32,
164 - loadv4i64, sub_ymm>;
165 - defm : subvector_zero_lowering<"DQAY", VR256, v64i8, v32i8, v16i32,
166 - loadv4i64, sub_ymm>;
167 + defm : subvector_zero_lowering<"APD", "UPD", VR128, v8f64, v2f64,
168 + v16i32,loadv2f64, sub_xmm>;
169 + defm : subvector_zero_lowering<"APS", "UPS", VR128, v16f32, v4f32,
170 + v16i32, loadv4f32, sub_xmm>;
171 + defm : subvector_zero_lowering<"DQA", "DQU", VR128, v8i64, v2i64,
172 + v16i32, loadv2i64, sub_xmm>;
173 + defm : subvector_zero_lowering<"DQA", "DQU", VR128, v16i32, v4i32,
174 + v16i32, loadv2i64, sub_xmm>;
175 + defm : subvector_zero_lowering<"DQA", "DQU", VR128, v32i16, v8i16,
176 + v16i32, loadv2i64, sub_xmm>;
177 + defm : subvector_zero_lowering<"DQA", "DQU", VR128, v64i8, v16i8,
178 + v16i32, loadv2i64, sub_xmm>;
179 +
180 + defm : subvector_zero_lowering<"APDY", "UPDY", VR256, v8f64, v4f64,
181 + v16i32, loadv4f64, sub_ymm>;
182 + defm : subvector_zero_lowering<"APSY", "UPSY", VR256, v16f32, v8f32,
183 + v16i32, loadv8f32, sub_ymm>;
184 + defm : subvector_zero_lowering<"DQAY", "DQUY", VR256, v8i64, v4i64,
185 + v16i32, loadv4i64, sub_ymm>;
186 + defm : subvector_zero_lowering<"DQAY", "DQUY", VR256, v16i32, v8i32,
187 + v16i32, loadv4i64, sub_ymm>;
188 + defm : subvector_zero_lowering<"DQAY", "DQUY", VR256, v32i16, v16i16,
189 + v16i32, loadv4i64, sub_ymm>;
190 + defm : subvector_zero_lowering<"DQAY", "DQUY", VR256, v64i8, v32i8,
191 + v16i32, loadv4i64, sub_ymm>;
192 }
193
194 // List of opcodes that guaranteed to zero the upper elements of vector regs.
195 diff --git a/test/CodeGen/X86/merge-consecutive-loads-256.ll b/test/CodeGen/X86/merge-consecutive-loads-256.ll
196 index 6ecd8116443..0f2cf594b1c 100644
197 --- a/test/CodeGen/X86/merge-consecutive-loads-256.ll
198 +++ b/test/CodeGen/X86/merge-consecutive-loads-256.ll
199 @@ -28,13 +28,13 @@ define <4 x double> @merge_4f64_2f64_23(<2 x double>* %ptr) nounwind uwtable noi
200 define <4 x double> @merge_4f64_2f64_2z(<2 x double>* %ptr) nounwind uwtable noinline ssp {
201 ; AVX-LABEL: merge_4f64_2f64_2z:
202 ; AVX: # %bb.0:
203 -; AVX-NEXT: vmovaps 32(%rdi), %xmm0
204 +; AVX-NEXT: vmovups 32(%rdi), %xmm0
205 ; AVX-NEXT: retq
206 ;
207 ; X32-AVX-LABEL: merge_4f64_2f64_2z:
208 ; X32-AVX: # %bb.0:
209 ; X32-AVX-NEXT: movl {{[0-9]+}}(%esp), %eax
210 -; X32-AVX-NEXT: vmovaps 32(%eax), %xmm0
211 +; X32-AVX-NEXT: vmovups 32(%eax), %xmm0
212 ; X32-AVX-NEXT: retl
213 %ptr0 = getelementptr inbounds <2 x double>, <2 x double>* %ptr, i64 2
214 %val0 = load <2 x double>, <2 x double>* %ptr0
215 @@ -109,13 +109,13 @@ define <4 x double> @merge_4f64_f64_34uu(double* %ptr) nounwind uwtable noinline
216 define <4 x double> @merge_4f64_f64_45zz(double* %ptr) nounwind uwtable noinline ssp {
217 ; AVX-LABEL: merge_4f64_f64_45zz:
218 ; AVX: # %bb.0:
219 -; AVX-NEXT: vmovaps 32(%rdi), %xmm0
220 +; AVX-NEXT: vmovups 32(%rdi), %xmm0
221 ; AVX-NEXT: retq
222 ;
223 ; X32-AVX-LABEL: merge_4f64_f64_45zz:
224 ; X32-AVX: # %bb.0:
225 ; X32-AVX-NEXT: movl {{[0-9]+}}(%esp), %eax
226 -; X32-AVX-NEXT: vmovaps 32(%eax), %xmm0
227 +; X32-AVX-NEXT: vmovups 32(%eax), %xmm0
228 ; X32-AVX-NEXT: retl
229 %ptr0 = getelementptr inbounds double, double* %ptr, i64 4
230 %ptr1 = getelementptr inbounds double, double* %ptr, i64 5
231 @@ -155,13 +155,13 @@ define <4 x double> @merge_4f64_f64_34z6(double* %ptr) nounwind uwtable noinline
232 define <4 x i64> @merge_4i64_2i64_3z(<2 x i64>* %ptr) nounwind uwtable noinline ssp {
233 ; AVX-LABEL: merge_4i64_2i64_3z:
234 ; AVX: # %bb.0:
235 -; AVX-NEXT: vmovaps 48(%rdi), %xmm0
236 +; AVX-NEXT: vmovups 48(%rdi), %xmm0
237 ; AVX-NEXT: retq
238 ;
239 ; X32-AVX-LABEL: merge_4i64_2i64_3z:
240 ; X32-AVX: # %bb.0:
241 ; X32-AVX-NEXT: movl {{[0-9]+}}(%esp), %eax
242 -; X32-AVX-NEXT: vmovaps 48(%eax), %xmm0
243 +; X32-AVX-NEXT: vmovups 48(%eax), %xmm0
244 ; X32-AVX-NEXT: retl
245 %ptr0 = getelementptr inbounds <2 x i64>, <2 x i64>* %ptr, i64 3
246 %val0 = load <2 x i64>, <2 x i64>* %ptr0
247 @@ -217,13 +217,13 @@ define <4 x i64> @merge_4i64_i64_1zzu(i64* %ptr) nounwind uwtable noinline ssp {
248 define <4 x i64> @merge_4i64_i64_23zz(i64* %ptr) nounwind uwtable noinline ssp {
249 ; AVX-LABEL: merge_4i64_i64_23zz:
250 ; AVX: # %bb.0:
251 -; AVX-NEXT: vmovaps 16(%rdi), %xmm0
252 +; AVX-NEXT: vmovups 16(%rdi), %xmm0
253 ; AVX-NEXT: retq
254 ;
255 ; X32-AVX-LABEL: merge_4i64_i64_23zz:
256 ; X32-AVX: # %bb.0:
257 ; X32-AVX-NEXT: movl {{[0-9]+}}(%esp), %eax
258 -; X32-AVX-NEXT: vmovaps 16(%eax), %xmm0
259 +; X32-AVX-NEXT: vmovups 16(%eax), %xmm0
260 ; X32-AVX-NEXT: retl
261 %ptr0 = getelementptr inbounds i64, i64* %ptr, i64 2
262 %ptr1 = getelementptr inbounds i64, i64* %ptr, i64 3
263 diff --git a/test/CodeGen/X86/merge-consecutive-loads-512.ll b/test/CodeGen/X86/merge-consecutive-loads-512.ll
264 index 62102eb382c..3c6eaf65292 100644
265 --- a/test/CodeGen/X86/merge-consecutive-loads-512.ll
266 +++ b/test/CodeGen/X86/merge-consecutive-loads-512.ll
267 @@ -106,13 +106,13 @@ define <8 x double> @merge_8f64_f64_23uuuuu9(double* %ptr) nounwind uwtable noin
268 define <8 x double> @merge_8f64_f64_12zzuuzz(double* %ptr) nounwind uwtable noinline ssp {
269 ; ALL-LABEL: merge_8f64_f64_12zzuuzz:
270 ; ALL: # %bb.0:
271 -; ALL-NEXT: vmovaps 8(%rdi), %xmm0
272 +; ALL-NEXT: vmovups 8(%rdi), %xmm0
273 ; ALL-NEXT: retq
274 ;
275 ; X32-AVX512F-LABEL: merge_8f64_f64_12zzuuzz:
276 ; X32-AVX512F: # %bb.0:
277 ; X32-AVX512F-NEXT: movl {{[0-9]+}}(%esp), %eax
278 -; X32-AVX512F-NEXT: vmovaps 8(%eax), %xmm0
279 +; X32-AVX512F-NEXT: vmovups 8(%eax), %xmm0
280 ; X32-AVX512F-NEXT: retl
281 %ptr0 = getelementptr inbounds double, double* %ptr, i64 1
282 %ptr1 = getelementptr inbounds double, double* %ptr, i64 2
283 @@ -190,7 +190,7 @@ define <8 x i64> @merge_8i64_4i64_z3(<4 x i64>* %ptr) nounwind uwtable noinline
284 define <8 x i64> @merge_8i64_i64_56zz9uzz(i64* %ptr) nounwind uwtable noinline ssp {
285 ; ALL-LABEL: merge_8i64_i64_56zz9uzz:
286 ; ALL: # %bb.0:
287 -; ALL-NEXT: vmovaps 40(%rdi), %xmm0
288 +; ALL-NEXT: vmovups 40(%rdi), %xmm0
289 ; ALL-NEXT: vmovsd {{.*#+}} xmm1 = mem[0],zero
290 ; ALL-NEXT: vinsertf64x4 $1, %ymm1, %zmm0, %zmm0
291 ; ALL-NEXT: retq
292 @@ -198,7 +198,7 @@ define <8 x i64> @merge_8i64_i64_56zz9uzz(i64* %ptr) nounwind uwtable noinline s
293 ; X32-AVX512F-LABEL: merge_8i64_i64_56zz9uzz:
294 ; X32-AVX512F: # %bb.0:
295 ; X32-AVX512F-NEXT: movl {{[0-9]+}}(%esp), %eax
296 -; X32-AVX512F-NEXT: vmovaps 40(%eax), %xmm0
297 +; X32-AVX512F-NEXT: vmovups 40(%eax), %xmm0
298 ; X32-AVX512F-NEXT: vmovsd {{.*#+}} xmm1 = mem[0],zero
299 ; X32-AVX512F-NEXT: vinsertf64x4 $1, %ymm1, %zmm0, %zmm0
300 ; X32-AVX512F-NEXT: retl
3939 end
4040 end
4141
42 # Generate a suitable markdown file from NEWS.md and put it in src
43 str = read(joinpath(@__DIR__, "..", "NEWS.md"), String)
44 splitted = split(str, "<!--- generated by NEWS-update.jl: -->")
45 @assert length(splitted) == 2
46 replaced_links = replace(splitted[1], r"\[\#([0-9]*?)\]" => s"[#\g<1>](https://github.com/JuliaLang/julia/issues/\g<1>)")
47 write(joinpath(@__DIR__, "src", "NEWS.md"), replaced_links)
42 # # Generate a suitable markdown file from NEWS.md and put it in src
43 # str = read(joinpath(@__DIR__, "..", "NEWS.md"), String)
44 # splitted = split(str, "<!--- generated by NEWS-update.jl: -->")
45 # @assert length(splitted) == 2
46 # replaced_links = replace(splitted[1], r"\[\#([0-9]*?)\]" => s"[#\g<1>](https://github.com/JuliaLang/julia/issues/\g<1>)")
47 # write(joinpath(@__DIR__, "src", "NEWS.md"), replaced_links)
4848
4949 const PAGES = [
5050 "Home" => "index.md",
51 hide("NEWS.md"),
51 # hide("NEWS.md"),
5252 "Manual" => [
5353 "manual/getting-started.md",
5454 "manual/variables.md",
161161 analytics = "UA-28835595-6",
162162 pages = PAGES,
163163 html_prettyurls = ("deploy" in ARGS),
164 html_canonical = ("deploy" in ARGS) ? "https://docs.julialang.org/en/stable/" : nothing,
164 html_canonical = ("deploy" in ARGS) ? "https://docs.julialang.org/en/v1/" : nothing,
165165 assets = ["assets/julia-manual.css", ]
166166 )
167
168 # This overloads the function in Documenter that generates versions.js, to include
169 # v1/ in the version selector, instead of stable/.
170 #
171 # The function is identical to the version found in Documenter v0.19.6, except that
172 # it includes "v1" instead of "stable".
173 #
174 # Original:
175 # https://github.com/JuliaDocs/Documenter.jl/blob/v0.19.6/src/Writers/HTMLWriter.jl#L481-L506
176 #
177 import Documenter.Writers.HTMLWriter: generate_version_file
178 function generate_version_file(dir::AbstractString)
179 named_folders = ["v1", "latest"]
180 tag_folders = []
181 for each in readdir(dir)
182 each == "v1" && continue # skip the v1 symlink
183 occursin(Base.VERSION_REGEX, each) && push!(tag_folders, each)
184 end
185 # sort tags by version number
186 sort!(tag_folders, lt = (x, y) -> VersionNumber(x) < VersionNumber(y), rev = true)
187 open(joinpath(dir, "versions.js"), "w") do buf
188 println(buf, "var DOC_VERSIONS = [")
189 for group in (named_folders, tag_folders)
190 for folder in group
191 println(buf, " \"", folder, "\",")
192 end
193 end
194 println(buf, "];")
195 end
196 end
167197
168198 # Only deploy docs from 64bit Linux to avoid committing multiple versions of the same
169199 # docs from different workers.
5252 Base.length(::AbstractArray)
5353 Base.eachindex
5454 Base.IndexStyle
55 Base.IndexLinear
56 Base.IndexCartesian
5557 Base.conj!
5658 Base.stride
5759 Base.strides
8888 Base.isreal
8989 Core.Float32(::Any)
9090 Core.Float64(::Any)
91 Base.GMP.BigInt(::Any)
92 Base.MPFR.BigFloat(::Any)
9391 Base.Rounding.rounding
9492 Base.Rounding.setrounding(::Type, ::Any)
9593 Base.Rounding.setrounding(::Function, ::Type, ::RoundingMode)
112110 Base.@uint128_str
113111 ```
114112
115 ## BigFloats
113 ## BigFloats and BigInts
116114
117 The [`BigFloat`](@ref) type implements arbitrary-precision floating-point arithmetic using
118 the [GNU MPFR library](http://www.mpfr.org/).
115 The [`BigFloat`](@ref) and [`BigInt`](@ref) types implements
116 arbitrary-precision floating point and integer arithmetic, respectively. For
117 [`BigFloat`](@ref) the [GNU MPFR library](http://www.mpfr.org/) is used,
118 and for [`BigInt`](@ref) the [GNU Multiple Precision Arithmetic Library (GMP)]
119 (https://gmplib.org) is used.
119120
120121 ```@docs
122 Base.MPFR.BigFloat(::Any)
121123 Base.precision
122124 Base.MPFR.precision(::Type{BigFloat})
123125 Base.MPFR.setprecision
124126 Base.MPFR.BigFloat(x, prec::Int)
125 BigFloat(x::Union{Integer, AbstractFloat, String}, rounding::RoundingMode)
127 Base.MPFR.BigFloat(x::Union{Integer, AbstractFloat, String}, rounding::RoundingMode)
126128 Base.MPFR.BigFloat(x, prec::Int, rounding::RoundingMode)
127 Base.MPFR.BigFloat(x::String)
129 Base.GMP.BigInt(::Any)
128130 Base.@big_str
129131 ```
109109 Base.sort!
110110 Base.sort
111111 Base.sortperm
112 Base.InsertionSort
113 Base.MergeSort
114 Base.QuickSort
115 Base.PartialQuickSort
112116 Base.Sort.sortperm!
113117 Base.Sort.sortslices
114118 ```
130134
131135 There are currently four sorting algorithms available in base Julia:
132136
133 * `InsertionSort`
134 * `QuickSort`
135 * `PartialQuickSort(k)`
136 * `MergeSort`
137 * [`InsertionSort`](@ref)
138 * [`QuickSort`](@ref)
139 * [`PartialQuickSort(k)`](@ref)
140 * [`MergeSort`](@ref)
137141
138142 `InsertionSort` is an O(n^2) stable sorting algorithm. It is efficient for very small `n`, and
139143 is used internally by `QuickSort`.
1414 ## [Version/Environment info](@id dev-version-info)
1515
1616 No matter the error, we will always need to know what version of Julia you are running. When Julia
17 first starts up, a header is printed out with a version number and date. Please also include the
18 output of `versioninfo()` in any report you create:
17 first starts up, a header is printed out with a version number and date. Please also include the output of `versioninfo()` (exported from the [`InteractiveUtils`](@ref InteractiveUtils.versioninfo) standard library) in any report you create:
1918
2019 ```@repl
20 using InteractiveUtils
2121 versioninfo()
2222 ```
2323
00 # Memory layout of Julia Objects
11
2 ## Object layout (jl_value_t)
2 ## Object layout (`jl_value_t`)
33
44 The `jl_value_t` struct is the name for a block of memory owned by the Julia Garbage Collector,
55 representing the data associated with a Julia object in memory. Absent any type information, it
0 # Julia 0.7 Documentation
0 # Julia 1.0 Documentation
11
2 Welcome to the documentation for Julia 0.7.
2 Welcome to the documentation for Julia 1.0.
33
4 Please read the [release notes](NEWS.md) to see what has changed since the last release.
4 Please read the [release blog post](https://julialang.org/blog/2018/08/one-point-zero) for a general overview of the language and
5 many of the changes since Julia v0.6. Note that version 0.7 was released alongside
6 1.0 to provide an upgrade path for packages and code that predates the 1.0 release.
7 The only difference between 0.7 and 1.0 is the removal of deprecation warnings.
8 For a complete list of all the changes since 0.6, see the [release notes for version 0.7](https://docs.julialang.org/en/v0.7.0/NEWS/)
59
610 ### [Introduction](@id man-introduction)
711
691691 2. Binary arithmetic -- `-`, `+`, `*`, `/`, `\`, `^`
692692 3. Comparison -- `==`, `!=`, `≈` ([`isapprox`](@ref)), `≉`
693693
694 Most of the binary arithmetic operators listed above also operate elementwise
695 when one argument is scalar: `-`, `+`, and `*` when either argument is scalar,
696 and `/` and `\` when the denominator is scalar. For example, `[1, 2] + 3 == [4, 5]`
697 and `[6, 4] / 2 == [3, 2]`.
698
699 Additionally, to enable convenient vectorization of mathematical and other operations,
694 To enable convenient vectorization of mathematical and other operations,
700695 Julia [provides the dot syntax](@ref man-vectorized) `f.(args...)`, e.g. `sin.(x)`
701696 or `min.(x,y)`, for elementwise operations over arrays or mixtures of arrays and
702697 scalars (a [Broadcasting](@ref) operation); these have the additional advantage of
781776
782777 ## Implementation
783778
784 The base array type in Julia is the abstract type [`AbstractArray{T,N}`](@ref). It is parametrized by
779 The base array type in Julia is the abstract type [`AbstractArray{T,N}`](@ref). It is parameterized by
785780 the number of dimensions `N` and the element type `T`. [`AbstractVector`](@ref) and [`AbstractMatrix`](@ref) are
786781 aliases for the 1-d and 2-d cases. Operations on `AbstractArray` objects are defined using higher
787782 level operators and functions, in a way that is independent of the underlying storage. These operations
832827 [`stride(A,k)`](@ref). If a pointer conversion method [`Base.unsafe_convert(Ptr{T}, A)`](@ref) is
833828 provided, the memory layout must correspond in the same way to these strides. `DenseArray` is a
834829 very specific example of a strided array where the elements are arranged contiguously, thus it
835 provides its subtypes with the approporiate definition of `strides`. More concrete examples
830 provides its subtypes with the appropriate definition of `strides`. More concrete examples
836831 can be found within the [interface guide for strided arrays](@ref man-interface-strided-arrays).
837832 [`StridedVector`](@ref) and [`StridedMatrix`](@ref) are convenient aliases for many of the builtin array types that
838833 are considered strided arrays, allowing them to dispatch to select specialized implementations that
129129
130130 ```julia
131131 function gethostname()
132 hostname = Vector{UInt8}(128)
132 hostname = Vector{UInt8}(undef, 128)
133133 ccall((:gethostname, "libc"), Int32,
134134 (Ptr{UInt8}, Csize_t),
135135 hostname, sizeof(hostname))
819819 if nmax < nmin
820820 throw(DomainError())
821821 end
822 result_array = Vector{Cdouble}(nmax - nmin + 1)
822 result_array = Vector{Cdouble}(undef, nmax - nmin + 1)
823823 errorcode = ccall(
824824 (:gsl_sf_bessel_Jn_array, :libgsl), # name of C function and library
825825 Cint, # output type
972972 signature for Windows:
973973
974974 ```julia
975 hn = Vector{UInt8}(256)
975 hn = Vector{UInt8}(undef, 256)
976976 err = ccall(:gethostname, stdcall, Int32, (Ptr{UInt8}, UInt32), hn, length(hn))
977977 ```
978978
180180 9. Respect the line length limit used in the surrounding code.
181181
182182 Docstrings are edited using the same tools as code. Therefore, the same conventions should apply.
183 It it advised to add line breaks after 92 characters.
183 It is advised to add line breaks after 92 characters.
184184 6. Provide information allowing custom types to implement the function in an
185185 `# Implementation` section. These implementation details intended for developers
186186 rather than users, explaining e.g. which functions should be overridden and which functions
567567 Surround words with one asterisk, `*`, to display the enclosed text in italics.
568568
569569 ```
570 A paragraph containing an *emphasised* word.
570 A paragraph containing an *emphasized* word.
571571 ```
572572
573573 #### Literals
620620
621621 ```julia
622622 """
623 accumulate!(op, y, x)
624
625 Cumulative operation `op` on a vector `x`, storing the result in `y`. See also [`accumulate`](@ref).
623 tryparse(type, str; base)
624
625 Like [`parse`](@ref), but returns either a value of the requested type,
626 or [`nothing`](@ref) if the string does not contain a valid number.
626627 """
627628 ```
628629
629 This will create a link in the generated docs to the `accumulate` documentation
630 (which has more information about what this function actually does). It's good to include
631 cross references to mutating/non-mutating versions of a function, or to highlight a difference
632 between two similar-seeming functions.
630 This will create a link in the generated docs to the [`parse`](@ref) documentation
631 (which has more information about what this function actually does), and to the
632 [`nothing`](@ref) documentation. It's good to include cross references to mutating/non-mutating
633 versions of a function, or to highlight a difference between two similar-seeming functions.
633634
634635 !!! note
635636 The above cross referencing is *not* a Markdown feature, and relies on
663664 ```
664665 This is a paragraph.
665666
666 And this is *another* one containing some emphasised text.
667 And this is *another* one containing some emphasized text.
667668 A new line, but still part of the same paragraph.
668669 ```
669670
6363 ```
6464 /etc/julia/startup.jl
6565 ```
66
67 ### `JULIA_PROJECT`
68
69 A directory path that points to the current Julia project. Setting this
70 environment variable has the same effect as specifying the `--project` start-up
71 option, but `--project` has higher precedence. If the variable is set to `@.`,
72 Julia tries to find a project directory that contains `Project.toml` or
73 `JuliaProject.toml` file from the current directory and its parents. See also
74 the chapter on [Code Loading](@ref).
6675
6776 ### `JULIA_LOAD_PATH`
6877
3939 obj3 = MyModule.someotherfunction(obj2, c)
4040 ...
4141 ```
42
43 ### How do I check if the current file is being run as the main script?
44
45 When a file is run as the main script using `julia file.jl` one might want to activate extra
46 functionality like command line argument handling. A way to determine that a file is run in
47 this fashion is to check if `abspath(PROGRAM_FILE) == @__FILE__` is `true`.
4248
4349 ## Functions
4450
644650 The empty (or "bottom") type, written as `Union{}` (an empty union type), is a type with
645651 no values and no subtypes (except itself). You will generally not need to use this type.
646652
647
648 ### How do I check if the current file is being run as the main script?
649
650 When a file is run as the main script using `julia file.jl` one might want to activate extra
651 functionality like command line argument handling. A way to determine that a file is run in
652 this fashion is to check if `abspath(PROGRAM_FILE) == @__FILE__` is `true`.
653
654653 ## Memory
655654
656655 ### Why does `x += y` allocate memory when `x` and `y` are arrays?
540540 end
541541 ```
542542
543 Inside `f`, `kwargs` will be a key-value iterator over a named tuple. Named
544 tuples (as well as dictionaries with keys of `Symbol`) can be passed as keyword
545 arguments using a semicolon in a call, e.g. `f(x, z=1; kwargs...)`.
546
543547 If a keyword argument is not assigned a default value in the method definition,
544548 then it is *required*: an [`UndefKeywordError`](@ref) exception will be thrown
545549 if the caller does not assign it a value:
550554 f(3, y=5) # ok, y is assigned
551555 f(3) # throws UndefKeywordError(:y)
552556 ```
553
554 Inside `f`, `kwargs` will be a named tuple. Named tuples (as well as dictionaries) can be passed as
555 keyword arguments using a semicolon in a call, e.g. `f(x, z=1; kwargs...)`.
556557
557558 One can also pass `key => value` expressions after a semicolon. For example, `plot(x, y; :width => 2)`
558559 is equivalent to `plot(x, y, width=2)`. This is useful in situations where the keyword name is computed
110110 |`--history-file={yes\|no}` |Load or save history|
111111 |`--depwarn={yes\|no\|error}` |Enable or disable syntax and method deprecation warnings (`error` turns warnings into errors)|
112112 |`--warn-overwrite={yes\|no}` |Enable or disable method overwrite warnings|
113 |`-C`, `--cpu-target <target>` |Limit usage of cpu features up to <target>; set to `help` to see the available options|
113 |`-C`, `--cpu-target <target>` |Limit usage of CPU features up to `<target>`; set to `help` to see the available options|
114114 |`-O`, `--optimize={0,1,2,3}` |Set the optimization level (default level is 2 if unspecified or 3 if used without a level)|
115115 |`-g`, `-g <level>` |Enable / Set the level of debug info generation (default level is 1 if unspecified or 2 if used without a level)|
116116 |`--inline={yes\|no}` |Control whether inlining is permitted, including overriding `@inline` declarations|
+0
-39
doc/src/manual/index.md less more
0 # The Julia Manual
1
2 * [Introduction](@ref man-introduction)
3 * [Getting Started](@ref man-getting-started)
4 * [Variables](@ref)
5 * [Integers and Floating-Point Numbers](@ref)
6 * [Mathematical Operations and Elementary Functions](@ref)
7 * [Complex and Rational Numbers](@ref)
8 * [Strings](@ref)
9 * [Functions](@ref)
10 * [Control Flow](@ref)
11 * [Scope of Variables](@ref scope-of-variables)
12 * [Types](@ref man-types)
13 * [Methods](@ref)
14 * [Constructors](@ref man-constructors)
15 * [Conversion and Promotion](@ref conversion-and-promotion)
16 * [Interfaces](@ref)
17 * [Modules](@ref)
18 * [Documentation](@ref)
19 * [Metaprogramming](@ref)
20 * [Multi-dimensional Arrays](@ref man-multi-dim-arrays)
21 * [Missing Values](@ref missing)
22 * [Networking and Streams](@ref)
23 * [Parallel Computing](@ref)
24 * [Dates](@ref)
25 * [Running External Programs](@ref)
26 * [Calling C and Fortran Code](@ref)
27 * [Handling Operating System Variation](@ref)
28 * [Environment Variables](@ref)
29 * [Embedding Julia](@ref)
30 * [Profiling](@ref)
31 * [Memory allocation analysis](@ref)
32 * [Stack Traces](@ref)
33 * [Performance Tips](@ref man-performance-tips)
34 * [Workflow Tips](@ref man-workflow-tips)
35 * [Style Guide](@ref)
36 * [Frequently Asked Questions](@ref)
37 * [Noteworthy Differences from other Languages](@ref)
38 * [Unicode Input](@ref)
177177 `0`. In the case of leading zeros, the size is determined by the minimal needed size for a
178178 literal, which has the same length but leading digit `1`. That allows the user to control
179179 the size.
180 Values, which cannot be stored in `UInt128` cannot be written as such literals.
180 Values which cannot be stored in `UInt128` cannot be written as such literals.
181181
182182 Binary, octal, and hexadecimal literals may be signed by a `-` immediately preceding the
183183 unsigned literal. They produce an unsigned integer of the same size as the unsigned literal
214214 ```
215215
216216 The values returned by [`typemin`](@ref) and [`typemax`](@ref) are always of the given argument
217 type. (The above expression uses several features we have yet to introduce, including [for loops](@ref man-loops),
217 type. (The above expression uses several features that have yet to be introduced, including [for loops](@ref man-loops),
218218 [Strings](@ref man-strings), and [Interpolation](@ref), but should be easy enough to understand for users
219219 with some existing programming experience.)
220220
677677 * The 32-bit floating-point literal expression `1.5f22` could be interpreted as the numeric literal
678678 `1.5` multiplied by the variable `f22`.
679679
680 In all cases, we resolve the ambiguity in favor of interpretation as numeric literals:
680 In all cases the ambiguity is resolved in favor of interpretation as numeric literals:
681681
682682 * Expressions starting with `0x` are always hexadecimal literals.
683683 * Expressions starting with a numeric literal followed by `e` or `E` are always floating-point literals.
1515 | `IteratorEltype(IterType)` | `HasEltype()` | Either `EltypeUnknown()` or `HasEltype()` as appropriate |
1616 | `eltype(IterType)` | `Any` | The type of the first entry of the tuple returned by `iterate()` |
1717 | `length(iter)` | (*undefined*) | The number of items, if known |
18 | `size(iter, [dim...])` | (*undefined*) | The number of items in each dimension, if known |
18 | `size(iter, [dim])` | (*undefined*) | The number of items in each dimension, if known |
1919
2020 | Value returned by `IteratorSize(IterType)` | Required Methods |
2121 |:------------------------------------------ |:------------------------------------------ |
2222 | `HasLength()` | [`length(iter)`](@ref) |
23 | `HasShape{N}()` | `length(iter)` and `size(iter, [dim...])` |
23 | `HasShape{N}()` | `length(iter)` and `size(iter, [dim])` |
2424 | `IsInfinite()` | (*none*) |
2525 | `SizeUnknown()` | (*none*) |
2626
230230 | `length(A)` | `prod(size(A))` | Number of elements |
231231 | `similar(A)` | `similar(A, eltype(A), size(A))` | Return a mutable array with the same shape and element type |
232232 | `similar(A, ::Type{S})` | `similar(A, S, size(A))` | Return a mutable array with the same shape and the specified element type |
233 | `similar(A, dims::NTuple{Int})` | `similar(A, eltype(A), dims)` | Return a mutable array with the same element type and size *dims* |
234 | `similar(A, ::Type{S}, dims::NTuple{Int})` | `Array{S}(undef, dims)` | Return a mutable array with the specified element type and size |
233 | `similar(A, dims::Dims)` | `similar(A, eltype(A), dims)` | Return a mutable array with the same element type and size *dims* |
234 | `similar(A, ::Type{S}, dims::Dims)` | `Array{S}(undef, dims)` | Return a mutable array with the specified element type and size |
235235 | **Non-traditional indices** | **Default definition** | **Brief description** |
236236 | `axes(A)` | `map(OneTo, size(A))` | Return the `AbstractUnitRange` of valid indices |
237 | `Base.similar(A, ::Type{S}, inds::NTuple{Ind})` | `similar(A, S, Base.to_shape(inds))` | Return a mutable array with the specified indices `inds` (see below) |
237 | `Base.similar(A, ::Type{S}, inds)` | `similar(A, S, Base.to_shape(inds))` | Return a mutable array with the specified indices `inds` (see below) |
238238 | `Base.similar(T::Union{Type,Function}, inds)` | `T(Base.to_shape(inds))` | Return an array similar to `T` with the specified indices `inds` (see below) |
239239
240240 If a type is defined as a subtype of `AbstractArray`, it inherits a very large set of rich behaviors
231231 of each file loaded by `include` or added explicitly by `include_dependency` is unchanged, or equal
232232 to the modification time truncated to the nearest second (to accommodate systems that can't copy
233233 mtime with sub-second accuracy). It also takes into account whether the path to the file chosen
234 by the search logic in `require` matches the path that had created the precompile file.
235
236 It also takes into account the set of dependencies already loaded into the current process and
237 won't recompile those modules, even if their files change or disappear, in order to avoid creating
238 incompatibilities between the running system and the precompile cache. If you want to have changes
239 to the source reflected in the running system, you should call `reload("Module")` on the module
240 you changed, and any module that depended on it in which you want to see the change reflected.
234 by the search logic in `require` matches the path that had created the precompile file. It also takes
235 into account the set of dependencies already loaded into the current process and won't recompile those
236 modules, even if their files change or disappear, in order to avoid creating incompatibilities between
237 the running system and the precompile cache.
241238
242239 If you know that a module is *not* safe to precompile your module
243240 (for example, for one of the reasons described below), you should
252252 Floating point literals are closer in behavior to C/C++. Octal (prefixed with `0o`) and binary
253253 (prefixed with `0b`) literals are also treated as unsigned.
254254 * String literals can be delimited with either `"` or `"""`, `"""` delimited literals can contain
255 `"` characters without quoting it like `"\""` String literals can have values of other variables
255 `"` characters without quoting it like `"\""`. String literals can have values of other variables
256256 or expressions interpolated into them, indicated by `$variablename` or `$(expression)`, which
257257 evaluates the variable name or the expression in the context of the function.
258258 * `//` indicates a [`Rational`](@ref) number, and not a single-line comment (which is `#` in Julia)
66 2. Multi-Threading
77 3. Multi-Core or Distributed Processing
88
9 We will first consider Julia [Tasks (aka Coroutines)](@ref man-tasks) and other modules that rely on the Julia runtime library, that allow to suspend and resume computations with full control of inter-`Tasks` communication without having to manually interface with the operative system's scheduler.
10 Julia also allows to communicate between `Tasks` through operations like [`wait`](@ref) and [`fetch`](@ref).
11 Communication and data synchronization is managed through [`Channel`](@ref)s, which are the conduit
12 that allows inter-`Tasks` communication.
9 We will first consider Julia [Tasks (aka Coroutines)](@ref man-tasks) and other modules that rely on the Julia runtime library, that allow us to suspend and resume computations with full control of inter-`Tasks` communication without having to manually interface with the operating system's scheduler.
10 Julia also supports communication between `Tasks` through operations like [`wait`](@ref) and [`fetch`](@ref).
11 Communication and data synchronization is managed through [`Channel`](@ref)s, which are the conduits
12 that provide inter-`Tasks` communication.
1313
1414 Julia also supports experimental multi-threading, where execution is forked and an anonymous function is run across all
1515 threads.
16 Described as a fork-join approach, parallel threads are branched off and they all have to join the Julia main thread to make serial execution continue.
16 Known as the fork-join approach, parallel threads execute independently, and must ultimately be joined in Julia's main thread to allow serial execution to continue.
1717 Multi-threading is supported using the `Base.Threads` module that is still considered experimental, as Julia is
18 not fully thread-safe yet. In particular segfaults seem to emerge for I\O operations and task switching.
19 As an un up-to-date reference, keep an eye on [the issue tracker](https://github.com/JuliaLang/julia/issues?q=is%3Aopen+is%3Aissue+label%3Amultithreading).
18 not yet fully thread-safe. In particular segfaults seem to occur during I\O operations and task switching.
19 As an up-to-date reference, keep an eye on [the issue tracker](https://github.com/JuliaLang/julia/issues?q=is%3Aopen+is%3Aissue+label%3Amultithreading).
2020 Multi-Threading should only be used if you take into consideration global variables, locks and
21 atomics, so we will explain it later.
22
23 In the end we will present Julia's way to distributed and parallel computing. With scientific computing
24 in mind, Julia natively implements interfaces to distribute a process through multiple cores or machines.
21 atomics, all of which are explained later.
22
23 In the end we will present Julia's approach to distributed and parallel computing. With scientific computing
24 in mind, Julia natively implements interfaces to distribute a process across multiple cores or machines.
2525 Also we will mention useful external packages for distributed programming like `MPI.jl` and `DistributedArrays.jl`.
2626
2727 # Coroutines
7676
7777 # we can schedule `n` instances of `foo` to be active concurrently.
7878 for _ in 1:n
79 @schedule foo()
79 @async foo()
8080 end
8181 ```
8282 * Channels are created via the `Channel{T}(sz)` constructor. The channel will only hold objects
183183
184184 julia> n = 12;
185185
186 julia> @schedule make_jobs(n); # feed the jobs channel with "n" jobs
186 julia> @async make_jobs(n); # feed the jobs channel with "n" jobs
187187
188188 julia> for i in 1:4 # start 4 tasks to process requests in parallel
189 @schedule do_work()
189 @async do_work()
190190 end
191191
192192 julia> @elapsed while n > 0 # print out results
193193 job_id, exec_time = take!(results)
194 println("$job_id finished in $(round(exec_time,2)) seconds")
195 n = n - 1
194 println("$job_id finished in $(round(exec_time; digits=2)) seconds")
195 global n = n - 1
196196 end
197197 4 finished in 0.22 seconds
198198 3 finished in 0.45 seconds
464464 g_fix (generic function with 1 method)
465465
466466 julia> r = let m = MersenneTwister(1)
467 [m; accumulate(Future.randjump, m, fill(big(10)^20, nthreads()-1))]
467 [m; accumulate(Future.randjump, fill(big(10)^20, nthreads()-1), init=m)]
468468 end;
469469
470470 julia> g_fix(r)
10851085
10861086 julia> @elapsed while n > 0 # print out results
10871087 job_id, exec_time, where = take!(results)
1088 println("$job_id finished in $(round(exec_time,2)) seconds on worker $where")
1088 println("$job_id finished in $(round(exec_time; digits=2)) seconds on worker $where")
10891089 n = n - 1
10901090 end
10911091 1 finished in 0.18 seconds on worker 4
15941594 running the Julia REPL (i.e., the master) with the rest of the cluster on the cloud, say on Amazon
15951595 EC2. In this case only port 22 needs to be opened at the remote cluster coupled with SSH client
15961596 authenticated via public key infrastructure (PKI). Authentication credentials can be supplied
1597 via `sshflags`, for example ```sshflags=`-e <keyfile>` ```.
1597 via `sshflags`, for example ```sshflags=`-i <keyfile>` ```.
15981598
15991599 In an all-to-all topology (the default), all workers connect to each other via plain TCP sockets.
16001600 The security policy on the cluster nodes must thus ensure free connectivity between workers for
466466 ```
467467
468468 the annotation of `c` harms performance. To write performant code involving types constructed at
469 run-time, use the [function-barrier technique](@ref kernal-functions) discussed below, and ensure
469 run-time, use the [function-barrier technique](@ref kernel-functions) discussed below, and ensure
470470 that the constructed type appears among the argument types of the kernel function so that the kernel
471471 operations are properly specialized by the compiler. For example, in the above snippet, as soon as
472472 `b` is constructed, it can be passed to another function `k`, the kernel. If, for example, function
575575 * Use an explicit conversion: `x = oneunit(Float64)`
576576 * Initialize with the first loop iteration, to `x = 1 / rand()`, then loop `for i = 2:10`
577577
578 ## [Separate kernel functions (aka, function barriers)](@id kernal-functions)
578 ## [Separate kernel functions (aka, function barriers)](@id kernel-functions)
579579
580580 Many functions follow a pattern of performing some set-up work, and then running many iterations
581581 to perform a core computation. Where possible, it is a good idea to put these core computations
674674 function has to be conservative, checking the type on each access of `A`; such code will be very
675675 slow.
676676
677 Now, one very good way to solve such problems is by using the [function-barrier technique](@ref kernal-functions).
677 Now, one very good way to solve such problems is by using the [function-barrier technique](@ref kernel-functions).
678678 However, in some cases you might want to eliminate the type-instability altogether. In such cases,
679679 one approach is to pass the dimensionality as a parameter, for example through `Val{T}()` (see
680680 ["Value types"](@ref)):
11501150 and may cause a segmentation fault if bounds checking is turned off. Use `LinearIndices(x)` or `eachindex(x)`
11511151 instead (see also [offset-arrays](https://docs.julialang.org/en/latest/devdocs/offset-arrays)).
11521152
1153 !!!note
1153 !!! note
11541154 While `@simd` needs to be placed directly in front of an innermost `for` loop, both `@inbounds` and `@fastmath`
11551155 can be applied to either single expressions or all the expressions that appear within nested blocks of code, e.g.,
11561156 using `@inbounds begin` or `@inbounds for ...`.
12301230 @fastmath @inbounds @simd for i in 1:n
12311231 s += u[i]^2
12321232 end
1233 @fastmath @inbounds return sqrt(s/n)
1233 @fastmath @inbounds return sqrt(s)
12341234 end
12351235
12361236 function main()
129129 In this case `Vector{Any}(undef, n)` is better. It is also more helpful to the compiler to annotate specific
130130 uses (e.g. `a[i]::Int`) than to try to pack many alternatives into one type.
131131
132 ## Use naming conventions consistent with Julia's `base/`
132 ## Use naming conventions consistent with Julia `base/`
133133
134134 * modules and type names use capitalization and camel case: `module SparseArrays`, `struct UnitRange`.
135135 * functions are lowercase ([`maximum`](@ref), [`convert`](@ref)) and, when readable, with multiple
142142 If a function name requires multiple words, consider whether it might represent more than one
143143 concept and might be better split into pieces.
144144
145 ## Write functions with argument ordering similar to Julia's Base
145 ## Write functions with argument ordering similar to Julia Base
146146
147147 As a general rule, the Base library uses the following order of arguments to functions,
148148 as applicable:
448448 0
449449 ```
450450
451 However, it is occasionally useful to reuse an existing variable as the iteration variable.
451 However, it is occasionally useful to reuse an existing local variable as the iteration variable.
452452 This can be done conveniently by adding the keyword `outer`:
453453
454454 ```jldoctest
494494
495495 Note that `const` only affects the variable binding; the variable may be bound to a mutable
496496 object (such as an array), and that object may still be modified. Additionally when one tries
497 to assign a value a variable that is declared constant the following scenarios are possible:
497 to assign a value to a variable that is declared constant the following scenarios are possible:
498498
499499 * if a new value has a different type than the type of the constant then an error is thrown:
500500 ```jldoctest
521521 julia> z = 100
522522 100
523523 ```
524 The last rule applies for immutable objects even if the vairable binding would change, e.g.:
524 The last rule applies for immutable objects even if the variable binding would change, e.g.:
525525 ```julia-repl
526526 julia> const s1 = "1"
527527 "1"
554554 1
555555 ```
556556
557 Note that although possible, changing the value of a variable that is declared as constant
558 is strongly discouraged. For instance, if a method references a constant and is already
557 Note that although sometimes possible, changing the value of a `const` variable
558 is strongly discouraged, and is intended only for convenience during
559 interactive use.
560 Changing constants can cause various problems or unexpected behaviors.
561 For instance, if a method references a constant and is already
559562 compiled before the constant is changed then it might keep using the old value:
560563 ```jldoctest
561564 julia> const x = 1
5252 #define MAXINTVAL (((size_t)-1)>>1)
5353
5454 static jl_array_t *_new_array_(jl_value_t *atype, uint32_t ndims, size_t *dims,
55 int isunboxed, int elsz)
55 int isunboxed, int isunion, int elsz)
5656 {
5757 jl_ptls_t ptls = jl_get_ptls_states();
5858 size_t i, tot, nel=1;
6060 jl_array_t *a;
6161
6262 for(i=0; i < ndims; i++) {
63 wideint_t prod = (wideint_t)nel * (wideint_t)dims[i];
64 if (prod > (wideint_t) MAXINTVAL)
63 size_t di = dims[i];
64 wideint_t prod = (wideint_t)nel * (wideint_t)di;
65 if (prod > (wideint_t) MAXINTVAL || di > MAXINTVAL)
6566 jl_error("invalid Array dimensions");
6667 nel = prod;
6768 }
68 int isunion = atype != NULL && jl_is_uniontype(jl_tparam0(atype));
69 assert(atype == NULL || isunion == jl_is_uniontype(jl_tparam0(atype)));
6970 if (isunboxed) {
7071 wideint_t prod = (wideint_t)elsz * (wideint_t)nel;
7172 if (prod > (wideint_t) MAXINTVAL)
147148 jl_value_t *eltype = jl_tparam0(atype);
148149 size_t elsz = 0, al = 0;
149150 int isunboxed = jl_islayout_inline(eltype, &elsz, &al);
151 int isunion = jl_is_uniontype(eltype);
150152 if (!isunboxed) {
151153 elsz = sizeof(void*);
152154 al = elsz;
153155 }
154156
155 return _new_array_(atype, ndims, dims, isunboxed, elsz);
157 return _new_array_(atype, ndims, dims, isunboxed, isunion, elsz);
156158 }
157159
158160 jl_array_t *jl_new_array_for_deserialization(jl_value_t *atype, uint32_t ndims, size_t *dims,
159 int isunboxed, int elsz)
160 {
161 return _new_array_(atype, ndims, dims, isunboxed, elsz);
161 int isunboxed, int isunion, int elsz)
162 {
163 return _new_array_(atype, ndims, dims, isunboxed, isunion, elsz);
162164 }
163165
164166 #ifndef JL_NDEBUG
11111113 {
11121114 size_t elsz = ary->elsize;
11131115 size_t len = jl_array_len(ary);
1116 int isunion = jl_is_uniontype(jl_tparam0(jl_typeof(ary)));
11141117 jl_array_t *new_ary = _new_array_(jl_typeof(ary), jl_array_ndims(ary),
1115 &ary->nrows, !ary->flags.ptrarray, elsz);
1118 &ary->nrows, !ary->flags.ptrarray,
1119 isunion, elsz);
11161120 memcpy(new_ary->data, ary->data, len * elsz);
11171121 // ensure isbits union arrays copy their selector bytes correctly
11181122 if (jl_array_isbitsunion(ary))
18191819 JL_GC_POP();
18201820 return mark_or_box_ccall_result(ctx, strp, retboxed, rt, unionall, static_rt);
18211821 }
1822 else if (is_libjulia_func(memcpy)) {
1823 const jl_cgval_t &dst = argv[0];
1824 const jl_cgval_t &src = argv[1];
1825 const jl_cgval_t &n = argv[2];
1826 ctx.builder.CreateMemCpy(
1827 ctx.builder.CreateIntToPtr(
1828 emit_unbox(ctx, T_size, dst, (jl_value_t*)jl_voidpointer_type), T_pint8),
1829 ctx.builder.CreateIntToPtr(
1830 emit_unbox(ctx, T_size, src, (jl_value_t*)jl_voidpointer_type), T_pint8),
1831 emit_unbox(ctx, T_size, n, (jl_value_t*)jl_ulong_type), 1,
1832 false);
1833 JL_GC_POP();
1834 return ghostValue(jl_void_type);
1835 }
18221836
18231837 jl_cgval_t retval = sig.emit_a_ccall(
18241838 ctx,
769769 uint32_t na)
770770 {
771771 jl_ptls_t ptls = jl_get_ptls_states();
772 if (type->instance != NULL) return type->instance;
772 if (type->instance != NULL) {
773 for (size_t i = 0; i < na; i++) {
774 jl_value_t *ft = jl_field_type(type, i);
775 if (!jl_isa(args[i], ft))
776 jl_type_error("new", ft, args[i]);
777 }
778 return type->instance;
779 }
780 if (type->layout == NULL)
781 jl_type_error("new", (jl_value_t*)jl_datatype_type, (jl_value_t*)type);
773782 size_t nf = jl_datatype_nfields(type);
774783 jl_value_t *jv = jl_gc_alloc(ptls, jl_datatype_size(type), type);
775784 JL_GC_PUSH1(&jv);
782791 for(size_t i=na; i < nf; i++) {
783792 if (jl_field_isptr(type, i)) {
784793 *(jl_value_t**)((char*)jl_data_ptr(jv)+jl_field_offset(type,i)) = NULL;
785
786 } else {
794 }
795 else {
787796 jl_value_t *ft = jl_field_type(type, i);
788797 if (jl_is_uniontype(ft)) {
789798 uint8_t *psel = &((uint8_t *)jv)[jl_field_offset(type, i) + jl_field_size(type, i) - 1];
637637 }
638638 else if (jl_is_array(v)) {
639639 jl_array_t *ar = (jl_array_t*)v;
640 if (ar->flags.ndims == 1 && ar->elsize < 128) {
640 int isunion = jl_is_uniontype(jl_tparam0(jl_typeof(ar)));
641 if (ar->flags.ndims == 1 && ar->elsize <= 0x3f) {
641642 write_uint8(s->s, TAG_ARRAY1D);
642 write_uint8(s->s, (ar->flags.ptrarray<<7) | (ar->elsize & 0x7f));
643 write_uint8(s->s, (ar->flags.ptrarray<<7) | (isunion << 6) | (ar->elsize & 0x3f));
643644 }
644645 else {
645646 write_uint8(s->s, TAG_ARRAY);
646647 write_uint16(s->s, ar->flags.ndims);
647 write_uint16(s->s, (ar->flags.ptrarray<<15) | (ar->elsize & 0x7fff));
648 write_uint16(s->s, (ar->flags.ptrarray << 15) | (isunion << 14) | (ar->elsize & 0x3fff));
648649 }
649650 for (i = 0; i < ar->flags.ndims; i++)
650651 jl_serialize_value(s, jl_box_long(jl_array_dim(ar,i)));
12091210 }
12101211
12111212 // "magic" string and version header of .ji file
1212 static const int JI_FORMAT_VERSION = 6;
1213 static const int JI_FORMAT_VERSION = 7;
12131214 static const char JI_MAGIC[] = "\373jli\r\n\032\n"; // based on PNG signature
12141215 static const uint16_t BOM = 0xFEFF; // byte-order marker
12151216 static void write_header(ios_t *s)
14941495 {
14951496 int usetable = (s->mode != MODE_IR);
14961497 int16_t i, ndims;
1497 int isunboxed, elsize;
1498 int isunboxed, isunion, elsize;
14981499 if (tag == TAG_ARRAY1D) {
14991500 ndims = 1;
15001501 elsize = read_uint8(s->s);
15011502 isunboxed = !(elsize >> 7);
1502 elsize = elsize & 0x7f;
1503 isunion = elsize >> 6;
1504 elsize = elsize & 0x3f;
15031505 }
15041506 else {
15051507 ndims = read_uint16(s->s);
15061508 elsize = read_uint16(s->s);
15071509 isunboxed = !(elsize >> 15);
1508 elsize = elsize & 0x7fff;
1510 isunion = elsize >> 14;
1511 elsize = elsize & 0x3fff;
15091512 }
15101513 uintptr_t pos = backref_list.len;
15111514 if (usetable)
15141517 for (i = 0; i < ndims; i++) {
15151518 dims[i] = jl_unbox_long(jl_deserialize_value(s, NULL));
15161519 }
1517 jl_array_t *a = jl_new_array_for_deserialization((jl_value_t*)NULL, ndims, dims, isunboxed, elsize);
1520 jl_array_t *a = jl_new_array_for_deserialization(
1521 (jl_value_t*)NULL, ndims, dims, isunboxed, isunion, elsize);
15181522 if (usetable)
15191523 backref_list.items[pos] = a;
15201524 jl_value_t *aty = jl_deserialize_value(s, &jl_astaggedvalue(a)->type);
16421646 m->file = (jl_sym_t*)jl_deserialize_value(s, NULL);
16431647 m->line = read_int32(s->s);
16441648 m->min_world = jl_world_counter;
1649 m->max_world = ~(size_t)0;
16451650 m->ambig = jl_deserialize_value(s, (jl_value_t**)&m->ambig);
16461651 jl_gc_wb(m, m->ambig);
16471652 m->called = read_int32(s->s);
29872992 //assert(ti != jl_bottom_type); (void)ti;
29882993 if (ti == jl_bottom_type)
29892994 env = jl_emptysvec; // the intersection may fail now if the type system had made an incorrect subtype env in the past
2990 jl_method_instance_t *_new = jl_specializations_get_linfo(m, (jl_value_t*)argtypes, env, jl_world_counter);
2995 jl_method_instance_t *_new = jl_specializations_get_linfo(m, (jl_value_t*)argtypes, env, jl_world_counter < max_world ? jl_world_counter : max_world);
29912996 _new->max_world = max_world;
29922997 jl_update_backref_list((jl_value_t*)li, (jl_value_t*)_new, start);
29932998 return _new;
147147 // get or create the MethodInstance for a specialization
148148 JL_DLLEXPORT jl_method_instance_t *jl_specializations_get_linfo(jl_method_t *m, jl_value_t *type, jl_svec_t *sparams, size_t world)
149149 {
150 assert(world >= m->min_world && "typemap lookup is corrupted");
150 assert(world >= m->min_world && world <= m->max_world && "typemap lookup is corrupted");
151151 JL_LOCK(&m->writelock);
152152 jl_typemap_entry_t *sf =
153153 jl_typemap_assoc_by_type(m->specializations, type, NULL, /*subtype*/0, /*offs*/0, world, /*max_world_mask*/0);
168168 li->min_world = world;
169169 }
170170 if (world == jl_world_counter) {
171 li->max_world = ~(size_t)0;
171 li->max_world = m->max_world;
172172 }
173173 else {
174174 li->max_world = world;
357357 else {
358358 JL_LOCK(&li->def.method->writelock);
359359 assert(min_world >= li->def.method->min_world);
360 assert(max_world <= li->def.method->max_world);
360361 int isinferred = jl_is_rettype_inferred(li);
361362 if (!isinferred && li->min_world >= min_world && li->max_world <= max_world) {
362363 // expand the current (uninferred) entry to cover the full inferred range
954955 jl_tupletype_t *cachett = tt;
955956 jl_svec_t* guardsigs = jl_emptysvec;
956957 size_t min_valid = definition->min_world;
957 size_t max_valid = ~(size_t)0;
958 size_t max_valid = definition->max_world;
958959 if (!cache_with_orig) {
959960 // now examine what will happen if we chose to use this sig in the cache
960961 temp = ml_matches(mt->defs, 0, compilationsig, -1, 0, world, &min_valid, &max_valid); // TODO: use MAX_UNSPECIALIZED_CONFLICTS?
15001501 jl_error("method not in method table");
15011502 JL_LOCK(&mt->writelock);
15021503 // Narrow the world age on the method to make it uncallable
1504 method->max_world = jl_world_counter;
15031505 methodentry->max_world = jl_world_counter++;
15041506 // Recompute ambiguities (deleting a more specific method might reveal ambiguities that it previously resolved)
15051507 check_ambiguous_matches(mt->defs, methodentry, check_disabled_ambiguous_visitor); // TODO: decrease repeated work?
15241526 JL_LOCK(&mt->writelock);
15251527 jl_typemap_entry_t *newentry = jl_typemap_insert(&mt->defs, (jl_value_t*)mt,
15261528 (jl_tupletype_t*)type, simpletype, jl_emptysvec, (jl_value_t*)method, 0, &method_defs,
1527 method->min_world, ~(size_t)0, &oldvalue);
1529 method->min_world, method->max_world, &oldvalue);
15281530 if (oldvalue) {
15291531 if (oldvalue == (jl_value_t*)method) {
15301532 // redundant add of same method; no need to do anything
19811983 return 0;
19821984 for (size_t i = 0; i < jl_array_len(m->ambig); i++) {
19831985 jl_method_t *mambig = (jl_method_t*)jl_array_ptr_ref(m->ambig, i);
1984 if (jl_subtype((jl_value_t*)types, (jl_value_t*)mambig->sig))
1986 if (mambig->min_world <= jl_world_counter && jl_world_counter <= mambig->max_world && jl_subtype((jl_value_t*)types, (jl_value_t*)mambig->sig))
19851987 return 1;
19861988 }
19871989 return 0;
19951997 return 0;
19961998 for (size_t i = 0; i < jl_array_len(m->ambig); i++) {
19971999 jl_method_t *mambig = (jl_method_t*)jl_array_ptr_ref(m->ambig, i);
1998 if (!jl_has_empty_intersection(mambig->sig, types))
2000 if (mambig->min_world <= jl_world_counter && jl_world_counter <= mambig->max_world && !jl_has_empty_intersection(mambig->sig, types))
19992001 return 1;
20002002 }
20012003 return 0;
591591 jl_options.outputbc = abspath(jl_options.outputbc, 0);
592592 if (jl_options.machine_file)
593593 jl_options.machine_file = abspath(jl_options.machine_file, 0);
594 if (jl_options.project && strncmp(jl_options.project, "@.", strlen(jl_options.project)) != 0)
595 jl_options.project = abspath(jl_options.project, 0);
594596
595597 const char **cmdp = jl_options.cmds;
596598 if (cmdp) {
396396 if (jl_is_pinode(e)) {
397397 jl_value_t *val = eval_value(jl_fieldref_noalloc(e, 0), s);
398398 #ifndef JL_NDEBUG
399 JL_GC_PUSH1(&val);
399400 jl_typeassert(val, jl_fieldref_noalloc(e, 1));
401 JL_GC_POP();
400402 #endif
401403 return val;
402404 }
474476 return jl_nothing;
475477 }
476478 else if (head == new_sym) {
477 jl_value_t *thetype = eval_value(args[0], s);
478 jl_value_t *v=NULL, *fldv=NULL;
479 JL_GC_PUSH3(&thetype, &v, &fldv);
480 assert(jl_is_structtype(thetype));
481 v = jl_new_struct_uninit((jl_datatype_t*)thetype);
482 for (size_t i = 1; i < nargs; i++) {
483 jl_value_t *ft = jl_field_type(thetype, i - 1);
484 fldv = eval_value(args[i], s);
485 if (!jl_isa(fldv, ft))
486 jl_type_error("new", ft, fldv);
487 jl_set_nth_field(v, i - 1, fldv);
488 }
479 jl_value_t **argv;
480 JL_GC_PUSHARGS(argv, nargs);
481 for (size_t i = 0; i < nargs; i++)
482 argv[i] = eval_value(args[i], s);
483 assert(jl_is_structtype(argv[0]));
484 jl_value_t *v = jl_new_structv((jl_datatype_t*)argv[0], &argv[1], nargs - 1);
489485 JL_GC_POP();
490486 return v;
491487 }
132132 (jl-expand-to-thunk
133133 (let* ((name (caddr e))
134134 (body (cadddr e))
135 (loc (cadr body))
136 (x (if (eq? name 'x) 'y 'x)))
135 (loc (cadr body))
136 (loc (if (and (pair? loc) (eq? (car loc) 'line))
137 (list loc)
138 '()))
139 (x (if (eq? name 'x) 'y 'x)))
137140 `(block
138141 (= (call eval ,x)
139142 (block
140 ,loc
143 ,@loc
141144 (call (core eval) ,name ,x)))
142145 (= (call include ,x)
143146 (block
144 ,loc
147 ,@loc
145148 (call (top include) ,name ,x)))))))
146149
147150 ;; parse only, returning end position, no expansion.
109109
110110 // code generation options
111111 //" --compile={yes|no|all|min}Enable or disable JIT compiler, or request exhaustive compilation\n"
112 " -C, --cpu-target <target> Limit usage of cpu features up to <target>; set to \"help\" to see the available options\n"
112 " -C, --cpu-target <target> Limit usage of CPU features up to <target>; set to \"help\" to see the available options\n"
113113 " -O, --optimize={0,1,2,3} Set the optimization level (default level is 2 if unspecified or 3 if used without a level)\n"
114114 " -g, -g <level> Enable / Set the level of debug info generation"
115115 #ifdef JL_DEBUG_BUILD
20582058 jl_method_type =
20592059 jl_new_datatype(jl_symbol("Method"), core,
20602060 jl_any_type, jl_emptysvec,
2061 jl_perm_symsvec(19,
2061 jl_perm_symsvec(20,
20622062 "name",
20632063 "module",
20642064 "file",
20652065 "line",
20662066 "sig",
20672067 "min_world",
2068 "max_world",
20682069 "ambig",
20692070 "specializations",
20702071 "sparam_syms",
20782079 "nospecialize",
20792080 "isva",
20802081 "pure"),
2081 jl_svec(19,
2082 jl_svec(20,
20822083 jl_sym_type,
20832084 jl_module_type,
20842085 jl_sym_type,
20852086 jl_int32_type,
20862087 jl_type_type,
2088 jl_long_type,
20872089 jl_long_type,
20882090 jl_any_type, // Union{Array, Nothing}
20892091 jl_any_type, // TypeMap
20982100 jl_int32_type,
20992101 jl_bool_type,
21002102 jl_bool_type),
2101 0, 1, 9);
2103 0, 1, 10);
21022104
21032105 jl_method_instance_type =
21042106 jl_new_datatype(jl_symbol("MethodInstance"), core,
22102212 jl_svecset(jl_methtable_type->types, 7, jl_int32_type); // DWORD
22112213 #endif
22122214 jl_svecset(jl_methtable_type->types, 8, jl_int32_type); // uint32_t
2213 jl_svecset(jl_method_type->types, 10, jl_method_instance_type);
2215 jl_svecset(jl_method_type->types, 11, jl_method_instance_type);
22142216 jl_svecset(jl_method_instance_type->types, 11, jl_voidpointer_type);
22152217 jl_svecset(jl_method_instance_type->types, 12, jl_voidpointer_type);
22162218 jl_svecset(jl_method_instance_type->types, 13, jl_voidpointer_type);
778778 (begin (if (not (ts:space? s))
779779 (error "space required before \"?\" operator"))
780780 (take-token s) ; take the ?
781 (let ((t (with-whitespace-newline (without-range-colon (peek-token s)))))
781 (let ((t (with-whitespace-newline (without-range-colon (require-token s)))))
782782 (if (not (ts:space? s))
783783 (error "space required after \"?\" operator")))
784784 (let ((then (without-range-colon (parse-eq* s))))
787787 (if (not (ts:space? s))
788788 (error "space required before colon in \"?\" expression"))
789789 (take-token s) ; take the :
790 (let ((t (with-whitespace-newline (peek-token s))))
790 (let ((t (with-whitespace-newline (require-token s))))
791791 (if (not (ts:space? s))
792792 (error "space required after colon in \"?\" expression")))
793793 (list 'if ex then (parse-eq* s)))))
199199 (let ((bounds (map analyze-typevar params)))
200200 (values (map car bounds) bounds)))
201201
202 (define (unmangled-name v)
203 (if (eq? v '||)
204 v
205 (let ((s (string v)))
206 (if (eqv? (string.char s 0) #\#)
207 (symbol (last (string-split s "#")))
208 v))))
209
202210 ;; construct expression to allocate a TypeVar
203 (define (bounds-to-TypeVar v)
204 (let ((v (car v))
211 (define (bounds-to-TypeVar v (unmangle #f))
212 (let ((v ((if unmangle unmangled-name identity) (car v)))
205213 (lb (cadr v))
206214 (ub (caddr v)))
207215 `(call (core TypeVar) ',v
683691 ,@(map make-decl field-names field-types))
684692 (block
685693 ,@locs
686 (new ,name ,@field-names))))
694 (new (outerref ,name) ,@field-names))))
687695 any-ctor)
688696 (list any-ctor))))
689697
835843 (block
836844 (global ,name) (const ,name)
837845 ,@(map (lambda (v) `(local ,v)) params)
838 ,@(map (lambda (n v) (make-assignment n (bounds-to-TypeVar v))) params bounds)
846 ,@(map (lambda (n v) (make-assignment n (bounds-to-TypeVar v #t))) params bounds)
839847 (struct_type ,name (call (core svec) ,@params)
840848 (call (core svec) ,@(map quotify field-names))
841849 ,super (call (core svec) ,@field-types) ,mut ,min-initialized)))
876884 (scope-block
877885 (block
878886 ,@(map (lambda (v) `(local ,v)) params)
879 ,@(map (lambda (n v) (make-assignment n (bounds-to-TypeVar v))) params bounds)
887 ,@(map (lambda (n v) (make-assignment n (bounds-to-TypeVar v #t))) params bounds)
880888 (abstract_type ,name (call (core svec) ,@params) ,super))))))
881889
882890 (define (primitive-type-def-expr n name params super)
887895 (scope-block
888896 (block
889897 ,@(map (lambda (v) `(local ,v)) params)
890 ,@(map (lambda (n v) (make-assignment n (bounds-to-TypeVar v))) params bounds)
898 ,@(map (lambda (n v) (make-assignment n (bounds-to-TypeVar v #t))) params bounds)
891899 (primitive_type ,name (call (core svec) ,@params) ,n ,super))))))
892900
893901 ;; take apart a type signature, e.g. T{X} <: S{Y}
19071915 (ssavalue? x))
19081916 x (make-ssavalue)))
19091917 (ini (if (eq? x xx) '() `((= ,xx ,(expand-forms x)))))
1918 (n (length lhss))
19101919 (st (gensy)))
19111920 `(block
19121921 ,@ini
19131922 ,.(map (lambda (i lhs)
19141923 (expand-forms
19151924 (lower-tuple-assignment
1916 (list lhs st)
1925 (if (= i (- n 1))
1926 (list lhs)
1927 (list lhs st))
19171928 `(call (top indexed_iterate)
19181929 ,xx ,(+ i 1) ,.(if (eq? i 0) '() `(,st))))))
1919 (iota (length lhss))
1930 (iota n)
19201931 lhss)
19211932 (unnecessary ,xx))))))
19221933 ((typed_hcat)
24212432 '(null))
24222433 ((eq? (car e) 'require-existing-local)
24232434 (if (not (memq (cadr e) env))
2424 (error "no outer variable declaration exists for \"for outer\""))
2435 (error "no outer local variable declaration exists for \"for outer\""))
24252436 '(null))
24262437 ((eq? (car e) 'lambda)
24272438 (let* ((lv (lam:vars e))
27382749 ,(delete-duplicates (append (lam:sp lam) capt-sp)))
27392750 ,body)))
27402751
2752 ;; renumber ssavalues assigned in an expr, allowing it to be repeated
2753 (define (renumber-assigned-ssavalues e)
2754 (let ((vals (expr-find-all (lambda (x) (and (assignment? x) (ssavalue? (cadr x))))
2755 e
2756 cadadr)))
2757 (if (null? vals)
2758 e
2759 (let ((repl (table)))
2760 (for-each (lambda (id) (put! repl id (make-ssavalue)))
2761 vals)
2762 (let do-replace ((x e))
2763 (if (or (atom? x) (quoted? x))
2764 x
2765 (if (eq? (car x) 'ssavalue)
2766 (or (get repl (cadr x) #f) x)
2767 (cons (car x)
2768 (map do-replace (cdr x))))))))))
2769
27412770 (define (convert-for-type-decl rhs t)
27422771 (if (equal? t '(core Any))
27432772 rhs
2744 `(call (core typeassert)
2745 (call (top convert) ,t ,rhs)
2746 ,t)))
2773 (let* ((temp (if (or (atom? t) (ssavalue? t) (quoted? t))
2774 #f
2775 (make-ssavalue)))
2776 (ty (or temp t))
2777 (ex `(call (core typeassert)
2778 (call (top convert) ,ty ,rhs)
2779 ,ty)))
2780 (if temp
2781 `(block (= ,temp ,(renumber-assigned-ssavalues t)) ,ex)
2782 ex))))
27472783
27482784 ;; convert assignment to a closed variable to a setfield! call.
27492785 ;; while we're at it, generate `convert` calls for variables with
263263 // method's type signature. redundant with TypeMapEntry->specTypes
264264 jl_value_t *sig;
265265 size_t min_world;
266 size_t max_world;
266267
267268 // list of potentially-ambiguous methods (nothing = none, Vector{Any} of Methods otherwise)
268269 jl_value_t *ambig;
462462 jl_value_t *jl_nth_slot_type(jl_value_t *sig JL_PROPAGATES_ROOT, size_t i) JL_NOTSAFEPOINT;
463463 void jl_compute_field_offsets(jl_datatype_t *st);
464464 jl_array_t *jl_new_array_for_deserialization(jl_value_t *atype, uint32_t ndims, size_t *dims,
465 int isunboxed, int elsz);
465 int isunboxed, int isunion, int elsz);
466466 void jl_module_run_initializer(jl_module_t *m);
467467 extern jl_array_t *jl_module_init_order JL_GLOBALLY_ROOTED;
468468 extern jl_array_t *jl_cfunction_list JL_GLOBALLY_ROOTED;
348348 NoteUse(S, BBS, V, BBS.UpExposedUses);
349349 }
350350 Value *MaybeExtractUnion(std::pair<Value*,int> Val, Instruction *InsertBefore);
351 int LiftPhi(State &S, PHINode *Phi);
352 int LiftSelect(State &S, SelectInst *SI);
351 void LiftPhi(State &S, PHINode *Phi, SmallVector<int, 16> &PHINumbers);
352 bool LiftSelect(State &S, SelectInst *SI);
353353 int Number(State &S, Value *V);
354354 std::vector<int> NumberVector(State &S, Value *Vec);
355355 int NumberBase(State &S, Value *V, Value *Base);
382382 };
383383
384384 static unsigned getValueAddrSpace(Value *V) {
385 return cast<PointerType>(V->getType())->getAddressSpace();
385 Type *Ty = V->getType();
386 if (isa<VectorType>(Ty))
387 Ty = cast<VectorType>(V->getType())->getElementType();
388 return cast<PointerType>(Ty)->getAddressSpace();
386389 }
387390
388391 static bool isSpecialPtr(Type *Ty) {
507510 return Val.first;
508511 }
509512
510 int LateLowerGCFrame::LiftSelect(State &S, SelectInst *SI) {
511 Value *TrueBase = MaybeExtractUnion(FindBaseValue(S, SI->getTrueValue(), false), SI);
512 Value *FalseBase = MaybeExtractUnion(FindBaseValue(S, SI->getFalseValue(), false), SI);
513 if (getValueAddrSpace(TrueBase) != AddressSpace::Tracked)
514 TrueBase = ConstantPointerNull::get(cast<PointerType>(FalseBase->getType()));
515 if (getValueAddrSpace(FalseBase) != AddressSpace::Tracked)
516 FalseBase = ConstantPointerNull::get(cast<PointerType>(TrueBase->getType()));
517 if (getValueAddrSpace(TrueBase) != AddressSpace::Tracked)
518 return -1;
519 Value *SelectBase = SelectInst::Create(SI->getCondition(),
520 TrueBase, FalseBase, "gclift", SI);
521 int Number = ++S.MaxPtrNumber;
522 S.PtrNumbering[SelectBase] = S.AllPtrNumbering[SelectBase] =
523 S.AllPtrNumbering[SI] = Number;
524 S.ReversePtrNumbering[Number] = SelectBase;
525 return Number;
526 }
527
528 int LateLowerGCFrame::LiftPhi(State &S, PHINode *Phi)
513 static Value *GetPtrForNumber(State &S, unsigned Num, Instruction *InsertionPoint)
529514 {
530 PHINode *lift = PHINode::Create(T_prjlvalue, Phi->getNumIncomingValues(), "gclift", Phi);
531 for (unsigned i = 0; i < Phi->getNumIncomingValues(); ++i) {
532 Value *Incoming = Phi->getIncomingValue(i);
533 Value *Base = MaybeExtractUnion(FindBaseValue(S, Incoming, false),
534 Phi->getIncomingBlock(i)->getTerminator());
535 if (getValueAddrSpace(Base) != AddressSpace::Tracked)
536 Base = ConstantPointerNull::get(cast<PointerType>(T_prjlvalue));
537 if (Base->getType() != T_prjlvalue)
538 Base = new BitCastInst(Base, T_prjlvalue, "", Phi->getIncomingBlock(i)->getTerminator());
539 lift->addIncoming(Base, Phi->getIncomingBlock(i));
540 }
541 int Number = ++S.MaxPtrNumber;
542 S.PtrNumbering[lift] = S.AllPtrNumbering[lift] =
543 S.AllPtrNumbering[Phi] = Number;
544 S.ReversePtrNumbering[Number] = lift;
545 return Number;
515 Value *Val = S.ReversePtrNumbering[Num];
516 if (isSpecialPtrVec(Val->getType())) {
517 const std::vector<int> &AllNums = S.AllVectorNumbering[Val];
518 unsigned Idx = 0;
519 for (; Idx < AllNums.size(); ++Idx) {
520 if ((unsigned)AllNums[Idx] == Num)
521 break;
522 }
523 Val = ExtractElementInst::Create(Val, ConstantInt::get(
524 Type::getInt32Ty(Val->getContext()), Idx), "", InsertionPoint);
525 }
526 return Val;
527 }
528
529 bool LateLowerGCFrame::LiftSelect(State &S, SelectInst *SI) {
530 if (isSpecialPtrVec(SI->getType())) {
531 VectorType *VT = cast<VectorType>(SI->getType());
532 std::vector<int> TrueNumbers = NumberVector(S, SI->getTrueValue());
533 std::vector<int> FalseNumbers = NumberVector(S, SI->getFalseValue());
534 std::vector<int> Numbers;
535 for (unsigned i = 0; i < VT->getNumElements(); ++i) {
536 SelectInst *LSI = SelectInst::Create(SI->getCondition(),
537 TrueNumbers[i] < 0 ?
538 ConstantPointerNull::get(cast<PointerType>(T_prjlvalue)) :
539 GetPtrForNumber(S, TrueNumbers[i], SI),
540 FalseNumbers[i] < 0 ?
541 ConstantPointerNull::get(cast<PointerType>(T_prjlvalue)) :
542 GetPtrForNumber(S, FalseNumbers[i], SI),
543 "gclift", SI);
544 int Number = ++S.MaxPtrNumber;
545 Numbers.push_back(Number);
546 S.PtrNumbering[LSI] = S.AllPtrNumbering[LSI] = Number;
547 S.ReversePtrNumbering[Number] = LSI;
548 }
549 S.AllVectorNumbering[SI] = Numbers;
550 } else {
551 Value *TrueBase = MaybeExtractUnion(FindBaseValue(S, SI->getTrueValue(), false), SI);
552 Value *FalseBase = MaybeExtractUnion(FindBaseValue(S, SI->getFalseValue(), false), SI);
553 if (getValueAddrSpace(TrueBase) != AddressSpace::Tracked)
554 TrueBase = ConstantPointerNull::get(cast<PointerType>(FalseBase->getType()));
555 if (getValueAddrSpace(FalseBase) != AddressSpace::Tracked)
556 FalseBase = ConstantPointerNull::get(cast<PointerType>(TrueBase->getType()));
557 if (getValueAddrSpace(TrueBase) != AddressSpace::Tracked)
558 return false;
559 Value *SelectBase = SelectInst::Create(SI->getCondition(),
560 TrueBase, FalseBase, "gclift", SI);
561 int Number = ++S.MaxPtrNumber;
562 S.PtrNumbering[SelectBase] = S.AllPtrNumbering[SelectBase] =
563 S.AllPtrNumbering[SI] = Number;
564 S.ReversePtrNumbering[Number] = SelectBase;
565 }
566 return true;
567 }
568
569 void LateLowerGCFrame::LiftPhi(State &S, PHINode *Phi, SmallVector<int, 16> &PHINumbers)
570 {
571 if (isSpecialPtrVec(Phi->getType())) {
572 VectorType *VT = cast<VectorType>(Phi->getType());
573 std::vector<PHINode *> lifted;
574 for (unsigned i = 0; i < VT->getNumElements(); ++i) {
575 lifted.push_back(PHINode::Create(T_prjlvalue, Phi->getNumIncomingValues(), "gclift", Phi));
576 }
577 for (unsigned i = 0; i < Phi->getNumIncomingValues(); ++i) {
578 std::vector<int> Numbers = NumberVector(S, Phi->getIncomingValue(i));
579 BasicBlock *IncomingBB = Phi->getIncomingBlock(i);
580 Instruction *Terminator = IncomingBB->getTerminator();
581 for (unsigned i = 0; i < VT->getNumElements(); ++i) {
582 if (Numbers[i] < 0)
583 lifted[i]->addIncoming(ConstantPointerNull::get(cast<PointerType>(T_prjlvalue)), IncomingBB);
584 else
585 lifted[i]->addIncoming(GetPtrForNumber(S, Numbers[i], Terminator), IncomingBB);
586 }
587 }
588 std::vector<int> Numbers;
589 for (unsigned i = 0; i < VT->getNumElements(); ++i) {
590 int Number = ++S.MaxPtrNumber;
591 PHINumbers.push_back(Number);
592 Numbers.push_back(Number);
593 S.PtrNumbering[lifted[i]] = S.AllPtrNumbering[lifted[i]] = Number;
594 S.ReversePtrNumbering[Number] = lifted[i];
595 }
596 S.AllVectorNumbering[Phi] = Numbers;
597 } else {
598 PHINode *lift = PHINode::Create(T_prjlvalue, Phi->getNumIncomingValues(), "gclift", Phi);
599 for (unsigned i = 0; i < Phi->getNumIncomingValues(); ++i) {
600 Value *Incoming = Phi->getIncomingValue(i);
601 Value *Base = MaybeExtractUnion(FindBaseValue(S, Incoming, false),
602 Phi->getIncomingBlock(i)->getTerminator());
603 if (getValueAddrSpace(Base) != AddressSpace::Tracked)
604 Base = ConstantPointerNull::get(cast<PointerType>(T_prjlvalue));
605 if (Base->getType() != T_prjlvalue)
606 Base = new BitCastInst(Base, T_prjlvalue, "", Phi->getIncomingBlock(i)->getTerminator());
607 lift->addIncoming(Base, Phi->getIncomingBlock(i));
608 }
609 int Number = ++S.MaxPtrNumber;
610 PHINumbers.push_back(Number);
611 S.PtrNumbering[lift] = S.AllPtrNumbering[lift] =
612 S.AllPtrNumbering[Phi] = Number;
613 S.ReversePtrNumbering[Number] = lift;
614 }
546615 }
547616
548617 int LateLowerGCFrame::NumberBase(State &S, Value *V, Value *CurrentV)
565634 // input IR)
566635 Number = -1;
567636 } else if (isa<SelectInst>(CurrentV) && !isUnion && getValueAddrSpace(CurrentV) != AddressSpace::Tracked) {
568 int Number = LiftSelect(S, cast<SelectInst>(CurrentV));
569 S.AllPtrNumbering[V] = Number;
637 Number = -1;
638 if (LiftSelect(S, cast<SelectInst>(CurrentV)))
639 Number = S.AllPtrNumbering[V] = S.AllPtrNumbering.at(CurrentV);
570640 return Number;
571641 } else if (isa<PHINode>(CurrentV) && !isUnion && getValueAddrSpace(CurrentV) != AddressSpace::Tracked) {
572 int Number = LiftPhi(S, cast<PHINode>(CurrentV));
573 S.AllPtrNumbering[V] = Number;
642 SmallVector<int, 16> PHINumbers;
643 LiftPhi(S, cast<PHINode>(CurrentV), PHINumbers);
644 Number = S.AllPtrNumbering[V] = S.AllPtrNumbering.at(CurrentV);
574645 return Number;
575646 } else if (isa<ExtractValueInst>(CurrentV) && !isUnion) {
576647 assert(false && "TODO: Extract");
629700 Numbers = NumberVectorBase(S, IEI->getOperand(0));
630701 int ElNumber = Number(S, IEI->getOperand(1));
631702 Numbers[idx] = ElNumber;
632 } else if (isa<LoadInst>(CurrentV) || isa<CallInst>(CurrentV) || isa<PHINode>(CurrentV)) {
703 } else if (isa<SelectInst>(CurrentV) && getValueAddrSpace(CurrentV) != AddressSpace::Tracked) {
704 LiftSelect(S, cast<SelectInst>(CurrentV));
705 Numbers = S.AllVectorNumbering[CurrentV];
706 } else if (isa<PHINode>(CurrentV) && getValueAddrSpace(CurrentV) != AddressSpace::Tracked) {
707 SmallVector<int, 16> PHINumbers;
708 LiftPhi(S, cast<PHINode>(CurrentV), PHINumbers);
709 Numbers = S.AllVectorNumbering[CurrentV];
710 } else if (isa<LoadInst>(CurrentV) || isa<CallInst>(CurrentV) || isa<PHINode>(CurrentV) ||
711 isa<SelectInst>(CurrentV)) {
633712 // This is simple, we can just number them sequentially
634713 for (unsigned i = 0; i < cast<VectorType>(CurrentV->getType())->getNumElements(); ++i) {
635714 int Num = ++S.MaxPtrNumber;
637716 S.ReversePtrNumbering[Num] = CurrentV;
638717 }
639718 } else {
640 assert(false && "Unexpected vector generating operating");
719 assert(false && "Unexpected vector generating operation");
641720 }
642721 S.AllVectorNumbering[CurrentV] = Numbers;
643722 return Numbers;
11471226 NoteOperandUses(S, BBS, I, BBS.UpExposedUsesUnrooted);
11481227 } else if (SelectInst *SI = dyn_cast<SelectInst>(&I)) {
11491228 // We need to insert an extra select for the GC root
1150 if (!isSpecialPtr(SI->getType()) && !isUnionRep(SI->getType()))
1229 if (!isSpecialPtr(SI->getType()) && !isSpecialPtrVec(SI->getType()) &&
1230 !isUnionRep(SI->getType()))
11511231 continue;
11521232 if (!isUnionRep(SI->getType()) && getValueAddrSpace(SI) != AddressSpace::Tracked) {
1153 if (S.AllPtrNumbering.find(SI) != S.AllPtrNumbering.end())
1233 if (isSpecialPtrVec(SI->getType()) ?
1234 S.AllVectorNumbering.find(SI) != S.AllVectorNumbering.end() :
1235 S.AllPtrNumbering.find(SI) != S.AllPtrNumbering.end())
11541236 continue;
1155 auto Num = LiftSelect(S, SI);
1156 if (Num < 0)
1237 if (!LiftSelect(S, SI))
11571238 continue;
1158 auto SelectBase = cast<SelectInst>(S.ReversePtrNumbering[Num]);
1159 SmallVector<int, 1> RefinedPtr{Number(S, SelectBase->getTrueValue()),
1160 Number(S, SelectBase->getFalseValue())};
1161 S.Refinements[Num] = std::move(RefinedPtr);
1239 if (!isSpecialPtrVec(SI->getType())) {
1240 // TODO: Refinements for vector select
1241 int Num = S.AllPtrNumbering[SI];
1242 if (Num < 0)
1243 continue;
1244 auto SelectBase = cast<SelectInst>(S.ReversePtrNumbering[Num]);
1245 SmallVector<int, 2> RefinedPtr{Number(S, SelectBase->getTrueValue()),
1246 Number(S, SelectBase->getFalseValue())};
1247 S.Refinements[Num] = std::move(RefinedPtr);
1248 }
11621249 } else {
1163 SmallVector<int, 1> RefinedPtr{Number(S, SI->getTrueValue()),
1164 Number(S, SI->getFalseValue())};
1250 SmallVector<int, 2> RefinedPtr;
1251 if (!isSpecialPtrVec(SI->getType())) {
1252 RefinedPtr = {
1253 Number(S, SI->getTrueValue()),
1254 Number(S, SI->getFalseValue())
1255 };
1256 }
11651257 MaybeNoteDef(S, BBS, SI, BBS.Safepoints, std::move(RefinedPtr));
11661258 NoteOperandUses(S, BBS, I, BBS.UpExposedUsesUnrooted);
11671259 }
11681260 } else if (PHINode *Phi = dyn_cast<PHINode>(&I)) {
1169 if (!isSpecialPtr(Phi->getType()) && !isUnionRep(Phi->getType())) {
1261 if (!isSpecialPtr(Phi->getType()) && !isSpecialPtrVec(Phi->getType()) &&
1262 !isUnionRep(Phi->getType())) {
11701263 continue;
11711264 }
11721265 auto nIncoming = Phi->getNumIncomingValues();
11731266 // We need to insert an extra phi for the GC root
11741267 if (!isUnionRep(Phi->getType()) && getValueAddrSpace(Phi) != AddressSpace::Tracked) {
1175 if (S.AllPtrNumbering.find(Phi) != S.AllPtrNumbering.end())
1268 if (isSpecialPtrVec(Phi->getType()) ?
1269 S.AllVectorNumbering.find(Phi) != S.AllVectorNumbering.end() :
1270 S.AllPtrNumbering.find(Phi) != S.AllPtrNumbering.end())
11761271 continue;
1177 auto Num = LiftPhi(S, Phi);
1178 auto lift = cast<PHINode>(S.ReversePtrNumbering[Num]);
1179 S.Refinements[Num] = GetPHIRefinements(lift, S);
1180 PHINumbers.push_back(Num);
1272 LiftPhi(S, Phi, PHINumbers);
11811273 } else {
1182 MaybeNoteDef(S, BBS, Phi, BBS.Safepoints, GetPHIRefinements(Phi, S));
1183 PHINumbers.push_back(Number(S, Phi));
1274 SmallVector<int, 1> PHIRefinements;
1275 if (!isSpecialPtrVec(Phi->getType()))
1276 PHIRefinements = GetPHIRefinements(Phi, S);
1277 MaybeNoteDef(S, BBS, Phi, BBS.Safepoints, std::move(PHIRefinements));
1278 if (isSpecialPtrVec(Phi->getType())) {
1279 // TODO: Vector refinements
1280 std::vector<int> Nums = NumberVector(S, Phi);
1281 for (int Num : Nums)
1282 PHINumbers.push_back(Num);
1283 } else {
1284 PHINumbers.push_back(Number(S, Phi));
1285 }
11841286 for (unsigned i = 0; i < nIncoming; ++i) {
11851287 BBState &IncomingBBS = S.BBStates[Phi->getIncomingBlock(i)];
11861288 NoteUse(S, IncomingBBS, Phi->getIncomingValue(i), IncomingBBS.PhiOuts);
17731875 Frame->setOperand(0, ConstantInt::get(T_int32, maxframeargs));
17741876 }
17751877 return ChangesMade;
1776 }
1777
1778 static Value *GetPtrForNumber(State &S, unsigned Num, Instruction *InsertionPoint)
1779 {
1780 Value *Val = S.ReversePtrNumbering[Num];
1781 if (isSpecialPtrVec(Val->getType())) {
1782 const std::vector<int> &AllNums = S.AllVectorNumbering[Val];
1783 unsigned Idx = 0;
1784 for (; Idx < AllNums.size(); ++Idx) {
1785 if ((unsigned)AllNums[Idx] == Num)
1786 break;
1787 }
1788 Val = ExtractElementInst::Create(Val, ConstantInt::get(
1789 Type::getInt32Ty(Val->getContext()), Idx), "", InsertionPoint);
1790 }
1791 return Val;
17921878 }
17931879
17941880 static void AddInPredLiveOuts(BasicBlock *BB, BitVector &LiveIn, State &S)
5959
6060 ;; function definition
6161 (pattern-lambda (function (-$ (call name . argl) (|::| (call name . argl) _t)) body)
62 (cons 'varlist (safe-llist-positional-args (fix-arglist argl))))
62 (cons 'varlist (safe-llist-positional-args (fix-arglist (append (self-argname name) argl)))))
6363 (pattern-lambda (function (where callspec . wheres) body)
6464 (let ((others (pattern-expand1 vars-introduced-by-patterns `(function ,callspec ,body))))
6565 (cons 'varlist (append (if (and (pair? others) (eq? (car others) 'varlist))
7474 (pattern-lambda (= (call (curly name . sparams) . argl) body)
7575 `(function (call (curly ,name . ,sparams) . ,argl) ,body))
7676 (pattern-lambda (= (-$ (call name . argl) (|::| (call name . argl) _t)) body)
77 `(function (call ,name ,@argl) ,body))
77 `(function ,(cadr __) ,body))
7878 (pattern-lambda (= (where callspec . wheres) body)
7979 (cons 'function (cdr __)))
8080
134134 (if var (list 'varlist var) '()))
135135
136136 ;; type definition
137 (pattern-lambda (struct mut (<: (curly tn . tvars) super) body)
138 (list* 'varlist (cons (unescape tn) (unescape tn)) '(new . new)
139 (typevar-names tvars)))
140 (pattern-lambda (struct mut (curly tn . tvars) body)
141 (list* 'varlist (cons (unescape tn) (unescape tn)) '(new . new)
142 (typevar-names tvars)))
143 (pattern-lambda (struct mut (<: tn super) body)
144 (list 'varlist (cons (unescape tn) (unescape tn)) '(new . new)))
145 (pattern-lambda (struct mut tn body)
146 (list 'varlist (cons (unescape tn) (unescape tn)) '(new . new)))
137 (pattern-lambda (struct mut spec body)
138 (let ((tn (typedef-expr-name spec))
139 (tv (typedef-expr-tvars spec)))
140 (list* 'varlist (cons (unescape tn) (unescape tn)) '(new . new)
141 (typevar-names tv))))
142 (pattern-lambda (abstract spec)
143 (let ((tn (typedef-expr-name spec))
144 (tv (typedef-expr-tvars spec)))
145 (list* 'varlist (cons (unescape tn) (unescape tn))
146 (typevar-names tv))))
147 (pattern-lambda (primitive spec nb)
148 (let ((tn (typedef-expr-name spec))
149 (tv (typedef-expr-tvars spec)))
150 (list* 'varlist (cons (unescape tn) (unescape tn))
151 (typevar-names tv))))
147152
148153 )) ; vars-introduced-by-patterns
149154
176181 (if (and (pair? e) (eq? (car e) 'escape))
177182 (cadr e)
178183 e))
184
185 (define (typedef-expr-name e)
186 (cond ((atom? e) e)
187 ((or (eq? (car e) 'curly) (eq? (car e) '<:)) (typedef-expr-name (cadr e)))
188 (else e)))
189
190 (define (typedef-expr-tvars e)
191 (cond ((atom? e) '())
192 ((eq? (car e) '<:) (typedef-expr-tvars (cadr e)))
193 ((eq? (car e) 'curly) (cddr e))
194 (else '())))
179195
180196 (define (typevar-expr-name e) (car (analyze-typevar e)))
181197
239255 (safe-arg-names kwargs #t)
240256 ;; count escaped argument names as "keywords" to prevent renaming
241257 (safe-llist-positional-args lst #t))))
258
259 ;; argument name for the function itself given `function (f::T)(...)`, otherwise ()
260 (define (self-argname name)
261 (if (and (length= name 3) (eq? (car name) '|::|))
262 (list (cadr name))
263 '()))
242264
243265 ;; resolve-expansion-vars-with-new-env, but turn on `inarg` once we get inside
244266 ;; the formal argument list. `e` in general might be e.g. `(f{T}(x)::T) where T`,
362384 ;; in keyword arg A=B, don't transform "A"
363385 (unescape (cadr (cadr e))))
364386 ,(resolve-expansion-vars- (caddr (cadr e)) env m parent-scope inarg))
365 ,(resolve-expansion-vars- (caddr e) env m parent-scope inarg)))
387 ,(resolve-expansion-vars-with-new-env (caddr e) env m parent-scope inarg)))
366388 (else
367389 `(kw ,(if inarg
368390 (resolve-expansion-vars- (cadr e) env m parent-scope inarg)
369391 (unescape (cadr e)))
370 ,(resolve-expansion-vars- (caddr e) env m parent-scope inarg)))))
392 ,(resolve-expansion-vars-with-new-env (caddr e) env m parent-scope inarg)))))
371393
372394 ((let)
373395 (let* ((newenv (new-expansion-env-for e env))
459459 new_linfo->specTypes = types;
460460 new_linfo->sparam_vals = sp;
461461 new_linfo->min_world = m->min_world;
462 new_linfo->max_world = ~(size_t)0;
462 new_linfo->max_world = m->max_world;
463463 return new_linfo;
464464 }
465465
594594 m->nargs = 0;
595595 m->traced = 0;
596596 m->min_world = 1;
597 m->max_world = ~(size_t)0;
597598 JL_MUTEX_INIT(&m->writelock);
598599 return m;
599600 }
638639
639640 JL_GC_POP();
640641 m->min_world = ++jl_world_counter;
642 m->max_world = ~(size_t)0;
641643 return m;
642644 }
643645
7777 JL_DLLEXPORT jl_value_t *jl_cglobal(jl_value_t *v, jl_value_t *ty)
7878 {
7979 JL_TYPECHK(cglobal, type, ty);
80 JL_GC_PUSH1(&v);
8081 jl_value_t *rt =
81 v == (jl_value_t*)jl_void_type ? (jl_value_t*)jl_voidpointer_type : // a common case
82 ty == (jl_value_t*)jl_void_type ? (jl_value_t*)jl_voidpointer_type : // a common case
8283 (jl_value_t*)jl_apply_type1((jl_value_t*)jl_pointer_type, ty);
8384
8485 if (!jl_is_concrete_type(rt))
8788 if (jl_is_tuple(v) && jl_nfields(v) == 1)
8889 v = jl_fieldref(v, 0);
8990
90 if (jl_is_pointer(v))
91 return jl_bitcast(rt, v);
91 if (jl_is_pointer(v)) {
92 v = jl_bitcast(rt, v);
93 JL_GC_POP();
94 return v;
95 }
9296
9397 char *f_lib = NULL;
9498 if (jl_is_tuple(v) && jl_nfields(v) > 1) {
119123 jl_value_t *jv = jl_gc_alloc_1w();
120124 jl_set_typeof(jv, rt);
121125 *(void**)jl_data_ptr(jv) = ptr;
126 JL_GC_POP();
122127 return jv;
123128 }
124129
597597 {
598598 if (!jl_is_typevar(ty) && jl_has_free_typevars(ty)) {
599599 jl_value_t *ans = ty;
600 jl_array_t *vs = jl_find_free_typevars(ty);
600 jl_array_t *vs = NULL;
601601 JL_GC_PUSH2(&ans, &vs);
602 vs = jl_find_free_typevars(ty);
602603 int i;
603604 for (i = 0; i < jl_array_len(vs); i++) {
604605 ans = jl_type_unionall((jl_tvar_t*)jl_array_ptr_ref(vs, i), ans);
629630 btemp = btemp->prev;
630631 }
631632 jl_varbinding_t vb = { u->var, u->var->lb, u->var->ub, R, NULL, 0, 0, 0, 0, e->invdepth, 0, NULL, e->vars };
632 JL_GC_PUSH3(&u, &vb.lb, &vb.ub);
633 JL_GC_PUSH4(&u, &vb.lb, &vb.ub, &vb.innervars);
633634 e->vars = &vb;
634635 int ans;
635636 if (R) {
11871188 {
11881189 if (obviously_egal(a, b)) return 1;
11891190 if (obviously_unequal(a, b)) return 0;
1191 if (jl_is_datatype(a) && !jl_is_concrete_type(b)) {
1192 // if one type looks more likely to be abstract, check it on the left
1193 // first in order to reject more quickly.
1194 jl_value_t *temp = a;
1195 a = b;
1196 b = temp;
1197 }
11901198 return jl_subtype(a, b) && jl_subtype(b, a);
11911199 }
11921200
17231731 // only do the check if N is free in the tuple type's last parameter
17241732 if (jl_is_typevar(N) && N != (jl_value_t*)va_p1 && N != (jl_value_t*)va_p2) {
17251733 jl_value_t *len = jl_box_long(n);
1734 JL_GC_PUSH1(&len);
17261735 jl_value_t *il = R ? intersect(len, N, e, 2) : intersect(N, len, e, 2);
1736 JL_GC_POP();
17271737 if (il == jl_bottom_type)
17281738 return 0;
17291739 }
26082618 return ret;
26092619 }
26102620
2611 static int partially_morespecific(jl_value_t *a, jl_value_t *b, int invariant, jl_typeenv_t *env)
2612 {
2613 if (jl_is_uniontype(b)) {
2614 jl_uniontype_t *u = (jl_uniontype_t*)b;
2615 if (type_morespecific_(a, u->a, invariant, env) ||
2616 type_morespecific_(a, u->b, invariant, env))
2617 return 1;
2618 return 0;
2619 }
2620 return type_morespecific_(a, b, invariant, env);
2621 }
2622
26232621 static int count_occurs(jl_value_t *t, jl_tvar_t *v)
26242622 {
26252623 if (t == (jl_value_t*)v)
26912689 if (jl_is_uniontype(a)) {
26922690 // Union a is more specific than b if some element of a is more specific than b, but
26932691 // not vice-versa.
2692 if (sub_msp(b, a, env))
2693 return 0;
26942694 jl_uniontype_t *u = (jl_uniontype_t*)a;
2695 return ((partially_morespecific(u->a, b, invariant, env) || partially_morespecific(u->b, b, invariant, env)) &&
2696 !partially_morespecific(b, a, invariant, env));
2695 if (type_morespecific_(u->a, b, invariant, env) || type_morespecific_(u->b, b, invariant, env)) {
2696 if (jl_is_uniontype(b)) {
2697 jl_uniontype_t *v = (jl_uniontype_t*)b;
2698 if (type_morespecific_(v->a, a, invariant, env) || type_morespecific_(v->b, a, invariant, env))
2699 return 0;
2700 }
2701 return 1;
2702 }
2703 return 0;
26972704 }
26982705
26992706 if (jl_is_type_type(a) && !invariant) {
522522 ((jl_expr_t*)e)->head == jl_incomplete_sym);
523523 }
524524
525 int jl_needs_lowering(jl_value_t *e) JL_NOTSAFEPOINT
526 {
527 if (!jl_is_expr(e))
528 return 0;
529 jl_expr_t *ex = (jl_expr_t*)e;
530 jl_sym_t *head = ex->head;
531 if (head == module_sym || head == import_sym || head == using_sym ||
532 head == export_sym || head == thunk_sym || head == toplevel_sym ||
533 head == error_sym || head == jl_incomplete_sym || head == method_sym) {
534 return 0;
535 }
536 if (head == global_sym) {
537 size_t i, l = jl_array_len(ex->args);
538 for (i = 0; i < l; i++) {
539 jl_value_t *a = jl_exprarg(ex, i);
540 if (!jl_is_symbol(a) && !jl_is_globalref(a))
541 return 1;
542 }
543 return 0;
544 }
545 return 1;
546 }
547
525548 void jl_resolve_globals_in_ir(jl_array_t *stmts, jl_module_t *m, jl_svec_t *sparam_vals,
526549 int binding_effects);
527550
599622 }
600623
601624 jl_expr_t *ex = (jl_expr_t*)e;
625
602626 if (ex->head == dot_sym) {
603627 if (jl_expr_nargs(ex) != 2)
604628 jl_error("syntax: malformed \".\" expression");
605629 jl_value_t *lhs = jl_exprarg(ex, 0);
606630 jl_value_t *rhs = jl_exprarg(ex, 1);
607 // only handle `a.b` syntax here
631 // only handle `a.b` syntax here, so qualified names can be eval'd in pure contexts
608632 if (jl_is_quotenode(rhs) && jl_is_symbol(jl_fieldref(rhs,0)))
609633 return jl_eval_dot_expr(m, lhs, rhs, fast);
610634 }
635
611636 if (ptls->in_pure_callback) {
612637 jl_error("eval cannot be used in a generated function");
613638 }
614 else if (ex->head == module_sym) {
615 return jl_eval_module_expr(m, ex);
616 }
617 else if (ex->head == using_sym) {
639
640 jl_method_instance_t *li = NULL;
641 jl_code_info_t *thk = NULL;
642 JL_GC_PUSH3(&li, &thk, &ex);
643
644 if (!expanded && jl_needs_lowering(e)) {
645 ex = (jl_expr_t*)jl_expand(e, m);
646 }
647 jl_sym_t *head = jl_is_expr(ex) ? ex->head : NULL;
648
649 if (head == module_sym) {
650 jl_value_t *val = jl_eval_module_expr(m, ex);
651 JL_GC_POP();
652 return val;
653 }
654 else if (head == using_sym) {
618655 size_t last_age = ptls->world_age;
619656 ptls->world_age = jl_world_counter;
620657 jl_sym_t *name = NULL;
651688 }
652689 }
653690 ptls->world_age = last_age;
691 JL_GC_POP();
654692 return jl_nothing;
655693 }
656 else if (ex->head == import_sym) {
694 else if (head == import_sym) {
657695 size_t last_age = ptls->world_age;
658696 ptls->world_age = jl_world_counter;
659697 jl_sym_t *name = NULL;
678716 }
679717 }
680718 ptls->world_age = last_age;
719 JL_GC_POP();
681720 return jl_nothing;
682721 }
683 else if (ex->head == export_sym) {
722 else if (head == export_sym) {
684723 for (size_t i = 0; i < jl_array_len(ex->args); i++) {
685724 jl_sym_t *name = (jl_sym_t*)jl_array_ptr_ref(ex->args, i);
686725 if (!jl_is_symbol(name))
687726 jl_error("syntax: malformed \"export\" statement");
688727 jl_module_export(m, name);
689728 }
729 JL_GC_POP();
690730 return jl_nothing;
691731 }
692 else if (ex->head == global_sym) {
732 else if (head == global_sym) {
693733 // create uninitialized mutable binding for "global x" decl
694734 size_t i, l = jl_array_len(ex->args);
695735 for (i = 0; i < l; i++) {
696 jl_value_t *a = jl_exprarg(ex, i);
697 if (!jl_is_symbol(a) && !jl_is_globalref(a))
698 break;
699 }
700 if (i == l) {
701 for (i = 0; i < l; i++) {
702 jl_sym_t *gs = (jl_sym_t*)jl_exprarg(ex, i);
703 jl_module_t *gm = m;
704 if (jl_is_globalref(gs)) {
705 gm = jl_globalref_mod(gs);
706 gs = jl_globalref_name(gs);
707 }
708 assert(jl_is_symbol(gs));
709 jl_get_binding_wr(gm, gs, 0);
710 }
711 return jl_nothing;
712 }
713 // fall-through to expand to normalize the syntax
714 }
715
716 jl_method_instance_t *li = NULL;
717 jl_code_info_t *thk = NULL;
718 JL_GC_PUSH3(&li, &thk, &ex);
719
720 if (!expanded && ex->head != thunk_sym && ex->head != method_sym && ex->head != toplevel_sym &&
721 ex->head != error_sym && ex->head != jl_incomplete_sym) {
722 // not yet expanded
723 ex = (jl_expr_t*)jl_expand(e, m);
724 }
725 jl_sym_t *head = jl_is_expr(ex) ? ex->head : NULL;
726
727 if (head == toplevel_sym) {
736 jl_value_t *arg = jl_exprarg(ex, i);
737 jl_module_t *gm;
738 jl_sym_t *gs;
739 if (jl_is_globalref(arg)) {
740 gm = jl_globalref_mod(arg);
741 gs = jl_globalref_name(arg);
742 }
743 else {
744 assert(jl_is_symbol(arg));
745 gm = m;
746 gs = (jl_sym_t*)arg;
747 }
748 jl_get_binding_wr(gm, gs, 0);
749 }
750 JL_GC_POP();
751 return jl_nothing;
752 }
753 else if (head == toplevel_sym) {
728754 size_t last_age = ptls->world_age;
729755 jl_value_t *res = jl_nothing;
730756 int i;
742742 {
743743 // some manually-unrolled common special cases
744744 while (ml->simplesig == (void*)jl_nothing && ml->guardsigs == jl_emptysvec && ml->isleafsig) {
745 // use a tight loop for a long as possible
745 // use a tight loop for as long as possible
746746 if (world >= ml->min_world && world <= ml->max_world) {
747747 if (n == jl_field_count(ml->sig) && jl_typeof(args[0]) == jl_tparam(ml->sig, 0)) {
748748 if (n == 1)
186186
187187 julia> Dates.dayofweekofmonth(Date("2000-02-15"))
188188 3
189 ````
189 ```
190190 """
191191 function dayofweekofmonth(dt::TimeType)
192192 d = day(dt)
643643
644644 Return the cluster cookie.
645645 """
646 cluster_cookie() = LPROC.cookie
646 cluster_cookie() = (init_multi(); LPROC.cookie)
647647
648648 """
649649 cluster_cookie(cookie) -> cookie
651651 Set the passed cookie as the cluster cookie, then returns it.
652652 """
653653 function cluster_cookie(cookie)
654 init_multi()
654655 # The cookie must be an ASCII string with length <= HDR_COOKIE_LEN
655656 @assert isascii(cookie)
656657 @assert length(cookie) <= HDR_COOKIE_LEN
718719 myid()
719720
720721 Get the id of the current process.
722
723 # Examples
724 ```julia-repl
725 julia> myid()
726 1
727
728 julia> remotecall_fetch(() -> myid(), 4)
729 4
730 ```
721731 """
722732 myid() = LPROC.id
723733
725735 nprocs()
726736
727737 Get the number of available processes.
738
739 # Examples
740 ```julia-repl
741 julia> nprocs()
742 3
743
744 julia> workers()
745 5-element Array{Int64,1}:
746 2
747 3
748 ```
728749 """
729750 function nprocs()
730751 if myid() == 1 || (PGRP.topology == :all_to_all && !isclusterlazy())
744765 """
745766 nworkers()
746767
747 Get the number of available worker processes. This is one less than `nprocs()`. Equal to
768 Get the number of available worker processes. This is one less than [`nprocs()`](@ref). Equal to
748769 `nprocs()` if `nprocs() == 1`.
770
771 # Examples
772 ```julia-repl
773 \$ julia -p 5
774
775 julia> nprocs()
776 6
777
778 julia> nworkers()
779 5
780 ```
749781 """
750782 function nworkers()
751783 n = nprocs()
755787 """
756788 procs()
757789
758 Return a list of all process identifiers.
790 Return a list of all process identifiers, including pid 1 (which is not included by [`workers()`](@ref)).
791
792 # Examples
793 ```julia-repl
794 \$ julia -p 5
795
796 julia> procs()
797 3-element Array{Int64,1}:
798 1
799 2
800 3
801 ```
759802 """
760803 function procs()
761804 if myid() == 1 || (PGRP.topology == :all_to_all && !isclusterlazy())
807850 workers()
808851
809852 Return a list of all worker process identifiers.
853
854 # Examples
855 ```julia-repl
856 \$ julia -p 5
857
858 julia> workers()
859 2-element Array{Int64,1}:
860 2
861 3
862 ```
810863 """
811864 function workers()
812865 allp = procs()
830883 workers.
831884
832885 Argument `waitfor` specifies how long to wait for the workers to shut down:
833 - If unspecified, `rmprocs` will wait until all requested `pids` are removed.
834 - An `ErrorException` is raised if all workers cannot be terminated before
835 the requested `waitfor` seconds.
836 - With a `waitfor` value of 0, the call returns immediately with the workers
837 scheduled for removal in a different task. The scheduled `Task` object is
838 returned. The user should call `wait` on the task before invoking any other
839 parallel calls.
886 - If unspecified, `rmprocs` will wait until all requested `pids` are removed.
887 - An [`ErrorException`](@ref) is raised if all workers cannot be terminated before
888 the requested `waitfor` seconds.
889 - With a `waitfor` value of 0, the call returns immediately with the workers
890 scheduled for removal in a different task. The scheduled [`Task`](@ref) object is
891 returned. The user should call [`wait`](@ref) on the task before invoking any other
892 parallel calls.
893
894 # Examples
895 ```julia-repl
896 \$ julia -p 5
897
898 julia> t = rmprocs(2, 3, waitfor=0)
899 Task (runnable) @0x0000000107c718d0
900
901 julia> wait(t)
902
903 julia> workers()
904 3-element Array{Int64,1}:
905 4
906 5
907 6
908 ```
840909 """
841910 function rmprocs(pids...; waitfor=typemax(Int))
842911 cluster_mgmt_from_master_check()
250250
251251 function preduce(reducer, f, R)
252252 N = length(R)
253 chunks = splitrange(N, nworkers())
253 chunks = splitrange(Int(N), nworkers())
254254 all_w = workers()[1:length(chunks)]
255255
256256 w_exec = Task[]
387387 [`RemoteException`](@ref) and thrown.
388388
389389 See also [`fetch`](@ref) and [`remotecall`](@ref).
390
391 # Examples
392 ```julia-repl
393 \$ julia -p 2
394
395 julia> remotecall_fetch(sqrt, 2, 4)
396 2.0
397
398 julia> remotecall_fetch(sqrt, 2, -4)
399 ERROR: On worker 2:
400 DomainError with -4.0:
401 sqrt will only return a complex result if called with a complex argument. Try sqrt(Complex(x)).
402 ...
403 ```
390404 """
391405 remotecall_fetch(f, id::Integer, args...; kwargs...) =
392406 remotecall_fetch(f, worker_from_id(id), args...; kwargs...)
480494 """
481495 wait(r::Future)
482496
483 Wait for a value to become available for the specified future.
497 Wait for a value to become available for the specified [`Future`](@ref).
484498 """
485499 wait(r::Future) = (r.v !== nothing && return r; call_on_owner(wait_ref, r, myid()); r)
486500
487501 """
488502 wait(r::RemoteChannel, args...)
489503
490 Wait for a value to become available on the specified remote channel.
504 Wait for a value to become available on the specified [`RemoteChannel`](@ref).
491505 """
492506 wait(r::RemoteChannel, args...) = (call_on_owner(wait_ref, r, myid(), args...); r)
493507
3131 """
3232 WorkerPool(workers::Vector{Int})
3333
34 Create a WorkerPool from a vector of worker ids.
34 Create a `WorkerPool` from a vector of worker ids.
35
36 # Examples
37 ```julia-repl
38 \$ julia -p 3
39
40 julia> WorkerPool([2, 3])
41 WorkerPool(Channel{Int64}(sz_max:9223372036854775807,sz_curr:2), Set([2, 3]), RemoteChannel{Channel{Any}}(1, 1, 6))
42 ```
3543 """
3644 function WorkerPool(workers::Vector{Int})
3745 pool = WorkerPool()
154162 """
155163 remotecall(f, pool::AbstractWorkerPool, args...; kwargs...) -> Future
156164
157 `WorkerPool` variant of `remotecall(f, pid, ....)`. Waits for and takes a free worker from `pool` and performs a `remotecall` on it.
165 [`WorkerPool`](@ref) variant of `remotecall(f, pid, ....)`. Wait for and take a free worker from `pool` and perform a `remotecall` on it.
166
167 # Examples
168 ```julia-repl
169 \$ julia -p 3
170
171 julia> wp = WorkerPool([2, 3]);
172
173 julia> A = rand(3000);
174
175 julia> f = remotecall(maximum, wp, A)
176 Future(2, 1, 6, nothing)
177 ```
178 In this example, the task ran on pid 2, called from pid 1.
158179 """
159180 remotecall(f, pool::AbstractWorkerPool, args...; kwargs...) = remotecall_pool(remotecall, f, pool, args...; kwargs...)
160181
162183 """
163184 remotecall_wait(f, pool::AbstractWorkerPool, args...; kwargs...) -> Future
164185
165 `WorkerPool` variant of `remotecall_wait(f, pid, ....)`. Waits for and takes a free worker from `pool` and
166 performs a `remotecall_wait` on it.
186 [`WorkerPool`](@ref) variant of `remotecall_wait(f, pid, ....)`. Wait for and take a free worker from `pool` and
187 perform a `remotecall_wait` on it.
188
189 # Examples
190 ```julia-repl
191 \$ julia -p 3
192
193 julia> wp = WorkerPool([2, 3]);
194
195 julia> A = rand(3000);
196
197 julia> f = remotecall_wait(maximum, wp, A)
198 Future(3, 1, 9, nothing)
199
200 julia> fetch(f)
201 0.9995177101692958
202 ```
167203 """
168204 remotecall_wait(f, pool::AbstractWorkerPool, args...; kwargs...) = remotecall_pool(remotecall_wait, f, pool, args...; kwargs...)
169205
171207 """
172208 remotecall_fetch(f, pool::AbstractWorkerPool, args...; kwargs...) -> result
173209
174 `WorkerPool` variant of `remotecall_fetch(f, pid, ....)`. Waits for and takes a free worker from `pool` and
210 [`WorkerPool`](@ref) variant of `remotecall_fetch(f, pid, ....)`. Waits for and takes a free worker from `pool` and
175211 performs a `remotecall_fetch` on it.
212
213 # Examples
214 ```julia-repl
215 \$ julia -p 3
216
217 julia> wp = WorkerPool([2, 3]);
218
219 julia> A = rand(3000);
220
221 julia> remotecall_fetch(maximum, wp, A)
222 0.9995177101692958
223 ```
176224 """
177225 remotecall_fetch(f, pool::AbstractWorkerPool, args...; kwargs...) = remotecall_pool(remotecall_fetch, f, pool, args...; kwargs...)
178226
179227 """
180228 remote_do(f, pool::AbstractWorkerPool, args...; kwargs...) -> nothing
181229
182 `WorkerPool` variant of `remote_do(f, pid, ....)`. Waits for and takes a free worker from `pool` and
183 performs a `remote_do` on it.
230 [`WorkerPool`](@ref) variant of `remote_do(f, pid, ....)`. Wait for and take a free worker from `pool` and
231 perform a `remote_do` on it.
184232 """
185233 remote_do(f, pool::AbstractWorkerPool, args...; kwargs...) = remotecall_pool(remote_do, f, pool, args...; kwargs...)
186234
189237 """
190238 default_worker_pool()
191239
192 `WorkerPool` containing idle `workers` - used by `remote(f)` and [`pmap`](@ref) (by default).
240 [`WorkerPool`](@ref) containing idle [`workers`](@ref) - used by `remote(f)` and [`pmap`](@ref) (by default).
241
242 # Examples
243 ```julia-repl
244 \$ julia -p 3
245
246 julia> default_worker_pool()
247 WorkerPool(Channel{Int64}(sz_max:9223372036854775807,sz_curr:3), Set([4, 2, 3]), RemoteChannel{Channel{Any}}(1, 1, 4))
248 ```
193249 """
194250 function default_worker_pool()
195251 # On workers retrieve the default worker pool from the master when accessed
205261 end
206262
207263 """
208 remote([::AbstractWorkerPool], f) -> Function
264 remote([p::AbstractWorkerPool], f) -> Function
209265
210266 Return an anonymous function that executes function `f` on an available worker
211 using [`remotecall_fetch`](@ref).
267 (drawn from [`WorkerPool`](@ref) `p` if provided) using [`remotecall_fetch`](@ref).
212268 """
213269 remote(f) = (args...; kwargs...)->remotecall_fetch(f, default_worker_pool(), args...; kwargs...)
214270 remote(p::AbstractWorkerPool, f) = (args...; kwargs...)->remotecall_fetch(f, p, args...; kwargs...)
11
22 using Test, Distributed, Random, Serialization, Sockets
33 import Distributed: launch, manage
4
5 @test cluster_cookie() isa String
46
57 include(joinpath(Sys.BINDIR, "..", "share", "julia", "test", "testenv.jl"))
68
15241526 a27933 = :_not_defined_27933
15251527 @test remotecall_fetch(()->a27933, first(workers())) === a27933
15261528
1529 # PR #28651
1530 for T in (UInt8, Int8, UInt16, Int16, UInt32, Int32, UInt64)
1531 n = @distributed (+) for i in Base.OneTo(T(10))
1532 i
1533 end
1534 @test n == 55
1535 end
1536
15271537 # Run topology tests last after removing all workers, since a given
15281538 # cluster at any time only supports a single topology.
15291539 rmprocs(workers())
1414 $(fcn)(Core.kwfunc(arg1),
1515 Tuple{typeof(kwargs), Core.Typeof(arg1), map(Core.Typeof, args)...})
1616 end
17 elseif ex0.head == :call
17 elseif ex0.head === :call
1818 return Expr(:call, fcn, esc(ex0.args[1]),
1919 Expr(:call, typesof, map(esc, ex0.args[2:end])...))
20 elseif ex0.head == :(=) && length(ex0.args) == 2 && ex0.args[1].head == :(.)
21 return Expr(:call, fcn, Base.setproperty!,
22 Expr(:call, typesof, map(esc, [ex0.args[1].args..., ex0.args[2]])...))
20 elseif ex0.head === :(=) && length(ex0.args) == 2
21 lhs, rhs = ex0.args
22 if isa(lhs, Expr)
23 if lhs.head === :(.)
24 return Expr(:call, fcn, Base.setproperty!,
25 Expr(:call, typesof, map(esc, lhs.args)..., esc(rhs)))
26 elseif lhs.head === :ref
27 return Expr(:call, fcn, Base.setindex!,
28 Expr(:call, typesof, esc(lhs.args[1]), esc(rhs), map(esc, lhs.args[2:end])...))
29 end
30 end
31 elseif ex0.head === :vcat || ex0.head === :typed_vcat
32 if ex0.head === :vcat
33 f, hf = Base.vcat, Base.hvcat
34 args = ex0.args
35 else
36 f, hf = Base.typed_vcat, Base.typed_hvcat
37 args = ex0.args[2:end]
38 end
39 if any(a->isa(a,Expr) && a.head === :row, args)
40 rows = Any[ (isa(x,Expr) && x.head === :row ? x.args : Any[x]) for x in args ]
41 lens = map(length, rows)
42 return Expr(:call, fcn, hf,
43 Expr(:call, typesof,
44 (ex0.head === :vcat ? [] : Any[esc(ex0.args[1])])...,
45 Expr(:tuple, lens...),
46 map(esc, vcat(rows...))...))
47 else
48 return Expr(:call, fcn, f,
49 Expr(:call, typesof, map(esc, ex0.args)...))
50 end
2351 else
24 for (head, f) in (:ref => Base.getindex, :vcat => Base.vcat, :hcat => Base.hcat, :(.) => Base.getproperty, :vect => Base.vect)
25 if ex0.head == head
52 for (head, f) in (:ref => Base.getindex, :hcat => Base.hcat, :(.) => Base.getproperty, :vect => Base.vect, Symbol("'") => Base.adjoint, :typed_hcat => Base.typed_hcat, :string => string)
53 if ex0.head === head
2654 return Expr(:call, fcn, f,
2755 Expr(:call, typesof, map(esc, ex0.args)...))
2856 end
2957 end
3058 end
3159 end
32 if isa(ex0, Expr) && ex0.head == :macrocall # Make @edit @time 1+2 edit the macro by using the types of the *expressions*
60 if isa(ex0, Expr) && ex0.head === :macrocall # Make @edit @time 1+2 edit the macro by using the types of the *expressions*
3361 return Expr(:call, fcn, esc(ex0.args[1]), Tuple{#=__source__=#LineNumberNode, #=__module__=#Module, Any[ Core.Typeof(a) for a in ex0.args[3:end] ]...})
3462 end
3563
3967 end
4068
4169 exret = Expr(:none)
42 if ex.head == :call
43 if any(e->(isa(e, Expr) && e.head==:(...)), ex0.args) &&
70 if ex.head === :call
71 if any(e->(isa(e, Expr) && e.head === :(...)), ex0.args) &&
4472 (ex.args[1] === GlobalRef(Core,:_apply) ||
4573 ex.args[1] === GlobalRef(Base,:_apply))
4674 # check for splatting
5280 Expr(:call, typesof, map(esc, ex.args[2:end])...))
5381 end
5482 end
55 if ex.head == :thunk || exret.head == :none
83 if ex.head === :thunk || exret.head === :none
5684 exret = Expr(:call, :error, "expression is not a function call, "
5785 * "or is too complex for @$fcn to analyze; "
5886 * "break it down to simpler parts if possible")
197197 # issue #13264
198198 @test (@which vcat(1...)).name == :vcat
199199
200 # PR #28122
200 # PR #28122, issue #25474
201201 @test (@which [1][1]).name === :getindex
202 @test (@which [1 2]).name == :hcat
203 @test (@which [1; 2]).name == :vcat
204 @test (@which [1]).name == :vect
202 @test (@which [1][1] = 2).name === :setindex!
203 @test (@which [1]).name === :vect
204 @test (@which [1 2]).name === :hcat
205 @test (@which [1; 2]).name === :vcat
206 @test (@which Int[1 2]).name === :typed_hcat
207 @test (@which Int[1; 2]).name === :typed_vcat
208 @test (@which [1 2;3 4]).name === :hvcat
209 @test (@which Int[1 2;3 4]).name === :typed_hvcat
205210
206211 # issue #13464
207 let t13464 = "hey there sailor"
208 try
209 @which t13464[1,1] = (1.0,true)
210 error("unexpected")
211 catch err13464
212 @test startswith(err13464.msg, "expression is not a function call, or is too complex")
213 end
212 try
213 @which x = 1
214 error("unexpected")
215 catch err13464
216 @test startswith(err13464.msg, "expression is not a function call, or is too complex")
214217 end
215218
216219 module MacroTest
977977
978978 atexit() do
979979 # refcount zero, no objects to be finalized
980 if Threads.atomic_sub!(REFCOUNT, 1) >= 1
980 if Threads.atomic_sub!(REFCOUNT, 1) == 1
981981 ccall((:git_libgit2_shutdown, :libgit2), Cint, ())
982982 end
983983 end
5959 axpby!,
6060 bunchkaufman,
6161 bunchkaufman!,
62 chol,
6362 cholesky,
6463 cholesky!,
6564 cond,
133132 tr,
134133 transpose,
135134 transpose!,
136 transpose_type,
137135 tril,
138136 triu,
139137 tril!,
149149
150150 # sundry basic definitions
151151 parent(A::AdjOrTrans) = A.parent
152 vec(v::AdjOrTransAbsVec) = v.parent
152 vec(v::TransposeAbsVec) = parent(v)
153153
154154 cmp(A::AdjOrTransAbsVec, B::AdjOrTransAbsVec) = cmp(parent(A), parent(B))
155155 isless(A::AdjOrTransAbsVec, B::AdjOrTransAbsVec) = isless(parent(A), parent(B))
339339 Cuplo = getfield(C, :uplo)
340340 info = getfield(C, :info)
341341 if d == :U
342 return UpperTriangular(Symbol(Cuplo) == d ? Cfactors : copy(Cfactors'))
342 return UpperTriangular(Cuplo === char_uplo(d) ? Cfactors : copy(Cfactors'))
343343 elseif d == :L
344 return LowerTriangular(Symbol(Cuplo) == d ? Cfactors : copy(Cfactors'))
344 return LowerTriangular(Cuplo === char_uplo(d) ? Cfactors : copy(Cfactors'))
345345 elseif d == :UL
346 return (Symbol(Cuplo) == :U ? UpperTriangular(Cfactors) : LowerTriangular(Cfactors))
346 return (Cuplo === 'U' ? UpperTriangular(Cfactors) : LowerTriangular(Cfactors))
347347 else
348348 return getfield(C, d)
349349 end
540540 A2 = A * A
541541 A4 = A2 * A2
542542 A6 = A2 * A4
543 U = A * (A6 * (CC[14]*A6 + CC[12]*A4 + CC[10]*A2) +
544 CC[8]*A6 + CC[6]*A4 + CC[4]*A2 + CC[2]*Inn)
545 V = A6 * (CC[13]*A6 + CC[11]*A4 + CC[9]*A2) +
546 CC[7]*A6 + CC[5]*A4 + CC[3]*A2 + CC[1]*Inn
543 U = A * (A6 * (CC[14].*A6 .+ CC[12].*A4 .+ CC[10].*A2) .+
544 CC[8].*A6 .+ CC[6].*A4 .+ CC[4].*A2 .+ CC[2].*Inn)
545 V = A6 * (CC[13].*A6 .+ CC[11].*A4 .+ CC[9].*A2) .+
546 CC[7].*A6 .+ CC[5].*A4 .+ CC[3].*A2 .+ CC[1].*Inn
547547
548548 X = V + U
549549 LAPACK.gesv!(V-U, X)
276276 mul!(out::AbstractVector, A::Adjoint{<:Any,<:Diagonal}, in::AbstractVector) = out .= adjoint.(A.parent.diag) .* in
277277 mul!(out::AbstractVector, A::Transpose{<:Any,<:Diagonal}, in::AbstractVector) = out .= transpose.(A.parent.diag) .* in
278278
279 mul!(out::AbstractMatrix, A::Diagonal, in::AbstractMatrix) = out .= A.diag .* in
280 mul!(out::AbstractMatrix, A::Adjoint{<:Any,<:Diagonal}, in::AbstractMatrix) = out .= adjoint.(A.parent.diag) .* in
281 mul!(out::AbstractMatrix, A::Transpose{<:Any,<:Diagonal}, in::AbstractMatrix) = out .= transpose.(A.parent.diag) .* in
279 mul!(out::AbstractMatrix, A::Diagonal, in::StridedMatrix) = out .= A.diag .* in
280 mul!(out::AbstractMatrix, A::Adjoint{<:Any,<:Diagonal}, in::StridedMatrix) = out .= adjoint.(A.parent.diag) .* in
281 mul!(out::AbstractMatrix, A::Transpose{<:Any,<:Diagonal}, in::StridedMatrix) = out .= transpose.(A.parent.diag) .* in
282282
283283 # ambiguities with Symmetric/Hermitian
284284 # RealHermSymComplex[Sym]/[Herm] only include Number; invariant to [c]transpose
12731273 (0.6931471805599453, 1.0)
12741274 ```
12751275 """
1276 logabsdet(A::AbstractMatrix) = logabsdet(lu(A))
1276 logabsdet(A::AbstractMatrix) = logabsdet(lu(A, check=false))
12771277
12781278 """
12791279 logdet(M)
13231323 Complex{Float64}
13241324 ```
13251325 """
1326 promote_leaf_eltypes(x::Union{AbstractArray{T},Tuple{Vararg{T}}}) where {T<:Number} = T
1327 promote_leaf_eltypes(x::Union{AbstractArray{T},Tuple{Vararg{T}}}) where {T<:NumberArray} = eltype(T)
1326 promote_leaf_eltypes(x::Union{AbstractArray{T},Tuple{T,Vararg{T}}}) where {T<:Number} = T
1327 promote_leaf_eltypes(x::Union{AbstractArray{T},Tuple{T,Vararg{T}}}) where {T<:NumberArray} = eltype(T)
13281328 promote_leaf_eltypes(x::T) where {T} = T
13291329 promote_leaf_eltypes(x::Union{AbstractArray,Tuple}) = mapreduce(promote_leaf_eltypes, promote_type, x; init=Bool)
13301330
5757 """
5858 LowerTriangular(A::AbstractMatrix)
5959
60 Construct a `LowerTriangular` view of the the matrix `A`.
60 Construct a `LowerTriangular` view of the matrix `A`.
6161
6262 # Examples
6363 ```jldoctest
7878 """
7979 UpperTriangular(A::AbstractMatrix)
8080
81 Construct an `UpperTriangular` view of the the matrix `A`.
81 Construct an `UpperTriangular` view of the matrix `A`.
8282
8383 # Examples
8484 ```jldoctest
270270
271271 @testset "Adjoint and Transpose vector vec methods" begin
272272 intvec = [1, 2]
273 @test vec(Adjoint(intvec)) === intvec
273 @test vec(Adjoint(intvec)) == intvec
274274 @test vec(Transpose(intvec)) === intvec
275 cvec = [1 + 1im]
276 @test vec(cvec')[1] == cvec[1]'
275277 end
276278
277279 @testset "horizontal concatenation of Adjoint/Transpose-wrapped vectors and Numbers" begin
0 # This file is a part of Julia. License is MIT: https://julialang.org/license
1
2 using Test, LinearAlgebra
3 @test detect_ambiguities(LinearAlgebra; imported=true, recursive=true) == []
7979 @test logdet(A) ≈ log(det(A))
8080 @test logabsdet(A)[1] ≈ log(abs(det(A)))
8181 @test logabsdet(Matrix{elty}(-I, n, n))[2] == -1
82 infinity = convert(float(elty), Inf)
83 @test logabsdet(zeros(elty, n, n)) == (-infinity, zero(elty))
8284 if elty <: Real
8385 @test logabsdet(A)[2] == sign(det(A))
8486 @test_throws DomainError logdet(Matrix{elty}(-I, n, n))
444444 @test Xv1'*Xv3' ≈ XcXc
445445 end
446446
447 @testset "method ambiguity" begin
448 # Ambiguity test is run inside a clean process.
449 # https://github.com/JuliaLang/julia/issues/28804
450 script = joinpath(@__DIR__, "ambiguous_exec.jl")
451 cmd = `$(Base.julia_cmd()) --startup-file=no $script`
452 @test success(pipeline(cmd; stdout=stdout, stderr=stderr))
453 end
454
447455 end # module TestMatmul
192192 modules, such as `Pkg`, or module roots (see [`Base.moduleroot`](@ref)). To
193193 enable all debug logging, use the special value `all`.
194194
195 ## Writing log events to a file
196
197 Sometimes it can be useful to write log events to a file. Here is an example
198 of how to use a task-local and global logger to write information to a text
199 file:
200
201 ```julia-repl
202 # Load the logging module
203 julia> using Logging
204
205 # Open a textfile for writing
206 julia> io = open("log.txt", "w+")
207 IOStream(<file log.txt>)
208
209 # Create a simple logger
210 julia> logger = SimpleLogger(io)
211 SimpleLogger(IOStream(<file log.txt>), Info, Dict{Any,Int64}())
212
213 # Log a task-specific message
214 julia> with_logger(logger) do
215 @info("a context specific log message")
216 end
217
218 # Write all buffered messages to the file
219 julia> flush(io)
220
221 # Set the global logger to logger
222 julia> global_logger(logger)
223 SimpleLogger(IOStream(<file log.txt>), Info, Dict{Any,Int64}())
224
225 # This message will now also be written to the file
226 julia> @info("a global log message")
227
228 # Close the file
229 julia> close(io)
230 ```
231
195232
196233 ## Reference
197234
8080
8181 **Application:** a project which provides standalone functionality not intended
8282 to be reused by other Julia projects. For example a web application or a
83 commmand-line utility, or simulation/analytics code accompanying a scientific paper.
83 command-line utility, or simulation/analytics code accompanying a scientific paper.
8484 An application may have a UUID but does not need one.
8585 An application may also provide global configuration options for packages it
8686 depends on. Packages, on the other hand, may not provide global configuration
145145 **Depot:** a directory on a system where various package-related resources live,
146146 including:
147147
148 - `environments`: shared named environments (e.g. `v0.7`, `devtools`)
148 - `environments`: shared named environments (e.g. `v1.0`, `devtools`)
149149 - `clones`: bare clones of package repositories
150150 - `compiled`: cached compiled package images (`.ji` files)
151151 - `config`: global configuration files (e.g. `startup.jl`)
180180 The Pkg REPL-mode is entered from the Julia REPL using the key `]`.
181181
182182 ```
183 (v0.7) pkg>
183 (v1.0) pkg>
184184 ```
185185
186186 The part inside the parenthesis of the prompt shows the name of the current project.
187 Since we haven't created our own project yet, we are in the default project, located at `~/.julia/environments/v0.7`
187 Since we haven't created our own project yet, we are in the default project, located at `~/.julia/environments/v1.0`
188188 (or whatever version of Julia you happen to run).
189189
190190 To return to the `julia>` prompt, either press backspace when the input line is empty or press Ctrl+C.
206206 In the Pkg REPL packages can be added with the `add` command followed by the name of the package, for example:
207207
208208 ```
209 (v0.7) pkg> add Example
209 (v1.0) pkg> add Example
210210 Cloning default registries into /Users/kristoffer/.julia/registries
211211 Cloning registry General from "https://github.com/JuliaRegistries/General.git"
212212 Updating registry at `~/.julia/registries/General`
213213 Updating git-repo `https://github.com/JuliaRegistries/General.git`
214214 Resolving package versions...
215 Updating `~/.julia/environments/v0.7/Project.toml`
215 Updating `~/.julia/environments/v1.0/Project.toml`
216216 [7876af07] + Example v0.5.1
217 Updating `~/.julia/environments/v0.7/Manifest.toml`
217 Updating `~/.julia/environments/v1.0/Manifest.toml`
218218 [7876af07] + Example v0.5.1
219219 [8dfed614] + Test
220220 ```
227227 you have added yourself, in this case, `Example`:
228228
229229 ```
230 (v0.7) pkg> st
230 (v1.0) pkg> st
231231 Status `Project.toml`
232232 [7876af07] Example v0.5.1
233233 ```
235235 The manifest status, in addition, includes the dependencies of explicitly added packages.
236236
237237 ```
238 (v0.7) pkg> st --manifest
238 (v1.0) pkg> st --manifest
239239 Status `Manifest.toml`
240240 [7876af07] Example v0.5.1
241241 [8dfed614] Test
255255 A specific version can be installed by appending a version after a `@` symbol, e.g. `@v0.4`, to the package name:
256256
257257 ```
258 (v0.7) pkg> add Example@0.4
259 Resolving package versions...
260 Updating `~/.julia/environments/v0.7/Project.toml`
258 (v1.0) pkg> add Example@0.4
259 Resolving package versions...
260 Updating `~/.julia/environments/v1.0/Project.toml`
261261 [7876af07] + Example v0.4.1
262 Updating `~/.julia/environments/v0.7/Manifest.toml`
262 Updating `~/.julia/environments/v1.0/Manifest.toml`
263263 [7876af07] + Example v0.4.1
264264 ```
265265
267267 we can explicitly track a branch (or commit) by appending `#branch` (or `#commit`) to the package name:
268268
269269 ```
270 (v0.7) pkg> add Example#master
270 (v1.0) pkg> add Example#master
271271 Updating git-repo `https://github.com/JuliaLang/Example.jl.git`
272272 Resolving package versions...
273 Updating `~/.julia/environments/v0.7/Project.toml`
273 Updating `~/.julia/environments/v1.0/Project.toml`
274274 [7876af07] ~ Example v0.5.1 ⇒ v0.5.1+ #master (https://github.com/JuliaLang/Example.jl.git)
275 Updating `~/.julia/environments/v0.7/Manifest.toml`
275 Updating `~/.julia/environments/v1.0/Manifest.toml`
276276 [7876af07] ~ Example v0.5.1 ⇒ v0.5.1+ #master (https://github.com/JuliaLang/Example.jl.git)
277277 ```
278278
282282 To go back to tracking the registry version of `Example`, the command `free` is used:
283283
284284 ```
285 (v0.7) pkg> free Example
286 Resolving package versions...
287 Updating `~/.julia/environments/v0.7/Project.toml`
285 (v1.0) pkg> free Example
286 Resolving package versions...
287 Updating `~/.julia/environments/v1.0/Project.toml`
288288 [7876af07] ~ Example v0.5.1+ #master (https://github.com/JuliaLang/Example.jl.git) ⇒ v0.5.1
289 Updating `~/.julia/environments/v0.7/Manifest.toml`
289 Updating `~/.julia/environments/v1.0/Manifest.toml`
290290 [7876af07] ~ Example v0.5.1+ #master )https://github.com/JuliaLang/Example.jl.git) ⇒ v0.5.1
291291 ```
292292
296296 If a package is not in a registry, it can still be added by instead of the package name giving the URL to the repository to `add`.
297297
298298 ```
299 (v0.7) pkg> add https://github.com/fredrikekre/ImportMacros.jl
299 (v1.0) pkg> add https://github.com/fredrikekre/ImportMacros.jl
300300 Updating git-repo `https://github.com/fredrikekre/ImportMacros.jl`
301301 Resolving package versions...
302302 Downloaded MacroTools ─ v0.4.1
303 Updating `~/.julia/environments/v0.7/Project.toml`
303 Updating `~/.julia/environments/v1.0/Project.toml`
304304 [e6797606] + ImportMacros v0.0.0 # (https://github.com/fredrikekre/ImportMacros.jl)
305 Updating `~/.julia/environments/v0.7/Manifest.toml`
305 Updating `~/.julia/environments/v1.0/Manifest.toml`
306306 [e6797606] + ImportMacros v0.0.0 # (https://github.com/fredrikekre/ImportMacros.jl)
307307 [1914dd2f] + MacroTools v0.4.1
308308 ```
329329 Let's try to `dev` a registered package:
330330
331331 ```
332 (v0.7) pkg> dev Example
332 (v1.0) pkg> dev Example
333333 Updating git-repo `https://github.com/JuliaLang/Example.jl.git`
334334 Resolving package versions...
335 Updating `~/.julia/environments/v0.7/Project.toml`
335 Updating `~/.julia/environments/v1.0/Project.toml`
336336 [7876af07] + Example v0.5.1+ [`~/.julia/dev/Example`]
337 Updating `~/.julia/environments/v0.7/Manifest.toml`
337 Updating `~/.julia/environments/v1.0/Manifest.toml`
338338 [7876af07] + Example v0.5.1+ [`~/.julia/dev/Example`]
339339 ```
340340
346346 For example:
347347
348348 ```
349 (v0.7) pkg> dev Example
349 (v1.0) pkg> dev Example
350350 Updating git-repo `https://github.com/JuliaLang/Example.jl.git`
351351 [ Info: Path `/Users/kristoffer/.julia/dev/Example` exists and looks like the correct package, using existing path instead of cloning
352352 ```
360360 To stop tracking a path and use the registered version again, use `free`
361361
362362 ```
363 (v0.7) pkg> free Example
364 Resolving package versions...
365 Updating `~/.julia/environments/v0.7/Project.toml`
363 (v1.0) pkg> free Example
364 Resolving package versions...
365 Updating `~/.julia/environments/v1.0/Project.toml`
366366 [7876af07] ↓ Example v0.5.1+ [`~/.julia/dev/Example`] ⇒ v0.5.1
367 Updating `~/.julia/environments/v0.7/Manifest.toml`
367 Updating `~/.julia/environments/v1.0/Manifest.toml`
368368 [7876af07] ↓ Example v0.5.1+ [`~/.julia/dev/Example`] ⇒ v0.5.1
369369 ```
370370
389389 to the latest compatible version. Sometimes this is not what you want. You can specify a subset of the dependencies to upgrade by giving them as arguments to `up`, e.g:
390390
391391 ```
392 (v0.7) pkg> up Example
392 (v1.0) pkg> up Example
393393 ```
394394
395395 The version of all other packages direct dependencies will stay the same. If you only want to update the minor version of packages, to reduce the risk that your project breaks, you can give the `--minor` flag, e.g:
396396
397397 ```
398 (v0.7) pkg> up --minor Example
398 (v1.0) pkg> up --minor Example
399399 ```
400400
401401 Packages that track a repository are not updated when a minor upgrade is done.
406406 A pinned package will never be updated. A package can be pinned using `pin` as for example
407407
408408 ```
409 (v0.7) pkg> pin Example
410 Resolving package versions...
411 Updating `~/.julia/environments/v0.7/Project.toml`
409 (v1.0) pkg> pin Example
410 Resolving package versions...
411 Updating `~/.julia/environments/v1.0/Project.toml`
412412 [7876af07] ~ Example v0.5.1 ⇒ v0.5.1 ⚲
413 Updating `~/.julia/environments/v0.7/Manifest.toml`
413 Updating `~/.julia/environments/v1.0/Manifest.toml`
414414 [7876af07] ~ Example v0.5.1 ⇒ v0.5.1 ⚲
415415 ```
416416
417417 Note the pin symbol `⚲` showing that the package is pinned. Removing the pin is done using `free`
418418
419419 ```
420 (v0.7) pkg> free Example
421 Updating `~/.julia/environments/v0.7/Project.toml`
420 (v1.0) pkg> free Example
421 Updating `~/.julia/environments/v1.0/Project.toml`
422422 [7876af07] ~ Example v0.5.1 ⚲ ⇒ v0.5.1
423 Updating `~/.julia/environments/v0.7/Manifest.toml`
423 Updating `~/.julia/environments/v1.0/Manifest.toml`
424424 [7876af07] ~ Example v0.5.1 ⚲ ⇒ v0.5.1
425425 ```
426426
427427 ### Testing packages
428428
429 The tests for a package can be run using `test`command:
430
431 ```
432 (v0.7) pkg> test Example
429 The tests for a package can be run using `test` command:
430
431 ```
432 (v1.0) pkg> test Example
433433 Testing Example
434434 Testing Example tests passed
435435 ```
441441 To explicitly run the build step for a package the `build` command is used:
442442
443443 ```
444 (v0.7) pkg> build MbedTLS
444 (v1.0) pkg> build MbedTLS
445445 Building MbedTLS → `~/.julia/packages/MbedTLS/h1Vu/deps/build.log`
446446
447447 shell> cat ~/.julia/packages/MbedTLS/h1Vu/deps/build.log
454454
455455 ## Creating your own projects
456456
457 So far we have added packages to the default project at `~/.julia/environments/v0.7`, it is, however, easy to create other, independent, projects.
457 So far we have added packages to the default project at `~/.julia/environments/v1.0`, it is, however, easy to create other, independent, projects.
458458 It should be pointed out if two projects uses the same package at the same version, the content of this package is not duplicated.
459459 In order to create a new project, create a directory for it and then activate that directory to make it the "active project" which package operations manipulate:
460460
464464 shell> cd MyProject
465465 /Users/kristoffer/MyProject
466466
467 (v0.7) pkg> activate .
467 (v1.0) pkg> activate .
468468
469469 (MyProject) pkg> st
470470 Status `Project.toml`
517517 This is done with the `gc` command:
518518
519519 ```
520 (v0.7) pkg> gc
520 (v1.0) pkg> gc
521521 Active manifests at:
522522 `/Users/kristoffer/BinaryProvider/Manifest.toml`
523523 ...
541541 To generate files for a new package, use `pkg> generate`.
542542
543543 ```
544 (v0.7) pkg> generate HelloWorld
544 (v1.0) pkg> generate HelloWorld
545545 ```
546546
547547 This creates a new project `HelloWorld` with the following files (visualized with the external [`tree` command](https://linux.die.net/man/1/tree)):
730730
731731 ```toml
732732 [compat]
733 julia = "1.0"
733734 Example = "0.4.3"
734735 ```
735736
824825 Simply clone their project using e.g. `git clone`, `cd` to the project directory and call
825826
826827 ```
827 (v0.7) pkg> activate .
828 (v1.0) pkg> activate .
828829
829830 (SomeProject) pkg> instantiate
830831 ```
2828 add_or_develop(pkgs::Vector{PackageSpec}; kwargs...) = add_or_develop(Context(), pkgs; kwargs...)
2929
3030 function add_or_develop(ctx::Context, pkgs::Vector{PackageSpec}; mode::Symbol, shared::Bool=true, kwargs...)
31 pkgs = deepcopy(pkgs) # deepcopy for avoid mutating PackageSpec members
3132 Context!(ctx; kwargs...)
3233
3334 # All developed packages should go through handle_repos_develop so just give them an empty repo
4748
4849 ctx.preview && preview_info()
4950 if mode == :develop
50 devdir = shared ? Pkg.devdir() : joinpath(dirname(ctx.env.project_file), "dev")
51 new_git = handle_repos_develop!(ctx, pkgs, devdir)
51 new_git = handle_repos_develop!(ctx, pkgs, shared = shared)
5252 else
5353 new_git = handle_repos_add!(ctx, pkgs; upgrade_or_add=true)
5454 end
7373 rm(pkgs::Vector{PackageSpec}; kwargs...) = rm(Context(), pkgs; kwargs...)
7474
7575 function rm(ctx::Context, pkgs::Vector{PackageSpec}; mode=PKGMODE_PROJECT, kwargs...)
76 for pkg in pkgs
77 #TODO only overwrite pkg.mode is default value ?
76 pkgs = deepcopy(pkgs) # deepcopy for avoid mutating PackageSpec members
77 for pkg in pkgs
78 # TODO only overwrite pkg.mode if default value ?
7879 pkg.mode = mode
7980 end
8081
9697 else
9798 for reg in registries()
9899 if isdir(joinpath(reg, ".git"))
99 regpath = pathrepr(ctx, reg)
100 regpath = pathrepr(reg)
100101 printpkgstyle(ctx, :Updating, "registry at " * regpath)
101 LibGit2.with(LibGit2.GitRepo, reg) do repo
102 # Using LibGit2.with here crashes julia when running the
103 # tests for PkgDev wiht "Unreachable reached".
104 # This seems to work around it.
105 local repo
106 try
107 repo = LibGit2.GitRepo(reg)
102108 if LibGit2.isdirty(repo)
103109 push!(errors, (regpath, "registry dirty"))
104 return
110 @goto done
105111 end
106112 if !LibGit2.isattached(repo)
107113 push!(errors, (regpath, "registry detached"))
108 return
114 @goto done
115 end
116 if !("origin" in LibGit2.remotes(repo))
117 push!(errors, (regpath, "origin not in the list of remotes"))
118 @goto done
109119 end
110120 branch = LibGit2.headname(repo)
111121 try
113123 catch e
114124 e isa PkgError || rethrow(e)
115125 push!(errors, (reg, "failed to fetch from repo"))
116 return
126 @goto done
117127 end
118128 ff_succeeded = try
119129 LibGit2.merge!(repo; branch="refs/remotes/origin/$branch", fastforward=true)
120130 catch e
121131 e isa LibGit2.GitError && e.code == LibGit2.Error.ENOTFOUND || rethrow(e)
122132 push!(errors, (reg, "branch origin/$branch not found"))
123 return
133 @goto done
124134 end
125135
126136 if !ff_succeeded
128138 catch e
129139 e isa LibGit2.GitError || rethrow(e)
130140 push!(errors, (reg, "registry failed to rebase on origin/$branch"))
131 return
141 @goto done
132142 end
133143 end
144 @label done
145 finally
146 close(repo)
134147 end
135148 end
136149 end
154167
155168 function up(ctx::Context, pkgs::Vector{PackageSpec};
156169 level::UpgradeLevel=UPLEVEL_MAJOR, mode::PackageMode=PKGMODE_PROJECT, do_update_registry=true, kwargs...)
170 pkgs = deepcopy(pkgs) # deepcopy for avoid mutating PackageSpec members
157171 for pkg in pkgs
158172 # TODO only override if they are not already set
159173 pkg.mode = mode
193207 pin(pkgs::Vector{PackageSpec}; kwargs...) = pin(Context(), pkgs; kwargs...)
194208
195209 function pin(ctx::Context, pkgs::Vector{PackageSpec}; kwargs...)
210 pkgs = deepcopy(pkgs) # deepcopy for avoid mutating PackageSpec members
196211 Context!(ctx; kwargs...)
197212 ctx.preview && preview_info()
198213 project_deps_resolve!(ctx.env, pkgs)
207222 free(pkgs::Vector{PackageSpec}; kwargs...) = free(Context(), pkgs; kwargs...)
208223
209224 function free(ctx::Context, pkgs::Vector{PackageSpec}; kwargs...)
225 pkgs = deepcopy(pkgs) # deepcopy for avoid mutating PackageSpec members
210226 Context!(ctx; kwargs...)
211227 ctx.preview && preview_info()
212228 registry_resolve!(ctx.env, pkgs)
238254 test(pkgs::Vector{PackageSpec}; kwargs...) = test(Context(), pkgs; kwargs...)
239255
240256 function test(ctx::Context, pkgs::Vector{PackageSpec}; coverage=false, kwargs...)
257 pkgs = deepcopy(pkgs) # deepcopy for avoid mutating PackageSpec members
241258 Context!(ctx; kwargs...)
242259 ctx.preview && preview_info()
243260 if isempty(pkgs)
407424 build(pkg::PackageSpec) = build([pkg])
408425 build(pkgs::Vector{PackageSpec}) = build(Context(), pkgs)
409426 function build(ctx::Context, pkgs::Vector{PackageSpec}; kwargs...)
427 pkgs = deepcopy(pkgs) # deepcopy for avoid mutating PackageSpec members
410428 Context!(ctx; kwargs...)
411429
412430 ctx.preview && preview_info()
471489 for pkg in pkgids
472490 paths = Base.find_all_in_cache_path(pkg)
473491 sourcepath = Base.locate_package(pkg)
474 if sourcepath == nothing
475 # XXX: this isn't supposed to be fatal
476 pkgerror("couldn't find path to $(pkg.name) when trying to precompilie project")
477 end
492 sourcepath == nothing && continue
493 # Heuristic for when precompilation is disabled
494 occursin(r"\b__precompile__\(\s*false\s*\)", read(sourcepath, String)) && continue
478495 stale = true
479496 for path_to_try in paths::Vector{String}
480497 staledeps = Base.stale_cachefile(sourcepath, path_to_try)
571588 fullpath = abspath(devpath)
572589 else
573590 fullpath = abspath(path)
574 isdir(fullpath) || @info("new environment will be placed at $fullpath")
591 isdir(fullpath) || @info("activating new environment at $(Base.contractuser(fullpath)).")
575592 end
576593 else
577594 # initialize `fullpath` in case of empty `Pkg.depots()`
588605 # unless the shared environment already exists, place it in the first depots
589606 if !isdir(fullpath)
590607 fullpath = joinpath(Pkg.envdir(Pkg.depots1()), path)
591 @info("new shared environment \"$path\" will be placed at $fullpath")
608 @info("activating new environment at $(Base.contractuser(fullpath)).")
592609 end
593610 end
594611 Base.ACTIVE_PROJECT[] = Base.load_path_expand(fullpath)
5555 m₁ = filter_manifest(in_project(project₁["deps"]), manifest₁)
5656 diff = manifest_diff(ctx, m₀, m₁)
5757 if !use_as_api
58 printpkgstyle(ctx, :Status, pathrepr(ctx, env.project_file), #=ignore_indent=# true)
58 printpkgstyle(ctx, :Status, pathrepr(env.project_file), #=ignore_indent=# true)
5959 print_diff(ctx, diff, #=status=# true)
6060 end
6161 end
6262 if mode == PKGMODE_MANIFEST
6363 diff = manifest_diff(ctx, manifest₀, manifest₁)
6464 if !use_as_api
65 printpkgstyle(ctx, :Status, pathrepr(ctx, env.manifest_file), #=ignore_indent=# true)
65 printpkgstyle(ctx, :Status, pathrepr(env.manifest_file), #=ignore_indent=# true)
6666 print_diff(ctx, diff, #=status=# true)
6767 end
6868 elseif mode == PKGMODE_COMBINED
7272 c_diff = filter!(x->x.old != x.new, manifest_diff(ctx, m₀, m₁))
7373 if !isempty(c_diff)
7474 if !use_as_api
75 printpkgstyle(ctx, :Status, pathrepr(ctx, env.manifest_file), #=ignore_indent=# true)
75 printpkgstyle(ctx, :Status, pathrepr(env.manifest_file), #=ignore_indent=# true)
7676 print_diff(ctx, c_diff, #=status=# true)
7777 end
7878 diff = Base.vcat(c_diff, diff)
115115 vstring(ctx::Context, a::VerInfo) =
116116 string((a.ver == nothing && a.hash != nothing) ? "[$(string(a.hash)[1:16])]" : "",
117117 a.ver != nothing ? "v$(a.ver)" : "",
118 a.path != nothing ? " [$(pathrepr(ctx, a.path))]" : "",
118 a.path != nothing ? " [$(pathrepr(a.path))]" : "",
119119 a.repo != nothing ? " #$(revstring(a.repo.rev)) ($(a.repo.url))" : "",
120120 a.pinned == true ? " ⚲" : "",
121121 )
7474 # TODO: extend this to more urls
7575 function normalize_url(url::AbstractString)
7676 m = match(GITHUB_REGEX, url)
77 (m === nothing || GIT_PROTOCOL[] === nothing) ?
78 url : "$(GIT_PROTOCOL[])://github.com/$(m.captures[1]).git"
77 if m === nothing || GIT_PROTOCOL[] === nothing
78 url
79 elseif GIT_PROTOCOL[] == "ssh"
80 "ssh://git@github.com/$(m.captures[1]).git"
81 else
82 "$(GIT_PROTOCOL[])://github.com/$(m.captures[1]).git"
83 end
7984 end
8085
8186 function clone(url, source_path; header=nothing, kwargs...)
9797 path = pkg.path
9898 elseif info !== nothing && haskey(info, "repo-url")
9999 path = find_installed(pkg.name, pkg.uuid, SHA1(info["git-tree-sha1"]))
100 pkg.version = VersionNumber(info["version"])
101100 pkg.repo = Types.GitRepo(info["repo-url"], info["repo-rev"], SHA1(info["git-tree-sha1"]))
102101 else
103102 continue
309308 uuid_to_name[uuid] = name
310309
311310 uuid_idx = findfirst(isequal(uuid), uuids)
312 ver = VersionSpec()
311 info = manifest_info(ctx.env, uuid)
312 if info !== nothing && haskey(info, "version") # stdlibs might not have a version
313 ver = VersionSpec(VersionNumber(info["version"]))
314 else
315 ver = VersionSpec()
316 end
313317 if uuid_idx != nothing
314318 pkg = pkgs[uuid_idx]
315 info = manifest_info(ctx.env, uuid)
316 if info !== nothing && haskey(info, "version") # stdlibs might not have a version
317 ver = VersionNumber(info["version"])
318 if pkg.special_action != PKGSPEC_FREED && get(info, "pinned", false)
319 # This is a pinned package, fix its version
320 pkg.version = ver
321 end
319 if info !== nothing && pkg.special_action != PKGSPEC_FREED && get(info, "pinned", false)
320 # This is a pinned package, fix its version
321 pkg.version = ver
322322 end
323323 else
324324 pkg = PackageSpec(name, uuid, ver)
325325 push!(pkgs, pkg)
326326 end
327 proj_compat = Types.project_compatibility(ctx, name)
328 v = intersect(pkg.version, proj_compat)
329 if isempty(v)
330 pkgerror(string("for package $(pkg.name) intersection between project compatibility $(proj_compat) ",
331 "and package version $(pkg.version) is empty"))
332 end
333 pkg.version = v
334 end
327 end
328
329 # construct data structures for resolver and call it
330 # this also sets pkg.version for fixed packages
331 fixed = collect_fixed!(ctx, pkgs, uuid_to_name)
332
333 # compatibility
335334 proj_compat = Types.project_compatibility(ctx, "julia")
336335 v = intersect(VERSION, proj_compat)
337336 if isempty(v)
338 @warn("julia version requirement for project not satisfied")
339 end
340
341 # construct data structures for resolver and call it
337 @warn "julia version requirement for project not satisfied" _module=nothing _file=nothing
338 end
339
340 for pkg in pkgs
341 proj_compat = Types.project_compatibility(ctx, pkg.name)
342 v = intersect(pkg.version, proj_compat)
343 if isempty(v)
344 pkgerror(string("empty intersection between $(pkg.name)@$(pkg.version) and project ",
345 "compatibility $(proj_compat)"))
346 end
347 # Work around not clobbering 0.x.y+ for checked out old type of packages
348 if !(pkg.version isa VersionNumber)
349 pkg.version = v
350 end
351 end
352
342353 reqs = Requires(pkg.uuid => VersionSpec(pkg.version) for pkg in pkgs if pkg.uuid ≠ uuid_julia)
343 fixed = collect_fixed!(ctx, pkgs, uuid_to_name)
344354 fixed[uuid_julia] = Fixed(VERSION)
345355 graph = deps_graph(ctx, uuid_to_name, reqs, fixed)
346356
646656 return stdlib_deps
647657 end
648658
649 function relative_project_path_if_in_project(ctx::Context, path::String)
650 # Check if path is in project => relative
651 project_path = dirname(ctx.env.project_file)
652 if startswith(normpath(path), project_path)
653 return relpath(path, project_path)
654 else
655 return abspath(path)
656 end
657 end
658
659 project_rel_path(ctx::Context, path::String) = joinpath(dirname(ctx.env.project_file), path)
659 project_rel_path(ctx::Context, path::String) =
660 normpath(joinpath(dirname(ctx.env.project_file), path))
660661
661662 function update_manifest(ctx::Context, pkg::PackageSpec, hash::Union{SHA1, Nothing})
662663 env = ctx.env
10361037 for (uuid, name, hash_or_path, build_file, version) in builds
10371038 log_file = splitext(build_file)[1] * ".log"
10381039 printpkgstyle(ctx, :Building,
1039 rpad(name * " ", max_name + 1, "─") * "→ " * Types.pathrepr(ctx, log_file))
1040 rpad(name * " ", max_name + 1, "─") * "→ " * Types.pathrepr(log_file))
10401041 code = """
10411042 $(Base.load_path_setup_code(false))
10421043 cd($(repr(dirname(build_file))))
10441045 """
10451046 cmd = ```
10461047 $(Base.julia_cmd()) -O0 --color=no --history-file=no
1047 --startup-file=$(Base.JLOptions().startupfile != 2 ? "yes" : "no")
1048 --startup-file=$(Base.JLOptions().startupfile == 1 ? "yes" : "no")
10481049 --compiled-modules=$(Bool(Base.JLOptions().use_compiled_modules) ? "yes" : "no")
10491050 --eval $code
10501051 ```
7373
7474 # Define new variables so tab comleting Pkg. works.
7575 """
76 Pkg.add(pkg::Union{String, Vector{String})
76 Pkg.add(pkg::Union{String, Vector{String}})
7777 Pkg.add(pkg::Union{PackageSpec, Vector{PackageSpec}})
7878
7979 Add a package to the current project. This package will be available using the
9393 const add = API.add
9494
9595 """
96 Pkg.rm(pkg::Union{String, Vector{String})
96 Pkg.rm(pkg::Union{String, Vector{String}})
9797 Pkg.rm(pkg::Union{PackageSpec, Vector{PackageSpec}})
9898
9999 Remove a package from the current project. If the `mode` of `pkg` is
106106
107107 """
108108 Pkg.update(; level::UpgradeLevel=UPLEVEL_MAJOR, mode::PackageMode = PKGMODE_PROJECT)
109 Pkg.update(pkg::Union{String, Vector{String})
109 Pkg.update(pkg::Union{String, Vector{String}})
110110 Pkg.update(pkg::Union{PackageSpec, Vector{PackageSpec}})
111111
112112 Update a package `pkg`. If no posistional argument is given, update all packages in the manifest if `mode` is `PKGMODE_MANIFEST` and packages in both manifest and project if `mode` is `PKGMODE_PROJECT`.
161161
162162 """
163163 Pkg.build()
164 Pkg.build(pkg::Union{String, Vector{String})
164 Pkg.build(pkg::Union{String, Vector{String}})
165165 Pkg.build(pkgs::Union{PackageSpec, Vector{PackageSpec}})
166166
167167 Run the build script in `deps/build.jl` for `pkg` and all of the dependencies in
177177 const installed = API.installed
178178
179179 """
180 Pkg.pin(pkg::Union{String, Vector{String})
180 Pkg.pin(pkg::Union{String, Vector{String}})
181181 Pkg.pin(pkgs::Union{Packagespec, Vector{Packagespec}})
182182
183183 Pin a package to the current version (or the one given in the `packagespec` or a certain
186186 const pin = API.pin
187187
188188 """
189 Pkg.free(pkg::Union{String, Vector{String})
189 Pkg.free(pkg::Union{String, Vector{String}})
190190 Pkg.free(pkgs::Union{Packagespec, Vector{Packagespec}})
191191
192192 Free a package which removes a `pin` if it exists, or if the package is tracking a path,
202202
203203
204204 """
205 Pkg.develop(pkg::Union{String, Vector{String})
205 Pkg.develop(pkg::Union{String, Vector{String}})
206206 Pkg.develop(pkgs::Union{Packagespec, Vector{Packagespec}})
207207
208208 Make a package available for development by tracking it by path.
218218 Pkg.develop("Example")
219219
220220 # By url
221 Pkg.develop(PackageSpec(url="https://github.com/JuliaLang/Compat.jl", rev="master"))
222
223 # By path (also uses url keyword to PackageSpec)
224 Pkg.develop(PackageSpec(url="MyJuliaPackages/Package.jl")
221 Pkg.develop(PackageSpec(url="https://github.com/JuliaLang/Compat.jl"))
222
223 # By path
224 Pkg.develop(PackageSpec(path="MyJuliaPackages/Package.jl")
225225 ```
226226
227227 See also [`PackageSpec`](@ref)
269269 The logic for what path is activated is as follows:
270270
271271 * If `shared` is `true`, the first existing environment named `s` from the depots
272 in the depot stack will be activated. If no such environment exists yet,
273 activate it in the first depot.
274 * If `s` is a path that exist, that environment will be activated.
275 * If `s` is a package name in the current project activate that is tracking a path,
276 activate the environment at that path.
277 * If `s` is a non-existing path, activate that path.
278
279 If no argument is given to `activate`, activate the home project,
280 which is the one specified by either `--project` command line when starting julia,
281 or `JULIA_PROJECT` environment variable.
272 in the depot stack will be activated. If no such environment exists,
273 create and activate that environment in the first depot.
274 * If `s` is an existing path, then activate the environment at that path.
275 * If `s` is a package in the current project and `s` is tracking a path, then
276 activate the environment at the tracked path.
277 * Else, `s` is interpreted as a non-existing path, activate that path.
278
279 If no argument is given to `activate`, then activate the home project.
280 The home project is specified by either the `--project` command line option to
281 the julia executable, or the `JULIA_PROJECT` environment variable.
282282
283283 # Examples
284284 ```
367367 ] activate .
368368 $CTRL_C
369369 Pkg.add("Test") # adding an stdlib doesn't require internet access
370 ] add Te\t\t$CTRL_C
370371 ] st
371372 $CTRL_C
372373 rm(tmp; recursive=true)"""
373374
374 module PrecompileArea
375 import ..Pkg
376 using ..Types
377 using UUIDs
378 import LibGit2
379 import REPL
380 import SHA
381 include("precompile.jl")
382 end
383
384375 end # module
198198 [System.Net.ServicePointManager]::SecurityProtocol =
199199 [System.Net.SecurityProtocolType]::Tls12;
200200 \$webclient = (New-Object System.Net.Webclient);
201 \$webclient.UseDefaultCredentials = \$true;
202 \$webclient.Proxy.Credentials = \$webclient.Credentials;
201203 \$webclient.Headers.Add("user-agent", \"Pkg.jl (https://github.com/JuliaLang/Pkg.jl)\");
202204 \$webclient.DownloadFile(\"$url\", \"$path\")
203205 """
8181 end
8282
8383 meta_option_declarations = OptionDeclaration[
84 ("env", OPT_ARG, :env => arg->EnvCache(Base.parse_env(arg)))
84 ("preview", OPT_SWITCH, :preview => true)
8585 ]
8686 meta_option_specs = OptionSpecs(meta_option_declarations)
8787
9696 )
9797 @enum(ArgClass, ARG_RAW, ARG_PKG, ARG_VERSION, ARG_REV, ARG_ALL)
9898 struct ArgSpec
99 class::ArgClass
100 count::Vector{Int}
99 count::Pair
100 parser::Function
101 parser_keys::Vector{Pair{Symbol, Any}}
101102 end
102103 const CommandDeclaration = Tuple{CommandKind,
103104 Vector{String}, # names
104105 Union{Nothing,Function}, # handler
105 Tuple{ArgClass, Vector{Int}}, # argument count
106 Tuple{Pair, # count
107 Function, # parser
108 Vector{Pair{Symbol, Any}}, # parser keys
109 }, # arguments
106110 Vector{OptionDeclaration}, # options
111 String, #description
107112 Union{Nothing, Markdown.MD}, #help
108113 }
109114 struct CommandSpec
110115 kind::CommandKind
111 names::Vector{String}
116 canonical_name::String
117 short_name::Union{Nothing,String}
112118 handler::Union{Nothing,Function}
113 argument_spec::ArgSpec # note: just use range operator for max/min
119 argument_spec::ArgSpec
114120 option_specs::Dict{String, OptionSpec}
121 description::String
115122 help::Union{Nothing, Markdown.MD}
116123 end
117124 command_specs = Dict{String,CommandSpec}() # TODO remove this ?
134141 for dec in declarations
135142 names = dec[2]
136143 spec = CommandSpec(dec[1],
137 names,
144 names[1],
145 length(names) == 2 ? names[2] : nothing,
138146 dec[3],
139147 ArgSpec(dec[4]...),
140148 OptionSpecs(dec[5]),
149 dec[6],
141150 dec[end])
142151 for name in names
143152 # TODO regex check name
195204 isquoted::Bool
196205 end
197206
198 function parse(cmd::String)::Vector{Statement}
207 function unwrap_option(option::String)
208 if startswith(option, "--")
209 return length(option) == 2 ? "" : option[3:end]
210 elseif length(option) == 2
211 return option[end]
212 end
213 end
214
215 wrap_option(option::String) =
216 length(option) == 1 ? "-$option" : "--$option"
217
218 function _statement(words)
219 is_option(word) = first(word) == '-'
220
221 word = popfirst!(words)
222 # meta options
223 while is_option(word)
224 if isempty(words)
225 if unwrap_option(word) in keys(meta_option_specs)
226 return :cmd, "", nothing, true
227 else
228 return :meta, word, nothing, true
229 end
230 end
231 word = popfirst!(words)
232 end
233 # command
234 if word == "preview"
235 if isempty(words)
236 return :cmd, "", nothing, true
237 end
238 word = popfirst!(words)
239 end
240 if word in keys(super_specs) # have a super command
241 super_name = word
242 super = super_specs[word]
243 if isempty(words)
244 return :sub, "", super_name, true
245 end
246 word = popfirst!(words)
247 command = get(super, word, nothing)
248 if command === nothing
249 if isempty(words)
250 return :sub, word, super_name, true
251 else
252 return nothing
253 end
254 end
255 elseif get(super_specs["package"], word, nothing) !== nothing # given a "package" command
256 command = get(super_specs["package"], word, nothing)
257 elseif isempty(words) # try to complete the super command
258 return :cmd, word, nothing, true
259 else
260 return nothing
261 end
262 if isempty(words)
263 return :arg, "", command, true
264 end
265 word = words[end]
266 manifest = any(x->x in ["--manifest", "-m"], filter(is_option, words))
267 return is_option(word) ?
268 (:opt, word, command, true) :
269 (:arg, word, command, !manifest)
270 end
271
272 function parse(cmd::String; for_completions=false)
199273 # replace new lines with ; to support multiline commands
200274 cmd = replace(replace(cmd, "\r\n" => "; "), "\n" => "; ")
201275 # tokenize accoring to whitespace / quotes
205279 # break up words according to ";"(doing this early makes subsequent processing easier)
206280 word_groups = group_words(words)
207281 # create statements
208 statements = map(Statement, word_groups)
209 return statements
282 if for_completions
283 return _statement(word_groups[end])
284 end
285 return map(Statement, word_groups)
210286 end
211287
212288 # vector of words -> structured statement
223299 word = popfirst!(words)
224300 end
225301 # command
302 # special handling for `preview`, just convert it to a meta option under the hood
303 if word == "preview"
304 if !("--preview" in statement.meta_options)
305 push!(statement.meta_options, "--preview")
306 end
307 isempty(words) && pkgerror("preview requires a command")
308 word = popfirst!(words)
309 end
226310 if word in keys(super_specs)
227311 super = super_specs[word]
312 isempty(words) && pkgerror("no subcommand specified")
228313 word = popfirst!(words)
229314 else
230315 super = super_specs["package"]
314399 # PkgCommand #
315400 ##############
316401 const Token = Union{String, VersionRange, Rev}
402 const ArgToken = Union{VersionRange, Rev}
403 const PkgToken = Union{String, VersionRange, Rev}
317404 const PkgArguments = Union{Vector{String}, Vector{PackageSpec}}
318405 struct PkgCommand
319406 meta_options::Vector{Option}
343430 return Dict(keyword_vec)
344431 end
345432
346 function enforce_argument_order(args::Vector{Token})
347 prev_arg = nothing
348 function check_prev_arg(valid_type::DataType, error_message::AbstractString)
349 prev_arg isa valid_type || pkgerror(error_message)
350 end
351
352 for arg in args
353 if arg isa VersionRange
354 check_prev_arg(String, "package name/uuid must precede version spec `@$arg`")
355 elseif arg isa Rev
356 check_prev_arg(String, "package name/uuid must precede rev spec `#$(arg.rev)`")
357 end
358 prev_arg = arg
359 end
360 end
361
362 function word2token(word::AbstractString)::Token
363 if first(word) == '@'
364 return VersionRange(word[2:end])
365 elseif first(word) == '#'
366 return Rev(word[2:end])
367 else
368 return String(word)
369 end
370 end
371
372 function enforce_arg_spec(raw_args::Vector{String}, class::ArgClass)
373 # TODO is there a more idiomatic way to do this?
374 function has_types(arguments::Vector{Token}, types::Vector{DataType})
375 return !isempty(filter(x->typeof(x) in types, arguments))
376 end
377
378 class == ARG_RAW && return raw_args
379 args::Vector{Token} = map(word2token, raw_args)
380 class == ARG_ALL && return args
381
382 if class == ARG_PKG && has_types(args, [VersionRange, Rev])
383 pkgerror("no versioned packages allowed")
384 elseif class == ARG_REV && has_types(args, [VersionRange])
385 pkgerror("no versioned packages allowed")
386 elseif class == ARG_VERSION && has_types(args, [Rev])
387 pkgerror("no reved packages allowed")
388 end
389 return args
390 end
391
392 function package_args(args::Vector{Token}, spec::CommandSpec)::Vector{PackageSpec}
433 function enforce_argument_count(spec::Pair, args::PkgArguments)
434 count = length(args)
435 spec.first <= count <= spec.second ||
436 pkgerror("Wrong number of arguments")
437 end
438
439 # Only for PkgSpec
440 function package_args(args::Vector{Token}; add_or_dev=false)::Vector{PackageSpec}
393441 pkgs = PackageSpec[]
394442 for arg in args
395443 if arg isa String
396 is_add_or_develop = spec.kind in (CMD_ADD, CMD_DEVELOP)
397 push!(pkgs, parse_package(arg; add_or_develop=is_add_or_develop))
444 push!(pkgs, parse_package(arg; add_or_develop=add_or_dev))
398445 elseif arg isa VersionRange
399446 pkgs[end].version = VersionSpec(arg)
400447 elseif arg isa Rev
401 if spec.kind == CMD_DEVELOP
402 pkgerror("a git revision cannot be given to `develop`")
403 end
404448 pkg = pkgs[end]
405449 if pkg.repo == nothing
406450 pkg.repo = Types.GitRepo("", arg.rev)
414458 return pkgs
415459 end
416460
417 function enforce_arg_count(count::Vector{Int}, args::PkgArguments)
418 isempty(count) && return
419 length(args) in count ||
420 pkgerror("Wrong number of arguments")
421 end
422
423 function enforce_args(raw_args::Vector{String}, spec::ArgSpec, cmd_spec::CommandSpec)::PkgArguments
424 if spec.class == ARG_RAW
425 enforce_arg_count(spec.count, raw_args)
426 return raw_args
427 end
428
429 args = enforce_arg_spec(raw_args, spec.class)
461 # Only for PkgSpec
462 function word2token(word::AbstractString)::Token
463 if first(word) == '@'
464 return VersionRange(word[2:end])
465 elseif first(word) == '#'
466 return Rev(word[2:end])
467 else
468 return String(word)
469 end
470 end
471
472 # Only for PkgSpec
473 function enforce_argument_order(args::Vector{Token})
474 prev_arg = nothing
475 function check_prev_arg(valid_type::DataType, error_message::AbstractString)
476 prev_arg isa valid_type || pkgerror(error_message)
477 end
478
479 for arg in args
480 if arg isa VersionRange
481 check_prev_arg(String, "package name/uuid must precede version spec `@$arg`")
482 elseif arg isa Rev
483 check_prev_arg(String, "package name/uuid must precede rev spec `#$(arg.rev)`")
484 end
485 prev_arg = arg
486 end
487 end
488
489 function parse_pkg(raw_args::Vector{String}; valid=[], add_or_dev=false)
490 args::Vector{PkgToken} = map(word2token, raw_args)
430491 enforce_argument_order(args)
431 pkgs = package_args(args, cmd_spec)
432 enforce_arg_count(spec.count, pkgs)
433 return pkgs
492 # enforce spec
493 push!(valid, String) # always want at least PkgSpec identifiers
494 if !all(x->typeof(x) in valid, args)
495 pkgerror("invalid token")
496 end
497 # convert to final arguments
498 return package_args(args; add_or_dev=add_or_dev)
499 end
500
501 function enforce_argument(raw_args::Vector{String}, spec::ArgSpec)::PkgArguments
502 args = spec.parser(raw_args; spec.parser_keys...)
503 enforce_argument_count(spec.count, args)
504 return args
434505 end
435506
436507 function enforce_option(option::String, specs::Dict{String,OptionSpec})::Option
486557 function PkgCommand(statement::Statement)::PkgCommand
487558 meta_opts = enforce_meta_options(statement.meta_options,
488559 meta_option_specs)
489 args = enforce_args(statement.arguments,
490 statement.command.argument_spec,
491 statement.command)
560 args = enforce_argument(statement.arguments,
561 statement.command.argument_spec)
492562 opts = enforce_opts(statement.options, statement.command.option_specs)
493563 return PkgCommand(meta_opts, statement.command, opts, args)
494564 end
519589
520590 function do_cmd!(command::PkgCommand, repl)
521591 context = APIOptions(command.meta_options, meta_option_specs)
522 spec = command.spec
523592
524593 # REPL specific commands
525 if spec.kind == CMD_HELP
594 if command.spec.kind == CMD_HELP
526595 return Base.invokelatest(do_help!, command, repl)
527 elseif spec.kind == CMD_PREVIEW
528 context[:preview] = true
529 cmd = command.arguments[1]
530 cmd_spec = get(command_specs, cmd, nothing)
531 cmd_spec === nothing &&
532 pkgerror("'$cmd' is not a valid command")
533 spec = cmd_spec
534 command = PkgCommand([], cmd, [], PackageSpec[])
535596 end
536597
537598 # API commands
538599 # TODO is invokelatest still needed?
539600 api_opts = APIOptions(command)
540 if applicable(spec.handler, context, command.arguments, api_opts)
541 Base.invokelatest(spec.handler, context, command.arguments, api_opts)
601 if applicable(command.spec.handler, context, command.arguments, api_opts)
602 Base.invokelatest(command.spec.handler, context, command.arguments, api_opts)
542603 else
543 Base.invokelatest(spec.handler, command.arguments, api_opts)
544 end
604 Base.invokelatest(command.spec.handler, command.arguments, api_opts)
605 end
606 end
607
608 function CommandSpec(command_name::String)::Union{Nothing,CommandSpec}
609 # maybe a "package" command
610 spec = get(super_specs["package"], command_name, nothing)
611 if spec !== nothing
612 return spec
613 end
614 # maybe a "compound command"
615 m = match(r"(\w+)-(\w+)", command_name)
616 m !== nothing || (return nothing)
617 super = get(super_specs, m.captures[1], nothing)
618 super !== nothing || (return nothing)
619 return get(super, m.captures[2], nothing)
545620 end
546621
547622 function do_help!(command::PkgCommand, repl::REPL.AbstractREPL)
552627 end
553628 help_md = md""
554629 for arg in command.arguments
555 spec = get(command_specs, arg, nothing)
556 spec === nothing &&
630 spec = CommandSpec(arg)
631 if spec === nothing
557632 pkgerror("'$arg' does not name a command")
633 end
558634 spec.help === nothing &&
559635 pkgerror("Sorry, I don't have any help for the `$arg` command.")
560636 isempty(help_md.content) ||
665741 pkgstr(str::String) = do_cmd(minirepl[], str; do_rethrow=true)
666742
667743 # handle completions
668 all_commands_sorted = []
669 long_commands = []
670 all_options_sorted = []
671 long_options = []
744 mutable struct CompletionCache
745 commands::Vector{String}
746 canonical_names::Vector{String}
747 meta_options::Vector{String}
748 options::Dict{CommandKind, Vector{String}}
749 subcommands::Dict{String, Vector{String}}
750 CompletionCache() = new([],[],[],Dict(),Dict())
751 end
752
753 completion_cache = CompletionCache()
672754
673755 struct PkgCompletionProvider <: LineEdit.CompletionProvider end
674756
679761 return ret, partial[range], should_complete
680762 end
681763
682 function complete_command(s, i1, i2)
683 # only show short form commands when no input is given at all
684 cmp = filter(cmd -> startswith(cmd, s), isempty(s) ? all_commands_sorted : long_commands)
685 return cmp, i1:i2, !isempty(cmp)
686 end
687
688 function complete_option(s, i1, i2)
689 # only show short form options if only a dash is given
690 cmp = filter(cmd -> startswith(cmd, s), length(s) == 1 && first(s) == '-' ?
691 all_options_sorted :
692 long_options)
693 return cmp, i1:i2, !isempty(cmp)
694 end
695
696 function complete_package(s, i1, i2, lastcommand, project_opt)
697 if lastcommand in [CMD_STATUS, CMD_RM, CMD_UP, CMD_TEST, CMD_BUILD, CMD_FREE, CMD_PIN]
698 return complete_installed_package(s, i1, i2, project_opt)
699 elseif lastcommand in [CMD_ADD, CMD_DEVELOP]
700 return complete_remote_package(s, i1, i2)
701 end
702 return String[], 0:-1, false
764 function complete_local_path(s, i1, i2)
765 cmp = REPL.REPLCompletions.complete_path(s, i2)
766 completions = filter!(isdir, [REPL.REPLCompletions.completion_text(p) for p in cmp[1]])
767 return completions, cmp[2], !isempty(completions)
703768 end
704769
705770 function complete_installed_package(s, i1, i2, project_opt)
736801 return cmp, i1:i2, !isempty(cmp)
737802 end
738803
739 function completions(full, index)
804 function complete_argument(to_complete, i1, i2, lastcommand, project_opt
805 )::Tuple{Vector{String},UnitRange{Int},Bool}
806 if lastcommand == CMD_HELP
807 completions = filter(x->startswith(x,to_complete), completion_cache.canonical_names)
808 return completions, i1:i2, !isempty(completions)
809 elseif lastcommand in [CMD_STATUS, CMD_RM, CMD_UP, CMD_TEST, CMD_BUILD, CMD_FREE, CMD_PIN]
810 return complete_installed_package(to_complete, i1, i2, project_opt)
811 elseif lastcommand in [CMD_ADD, CMD_DEVELOP]
812 if occursin(Base.Filesystem.path_separator_re, to_complete)
813 return complete_local_path(to_complete, i1, i2)
814 else
815 rps = complete_remote_package(to_complete, i1, i2)
816 lps = complete_local_path(to_complete, i1, i2)
817 return vcat(rps[1], lps[1]), isempty(rps[1]) ? lps[2] : i1:i2, length(rps[1]) + length(lps[1]) > 0
818 end
819 end
820 return String[], 0:-1, false
821 end
822
823 function completions(full, index)::Tuple{Vector{String},UnitRange{Int},Bool}
740824 pre = full[1:index]
741
742 pre_words = split(pre, ' ', keepempty=true)
743
744 # first word should always be a command
745 if isempty(pre_words)
746 return complete_command("", 1:1)
747 else
748 to_complete = pre_words[end]
749 offset = isempty(to_complete) ? index+1 : to_complete.offset+1
750
751 if length(pre_words) == 1
752 return complete_command(to_complete, offset, index)
753 end
754
755 # tokenize input, don't offer any completions for invalid commands
756 statement = try
757 parse(join(pre_words[1:end-1], ' '))[end]
758 catch
759 return String[], 0:-1, false
760 end
761
762 lastcommand = statement.command.kind
763 project_opt = true
764 for opt in statement.options
765 if opt in ["--manifest", "--project", "-m", "-p"]
766 project_opt = opt in ["--project", "-p"]
767 break
768 end
769 end
770
771 if lastcommand in [CMD_HELP, CMD_PREVIEW]
772 return complete_command(to_complete, offset, index)
773 elseif !isempty(to_complete) && first(to_complete) == '-'
774 return complete_option(to_complete, offset, index)
775 else
776 return complete_package(to_complete, offset, index, lastcommand, project_opt)
777 end
778 end
825 if isempty(pre)
826 return completion_cache.commands, 0:-1, false
827 end
828 x = parse(pre; for_completions=true)
829 if x === nothing # failed parse (invalid command name)
830 return String[], 0:-1, false
831 end
832 (key::Symbol, to_complete::String, spec, proj::Bool) = x
833 last = split(pre, ' ', keepempty=true)[end]
834 offset = isempty(last) ? index+1 : last.offset+1
835 if last != to_complete # require a space before completing next field
836 return String[], 0:-1, false
837 end
838 if key == :arg
839 return complete_argument(to_complete, offset, index, spec.kind, proj)
840 end
841 possible::Vector{String} =
842 key == :meta ? completion_cache.meta_options :
843 key == :cmd ? completion_cache.commands :
844 key == :sub ? completion_cache.subcommands[spec] :
845 key == :opt ? completion_cache.options[spec.kind] :
846 String[]
847 completions = filter(x->startswith(x,to_complete), possible)
848 return completions, offset:index, !isempty(completions)
779849 end
780850
781851 prev_project_file = nothing
899969 # SPEC #
900970 ########
901971 command_declarations = [
972 #=
902973 ["registry"] => CommandDeclaration[
903974 (
904975 CMD_REGISTRY_ADD,
905976 ["add"],
906977 do_registry_add!,
907 (ARG_PKG, []),
978 (1=>Inf, identity, []),
908979 [],
980 "Currently just a placeholder for a future command",
909981 nothing,
910982 ),
911983 ], #registry
984 =#
912985
913986 ["package"] => CommandDeclaration[
914987 ( CMD_TEST,
915988 ["test"],
916989 do_test!,
917 (ARG_PKG, []),
990 (0=>Inf, parse_pkg, []),
918991 [
919992 ("coverage", OPT_SWITCH, :coverage => true),
920993 ],
994 "run tests for packages",
921995 md"""
922996
923997 test [opts] pkg[=uuid] ...
9321006 ),( CMD_HELP,
9331007 ["help", "?"],
9341008 nothing,
935 (ARG_RAW, []),
1009 (0=>Inf, identity, []),
9361010 [],
1011 "show this message",
9371012 md"""
9381013
9391014 help
9491024 ),( CMD_INSTANTIATE,
9501025 ["instantiate"],
9511026 do_instantiate!,
952 (ARG_RAW, [0]),
1027 (0=>0, identity, []),
9531028 [
9541029 (["project", "p"], OPT_SWITCH, :manifest => false),
9551030 (["manifest", "m"], OPT_SWITCH, :manifest => true),
9561031 ],
1032 "downloads all the dependencies for the project",
9571033 md"""
9581034 instantiate
9591035 instantiate [-m|--manifest]
9651041 ),( CMD_RM,
9661042 ["remove", "rm"],
9671043 do_rm!,
968 (ARG_PKG, []),
1044 (1=>Inf, parse_pkg, []),
9691045 [
9701046 (["project", "p"], OPT_SWITCH, :mode => PKGMODE_PROJECT),
9711047 (["manifest", "m"], OPT_SWITCH, :mode => PKGMODE_MANIFEST),
9721048 ],
1049 "remove packages from project or manifest",
9731050 md"""
9741051
9751052 rm [-p|--project] pkg[=uuid] ...
9931070 ),( CMD_ADD,
9941071 ["add"],
9951072 do_add!,
996 (ARG_ALL, []),
1073 (1=>Inf, parse_pkg, [:add_or_dev => true, :valid => [VersionRange, Rev]]),
9971074 [],
1075 "add packages to project",
9981076 md"""
9991077
10001078 add pkg[=uuid] [@version] [#rev] ...
10231101 ),( CMD_DEVELOP,
10241102 ["develop", "dev"],
10251103 do_develop!,
1026 (ARG_ALL, []),
1104 (1=>Inf, parse_pkg, [:add_or_dev => true, :valid => [VersionRange]]),
10271105 [
10281106 ("local", OPT_SWITCH, :shared => false),
10291107 ("shared", OPT_SWITCH, :shared => true),
10301108 ],
1109 "clone the full package repo locally for development",
10311110 md"""
10321111 develop [--shared|--local] pkg[=uuid] ...
10331112
10411120 *Example*
10421121 ```jl
10431122 pkg> develop Example
1044 pkg> develop Example#master
1045 pkg> develop Example#c37b675
1046 pkg> develop https://github.com/JuliaLang/Example.jl#master
1123 pkg> develop https://github.com/JuliaLang/Example.jl
1124 pkg> develop ~/mypackages/Example
10471125 pkg> develop --local Example
10481126 ```
10491127 """,
10501128 ),( CMD_FREE,
10511129 ["free"],
10521130 do_free!,
1053 (ARG_PKG, []),
1131 (1=>Inf, parse_pkg, []),
10541132 [],
1133 "undoes a `pin`, `develop`, or stops tracking a repo",
10551134 md"""
10561135 free pkg[=uuid] ...
10571136
10611140 ),( CMD_PIN,
10621141 ["pin"],
10631142 do_pin!,
1064 (ARG_VERSION, []),
1143 (1=>Inf, parse_pkg, [:valid => [VersionRange]]),
10651144 [],
1145 "pins the version of packages",
10661146 md"""
10671147
10681148 pin pkg[=uuid] ...
10731153 ),( CMD_BUILD,
10741154 ["build"],
10751155 do_build!,
1076 (ARG_PKG, []),
1156 (0=>Inf, parse_pkg, []),
10771157 [],
1158 "run the build script for packages",
10781159 md"""
10791160
10801161 build pkg[=uuid] ...
10861167 ),( CMD_RESOLVE,
10871168 ["resolve"],
10881169 do_resolve!,
1089 (ARG_RAW, [0]),
1170 (0=>0, identity, []),
10901171 [],
1172 "resolves to update the manifest from changes in dependencies of developed packages",
10911173 md"""
10921174 resolve
10931175
10941176 Resolve the project i.e. run package resolution and update the Manifest. This is useful in case the dependencies of developed
1095 packages have changed causing the current Manifest to_indices be out of sync.
1177 packages have changed causing the current Manifest to be out of sync.
10961178 """,
10971179 ),( CMD_ACTIVATE,
10981180 ["activate"],
10991181 do_activate!,
1100 (ARG_RAW, [0,1]),
1182 (0=>1, identity, []),
11011183 [
11021184 ("shared", OPT_SWITCH, :shared => true),
11031185 ],
1186 "set the primary environment the package manager manipulates",
11041187 md"""
11051188 activate
11061189 activate [--shared] path
11141197 ),( CMD_UP,
11151198 ["update", "up"],
11161199 do_up!,
1117 (ARG_VERSION, []),
1200 (0=>Inf, parse_pkg, [:valid => [VersionRange]]),
11181201 [
11191202 (["project", "p"], OPT_SWITCH, :mode => PKGMODE_PROJECT),
11201203 (["manifest", "m"], OPT_SWITCH, :mode => PKGMODE_MANIFEST),
11231206 ("patch", OPT_SWITCH, :level => UPLEVEL_PATCH),
11241207 ("fixed", OPT_SWITCH, :level => UPLEVEL_FIXED),
11251208 ],
1209 "update packages in manifest",
11261210 md"""
11271211
11281212 up [-p|project] [opts] pkg[=uuid] [@version] ...
11421226 ),( CMD_GENERATE,
11431227 ["generate"],
11441228 do_generate!,
1145 (ARG_RAW, [1]),
1229 (1=>1, identity, []),
11461230 [],
1231 "generate files for a new project",
11471232 md"""
11481233
11491234 generate pkgname
11531238 ),( CMD_PRECOMPILE,
11541239 ["precompile"],
11551240 do_precompile!,
1156 (ARG_RAW, [0]),
1241 (0=>0, identity, []),
11571242 [],
1243 "precompile all the project dependencies",
11581244 md"""
11591245 precompile
11601246
11611247 Precompile all the dependencies of the project by running `import` on all of them in a new process.
1162 The `startup.jl` file is disabled during precompilation unless julia is started with `--startup-file=yes`.
11631248 """,
11641249 ),( CMD_STATUS,
11651250 ["status", "st"],
11661251 do_status!,
1167 (ARG_RAW, [0]),
1252 (0=>0, identity, []),
11681253 [
11691254 (["project", "p"], OPT_SWITCH, :mode => PKGMODE_PROJECT),
11701255 (["manifest", "m"], OPT_SWITCH, :mode => PKGMODE_MANIFEST),
11711256 ],
1257 "summarize contents of and changes to environment",
11721258 md"""
11731259
11741260 status
11851271 ),( CMD_GC,
11861272 ["gc"],
11871273 do_gc!,
1188 (ARG_RAW, [0]),
1274 (0=>0, identity, []),
11891275 [],
1276 "garbage collect packages not used for a significant time",
11901277 md"""
11911278
11921279 Deletes packages that cannot be reached from any existing environment.
11931280 """,
1194 ),( CMD_PREVIEW,
1281 ),( # preview is not a regular command.
1282 # this is here so that preview appears as a registered command to users
1283 CMD_PREVIEW,
11951284 ["preview"],
11961285 nothing,
1197 (ARG_RAW, [1]),
1286 (1=>Inf, identity, []),
11981287 [],
1288 "previews a subsequent command without affecting the current state",
11991289 md"""
12001290
12011291 preview cmd
12091299 ] #command_declarations
12101300
12111301 super_specs = SuperSpecs(command_declarations)
1302 # cache things you need for completions
1303 completion_cache.meta_options = sort(map(wrap_option, collect(keys(meta_option_specs))))
1304 completion_cache.commands = sort(append!(collect(keys(super_specs)),
1305 collect(keys(super_specs["package"]))))
1306 let names = String[]
1307 for (super, specs) in pairs(super_specs)
1308 super == "package" && continue # skip "package"
1309 for spec in unique(values(specs))
1310 push!(names, join([super, spec.canonical_name], "-"))
1311 end
1312 end
1313 for spec in unique(values(super_specs["package"]))
1314 push!(names, spec.canonical_name)
1315 end
1316 completion_cache.canonical_names = names
1317 sort!(completion_cache.canonical_names)
1318 end
1319 for (k, v) in pairs(super_specs)
1320 completion_cache.subcommands[k] = sort(collect(keys(v)))
1321 for spec in values(v)
1322 completion_cache.options[spec.kind] =
1323 sort(map(wrap_option, collect(keys(spec.option_specs))))
1324 end
1325 end
1326 # TODO remove this
12121327 command_specs = super_specs["package"]
1213 all_commands_sorted = sort(collect(String,keys(command_specs)))
1214 long_commands = filter(c -> length(c) > 2, all_commands_sorted)
1215 function all_options()
1216 all_opts = []
1217 for command in values(command_specs)
1218 for opt_spec in values(command.option_specs)
1219 push!(all_opts, opt_spec.name)
1220 opt_spec.short_name !== nothing && push!(all_opts, opt_spec.short_name)
1221 end
1222 end
1223 unique!(all_opts)
1224 return all_opts
1225 end
1226 all_options_sorted = [length(opt) > 1 ? "--$opt" : "-$opt" for opt in sort!(all_options())]
1227 long_options = filter(c -> length(c) > 2, all_options_sorted)
12281328
12291329 const help = md"""
12301330
12341334
12351335 **Synopsis**
12361336
1237 pkg> [--env=...] cmd [opts] [args]
1337 pkg> cmd [opts] [args]
12381338
12391339 Multiple commands can be given on the same line by interleaving a `;` between the commands.
12401340
1241 **Environment**
1242
1243 The `--env` meta option determines which project environment to manipulate. By
1244 default, this looks for a git repo in the parents directories of the current
1245 working directory, and if it finds one, it uses that as an environment. Otherwise,
1246 it uses a named environment (typically found in `~/.julia/environments`) looking
1247 for environments named `v$(VERSION.major).$(VERSION.minor).$(VERSION.patch)`,
1248 `v$(VERSION.major).$(VERSION.minor)`, `v$(VERSION.major)` or `default` in order.
1249
12501341 **Commands**
1251
1252 What action you want the package manager to take:
1253
1254 `help`: show this message
1255
1256 `status`: summarize contents of and changes to environment
1257
1258 `add`: add packages to project
1259
1260 `develop`: clone the full package repo locally for development
1261
1262 `rm`: remove packages from project or manifest
1263
1264 `up`: update packages in manifest
1265
1266 `test`: run tests for packages
1267
1268 `build`: run the build script for packages
1269
1270 `pin`: pins the version of packages
1271
1272 `free`: undoes a `pin`, `develop`, or stops tracking a repo.
1273
1274 `instantiate`: downloads all the dependencies for the project
1275
1276 `resolve`: resolves to update the manifest from changes in dependencies of
1277 developed packages
1278
1279 `generate`: generate files for a new project
1280
1281 `preview`: previews a subsequent command without affecting the current state
1282
1283 `precompile`: precompile all the project dependencies
1284
1285 `gc`: garbage collect packages not used for a significant time
1286
1287 `activate`: set the primary environment the package manager manipulates
12881342 """
12891343
1344 for command in completion_cache.canonical_names
1345 spec = CommandSpec(command)
1346 push!(help.content, Markdown.parse("`$command`: $(spec.description)"))
1347 end
1348
12901349 end #module
239239 project_file = nothing
240240 if env isa Nothing
241241 project_file = Base.active_project()
242 project_file == nothing && error("no active project")
242 project_file == nothing && pkgerror("no active project")
243243 elseif startswith(env, '@')
244244 project_file = Base.load_path_expand(env)
245 project_file === nothing && error("package environment does not exist: $env")
245 project_file === nothing && pkgerror("package environment does not exist: $env")
246246 elseif env isa String
247247 if isdir(env)
248 isempty(readdir(env)) || error("environment is a package directory: $env")
248 isempty(readdir(env)) || pkgerror("environment is a package directory: $env")
249249 project_file = joinpath(env, Base.project_names[end])
250250 else
251251 project_file = endswith(env, ".toml") ? abspath(env) :
332332 ###########
333333 # Context #
334334 ###########
335 stdlib_dir() = joinpath(Sys.BINDIR, "..", "share", "julia", "stdlib", "v$(VERSION.major).$(VERSION.minor)")
335 stdlib_dir() = normpath(joinpath(Sys.BINDIR, "..", "share", "julia", "stdlib", "v$(VERSION.major).$(VERSION.minor)"))
336336 stdlib_path(stdlib::String) = joinpath(stdlib_dir(), stdlib)
337337 function gather_stdlib_uuids()
338338 stdlibs = Dict{UUID,String}()
491491 end
492492 end
493493
494 # try to call realpath on as much as possible
495 function safe_realpath(path)
496 ispath(path) && return realpath(path)
497 a, b = splitdir(path)
498 return joinpath(safe_realpath(a), b)
499 end
500 function relative_project_path(ctx::Context, path::String)
501 # compute path relative the project
502 # realpath needed to expand symlinks before taking the relative path
503 return relpath(safe_realpath(abspath(path)),
504 safe_realpath(dirname(ctx.env.project_file)))
505 end
506
494507 casesensitive_isdir(dir::String) = isdir_windows_workaround(dir) && dir in readdir(joinpath(dir, ".."))
495508
496 function handle_repos_develop!(ctx::Context, pkgs::AbstractVector{PackageSpec}, devdir::String)
509 function handle_repos_develop!(ctx::Context, pkgs::AbstractVector{PackageSpec}; shared::Bool)
497510 Base.shred!(LibGit2.CachedCredentials()) do creds
498511 env = ctx.env
499512 new_uuids = UUID[]
511524 else
512525 # Relative paths are given relative pwd() so we
513526 # translate that to be relative the project instead.
514 # `realpath` is needed to expand symlinks before taking the relative path.
515 pkg.path = relpath(realpath(abspath(pkg.repo.url)), realpath(dirname(ctx.env.project_file)))
527 pkg.path = relative_project_path(ctx, pkg.repo.url)
516528 end
517529 folder_already_downloaded = true
518530 project_path = pkg.repo.url
549561 else
550562 rev = string(LibGit2.GitHash(LibGit2.head(repo)))
551563 end
552 gitobject, isbranch = get_object_branch(repo, rev)
564 gitobject, isbranch = get_object_branch(repo, rev, creds)
553565 try
554566 LibGit2.transact(repo) do r
555567 if isbranch
564576 end
565577
566578 parse_package!(ctx, pkg, project_path)
579 devdir = shared ? Pkg.devdir() : joinpath(dirname(ctx.env.project_file), "dev")
567580 dev_pkg_path = joinpath(devdir, pkg.name)
568581 if isdir(dev_pkg_path)
569582 if !isfile(joinpath(dev_pkg_path, "src", pkg.name * ".jl"))
576589 mv(project_path, dev_pkg_path; force=true)
577590 push!(new_uuids, pkg.uuid)
578591 end
579 # Save the path as relative if the location is inside the project
580 # (e.g. from `dev --local`), otherwise put in the absolute path.
581 pkg.path = Pkg.Operations.relative_project_path_if_in_project(ctx, dev_pkg_path)
592 # Save the path as relative if it is a --local dev,
593 # otherwise put in the absolute path.
594 pkg.path = shared ? dev_pkg_path : relative_project_path(ctx, dev_pkg_path)
582595 end
583596 @assert pkg.path != nothing
597 @assert has_uuid(pkg)
584598 end
585599 return new_uuids
586600 end
606620 project_path = nothing
607621 folder_already_downloaded = false
608622 try
609 repo, just_cloned = ispath(repo_path) ? (LibGit2.GitRepo(repo_path), false) : begin
610 r = GitTools.clone(pkg.repo.url, repo_path, isbare=true, credentials=creds)
611 GitTools.fetch(r, pkg.repo.url; refspecs=refspecs, credentials=creds)
612 r, true
623 repo = if ispath(repo_path)
624 LibGit2.GitRepo(repo_path)
625 else
626 GitTools.clone(pkg.repo.url, repo_path, isbare=true, credentials=creds)
613627 end
614628 info = manifest_info(env, pkg.uuid)
615629 pinned = (info != nothing && get(info, "pinned", false))
616 if upgrade_or_add && !pinned && !just_cloned
617 rev = pkg.repo.rev
618 GitTools.fetch(repo, pkg.repo.url; refspecs=refspecs, credentials=creds)
619 end
620630 upgrading = upgrade_or_add && !pinned
621631 if upgrading
632 GitTools.fetch(repo; refspecs=refspecs, credentials=creds)
622633 rev = pkg.repo.rev
634 # see if we can get rev as a branch
635 if isempty(rev)
636 if LibGit2.isattached(repo)
637 rev = LibGit2.branch(repo)
638 else
639 rev = string(LibGit2.GitHash(LibGit2.head(repo)))
640 end
641 end
623642 else
624643 # Not upgrading so the rev should be the current git-tree-sha
625644 rev = info["git-tree-sha1"]
626645 pkg.version = VersionNumber(info["version"])
627646 end
628647
629 # see if we can get rev as a branch
630 if isempty(rev)
631 if LibGit2.isattached(repo)
632 rev = LibGit2.branch(repo)
633 else
634 rev = string(LibGit2.GitHash(LibGit2.head(repo)))
635 end
636 end
637 gitobject, isbranch = get_object_branch(repo, rev)
648 gitobject, isbranch = get_object_branch(repo, rev, creds)
638649 # If the user gave a shortened commit SHA, might as well update it to the full one
639650 try
640651 if upgrading
651662 info = manifest_info(env, pkg.uuid)
652663 if info != nothing && get(info, "git-tree-sha1", "") == string(pkg.repo.git_tree_sha1) && folder_already_downloaded
653664 # Same tree sha and this version already downloaded, nothing left to do
654 pkg.version = VersionNumber(info["version"])
655665 do_nothing_more = true
656666 end
657667 end
678688 mv(project_path, version_path; force=true)
679689 push!(new_uuids, pkg.uuid)
680690 end
681 @assert pkg.version isa VersionNumber
691 @assert has_uuid(pkg)
682692 end
683693 return new_uuids
684694 finally
693703 project_data = read_package(project_file)
694704 pkg.uuid = UUID(project_data["uuid"])
695705 pkg.name = project_data["name"]
696 if haskey(project_data, "version")
697 pkg.version = VersionNumber(project_data["version"])
698 else
699 @warn "project file for $(pkg.name) at $(project_path) is missing a `version` entry"
700 Pkg.Operations.set_maximum_version_registry!(env, pkg)
701 end
702706 else
703 # @warn "package $(pkg.name) at $(project_path) will need to have a [Julia]Project.toml file in the future"
704707 if !isempty(ctx.old_pkg2_clone_name) # remove when legacy CI script support is removed
705708 pkg.name = ctx.old_pkg2_clone_name
706709 else
707 # This is an old style package, get the name from src/PackageName
708 if isdir_windows_workaround(pkg.repo.url)
709 m = match(reg_pkg, abspath(pkg.repo.url))
710 else
711 m = match(reg_pkg, pkg.repo.url)
712 end
713 m === nothing && pkgerror("cannot determine package name from URL or path: $(pkg.repo.url)")
714 pkg.name = m.captures[1]
710 # This is an old style package, if not set, get the name from src/PackageName
711 if !has_name(pkg)
712 if isdir_windows_workaround(pkg.repo.url)
713 m = match(reg_pkg, abspath(pkg.repo.url))
714 else
715 m = match(reg_pkg, pkg.repo.url)
716 end
717 m === nothing && pkgerror("cannot determine package name from URL or path: $(pkg.repo.url), provide a name argument to `PackageSpec`")
718 pkg.name = m.captures[1]
719 end
715720 end
716721 reg_uuids = registered_uuids(env, pkg.name)
717722 is_registered = !isempty(reg_uuids)
722727 pkg.uuid = uuid5(uuid_unreg_pkg, pkg.name)
723728 @info "Assigning UUID $(pkg.uuid) to $(pkg.name)"
724729 end
725 pkg.version = v"0.0"
726730 else
727 # TODO: Fix
728731 @assert length(reg_uuids) == 1
729732 pkg.uuid = reg_uuids[1]
730 # Old style registered package
731 # What version does this package have? We have no idea... let's give it the latest one with a `+`...
732 Pkg.Operations.set_maximum_version_registry!(env, pkg)
733733 end
734734 end
735735 end
743743 _, pkg.repo.url = Types.registered_info(env, pkg.uuid, "repo")[1]
744744 end
745745
746 function get_object_branch(repo, rev)
746 function get_object_branch(repo, rev, creds)
747747 gitobject = nothing
748748 isbranch = false
749749 try
757757 gitobject = LibGit2.GitObject(repo, rev)
758758 catch err
759759 err isa LibGit2.GitError && err.code == LibGit2.Error.ENOTFOUND || rethrow(err)
760 pkgerror("git object $(rev) could not be found")
760 GitTools.fetch(repo; refspecs=refspecs, credentials=creds)
761 try
762 gitobject = LibGit2.GitObject(repo, rev)
763 catch err
764 err isa LibGit2.GitError && err.code == LibGit2.Error.ENOTFOUND || rethrow(err)
765 pkgerror("git object $(rev) could not be found")
766 end
761767 end
762768 end
763769 return gitobject, isbranch
781787 # Disambiguate name/uuid package specifications using project info.
782788 function project_deps_resolve!(env::EnvCache, pkgs::AbstractVector{PackageSpec})
783789 uuids = env.project["deps"]
784 names = Dict(uuid => name for (uuid, name) in uuids)
790 names = Dict(uuid => name for (name, uuid) in uuids)
785791 length(uuids) < length(names) && # TODO: handle this somehow?
786792 pkgerror("duplicate UUID found in project file's [deps] section")
787793 for pkg in pkgs
10491055 end
10501056 end
10511057 length(choices_cache) == 1 && return choices_cache[1][1]
1052 # prompt for which UUID was intended:
1053 menu = RadioMenu(choices)
1054 choice = request("There are multiple registered `$name` packages, choose one:", menu)
1055 choice == -1 && return UUID(zero(UInt128))
1056 env.paths[choices_cache[choice][1]] = [choices_cache[choice][2]]
1057 return choices_cache[choice][1]
1058 if isinteractive()
1059 # prompt for which UUID was intended:
1060 menu = RadioMenu(choices)
1061 choice = request("There are multiple registered `$name` packages, choose one:", menu)
1062 choice == -1 && return UUID(zero(UInt128))
1063 env.paths[choices_cache[choice][1]] = [choices_cache[choice][2]]
1064 return choices_cache[choice][1]
1065 else
1066 pkgerror("there are multiple registered `$name` packages, explicitly set the uuid")
1067 end
10581068 end
10591069
10601070 # Determine current name for a given package UUID
11081118 end
11091119
11101120
1111 function pathrepr(ctx::Union{Nothing, Context}, path::String, base::String=pwd())
1112 project_path = dirname(ctx.env.project_file)
1113 path = joinpath(project_path, path)
1114 if startswith(path, project_path) && startswith(base, project_path)
1115 # We are in project and path is in project
1116 path = relpath(path, base)
1117 end
1118 if !Sys.iswindows() && isabspath(path)
1119 home = joinpath(homedir(), "")
1120 if startswith(path, home)
1121 path = joinpath("~", path[nextind(path, lastindex(home)):end])
1122 end
1123 end
1124 return "`" * path * "`"
1121 function pathrepr(path::String)
1122 # print stdlib paths as @stdlib/Name
1123 if startswith(path, stdlib_dir())
1124 path = "@stdlib/" * basename(path)
1125 end
1126 return "`" * Base.contractuser(path) * "`"
11251127 end
11261128
11271129 function project_key_order(key::String)
11441146 isempty(project["deps"]) && delete!(project, "deps")
11451147 if !isempty(project) || ispath(env.project_file)
11461148 if display_diff && !(ctx.currently_running_target)
1147 printpkgstyle(ctx, :Updating, pathrepr(ctx, env.project_file))
1149 printpkgstyle(ctx, :Updating, pathrepr(env.project_file))
11481150 Pkg.Display.print_project_diff(ctx, old_env, env)
11491151 end
11501152 if !ctx.preview
11571159 # update the manifest file
11581160 if !isempty(env.manifest) || ispath(env.manifest_file)
11591161 if display_diff && !(ctx.currently_running_target)
1160 printpkgstyle(ctx, :Updating, pathrepr(ctx, env.manifest_file))
1162 printpkgstyle(ctx, :Updating, pathrepr(env.manifest_file))
11611163 Pkg.Display.print_manifest_diff(ctx, old_env, env)
11621164 end
11631165 manifest = deepcopy(env.manifest)
+0
-431
stdlib/Pkg/src/precompile.jl less more
0 # This file is a part of Julia. License is MIT: https://julialang.org/license
1
2 precompile(Tuple{Type{Base.Dict{K, V} where V where K}, Array{Base.Pair{A, B} where B where A, 1}})
3 precompile(Tuple{Type{Base.Dict{Pkg.Types.VersionRange, Base.Dict{String, Base.UUID}}}})
4 precompile(Tuple{Type{Base.Dict{Pkg.Types.VersionRange, Base.Dict{String, Pkg.Types.VersionSpec}}}})
5 precompile(Tuple{Type{Base.Dict{String, Any}}, Base.Pair{String, String}})
6 precompile(Tuple{Type{Base.Dict{String, Base.UUID}}})
7 precompile(Tuple{Type{Base.Dict{String, Pkg.Types.VersionSpec}}})
8 precompile(Tuple{Type{Base.Generator{I, F} where F where I}, Type{Base.UUID}, Base.ValueIterator{Base.Dict{String, Any}}})
9 precompile(Tuple{Type{Base.Generator{I, F} where F where I}, Type{Base.UUID}, Base.ValueIterator{Base.Dict{String, String}}})
10 precompile(Tuple{Type{Base.Generator{I, F} where F where I}, typeof(Base.close), Array{LibGit2.GitAnnotated, 1}})
11 precompile(Tuple{Type{Base.Generator{I, F} where F where I}, typeof(Pkg.TOML.is_tabular), Base.ValueIterator{Base.Dict{String, Any}}})
12 precompile(Tuple{Type{Base.Generator{I, F} where F where I}, typeof(Pkg.TOML.table2dict), Array{Any, 1}})
13 precompile(Tuple{Type{Base.IOContext{IO_t} where IO_t<:IO}, Base.GenericIOBuffer{Array{UInt8, 1}}, Base.TTY})
14 precompile(Tuple{Type{Base.Pair{A, B} where B where A}, Base.UUID, Int64})
15 precompile(Tuple{Type{Base.Pair{A, B} where B where A}, Base.UUID, Pkg.Types.VersionSpec})
16 precompile(Tuple{Type{Base.Pair{A, B} where B where A}, Base.VersionNumber, Base.SHA1})
17 precompile(Tuple{Type{Base.Pair{A, B} where B where A}, String, Base.UUID})
18 precompile(Tuple{Type{Base.SHA1}, Base.SubString{String}})
19 precompile(Tuple{Type{Base.SHA1}, String})
20 precompile(Tuple{Type{Char}, Int32})
21 precompile(Tuple{Type{NamedTuple{(:by,), T} where T<:Tuple}, Tuple{typeof(Base.identity)}})
22 precompile(Tuple{Type{NamedTuple{(:header, :color), T} where T<:Tuple}, Tuple{String, Symbol}})
23 precompile(Tuple{Type{NamedTuple{(:indent, :region_active), T} where T<:Tuple}, Tuple{Int64, Bool}})
24 precompile(Tuple{Type{NamedTuple{(:indent, :sorted, :by), T} where T<:Tuple}, Tuple{Int64, Bool, typeof(Base.identity)}})
25 precompile(Tuple{Type{NamedTuple{(:init,), T} where T<:Tuple}, Tuple{Int64}})
26 precompile(Tuple{Type{NamedTuple{(:mode,), T} where T<:Tuple}, Tuple{Symbol}})
27 precompile(Tuple{Type{NamedTuple{(:transfer_progress, :credentials), T} where T<:Tuple}, Tuple{Ptr{Nothing}, Ptr{Nothing}}})
28 precompile(Tuple{Type{Pkg.Display.DiffEntry}, Base.UUID, String, Pkg.Display.VerInfo, Pkg.Display.VerInfo})
29 precompile(Tuple{Type{Pkg.Display.VerInfo}, Base.SHA1, Nothing, Base.VersionNumber, Bool, Nothing})
30 precompile(Tuple{Type{Pkg.Display.VerInfo}, Base.SHA1, Nothing, Base.VersionNumber, Bool, Pkg.Types.GitRepo})
31 precompile(Tuple{Type{Pkg.Display.VerInfo}, Nothing, Nothing, Nothing, Bool, Nothing})
32 precompile(Tuple{Type{Pkg.Display.VerInfo}, Nothing, String, Base.VersionNumber, Bool, Nothing})
33 precompile(Tuple{Type{Pkg.Types.EnvCache}, Nothing, Nothing, String, String, Nothing, Base.Dict{String, Any}, Base.Dict{String, Any}, Base.Dict{String, Array{Base.UUID, 1}}, Base.Dict{Base.UUID, Array{String, 1}}, Base.Dict{Base.UUID, Array{String, 1}}})
34 precompile(Tuple{Type{Pkg.Types.GitRepo}, String, String, Base.SHA1})
35 precompile(Tuple{Type{Pkg.Types.GitRepo}, String, String})
36 precompile(Tuple{Type{Pkg.Types.PackageSpec}, Base.SubString{String}, Pkg.Types.VersionSpec})
37 precompile(Tuple{Type{Pkg.Types.PackageSpec}, Base.SubString{String}})
38 precompile(Tuple{Type{Pkg.Types.PackageSpec}, String, Base.UUID, Pkg.Types.VersionSpec})
39 precompile(Tuple{Type{Pkg.Types.PackageSpec}, String})
40 precompile(Tuple{Type{Pkg.Types.VersionBound}, Base.SubString{String}})
41 precompile(Tuple{Type{Pkg.Types.VersionBound}, Int64, Int64})
42 precompile(Tuple{Type{Pkg.Types.VersionBound}, Tuple{Int64, Int64, Int64}})
43 precompile(Tuple{Type{Pkg.Types.VersionBound}, Tuple{Int64, Int64}})
44 precompile(Tuple{Type{Pkg.Types.VersionBound}, Tuple{UInt32, UInt32}})
45 precompile(Tuple{Type{Pkg.Types.VersionBound}, UInt32, UInt32})
46 precompile(Tuple{Type{Pkg.Types.VersionRange}, Base.VersionNumber})
47 precompile(Tuple{Type{Pkg.Types.VersionSpec}, String})
48 precompile(Tuple{Type{REPL.LineEdit.PrefixSearchState}, REPL.Terminals.TTYTerminal, REPL.LineEdit.PrefixHistoryPrompt, String, Base.GenericIOBuffer{Array{UInt8, 1}}})
49 precompile(Tuple{Type{REPL.LineEdit.PromptState}, REPL.Terminals.TTYTerminal, REPL.LineEdit.Prompt, Base.GenericIOBuffer{Array{UInt8, 1}}, Symbol, Array{Base.GenericIOBuffer{Array{UInt8, 1}}, 1}, Int64, REPL.LineEdit.InputAreaState, Int64, Base.Threads.TatasLock, Float64})
50 precompile(Tuple{Type{REPL.LineEdit.SearchState}, REPL.Terminals.TTYTerminal, REPL.LineEdit.HistoryPrompt, Bool, Base.GenericIOBuffer{Array{UInt8, 1}}, Base.GenericIOBuffer{Array{UInt8, 1}}})
51 precompile(Tuple{Type{REPL.REPLHistoryProvider}, Array{String, 1}, Nothing, Int64, Int64, Int64, Base.GenericIOBuffer{Array{UInt8, 1}}, Nothing, Base.Dict{Symbol, Any}, Array{UInt8, 1}})
52 precompile(Tuple{Type{REPL.REPLHistoryProvider}, Base.Dict{Symbol, Any}})
53 precompile(Tuple{getfield(Base, Symbol("#kw##printstyled")), NamedTuple{(:bold, :color), Tuple{Bool, Symbol}}, typeof(Base.printstyled), Base.TTY, String})
54 precompile(Tuple{getfield(Base, Symbol("#kw##sort!")), NamedTuple{(:by,), Tuple{typeof(Base.Unicode.lowercase)}}, typeof(Base.sort!), Array{String, 1}})
55 precompile(Tuple{getfield(Base, Symbol("#kw##sort!")), NamedTuple{(:by,), Tuple{typeof(Base.identity)}}, typeof(Base.sort!), Array{String, 1}})
56 precompile(Tuple{getfield(Base.Cartesian, Symbol("#@nloops")), LineNumberNode, Module, Int64, Symbol, Expr, Expr, Expr})
57 precompile(Tuple{getfield(Core, Symbol("#kw#Type")), NamedTuple{(:header, :color), Tuple{String, Symbol}}, Type{Pkg.GitTools.MiniProgressBar}})
58 precompile(Tuple{getfield(Core, Symbol("#kw#Type")), NamedTuple{(:payload, :transfer_progress, :credentials), Tuple{Base.Dict{Symbol, Any}, Ptr{Nothing}, Ptr{Nothing}}}, Type{LibGit2.RemoteCallbacks}})
59 precompile(Tuple{getfield(Pkg.API, Symbol("#kw##add_or_develop")), NamedTuple{(:mode,), Tuple{Symbol}}, typeof(Pkg.API.add_or_develop), Pkg.Types.Context, Array{Pkg.Types.PackageSpec, 1}})
60 precompile(Tuple{getfield(Pkg.TOML, Symbol("#kw##_print")), NamedTuple{(:indent, :sorted, :by), Tuple{Int64, Bool, typeof(Base.identity)}}, typeof(Pkg.TOML._print), Base.IOStream, Base.Dict{String, Any}, Array{String, 1}})
61 precompile(Tuple{getfield(Pkg.TOML, Symbol("#kw##print")), NamedTuple{(:sorted,), Tuple{Bool}}, typeof(Pkg.TOML.print), Base.IOStream, Base.Dict{String, Any}})
62 precompile(Tuple{getfield(Pkg.TOML, Symbol("#kw##printvalue")), NamedTuple{(:sorted,), Tuple{Bool}}, typeof(Pkg.TOML.printvalue), Base.IOStream, Array{String, 1}})
63 precompile(Tuple{getfield(Pkg.TOML, Symbol("#kw##printvalue")), NamedTuple{(:sorted,), Tuple{Bool}}, typeof(Pkg.TOML.printvalue), Base.IOStream, String})
64 precompile(Tuple{getfield(REPL.LineEdit, Symbol("#kw##add_nested_key!")), NamedTuple{(:override,), Tuple{Bool}}, typeof(REPL.LineEdit.add_nested_key!), Base.Dict{Char, Any}, String, Nothing})
65 precompile(Tuple{getfield(REPL.LineEdit, Symbol("#kw##refresh_multi_line")), NamedTuple{(:indent, :region_active), Tuple{Int64, Bool}}, typeof(REPL.LineEdit.refresh_multi_line), REPL.Terminals.TerminalBuffer, REPL.Terminals.TTYTerminal, Base.GenericIOBuffer{Array{UInt8, 1}}, REPL.LineEdit.InputAreaState, REPL.LineEdit.PromptState})
66 precompile(Tuple{typeof(Base.:(!=)), Base.SubString{String}, Nothing})
67 precompile(Tuple{typeof(Base.:(!=)), Base.UUID, Base.UUID})
68 precompile(Tuple{typeof(Base.:(==)), Base.Dict{String, Any}, Nothing})
69 precompile(Tuple{typeof(Base.:(==)), Base.SHA1, Nothing})
70 precompile(Tuple{typeof(Base.:(==)), Base.UUID, Base.UUID})
71 precompile(Tuple{typeof(Base.:(==)), Expr, Int64})
72 precompile(Tuple{typeof(Base.:(==)), Nothing, Base.UUID})
73 precompile(Tuple{typeof(Base.:(==)), Nothing, Nothing})
74 precompile(Tuple{typeof(Base.:(==)), String, Nothing})
75 precompile(Tuple{typeof(Base.:(==)), Symbol, Int64})
76 precompile(Tuple{typeof(Base.Cartesian._nloops), Int64, Symbol, Expr, Expr, Expr})
77 precompile(Tuple{typeof(Base.Cartesian.exprresolve), LineNumberNode})
78 precompile(Tuple{typeof(Base.Cartesian.lreplace!), Int64, Base.Cartesian.LReplace{String}})
79 precompile(Tuple{typeof(Base.Filesystem.ispath), String})
80 precompile(Tuple{typeof(Base.Filesystem.mtime), String})
81 precompile(Tuple{typeof(Base.Iterators.enumerate), Array{Base.VersionNumber, 1}})
82 precompile(Tuple{typeof(Base._array_for), Type{Array{Base.BitArray{2}, 1}}, Base.UnitRange{Int64}, Base.HasShape{1}})
83 precompile(Tuple{typeof(Base._array_for), Type{Array{Base.VersionNumber, 1}}, Base.UnitRange{Int64}, Base.HasShape{1}})
84 precompile(Tuple{typeof(Base._array_for), Type{Base.BitArray{1}}, Base.UnitRange{Int64}, Base.HasShape{1}})
85 precompile(Tuple{typeof(Base._array_for), Type{Base.BitArray{2}}, Base.UnitRange{Int64}, Base.HasShape{1}})
86 precompile(Tuple{typeof(Base._array_for), Type{Base.Dict{Base.VersionNumber, Int64}}, Base.UnitRange{Int64}, Base.HasShape{1}})
87 precompile(Tuple{typeof(Base._array_for), Type{Base.UUID}, Base.ValueIterator{Base.Dict{String, Any}}, Base.HasLength})
88 precompile(Tuple{typeof(Base._collect), Array{Pkg.REPLMode.Statement, 1}, Base.Generator{Array{Pkg.REPLMode.Statement, 1}, Type{Pkg.REPLMode.PkgCommand}}, Base.EltypeUnknown, Base.HasShape{1}})
89 precompile(Tuple{typeof(Base._compute_eltype), Type{Tuple{Array{String, 1}, LibGit2.CachedCredentials}}})
90 precompile(Tuple{typeof(Base._compute_eltype), Type{Tuple{Bool, LibGit2.CachedCredentials}}})
91 precompile(Tuple{typeof(Base._compute_eltype), Type{Tuple{Int32, Base.Cstring, Ptr{Nothing}}}})
92 precompile(Tuple{typeof(Base._deepcopy_array_t), Array{Base.Dict{String, Any}, 1}, Type{Base.Dict{String, Any}}, Base.IdDict{Any, Any}})
93 precompile(Tuple{typeof(Base._getindex), Base.IndexLinear, Base.BitArray{2}, Base.LogicalIndex{Int64, Base.BitArray{1}}, Int64})
94 precompile(Tuple{typeof(Base._iterate), Base.Dict{String, Any}, Int64})
95 precompile(Tuple{typeof(Base._promote_typejoin), Type{Any}, Type{Ptr{Nothing}}})
96 precompile(Tuple{typeof(Base._promote_typejoin), Type{Array{String, 1}}, Type{LibGit2.CachedCredentials}})
97 precompile(Tuple{typeof(Base._promote_typejoin), Type{Bool}, Type{LibGit2.CachedCredentials}})
98 precompile(Tuple{typeof(Base._promote_typejoin), Type{Int32}, Type{Base.Cstring}})
99 precompile(Tuple{typeof(Base._promote_typejoin), Type{Union{}}, Type{Array{String, 1}}})
100 precompile(Tuple{typeof(Base._promote_typejoin), Type{Union{}}, Type{Bool}})
101 precompile(Tuple{typeof(Base._promote_typejoin), Type{Union{}}, Type{Int32}})
102 precompile(Tuple{typeof(Base._shrink), typeof(Base.setdiff!), Array{Base.UUID, 1}, Tuple{Array{Base.UUID, 1}}})
103 precompile(Tuple{typeof(Base.add_sum), Int64, Int64})
104 precompile(Tuple{typeof(Base.afoldl), typeof(Base.:(+)), Int64, Int64, Int64})
105 precompile(Tuple{typeof(Base.all), Base.Generator{Base.ValueIterator{Base.Dict{String, Any}}, typeof(Pkg.TOML.is_tabular)}})
106 precompile(Tuple{typeof(Base.close), Base.Channel{Any}})
107 precompile(Tuple{typeof(Base.close), LibGit2.GitAnnotated})
108 precompile(Tuple{typeof(Base.close), LibGit2.GitConfig})
109 precompile(Tuple{typeof(Base.close), LibGit2.GitDiff})
110 precompile(Tuple{typeof(Base.close), LibGit2.GitReference})
111 precompile(Tuple{typeof(Base.close), LibGit2.GitRemote})
112 precompile(Tuple{typeof(Base.close), LibGit2.GitRepo})
113 precompile(Tuple{typeof(Base.close), LibGit2.GitTree})
114 precompile(Tuple{typeof(Base.cmd_gen), Tuple{Tuple{Base.Cmd}}})
115 precompile(Tuple{typeof(Base.collect), Base.Generator{Array{Any, 1}, typeof(Pkg.TOML.table2dict)}})
116 precompile(Tuple{typeof(Base.collect), Base.Generator{Base.ValueIterator{Base.Dict{String, Any}}, Type{Base.UUID}}})
117 precompile(Tuple{typeof(Base.collect), Base.Generator{Base.ValueIterator{Base.Dict{String, String}}, Type{Base.UUID}}})
118 precompile(Tuple{typeof(Base.collect), Base.KeySet{String, Base.Dict{String, Any}}})
119 precompile(Tuple{typeof(Base.collect_similar), Array{LibGit2.GitAnnotated, 1}, Base.Generator{Array{LibGit2.GitAnnotated, 1}, typeof(Base.close)}})
120 precompile(Tuple{typeof(Base.collect_to_with_first!), Array{Base.UUID, 1}, Base.UUID, Base.Generator{Base.ValueIterator{Base.Dict{String, Any}}, Type{Base.UUID}}, Int64})
121 precompile(Tuple{typeof(Base.collect_to_with_first!), Array{String, 1}, String, Base.Generator{Array{String, 1}, typeof(Pkg.REPLMode.word2token)}, Int64})
122 precompile(Tuple{typeof(Base.convert), Type{Array{Array{Base.BitArray{2}, 1}, 1}}, Array{Array{Base.BitArray{2}, 1}, 1}})
123 precompile(Tuple{typeof(Base.convert), Type{Array{Array{Base.VersionNumber, 1}, 1}}, Array{Array{Base.VersionNumber, 1}, 1}})
124 precompile(Tuple{typeof(Base.convert), Type{Array{Array{Int64, 1}, 1}}, Array{Array{Int64, 1}, 1}})
125 precompile(Tuple{typeof(Base.convert), Type{Array{Base.BitArray{1}, 1}}, Array{Base.BitArray{1}, 1}})
126 precompile(Tuple{typeof(Base.convert), Type{Array{Base.Dict{Base.VersionNumber, Int64}, 1}}, Array{Base.Dict{Base.VersionNumber, Int64}, 1}})
127 precompile(Tuple{typeof(Base.convert), Type{Array{Base.UUID, 1}}, Array{Base.UUID, 1}})
128 precompile(Tuple{typeof(Base.convert), Type{Array{Char, 1}}, Array{Char, 1}})
129 precompile(Tuple{typeof(Base.convert), Type{Array{Int64, 1}}, Array{Int64, 1}})
130 precompile(Tuple{typeof(Base.convert), Type{Array{Symbol, 1}}, Array{UInt8, 1}})
131 precompile(Tuple{typeof(Base.convert), Type{Array{Union{Pkg.Types.VersionRange, String, Pkg.REPLMode.Rev}, 1}}, Array{String, 1}})
132 precompile(Tuple{typeof(Base.convert), Type{Base.Dict{Base.UUID, Int64}}, Base.Dict{Base.UUID, Int64}})
133 precompile(Tuple{typeof(Base.convert), Type{Base.Dict{Base.UUID, Pkg.GraphType.ResolveLogEntry}}, Base.Dict{Base.UUID, Pkg.GraphType.ResolveLogEntry}})
134 precompile(Tuple{typeof(Base.convert), Type{Base.Dict{K, V} where V where K}, Base.Dict{Symbol, Any}})
135 precompile(Tuple{typeof(Base.convert), Type{Base.Dict{Symbol, Any}}, Base.Dict{Any, Any}})
136 precompile(Tuple{typeof(Base.convert), Type{Base.UUID}, Base.UUID})
137 precompile(Tuple{typeof(Base.convert), Type{REPL.LineEdit.TextInterface}, REPL.LineEdit.Prompt})
138 precompile(Tuple{typeof(Base.convert), Type{REPL.Terminals.AbstractTerminal}, REPL.Terminals.TTYTerminal})
139 precompile(Tuple{typeof(Base.convert), Type{REPL.Terminals.TextTerminal}, REPL.Terminals.TTYTerminal})
140 precompile(Tuple{typeof(Base.convert), Type{Union{Nothing, IO}}, Base.IOStream})
141 precompile(Tuple{typeof(Base.convert), Type{Union{Nothing, IO}}, Nothing})
142 precompile(Tuple{typeof(Base.convert), Type{Union{Nothing, REPL.LineEdit.Prompt}}, Nothing})
143 precompile(Tuple{typeof(Base.convert), Type{Union{Pkg.Types.UpgradeLevel, Base.VersionNumber, Pkg.Types.VersionSpec}}, Base.VersionNumber})
144 precompile(Tuple{typeof(Base.copy_chunks!), Array{UInt64, 1}, Int64, Array{UInt64, 1}, Int64, Int64})
145 precompile(Tuple{typeof(Base.count), Base.BitArray{1}})
146 precompile(Tuple{typeof(Base.deepcopy), Base.Dict{String, Any}})
147 precompile(Tuple{typeof(Base.deepcopy_internal), Array{Base.Dict{String, Any}, 1}, Base.IdDict{Any, Any}})
148 precompile(Tuple{typeof(Base.deepcopy_internal), Base.Dict{Any, Any}, Base.IdDict{Any, Any}})
149 precompile(Tuple{typeof(Base.deepcopy_internal), Base.Dict{String, Any}, Base.IdDict{Any, Any}})
150 precompile(Tuple{typeof(Base.deepcopy_internal), Base.Dict{String, String}, Base.IdDict{Any, Any}})
151 precompile(Tuple{typeof(Base.deepcopy_internal), String, Base.IdDict{Any, Any}})
152 precompile(Tuple{typeof(Base.delete!), Base.Dict{String, Any}, String})
153 precompile(Tuple{typeof(Base.delete!), Base.IdDict{Any, Any}, Symbol})
154 precompile(Tuple{typeof(Base.empty), Base.Dict{Any, Any}, Type{Base.UUID}, Type{Int64}})
155 precompile(Tuple{typeof(Base.empty), Base.Dict{Any, Any}, Type{String}, Type{Base.UUID}})
156 precompile(Tuple{typeof(Base.empty), Base.Dict{Any, Any}, Type{String}, Type{String}})
157 precompile(Tuple{typeof(Base.eof), Base.IOStream})
158 precompile(Tuple{typeof(Base.get!), Base.Dict{Base.UUID, Array{String, 1}}, Base.UUID, Array{String, 1}})
159 precompile(Tuple{typeof(Base.get!), Base.Dict{Pkg.Types.VersionRange, Base.Dict{String, Base.UUID}}, Pkg.Types.VersionRange, Base.Dict{String, Base.UUID}})
160 precompile(Tuple{typeof(Base.get!), Base.Dict{Pkg.Types.VersionRange, Base.Dict{String, Pkg.Types.VersionSpec}}, Pkg.Types.VersionRange, Base.Dict{String, Pkg.Types.VersionSpec}})
161 precompile(Tuple{typeof(Base.get!), Base.Dict{String, Any}, String, Array{Base.Dict{String, Any}, 1}})
162 precompile(Tuple{typeof(Base.get!), Base.Dict{String, Array{Base.UUID, 1}}, String, Array{Base.UUID, 1}})
163 precompile(Tuple{typeof(Base.get), Base.Dict{String, Any}, String, Base.Dict{Any, Any}})
164 precompile(Tuple{typeof(Base.get), Base.Dict{String, Pkg.REPLMode.CommandSpec}, String, Nothing})
165 precompile(Tuple{typeof(Base.getindex), Array{Array{Base.VersionNumber, 1}, 1}, Int64})
166 precompile(Tuple{typeof(Base.getindex), Array{Array{Int64, 1}, 1}, Int64})
167 precompile(Tuple{typeof(Base.getindex), Array{Array{UInt64, 1}, 1}, Int64})
168 precompile(Tuple{typeof(Base.getindex), Array{Base.BitArray{1}, 1}, Int64})
169 precompile(Tuple{typeof(Base.getindex), Array{Base.BitArray{2}, 1}, Int64})
170 precompile(Tuple{typeof(Base.getindex), Array{Base.Dict{Int64, Int64}, 1}, Int64})
171 precompile(Tuple{typeof(Base.getindex), Array{Base.Dict{String, Any}, 1}, Int64})
172 precompile(Tuple{typeof(Base.getindex), Array{Base.UUID, 1}, Int64})
173 precompile(Tuple{typeof(Base.getindex), Array{Base.VersionNumber, 1}, Base.BitArray{1}})
174 precompile(Tuple{typeof(Base.getindex), Array{Int64, 1}, Int64})
175 precompile(Tuple{typeof(Base.getindex), Base.BitArray{1}, Base.UnitRange{Int64}})
176 precompile(Tuple{typeof(Base.getindex), Base.BitArray{2}, Base.BitArray{1}, Base.BitArray{1}})
177 precompile(Tuple{typeof(Base.getindex), Base.Dict{Int64, Int64}, Int64})
178 precompile(Tuple{typeof(Base.getindex), Base.Dict{String, Base.UUID}, String})
179 precompile(Tuple{typeof(Base.getindex), Base.Dict{Symbol, Function}, Symbol})
180 precompile(Tuple{typeof(Base.getindex), NamedTuple{(:indent, :region_active), Tuple{Int64, Bool}}, Symbol})
181 precompile(Tuple{typeof(Base.getindex), NamedTuple{(:prompt_prefix, :prompt_suffix, :complete, :sticky), Tuple{String, String, Pkg.REPLMode.PkgCompletionProvider, Bool}}, Symbol})
182 precompile(Tuple{typeof(Base.getindex), NamedTuple{(:prompt_prefix, :prompt_suffix, :repl, :complete, :on_enter), Tuple{String, typeof(Base.input_color), REPL.LineEditREPL, REPL.REPLCompletionProvider, typeof(REPL.return_callback)}}, Symbol})
183 precompile(Tuple{typeof(Base.getindex), Pkg.TOML.Table, String})
184 precompile(Tuple{typeof(Base.getindex), Type{Pkg.Types.VersionRange}, Pkg.Pkg2.Pkg2Types.VersionInterval})
185 precompile(Tuple{typeof(Base.getproperty), Pkg.TOML.Table, Symbol})
186 precompile(Tuple{typeof(Base.getproperty), Pkg.Types.PackageSpec, Symbol})
187 precompile(Tuple{typeof(Base.getproperty), REPL.Terminals.TerminalBuffer, Symbol})
188 precompile(Tuple{typeof(Base.hash), Tuple{String, UInt64}, UInt64})
189 precompile(Tuple{typeof(Base.hash), Tuple{String}, UInt64})
190 precompile(Tuple{typeof(Base.haskey), Base.Dict{Base.UUID, Base.Dict{K, V} where V where K}, Base.UUID})
191 precompile(Tuple{typeof(Base.haskey), Base.Dict{String, Base.UUID}, String})
192 precompile(Tuple{typeof(Base.haskey), Base.Dict{String, Pkg.Types.VersionSpec}, String})
193 precompile(Tuple{typeof(Base.haskey), NamedTuple{(:indent, :region_active), Tuple{Int64, Bool}}, Symbol})
194 precompile(Tuple{typeof(Base.haskey), NamedTuple{(:prompt_prefix, :prompt_suffix, :complete, :sticky), Tuple{String, String, Pkg.REPLMode.PkgCompletionProvider, Bool}}, Symbol})
195 precompile(Tuple{typeof(Base.haskey), NamedTuple{(:prompt_prefix, :prompt_suffix, :repl, :complete, :on_enter), Tuple{String, typeof(Base.input_color), REPL.LineEditREPL, REPL.REPLCompletionProvider, typeof(REPL.return_callback)}}, Symbol})
196 precompile(Tuple{typeof(Base.haskey), Pkg.TOML.Table, String})
197 precompile(Tuple{typeof(Base.ident_cmp), Tuple{String, UInt64}, Tuple{String, UInt64}})
198 precompile(Tuple{typeof(Base.ident_cmp), Tuple{String}, Tuple{String}})
199 precompile(Tuple{typeof(Base.ident_cmp), Tuple{}, Tuple{}})
200 precompile(Tuple{typeof(Base.identity), Int64})
201 precompile(Tuple{typeof(Base.in), Base.UUID, Array{Base.UUID, 1}})
202 precompile(Tuple{typeof(Base.in), Base.VersionNumber, Pkg.Types.VersionSpec})
203 precompile(Tuple{typeof(Base.in), String, Array{String, 1}})
204 precompile(Tuple{typeof(Base.in), String, Base.KeySet{String, Base.Dict{String, Any}}})
205 precompile(Tuple{typeof(Base.in), String, Base.KeySet{String, Base.Dict{String, Base.Dict{String, Pkg.REPLMode.CommandSpec}}}})
206 precompile(Tuple{typeof(Base.indexed_iterate), Base.Pair{Any, Any}, Int64, Int64})
207 precompile(Tuple{typeof(Base.indexed_iterate), Base.Pair{Any, Any}, Int64})
208 precompile(Tuple{typeof(Base.indexed_iterate), Base.Pair{String, Any}, Int64, Int64})
209 precompile(Tuple{typeof(Base.indexed_iterate), Base.Pair{String, Any}, Int64})
210 precompile(Tuple{typeof(Base.indexed_iterate), Tuple{Char, Bool}, Int64, Int64})
211 precompile(Tuple{typeof(Base.indexed_iterate), Tuple{Char, Bool}, Int64})
212 precompile(Tuple{typeof(Base.indexed_iterate), Tuple{String, Array{String, 1}, Array{String, 1}}, Int64, Int64})
213 precompile(Tuple{typeof(Base.indexed_iterate), Tuple{String, Array{String, 1}, Array{String, 1}}, Int64})
214 precompile(Tuple{typeof(Base.input_color)})
215 precompile(Tuple{typeof(Base.invokelatest), typeof(Pkg.REPLMode.do_status!), Base.Dict{Symbol, Any}, Array{String, 1}, Base.Dict{Symbol, Any}})
216 precompile(Tuple{typeof(Base.isempty), Array{Base.Dict{String, Any}, 1}})
217 precompile(Tuple{typeof(Base.isempty), Array{Base.UUID, 1}})
218 precompile(Tuple{typeof(Base.isempty), Base.Dict{String, Any}})
219 precompile(Tuple{typeof(Base.isempty), Base.Dict{String, String}})
220 precompile(Tuple{typeof(Base.isempty), NamedTuple{(:mode,), Tuple{Symbol}}})
221 precompile(Tuple{typeof(Base.isopen), Base.Channel{Any}})
222 precompile(Tuple{typeof(Base.iterate), Array{Base.Dict{String, Any}, 1}, Int64})
223 precompile(Tuple{typeof(Base.iterate), Array{Base.Dict{String, Any}, 1}})
224 precompile(Tuple{typeof(Base.iterate), Array{Base.UUID, 1}, Int64})
225 precompile(Tuple{typeof(Base.iterate), Array{Base.UUID, 1}})
226 precompile(Tuple{typeof(Base.iterate), Base.Channel{Any}})
227 precompile(Tuple{typeof(Base.iterate), Base.Dict{Any, Any}, Int64})
228 precompile(Tuple{typeof(Base.iterate), Base.Dict{Any, Any}})
229 precompile(Tuple{typeof(Base.iterate), Base.Dict{String, Any}, Int64})
230 precompile(Tuple{typeof(Base.iterate), Base.Dict{String, Any}})
231 precompile(Tuple{typeof(Base.iterate), Tuple{Base.BitArray{1}}, Int64})
232 precompile(Tuple{typeof(Base.iterate), Tuple{Base.BitArray{1}}})
233 precompile(Tuple{typeof(Base.join), Base.GenericIOBuffer{Array{UInt8, 1}}, Tuple{String}, Char})
234 precompile(Tuple{typeof(Base.join), Base.GenericIOBuffer{Array{UInt8, 1}}, Tuple{Symbol, Symbol}, String})
235 precompile(Tuple{typeof(Base.join), Base.GenericIOBuffer{Array{UInt8, 1}}, Tuple{UInt32, UInt32, UInt32}, Char})
236 precompile(Tuple{typeof(Base.join), Base.GenericIOBuffer{Array{UInt8, 1}}, Tuple{UInt32, UInt32}, Char})
237 precompile(Tuple{typeof(Base.join), Tuple{Symbol, Symbol}, String})
238 precompile(Tuple{typeof(Base.keys), Base.Dict{String, Any}})
239 precompile(Tuple{typeof(Base.keys), Base.Dict{String, Base.Dict{String, Pkg.REPLMode.CommandSpec}}})
240 precompile(Tuple{typeof(Base.lastindex), Base.BitArray{1}})
241 precompile(Tuple{typeof(Base.length), Array{Array{Base.BitArray{2}, 1}, 1}})
242 precompile(Tuple{typeof(Base.length), Array{Array{Base.VersionNumber, 1}, 1}})
243 precompile(Tuple{typeof(Base.length), Array{Array{Int64, 1}, 1}})
244 precompile(Tuple{typeof(Base.length), Array{Base.BitArray{1}, 1}})
245 precompile(Tuple{typeof(Base.length), Array{Base.Dict{Base.VersionNumber, Int64}, 1}})
246 precompile(Tuple{typeof(Base.length), Array{Base.Dict{Int64, Int64}, 1}})
247 precompile(Tuple{typeof(Base.length), Array{Base.Dict{String, Any}, 1}})
248 precompile(Tuple{typeof(Base.length), Array{Base.UUID, 1}})
249 precompile(Tuple{typeof(Base.length), Array{Int64, 1}})
250 precompile(Tuple{typeof(Base.length), Base.BitArray{1}})
251 precompile(Tuple{typeof(Base.length), Base.Dict{Base.UUID, Int64}})
252 precompile(Tuple{typeof(Base.length), Base.Dict{Base.UUID, Pkg.GraphType.ResolveLogEntry}})
253 precompile(Tuple{typeof(Base.length), Base.Dict{String, Any}})
254 precompile(Tuple{typeof(Base.map), Type{Base.UUID}, Base.ValueIterator{Base.Dict{String, Any}}})
255 precompile(Tuple{typeof(Base.map), Type{Base.UUID}, Base.ValueIterator{Base.Dict{String, String}}})
256 precompile(Tuple{typeof(Base.map), typeof(Base.close), Array{LibGit2.GitAnnotated, 1}})
257 precompile(Tuple{typeof(Base.mapreduce_first), typeof(Base.identity), typeof(Base.add_sum), Int64})
258 precompile(Tuple{typeof(Base.match), Base.Regex, String})
259 precompile(Tuple{typeof(Base.merge!), Base.Dict{String, Any}, Base.Dict{String, Any}})
260 precompile(Tuple{typeof(Base.merge), Base.Dict{String, Any}, Base.Dict{String, String}})
261 precompile(Tuple{typeof(Base.merge), NamedTuple{(), Tuple{}}, Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}})
262 precompile(Tuple{typeof(Base.merge), NamedTuple{(), Tuple{}}, NamedTuple{(:mode,), Tuple{Symbol}}})
263 precompile(Tuple{typeof(Base.merge), NamedTuple{(:payload,), Tuple{Base.Dict{Symbol, Any}}}, NamedTuple{(:transfer_progress, :credentials), Tuple{Ptr{Nothing}, Ptr{Nothing}}}})
264 precompile(Tuple{typeof(Base.merge_names), Tuple{Symbol, Symbol, Symbol}, Tuple{Symbol}})
265 precompile(Tuple{typeof(Base.merge_names), Tuple{Symbol, Symbol}, Tuple{Symbol, Symbol}})
266 precompile(Tuple{typeof(Base.merge_names), Tuple{Symbol, Symbol}, Tuple{Symbol}})
267 precompile(Tuple{typeof(Base.merge_names), Tuple{Symbol}, Tuple{Symbol, Symbol}})
268 precompile(Tuple{typeof(Base.merge_names), Tuple{Symbol}, Tuple{Symbol}})
269 precompile(Tuple{typeof(Base.merge_names), Tuple{Symbol}, Tuple{}})
270 precompile(Tuple{typeof(Base.notify_error), Base.Channel{Any}, Base.InvalidStateException})
271 precompile(Tuple{typeof(Base.peek), Base.IOStream})
272 precompile(Tuple{typeof(Base.prepend!), Array{Base.Dict{Any, Any}, 1}, Array{Base.Dict{Any, Any}, 1}})
273 precompile(Tuple{typeof(Base.print), Base.GenericIOBuffer{Array{UInt8, 1}}, Base.SubString{String}})
274 precompile(Tuple{typeof(Base.print), Base.GenericIOBuffer{Array{UInt8, 1}}, Pkg.Types.VersionSpec})
275 precompile(Tuple{typeof(Base.print), Base.IOStream, String, String, String, Char})
276 precompile(Tuple{typeof(Base.print), Base.TTY, String, String, Char})
277 precompile(Tuple{typeof(Base.promote_eltype), Base.KeySet{Base.UUID, Base.Dict{Base.UUID, Pkg.Types.VersionSpec}}})
278 precompile(Tuple{typeof(Base.push!), Array{Base.UUID, 1}, Base.UUID})
279 precompile(Tuple{typeof(Base.push!), Array{Int64, 1}, Int64})
280 precompile(Tuple{typeof(Base.push!), Array{Pkg.Types.VersionRange, 1}, Pkg.Types.VersionRange})
281 precompile(Tuple{typeof(Base.push!), Array{Tuple{Base.UUID, String}, 1}, Tuple{Base.UUID, String}})
282 precompile(Tuple{typeof(Base.push!), Base.Set{Base.VersionNumber}, Base.VersionNumber})
283 precompile(Tuple{typeof(Base.push!), Base.Set{Symbol}, Symbol})
284 precompile(Tuple{typeof(Base.push!), Pkg.GraphType.ResolveLogEntry, Tuple{Nothing, String}})
285 precompile(Tuple{typeof(Base.push!), Pkg.GraphType.ResolveLogEntry, Tuple{Pkg.GraphType.ResolveLogEntry, String}})
286 precompile(Tuple{typeof(Base.put!), Base.Channel{Any}, Tuple{String, Array{String, 1}, Array{String, 1}}})
287 precompile(Tuple{typeof(Base.rethrow), Base.InvalidStateException})
288 precompile(Tuple{typeof(Base.rstrip), String})
289 precompile(Tuple{typeof(Base.seek), Base.IOStream, Int64})
290 precompile(Tuple{typeof(Base.setdiff!), Base.Set{Base.UUID}, Array{Base.UUID, 1}})
291 precompile(Tuple{typeof(Base.setindex!), Array{Base.BitArray{1}, 1}, Base.BitArray{1}, Int64})
292 precompile(Tuple{typeof(Base.setindex!), Base.BitArray{1}, Bool, Int64})
293 precompile(Tuple{typeof(Base.setindex!), Base.Dict{Base.UUID, Base.Dict{K, V} where V where K}, Base.Dict{String, Any}, Base.UUID})
294 precompile(Tuple{typeof(Base.setindex!), Base.Dict{Base.UUID, Int64}, Int64, Base.UUID})
295 precompile(Tuple{typeof(Base.setindex!), Base.Dict{Base.UUID, Pkg.Types.VersionSpec}, Pkg.Types.VersionSpec, Base.UUID})
296 precompile(Tuple{typeof(Base.setindex!), Base.Dict{Base.UUID, String}, String, Base.UUID})
297 precompile(Tuple{typeof(Base.setindex!), Base.Dict{Base.VersionNumber, Base.SHA1}, Base.SHA1, Base.VersionNumber})
298 precompile(Tuple{typeof(Base.setindex!), Base.Dict{Int64, Int64}, Int64, Int64})
299 precompile(Tuple{typeof(Base.setindex!), Base.Dict{String, Any}, Array{Any, 1}, String})
300 precompile(Tuple{typeof(Base.setindex!), Base.Dict{String, Any}, Array{Base.Dict{String, Any}, 1}, String})
301 precompile(Tuple{typeof(Base.setindex!), Base.Dict{String, Any}, Array{String, 1}, String})
302 precompile(Tuple{typeof(Base.setindex!), Base.Dict{String, Any}, Base.Dict{Any, Any}, String})
303 precompile(Tuple{typeof(Base.setindex!), Base.Dict{String, Any}, Base.Dict{String, String}, String})
304 precompile(Tuple{typeof(Base.setindex!), Base.Dict{String, Any}, Base.UUID, String})
305 precompile(Tuple{typeof(Base.setindex!), Base.Dict{String, Base.UUID}, Base.UUID, String})
306 precompile(Tuple{typeof(Base.setindex!), Base.Dict{String, Pkg.Types.VersionSpec}, Pkg.Types.VersionSpec, String})
307 precompile(Tuple{typeof(Base.setindex!), Base.Dict{Symbol, Any}, LibGit2.CredentialPayload, Symbol})
308 precompile(Tuple{typeof(Base.setindex!), Base.Dict{Symbol, Any}, Pkg.GitTools.MiniProgressBar, Symbol})
309 precompile(Tuple{typeof(Base.setindex!), Base.EnvDict, String, String})
310 precompile(Tuple{typeof(Base.setproperty!), Pkg.GraphType.Graph, Symbol, Array{Array{Base.BitArray{2}, 1}, 1}})
311 precompile(Tuple{typeof(Base.setproperty!), Pkg.GraphType.Graph, Symbol, Array{Array{Int64, 1}, 1}})
312 precompile(Tuple{typeof(Base.setproperty!), Pkg.GraphType.Graph, Symbol, Array{Base.BitArray{1}, 1}})
313 precompile(Tuple{typeof(Base.setproperty!), Pkg.GraphType.Graph, Symbol, Array{Int64, 1}})
314 precompile(Tuple{typeof(Base.setproperty!), Pkg.GraphType.GraphData, Symbol, Array{Array{Base.VersionNumber, 1}, 1}})
315 precompile(Tuple{typeof(Base.setproperty!), Pkg.GraphType.GraphData, Symbol, Array{Base.Dict{Base.VersionNumber, Int64}, 1}})
316 precompile(Tuple{typeof(Base.setproperty!), Pkg.GraphType.GraphData, Symbol, Array{Base.UUID, 1}})
317 precompile(Tuple{typeof(Base.setproperty!), Pkg.GraphType.GraphData, Symbol, Array{Int64, 1}})
318 precompile(Tuple{typeof(Base.setproperty!), Pkg.GraphType.GraphData, Symbol, Base.Dict{Base.UUID, Int64}})
319 precompile(Tuple{typeof(Base.setproperty!), Pkg.GraphType.ResolveLog, Symbol, Base.Dict{Base.UUID, Pkg.GraphType.ResolveLogEntry}})
320 precompile(Tuple{typeof(Base.setproperty!), Pkg.REPLMode.Statement, Symbol, Pkg.REPLMode.CommandSpec})
321 precompile(Tuple{typeof(Base.setproperty!), Pkg.Types.PackageSpec, Symbol, Base.UUID})
322 precompile(Tuple{typeof(Base.setproperty!), Pkg.Types.PackageSpec, Symbol, Base.VersionNumber})
323 precompile(Tuple{typeof(Base.setproperty!), Pkg.Types.PackageSpec, Symbol, String})
324 precompile(Tuple{typeof(Base.similar), Array{Base.Dict{String, Any}, 1}})
325 precompile(Tuple{typeof(Base.skip_deleted_floor!), Base.Dict{String, Any}})
326 precompile(Tuple{typeof(Base.string), String, Base.SubString{String}, String, String})
327 precompile(Tuple{typeof(Base.string), Symbol, Int64})
328 precompile(Tuple{typeof(Base.strip), Base.SubString{String}})
329 precompile(Tuple{typeof(Base.structdiff), NamedTuple{(:indent, :region_active), Tuple{Int64, Bool}}, Type{NamedTuple{(:indent, :region_active), T} where T<:Tuple}})
330 precompile(Tuple{typeof(Base.structdiff), NamedTuple{(:prompt_prefix, :prompt_suffix, :complete, :sticky), Tuple{String, String, Pkg.REPLMode.PkgCompletionProvider, Bool}}, Type{NamedTuple{(:prompt_prefix, :prompt_suffix, :keymap_dict, :repl, :complete, :on_enter, :on_done, :hist, :sticky), T} where T<:Tuple}})
331 precompile(Tuple{typeof(Base.structdiff), NamedTuple{(:prompt_prefix, :prompt_suffix, :repl, :complete, :on_enter), Tuple{String, typeof(Base.input_color), REPL.LineEditREPL, REPL.REPLCompletionProvider, typeof(REPL.return_callback)}}, Type{NamedTuple{(:prompt_prefix, :prompt_suffix, :keymap_dict, :repl, :complete, :on_enter, :on_done, :hist, :sticky), T} where T<:Tuple}})
332 precompile(Tuple{typeof(Base.sum), Array{Int64, 1}})
333 precompile(Tuple{typeof(Base.sym_in), Symbol, Tuple{Symbol, Symbol}})
334 precompile(Tuple{typeof(Base.sym_in), Symbol, Tuple{Symbol}})
335 precompile(Tuple{typeof(Base.sym_in), Symbol, Tuple{}})
336 precompile(Tuple{typeof(Base.to_indices), Base.BitArray{2}, Tuple{Base.OneTo{Int64}}, Tuple{Int64}})
337 precompile(Tuple{typeof(Base.trues), Int64})
338 precompile(Tuple{typeof(Base.union!), Base.Set{Base.UUID}, Base.KeySet{Base.UUID, Base.Dict{Base.UUID, Pkg.Types.Fixed}}})
339 precompile(Tuple{typeof(Base.union!), Base.Set{Base.UUID}, Base.KeySet{Base.UUID, Base.Dict{Base.UUID, Pkg.Types.VersionSpec}}})
340 precompile(Tuple{typeof(Base.unique!), Array{Base.UUID, 1}})
341 precompile(Tuple{typeof(Base.unique!), Array{String, 1}})
342 precompile(Tuple{typeof(Base.values), Base.Dict{String, Any}})
343 precompile(Tuple{typeof(Base.values), Base.Dict{String, String}})
344 precompile(Tuple{typeof(Base.vcat), Base.BitArray{1}, Base.BitArray{1}})
345 precompile(Tuple{typeof(Base.vcat), Base.BitArray{1}})
346 precompile(Tuple{typeof(Base.vcat), Base.BitArray{2}, Base.BitArray{2}, Base.BitArray{2}, Base.BitArray{2}})
347 precompile(Tuple{typeof(Base.vcat), Base.BitArray{2}, Base.BitArray{2}})
348 precompile(Tuple{typeof(Base.vect), Base.Cmd, Base.Cmd})
349 precompile(Tuple{typeof(Base.vect), Base.VersionNumber})
350 precompile(Tuple{typeof(Base.vect), Nothing})
351 precompile(Tuple{typeof(Base.write), Base.TTY, Array{UInt8, 1}})
352 precompile(Tuple{typeof(Base.write), REPL.Terminals.TTYTerminal, Array{UInt8, 1}})
353 precompile(Tuple{typeof(Core.Compiler.eltype), Type{Array{Base.BitArray{2}, 1}}})
354 precompile(Tuple{typeof(Core.Compiler.eltype), Type{Array{Base.KeySet{Base.UUID, Base.Dict{Base.UUID, Pkg.Types.VersionSpec}}, 1}}})
355 precompile(Tuple{typeof(Core.Compiler.eltype), Type{Array{Pkg.Pkg2.Pkg2Types.VersionInterval, 1}}})
356 precompile(Tuple{typeof(Core.Compiler.eltype), Type{Array{UInt32, 1}}})
357 precompile(Tuple{typeof(Core.Compiler.eltype), Type{Array{UInt8, 1}}})
358 precompile(Tuple{typeof(Core.Compiler.getindex), Tuple{Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, typeof(Base.invokelatest), Nothing}, Int64})
359 precompile(Tuple{typeof(Core.Compiler.getindex), Tuple{Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, typeof(Base.invokelatest), typeof(Pkg.REPLMode.do_help!)}, Int64})
360 precompile(Tuple{typeof(Core.Compiler.getindex), Tuple{Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, typeof(Base.open), typeof(Pkg.Pkg2.Reqs.read)}, Int64})
361 precompile(Tuple{typeof(Core.Compiler.getindex), Tuple{Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, typeof(Base.open), typeof(Pkg.TOML.parse)}, Int64})
362 precompile(Tuple{typeof(Core.Compiler.getindex), Tuple{Base.IteratorsMD.CartesianIndex{0}}, Int64})
363 precompile(Tuple{typeof(Core.Compiler.getindex), Tuple{Base.Missing, Int64}, Int64})
364 precompile(Tuple{typeof(Core.Compiler.getindex), Tuple{Base.Missing}, Int64})
365 precompile(Tuple{typeof(Core.Compiler.getindex), Tuple{Base.Val{1}, typeof(Base.cat_t), Union}, Int64})
366 precompile(Tuple{typeof(Core.Compiler.getindex), Tuple{Bool, typeof(Pkg.Types.parse_toml)}, Int64})
367 precompile(Tuple{typeof(Core.Compiler.getindex), Tuple{Int64, Tuple{Int64, Tuple{Int64, Tuple{Int64, Tuple{}}}}}, Int64})
368 precompile(Tuple{typeof(Core.Compiler.getindex), Tuple{NamedTuple{(:dims,), Tuple{Base.Val{1}}}, typeof(Base.cat_t), Union}, Int64})
369 precompile(Tuple{typeof(Core.Compiler.getindex), Tuple{Nothing, Int64, typeof(Base.sprint), typeof(Base.showerror)}, Int64})
370 precompile(Tuple{typeof(Core.Compiler.getindex), Tuple{Nothing, Int64, typeof(Base.sprint), typeof(Pkg.GraphType.showlog)}, Int64})
371 precompile(Tuple{typeof(Core.Compiler.getindex), Tuple{Pkg.REPLMode.CommandKind, Int64}, Int64})
372 precompile(Tuple{typeof(Core.Compiler.getindex), Tuple{typeof(Base.:(!))}, Int64})
373 precompile(Tuple{typeof(Core.Compiler.getindex), Tuple{typeof(Base.:(&))}, Int64})
374 precompile(Tuple{typeof(Core.Compiler.getindex), Tuple{typeof(Base.:(+))}, Int64})
375 precompile(Tuple{typeof(Core.Compiler.getindex), Tuple{typeof(Base.:(-))}, Int64})
376 precompile(Tuple{typeof(Core.Compiler.getindex), Tuple{typeof(Base.:(==))}, Int64})
377 precompile(Tuple{typeof(Core.Compiler.getindex), Tuple{typeof(Base.:(>))}, Int64})
378 precompile(Tuple{typeof(Core.Compiler.getindex), Tuple{typeof(Base.:(~))}, Int64})
379 precompile(Tuple{typeof(Core.Compiler.getindex), Tuple{typeof(Base.Unicode.lowercase)}, Int64})
380 precompile(Tuple{typeof(Core.Compiler.getindex), Tuple{typeof(Base.abs)}, Int64})
381 precompile(Tuple{typeof(Core.Compiler.getindex), Tuple{typeof(Base.first)}, Int64})
382 precompile(Tuple{typeof(Core.Compiler.getindex), Tuple{typeof(Base.identity)}, Int64})
383 precompile(Tuple{typeof(Core.Compiler.getindex), Tuple{typeof(Base.maximum)}, Int64})
384 precompile(Tuple{typeof(Core.Compiler.getindex), Tuple{typeof(Pkg.BinaryProvider.parse_tar_list)}, Int64})
385 precompile(Tuple{typeof(Pkg.Display.filter_manifest), Pkg.Display.InProject{Base.Dict{String, Any}}, Base.Dict{String, Any}})
386 precompile(Tuple{typeof(Pkg.Display.in_project), Base.Dict{String, Any}})
387 precompile(Tuple{typeof(Pkg.Display.manifest_diff), Pkg.Types.Context, Base.Dict{String, Any}, Base.Dict{String, Any}})
388 precompile(Tuple{typeof(Pkg.Display.name_ver_info), Base.Dict{String, Any}})
389 precompile(Tuple{typeof(Pkg.Display.not_in_project), Base.Dict{String, Any}})
390 precompile(Tuple{typeof(Pkg.Display.print_diff), Base.TTY, Pkg.Types.Context, Array{Pkg.Display.DiffEntry, 1}, Bool})
391 precompile(Tuple{typeof(Pkg.Operations.load_package_data_raw), Type{Base.UUID}, String})
392 precompile(Tuple{typeof(Pkg.REPLMode.do_add!), Base.Dict{Symbol, Any}, Array{Pkg.Types.PackageSpec, 1}, Base.Dict{Symbol, Any}})
393 precompile(Tuple{typeof(Pkg.REPLMode.do_status!), Base.Dict{Symbol, Any}, Array{String, 1}, Base.Dict{Symbol, Any}})
394 precompile(Tuple{typeof(Pkg.REPLMode.promptf)})
395 precompile(Tuple{typeof(Pkg.TOML.SOME), Array{String, 1}})
396 precompile(Tuple{typeof(Pkg.TOML.SOME), Pkg.TOML.Table})
397 precompile(Tuple{typeof(Pkg.TOML.insertpair), Pkg.TOML.Parser{Base.IOStream}, Pkg.TOML.Table, String, Array{String, 1}, Int64})
398 precompile(Tuple{typeof(Pkg.TOML.insertpair), Pkg.TOML.Parser{Base.IOStream}, Pkg.TOML.Table, String, Pkg.TOML.Table, Int64})
399 precompile(Tuple{typeof(Pkg.TOML.is_array_of_tables), Array{Base.Dict{String, Any}, 1}})
400 precompile(Tuple{typeof(Pkg.TOML.is_array_of_tables), Array{String, 1}})
401 precompile(Tuple{typeof(Pkg.TOML.is_array_of_tables), String})
402 precompile(Tuple{typeof(Pkg.TOML.is_tabular), Array{Base.Dict{String, Any}, 1}})
403 precompile(Tuple{typeof(Pkg.TOML.is_tabular), Array{String, 1}})
404 precompile(Tuple{typeof(Pkg.TOML.is_tabular), Base.Dict{String, Any}})
405 precompile(Tuple{typeof(Pkg.TOML.is_tabular), String})
406 precompile(Tuple{typeof(Pkg.TOML.parsefile), String})
407 precompile(Tuple{typeof(Pkg.Types.printpkgstyle), Base.TTY, Symbol, String})
408 precompile(Tuple{typeof(Pkg.Types.semver_interval), Base.RegexMatch})
409 precompile(Tuple{typeof(Pkg.Types.write_env_usage), String})
410 precompile(Tuple{typeof(REPL.LineEdit._clear_input_area), REPL.Terminals.TerminalBuffer, REPL.LineEdit.InputAreaState})
411 precompile(Tuple{typeof(REPL.LineEdit.add_history), REPL.REPLHistoryProvider, REPL.LineEdit.PromptState})
412 precompile(Tuple{typeof(REPL.LineEdit.clear_input_area), REPL.Terminals.TerminalBuffer, REPL.LineEdit.PromptState})
413 precompile(Tuple{typeof(REPL.LineEdit.edit_abort), REPL.LineEdit.MIState, Bool})
414 precompile(Tuple{typeof(REPL.LineEdit.edit_insert), REPL.LineEdit.MIState, String})
415 precompile(Tuple{typeof(REPL.LineEdit.edit_insert), REPL.LineEdit.PromptState, String})
416 precompile(Tuple{typeof(REPL.LineEdit.fixup_keymaps!), Base.Dict{Char, Any}, Int64, Char, Nothing})
417 precompile(Tuple{typeof(REPL.LineEdit.init_state), REPL.Terminals.TTYTerminal, REPL.LineEdit.Prompt})
418 precompile(Tuple{typeof(REPL.LineEdit.move_input_end), REPL.LineEdit.MIState})
419 precompile(Tuple{typeof(REPL.LineEdit.normalize_key), Int64})
420 precompile(Tuple{typeof(REPL.LineEdit.normalize_key), String})
421 precompile(Tuple{typeof(REPL.LineEdit.on_enter), REPL.LineEdit.MIState})
422 precompile(Tuple{typeof(REPL.LineEdit.postprocess!), Base.Dict{Char, Any}})
423 precompile(Tuple{typeof(REPL.LineEdit.prompt_string), String})
424 precompile(Tuple{typeof(REPL.LineEdit.push_undo), REPL.LineEdit.PromptState, Bool})
425 precompile(Tuple{typeof(REPL.LineEdit.refresh_line), REPL.LineEdit.PromptState, REPL.Terminals.TTYTerminal})
426 precompile(Tuple{typeof(REPL.LineEdit.refresh_multi_line), REPL.Terminals.TerminalBuffer, REPL.LineEdit.PromptState})
427 precompile(Tuple{typeof(REPL.LineEdit.state), REPL.LineEdit.MIState, REPL.LineEdit.Prompt})
428 precompile(Tuple{typeof(REPL.LineEdit.update_key_repeats), REPL.LineEdit.MIState, Array{Char, 1}})
429 precompile(Tuple{typeof(REPL.LineEdit.write_prompt), REPL.Terminals.TerminalBuffer, REPL.LineEdit.Prompt})
430 precompile(Tuple{typeof(REPL.LineEdit.write_prompt), REPL.Terminals.TerminalBuffer, String})
6565 # `2.3.4` can be joined with `2.3.5` etc.
6666
6767 function isjoinable(up::VersionBound, lo::VersionBound)
68 up.n == 0 && up.lo == 0 && return true
68 up.n == 0 && lo.n == 0 && return true
6969 if up.n == lo.n
7070 n = up.n
7171 for i = 1:(n - 1)
8787 @test_throws ErrorException semver_spec("^^0.2.3")
8888 @test_throws ErrorException semver_spec("^^0.2.3.4")
8989 @test_throws ErrorException semver_spec("0.0.0")
90
91 @test Pkg.Types.isjoinable(Pkg.Types.VersionBound((1,5)), Pkg.Types.VersionBound((1,6)))
92 @test !(Pkg.Types.isjoinable(Pkg.Types.VersionBound((1,5)), Pkg.Types.VersionBound((1,6,0))))
9093 end
9194
9295 # TODO: Should rewrite these tests not to rely on internals like field names
143146 # VersionRange
144147 Pkg.add(PackageSpec(TEST_PKG.name, VersionSpec(VersionRange("0.3.0-0.3.2"))))
145148 @test Pkg.API.__installed()[TEST_PKG.name] == v"0.3.2"
149 # Check that adding another packages doesn't upgrade other packages
150 Pkg.add("Test")
151 @test Pkg.API.__installed()[TEST_PKG.name] == v"0.3.2"
146152 Pkg.update(; level = UPLEVEL_PATCH)
147153 @test Pkg.API.__installed()[TEST_PKG.name] == v"0.3.3"
148154 Pkg.update(; level = UPLEVEL_MINOR)
152158
153159 @testset "testing" begin
154160 # TODO: Check that preview = true doesn't actually execute the test
155 # TODO: Test-only dependencies
156161 Pkg.add(TEST_PKG.name)
157162 Pkg.test(TEST_PKG.name; coverage=true)
158163 pkgdir = Base.locate_package(Base.PkgId(TEST_PKG.uuid, TEST_PKG.name))
250255 end
251256 end
252257 end
258 mktempdir() do devdir
259 withenv("JULIA_PKG_DEVDIR" => devdir) do
260 try
261 https_url = "https://github.com/JuliaLang/Example.jl.git"
262 ssh_url = "ssh://git@github.com/JuliaLang/Example.jl.git"
263 @test Pkg.GitTools.normalize_url(https_url) == https_url
264 Pkg.setprotocol!("ssh")
265 @test Pkg.GitTools.normalize_url(https_url) == ssh_url
266 # TODO: figure out how to test this without
267 # having to deploy a ssh key on github
268 #Pkg.develop("Example")
269 #@test isinstalled(TEST_PKG)
270 finally
271 Pkg.setprotocol!()
272 end
273 end
274 end
253275 end
254276
255277 @testset "check logging" begin
413435 end
414436 end
415437
438 temp_pkg_dir() do project_path; cd(project_path) do
439 @testset "instantiating updated repo" begin
440 tmp = mktempdir()
441 cd(tmp)
442 depo1 = mktempdir()
443 depo2 = mktempdir()
444
445 empty!(DEPOT_PATH)
446 pushfirst!(DEPOT_PATH, depo1)
447 LibGit2.close(LibGit2.clone("https://github.com/JuliaLang/Example.jl", "Example.jl"))
448 mkdir("machine1")
449 cd("machine1")
450 Pkg.activate(".")
451 Pkg.add(PackageSpec(path="../Example.jl"))
452 cd("..")
453 cp("machine1", "machine2")
454 empty!(DEPOT_PATH)
455 pushfirst!(DEPOT_PATH, depo2)
456 cd("machine2")
457 Pkg.activate(".")
458 Pkg.instantiate()
459 cd("..")
460 cd("Example.jl")
461 open("README.md", "a") do io
462 print(io, "Hello")
463 end
464 LibGit2.with(LibGit2.GitRepo(".")) do repo
465 LibGit2.add!(repo, "*")
466 LibGit2.commit(repo, "changes"; author=TEST_SIG, committer=TEST_SIG)
467 end
468 cd("../machine1")
469 empty!(DEPOT_PATH)
470 pushfirst!(DEPOT_PATH, depo1)
471 Pkg.activate(".")
472 Pkg.update()
473 cd("..")
474 cp("machine1/Manifest.toml", "machine2/Manifest.toml"; force=true)
475 cd("machine2")
476 empty!(DEPOT_PATH)
477 pushfirst!(DEPOT_PATH, depo2)
478 Pkg.activate(".")
479 Pkg.instantiate()
480 end
481 end end
482
416483 temp_pkg_dir() do project_path
417484 cd(project_path) do
418485 project = """
447514 end
448515 end
449516
517 @testset "printing of stdlib paths, issue #605" begin
518 path = Pkg.Types.stdlib_path("Test")
519 @test Pkg.Types.pathrepr(path) == "`@stdlib/Test`"
520 end
521
522
523 temp_pkg_dir() do project_path
524 @testset "Pkg.add should not mutate" begin
525 package_names = ["JSON"]
526 packages = PackageSpec.(package_names)
527 Pkg.add(packages)
528 @test [p.name for p in packages] == package_names
529 end
530 end
531
450532 include("repl.jl")
451533 include("api.jl")
452534
22 module REPLTests
33
44 using Pkg
5 using Pkg.Types: manifest_info, EnvCache
56 import Pkg.Types.PkgError
67 using UUIDs
78 using Test
89 import LibGit2
910
1011 include("utils.jl")
11
12 const TEST_SIG = LibGit2.Signature("TEST", "TEST@TEST.COM", round(time()), 0)
13 const TEST_PKG = (name = "Example", uuid = UUID("7876af07-990d-54b4-ab0e-23690620f79a"))
1412
1513 function git_init_package(tmp, path)
1614 base = basename(path)
6765 @test length(statement.arguments) == 1
6866 @test statement.arguments[1] == "dev"
6967 statement = Pkg.REPLMode.parse("add git@github.com:JuliaLang/Example.jl.git")[1]
70 @test "add" in statement.command.names
68 @test "add" == statement.command.canonical_name
7169 @test statement.arguments[1] == "git@github.com:JuliaLang/Example.jl.git"
7270 statement = Pkg.REPLMode.parse("add git@github.com:JuliaLang/Example.jl.git#master")[1]
73 @test "add" in statement.command.names
71 @test "add" == statement.command.canonical_name
7472 @test length(statement.arguments) == 2
7573 @test statement.arguments[1] == "git@github.com:JuliaLang/Example.jl.git"
7674 @test statement.arguments[2] == "#master"
7775 statement = Pkg.REPLMode.parse("add git@github.com:JuliaLang/Example.jl.git#c37b675")[1]
78 @test "add" in statement.command.names
76 @test "add" == statement.command.canonical_name
7977 @test length(statement.arguments) == 2
8078 @test statement.arguments[1] == "git@github.com:JuliaLang/Example.jl.git"
8179 @test statement.arguments[2] == "#c37b675"
8381 @test statement.arguments[1] == "git@github.com:JuliaLang/Example.jl.git"
8482 @test statement.arguments[2] == "@v0.5.0"
8583 statement = Pkg.REPLMode.parse("add git@gitlab-fsl.jsc.näsan.guvv:drats/URGA2010.jl.git@0.5.0")[1]
86 @test "add" in statement.command.names
84 @test "add" == statement.command.canonical_name
8785 @test length(statement.arguments) == 2
8886 @test statement.arguments[1] == "git@gitlab-fsl.jsc.näsan.guvv:drats/URGA2010.jl.git"
8987 @test statement.arguments[2] == "@0.5.0"
263261 pkg"activate Foo" # activate path Foo over deps Foo
264262 @test Base.active_project() == joinpath(path, "Foo", "Project.toml")
265263 pkg"activate ."
266 @test_logs (:info, r"new shared environment") pkg"activate --shared Foo" # activate shared Foo
264 @test_logs (:info, r"activating new environment at ") pkg"activate --shared Foo" # activate shared Foo
267265 @test Base.active_project() == joinpath(Pkg.envdir(), "Foo", "Project.toml")
268266 pkg"activate ."
269267 rm("Foo"; force=true, recursive=true)
270268 pkg"activate Foo" # activate path from developed Foo
271269 @test Base.active_project() == joinpath(path, "modules", "Foo", "Project.toml")
272270 pkg"activate ."
273 @test_logs (:info, r"new environment") pkg"activate ./Foo" # activate empty directory Foo (sidestep the developed Foo)
271 @test_logs (:info, r"activating new environment at ") pkg"activate ./Foo" # activate empty directory Foo (sidestep the developed Foo)
274272 @test Base.active_project() == joinpath(path, "Foo", "Project.toml")
275273 pkg"activate ."
276 @test_logs (:info, r"new environment") pkg"activate Bar" # activate empty directory Bar
274 @test_logs (:info, r"activating new environment at ") pkg"activate Bar" # activate empty directory Bar
277275 @test Base.active_project() == joinpath(path, "Bar", "Project.toml")
278276 pkg"activate ."
279277 pkg"add Example" # non-deved deps should not be activated
280 @test_logs (:info, r"new environment") pkg"activate Example"
278 @test_logs (:info, r"activating new environment at ") pkg"activate Example"
281279 @test Base.active_project() == joinpath(path, "Example", "Project.toml")
282280 pkg"activate ."
283281 cd(mkdir("tests"))
310308 @test manifest["SubModule"][1]["path"] == joinpath("..", "SubModule")
311309 end
312310
311 # path should not be relative when devdir() happens to be in project
312 # unless user used dev --local.
313 temp_pkg_dir() do depot
314 cd(mktempdir()) do
315 uuid = UUID("7876af07-990d-54b4-ab0e-23690620f79a") # Example
316 pkg"activate ."
317 withenv("JULIA_PKG_DEVDIR" => joinpath(pwd(), "dev")) do
318 pkg"dev Example"
319 @test manifest_info(EnvCache(), uuid)["path"] == joinpath(pwd(), "dev", "Example")
320 pkg"dev --shared Example"
321 @test manifest_info(EnvCache(), uuid)["path"] == joinpath(pwd(), "dev", "Example")
322 pkg"dev --local Example"
323 @test manifest_info(EnvCache(), uuid)["path"] == joinpath("dev", "Example")
324 end
325 end
326 end
327
328 # test relative dev paths (#490) without existing Project.toml
329 temp_pkg_dir() do depot
330 cd(mktempdir()) do
331 pkg"activate NonExistent"
332 withenv("USER" => "Test User") do
333 pkg"generate Foo"
334 end
335 # this dev should not error even if NonExistent/Project.toml file is non-existent
336 @test !isdir("NonExistent")
337 pkg"dev Foo"
338 manifest = Pkg.Types.Context().env.manifest
339 @test manifest["Foo"][1]["path"] == joinpath("..", "Foo")
340 end
341 end
342
313343 # develop with --shared and --local
314 using Pkg.Types: manifest_info, EnvCache
315344 cd(mktempdir()) do
316345 uuid = UUID("7876af07-990d-54b4-ab0e-23690620f79a") # Example
317346 pkg"activate ."
323352 @test manifest_info(EnvCache(), uuid)["path"] == joinpath("dev", "Example")
324353 end
325354
355 @testset "parse completions" begin
356 # meta options
357 @test Pkg.REPLMode.parse("--pre"; for_completions=true) == (:meta, "--pre", nothing, true)
358 @test Pkg.REPLMode.parse("--meta --pre"; for_completions=true) == (:meta, "--pre", nothing, true)
359 @test Pkg.REPLMode.parse("--meta -"; for_completions=true) == (:meta, "-", nothing, true)
360 @test Pkg.REPLMode.parse("--meta --"; for_completions=true) == (:meta, "--", nothing, true)
361 # commands
362 @test Pkg.REPLMode.parse("--preview"; for_completions=true) == (:cmd, "", nothing, true)
363 @test Pkg.REPLMode.parse("--preview ad"; for_completions=true) == (:cmd, "ad", nothing, true)
364 @test Pkg.REPLMode.parse("--meta --preview r"; for_completions=true) == (:cmd, "r", nothing, true)
365 @test Pkg.REPLMode.parse("--preview reg"; for_completions=true) == (:cmd, "reg", nothing, true)
366 # sub commands
367 @test Pkg.REPLMode.parse("--preview package"; for_completions=true) ==
368 (:sub, "", "package", true)
369 @test Pkg.REPLMode.parse("--preview package a"; for_completions=true) ==
370 (:sub, "a", "package", true)
371 # options
372 @test Pkg.REPLMode.parse("add -"; for_completions=true) ==
373 (:opt, "-", Pkg.REPLMode.super_specs["package"]["add"], true)
374 @test Pkg.REPLMode.parse("up --m"; for_completions=true) ==
375 (:opt, "--m", Pkg.REPLMode.super_specs["package"]["up"], true)
376 @test Pkg.REPLMode.parse("up --major --pro"; for_completions=true) ==
377 (:opt, "--pro", Pkg.REPLMode.super_specs["package"]["up"], true)
378 @test Pkg.REPLMode.parse("foo --maj"; for_completions=true) ===
379 nothing
380 # arguments
381 @test Pkg.REPLMode.parse("up --major Ex"; for_completions=true) ==
382 (:arg, "Ex", Pkg.REPLMode.super_specs["package"]["up"], true)
383 @test Pkg.REPLMode.parse("--preview up --major foo Ex"; for_completions=true) ==
384 (:arg, "Ex", Pkg.REPLMode.super_specs["package"]["up"], true)
385 @test Pkg.REPLMode.parse("remove --manifest Ex"; for_completions=true) ==
386 (:arg, "Ex", Pkg.REPLMode.super_specs["package"]["remove"], false)
387 end
388
326389 test_complete(s) = Pkg.REPLMode.completions(s,lastindex(s))
327390 apply_completion(str) = begin
328391 c, r, s = test_complete(str)
329 @test s == true
330392 str[1:prevind(str, first(r))]*first(c)
331393 end
332394
333395 # Autocompletions
334396 temp_pkg_dir() do project_path; cd(project_path) do
335 Pkg.Types.registries()
336 pkg"activate ."
337 c, r = test_complete("add Exam")
338 @test "Example" in c
339 c, r = test_complete("rm Exam")
340 @test isempty(c)
341 Pkg.REPLMode.pkgstr("develop $(joinpath(@__DIR__, "test_packages", "RequireDependency"))")
342
343 c, r = test_complete("rm RequireDep")
344 @test "RequireDependency" in c
345 c, r = test_complete("rm -p RequireDep")
346 @test "RequireDependency" in c
347 c, r = test_complete("rm --project RequireDep")
348 @test "RequireDependency" in c
349 c, r = test_complete("rm Exam")
350 @test isempty(c)
351 c, r = test_complete("rm -p Exam")
352 @test isempty(c)
353 c, r = test_complete("rm --project Exam")
354 @test isempty(c)
355
356 c, r = test_complete("rm -m RequireDep")
357 @test "RequireDependency" in c
358 c, r = test_complete("rm --manifest RequireDep")
359 @test "RequireDependency" in c
360 c, r = test_complete("rm -m Exam")
361 @test "Example" in c
362 c, r = test_complete("rm --manifest Exam")
363 @test "Example" in c
364
365 c, r = test_complete("rm RequireDep")
366 @test "RequireDependency" in c
367 c, r = test_complete("rm Exam")
368 @test isempty(c)
369 c, r = test_complete("rm -m Exam")
370 c, r = test_complete("rm -m Exam")
371 @test "Example" in c
372
373 pkg"add Example"
374 c, r = test_complete("rm Exam")
375 @test "Example" in c
376 c, r = test_complete("add --man")
377 @test "--manifest" in c
378 c, r = test_complete("rem")
379 @test "remove" in c
380 @test apply_completion("rm E") == "rm Example"
381 @test apply_completion("add Exampl") == "add Example"
382
383 c, r = test_complete("preview r")
384 @test "remove" in c
385 c, r = test_complete("help r")
386 @test "remove" in c
387 @test !("rm" in c)
388
389 c, r = test_complete("add REPL")
390 # Filtered by version
391 @test !("REPL" in c)
397 @testset "tab completion" begin
398 Pkg.Types.registries()
399 pkg"activate ."
400 c, r = test_complete("add Exam")
401 @test "Example" in c
402 c, r = test_complete("rm Exam")
403 @test isempty(c)
404 Pkg.REPLMode.pkgstr("develop $(joinpath(@__DIR__, "test_packages", "RequireDependency"))")
405
406 c, r = test_complete("rm RequireDep")
407 @test "RequireDependency" in c
408 c, r = test_complete("rm -p RequireDep")
409 @test "RequireDependency" in c
410 c, r = test_complete("rm --project RequireDep")
411 @test "RequireDependency" in c
412 c, r = test_complete("rm Exam")
413 @test isempty(c)
414 c, r = test_complete("rm -p Exam")
415 @test isempty(c)
416 c, r = test_complete("rm --project Exam")
417 @test isempty(c)
418
419 c, r = test_complete("rm -m RequireDep")
420 @test "RequireDependency" in c
421 c, r = test_complete("rm --manifest RequireDep")
422 @test "RequireDependency" in c
423 c, r = test_complete("rm -m Exam")
424 @test "Example" in c
425 c, r = test_complete("rm --manifest Exam")
426 @test "Example" in c
427
428 c, r = test_complete("rm RequireDep")
429 @test "RequireDependency" in c
430 c, r = test_complete("rm Exam")
431 @test isempty(c)
432 c, r = test_complete("rm -m Exam")
433 c, r = test_complete("rm -m Exam")
434 @test "Example" in c
435
436 pkg"add Example"
437 c, r = test_complete("rm Exam")
438 @test "Example" in c
439 c, r = test_complete("up --man")
440 @test "--manifest" in c
441 c, r = test_complete("rem")
442 @test "remove" in c
443 @test apply_completion("rm E") == "rm Example"
444 @test apply_completion("add Exampl") == "add Example"
445
446 c, r = test_complete("preview r")
447 @test "remove" in c
448 c, r = test_complete("help r")
449 @test "remove" in c
450 @test !("rm" in c)
451
452 c, r = test_complete("add REPL")
453 # Filtered by version
454 @test !("REPL" in c)
455
456 mkdir("testdir")
457 c, r = test_complete("add ")
458 @test Sys.iswindows() ? ("testdir\\\\" in c) : ("testdir/" in c)
459 @test "Example" in c
460 @test apply_completion("add tes") == (Sys.iswindows() ? "add testdir\\\\" : "add testdir/")
461 @test apply_completion("add ./tes") == (Sys.iswindows() ? "add ./testdir\\\\" : "add ./testdir/")
462 c, r = test_complete("dev ./")
463 @test (Sys.iswindows() ? ("testdir\\\\" in c) : ("testdir/" in c))
464 # dont complete files
465 touch("README.md")
466 c, r = test_complete("add RE")
467 @test !("README.md" in c)
468 end # testset
392469 end end
393470
394471 temp_pkg_dir() do project_path; cd(project_path) do
420497 print(io, """
421498
422499 [compat]
423 JSON = "0.16.0"
500 JSON = "0.18.0"
424501 """
425502 )
426503 end
427504 pkg"up"
428 @test Pkg.API.installed()["JSON"].minor == 16
505 @test Pkg.API.installed()["JSON"].minor == 18
429506 write("Project.toml", old_project)
430507 pkg"up"
431508 @test Pkg.API.installed()["JSON"] == current_json
819896 @test_throws PkgError Pkg.REPLMode.pkgstr("--foo=foo add Example")
820897 @test_throws PkgError Pkg.REPLMode.pkgstr("--bar add Example")
821898 @test_throws PkgError Pkg.REPLMode.pkgstr("-x add Example")
822 # malformed, but registered meta option
823899 @test_throws PkgError Pkg.REPLMode.pkgstr("--env Example")
824900 end end end
825901 end
841917 Pkg.REPLMode.pkg"package add Example"
842918 @test isinstalled(TEST_PKG)
843919 Pkg.REPLMode.pkg"package rm Example"
920 @test !isinstalled(TEST_PKG)
921 end end end
922 end
923
924 @testset "preview" begin
925 temp_pkg_dir() do project_path; cd_tempdir() do tmpdir; with_temp_env() do;
926 pkg"add Example"
927 pkg"preview rm Example"
928 @test isinstalled(TEST_PKG)
929 pkg"rm Example"
930 pkg"preview add Example"
931 @test !isinstalled(TEST_PKG)
932 # as a meta option
933 pkg"add Example"
934 pkg"--preview rm Example"
935 @test isinstalled(TEST_PKG)
936 pkg"rm Example"
937 pkg"--preview add Example"
938 @test !isinstalled(TEST_PKG)
939 # both
940 pkg"--preview preview add Example"
844941 @test !isinstalled(TEST_PKG)
845942 end end end
846943 end
1414 empty!(DEPOT_PATH)
1515 Base.HOME_PROJECT[] = nothing
1616 Base.ACTIVE_PROJECT[] = nothing
17 mktempdir() do env_dir
18 mktempdir() do depot_dir
19 push!(LOAD_PATH, "@", "@v#.#", "@stdlib")
20 push!(DEPOT_PATH, depot_dir)
21 fn(env_dir)
17 withenv("JULIA_PROJECT" => nothing, "JULIA_LOAD_PATH" => nothing) do
18 mktempdir() do env_dir
19 mktempdir() do depot_dir
20 push!(LOAD_PATH, "@", "@v#.#", "@stdlib")
21 push!(DEPOT_PATH, depot_dir)
22 fn(env_dir)
23 end
2224 end
2325 end
2426 finally
7981 Pkg.activate()
8082 end
8183 end
84
85 import LibGit2
86 using UUIDs
87 const TEST_SIG = LibGit2.Signature("TEST", "TEST@TEST.COM", round(time()), 0)
88 const TEST_PKG = (name = "Example", uuid = UUID("7876af07-990d-54b4-ab0e-23690620f79a"))
55 shell modes. The REPL can be started by simply calling `julia` with no arguments or double-clicking
66 on the executable:
77
8 ```
9 $ julia
10 _
11 _ _ _(_)_ | A fresh approach to technical computing
12 (_) | (_) (_) | Documentation: https://docs.julialang.org
13 _ _ _| |_ __ _ | Type "?help" for help.
14 | | | | | | |/ _` | |
15 | | |_| | | | (_| | | Version 0.6.0-dev.2493 (2017-01-31 18:53 UTC)
16 _/ |\__'_|_|_|\__'_| | Commit c99e12c* (0 days old master)
17 |__/ | x86_64-linux-gnu
18
19 julia>
8 ```@eval
9 io = IOBuffer()
10 Base.banner(io)
11 banner = String(take!(io))
12 import Markdown
13 Markdown.parse("```\n\$ julia\n\n$(banner)\njulia>\n```")
2014 ```
2115
2216 To exit the interactive session, type `^D` -- the control key together with the `d` key on a blank
23 line -- or type `quit()` followed by the return or enter key. The REPL greets you with a banner
17 line -- or type `exit()` followed by the return or enter key. The REPL greets you with a banner
2418 and a `julia>` prompt.
2519
2620 ## The different prompt modes
345345 partial = beforecursor(s.input_buffer)
346346 full = LineEdit.input_string(s)
347347 ret, range, should_complete = completions(full, lastindex(partial))
348 return map(completion_text, ret), partial[range], should_complete
348 return unique!(map(completion_text, ret)), partial[range], should_complete
349349 end
350350
351351 function complete_line(c::ShellCompletionProvider, s)
353353 partial = beforecursor(s.input_buffer)
354354 full = LineEdit.input_string(s)
355355 ret, range, should_complete = shell_completions(full, lastindex(partial))
356 return map(completion_text, ret), partial[range], should_complete
356 return unique!(map(completion_text, ret)), partial[range], should_complete
357357 end
358358
359359 function complete_line(c::LatexCompletions, s)
360360 partial = beforecursor(LineEdit.buffer(s))
361361 full = LineEdit.input_string(s)
362362 ret, range, should_complete = bslash_completions(full, lastindex(partial))[2]
363 return map(completion_text, ret), partial[range], should_complete
363 return unique!(map(completion_text, ret)), partial[range], should_complete
364364 end
365365
366366 mutable struct REPLHistoryProvider <: HistoryProvider
119119 cmove_line_down(t::UnixTerminal, n) = (cmove_down(t, n); cmove_col(t, 1))
120120 cmove_col(t::UnixTerminal, n) = (write(t.out_stream, '\r'); n > 1 && cmove_right(t, n-1))
121121
122 const is_precompiling = Ref(false)
122123 if Sys.iswindows()
123124 function raw!(t::TTYTerminal,raw::Bool)
125 is_precompiling[] && return true
124126 check_open(t.in_stream)
125127 if Base.ispty(t.in_stream)
126128 run((raw ? `stty raw -echo onlcr -ocrnl opost` : `stty sane`),
9999 @test "CompletionFoo" in c
100100 @test isempty(r)
101101 @test s[r] == ""
102 end
103
104 let s = "using REP"
105 c, r = test_complete(s)
106 @test count(isequal("REPL"), c) == 1
102107 end
103108
104109 let s = "Comp"
2222 shuffle, shuffle!,
2323 randperm, randperm!,
2424 randcycle, randcycle!,
25 AbstractRNG, MersenneTwister, RandomDevice,
26 randjump
27
25 AbstractRNG, MersenneTwister, RandomDevice
2826
2927 ## general definitions
3028
120120 end
121121
122122 """
123 randsubseq!(S, A, p)
123 randsubseq!([rng=GLOBAL_RNG,] S, A, p)
124124
125125 Like [`randsubseq`](@ref), but the results are stored in `S`
126126 (which is resized as needed).
127
128 # Examples
129 ```jldoctest
130 julia> rng = MersenneTwister(1234);
131
132 julia> S = Int64[];
133
134 julia> randsubseq!(rng, S, collect(1:8), 0.3);
135
136 julia> S
137 2-element Array{Int64,1}:
138 7
139 8
140 ```
127141 """
128142 randsubseq!(S::AbstractArray, A::AbstractArray, p::Real) = randsubseq!(GLOBAL_RNG, S, A, p)
129143
131145 randsubseq!(r, T[], A, p)
132146
133147 """
134 randsubseq(A, p) -> Vector
148 randsubseq([rng=GLOBAL_RNG,] A, p) -> Vector
135149
136150 Return a vector consisting of a random subsequence of the given array `A`, where each
137151 element of `A` is included (in order) with independent probability `p`. (Complexity is
138152 linear in `p*length(A)`, so this function is efficient even if `p` is small and `A` is
139153 large.) Technically, this process is known as "Bernoulli sampling" of `A`.
154
155 # Examples
156 ```jldoctest
157 julia> rng = MersenneTwister(1234);
158
159 julia> randsubseq(rng, collect(1:8), 0.3)
160 2-element Array{Int64,1}:
161 7
162 8
163 ```
140164 """
141165 randsubseq(A::AbstractArray, p::Real) = randsubseq(GLOBAL_RNG, A, p)
142166
181205 function shuffle!(r::AbstractRNG, a::AbstractArray)
182206 @assert !has_offset_axes(a)
183207 n = length(a)
208 n <= 1 && return a # nextpow below won't work with n == 0
184209 @assert n <= Int64(2)^52
185210 mask = nextpow(2, n) - 1
186211 for i = n:-1:2
685685 @test Random.gentype(Random.UInt52(UInt128)) == UInt128
686686 @test Random.gentype(Random.UInt104()) == UInt128
687687 end
688
689 @testset "shuffle[!]" begin
690 a = []
691 @test shuffle(a) == a # issue #28727
692 @test shuffle!(a) === a
693 a = rand(Int, 1)
694 @test shuffle(a) == a
695 end
66
77 [extras]
88 Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
9 InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
910
1011 [targets]
11 test = ["Test"]
12 test = ["Test", "InteractiveUtils"]
967967 end
968968
969969 # multiply by diagonal matrix as vector
970 function mul!(C::SparseMatrixCSC, A::SparseMatrixCSC, D::Diagonal{<:Vector})
970 function mul!(C::SparseMatrixCSC, A::SparseMatrixCSC, D::Diagonal{T, <:Vector}) where T
971971 m, n = size(A)
972972 b = D.diag
973973 (n==length(b) && size(A)==size(C)) || throw(DimensionMismatch())
981981 C
982982 end
983983
984 function mul!(C::SparseMatrixCSC, D::Diagonal{<:Vector}, A::SparseMatrixCSC)
984 function mul!(C::SparseMatrixCSC, D::Diagonal{T, <:Vector}, A::SparseMatrixCSC) where T
985985 m, n = size(A)
986986 b = D.diag
987987 (m==length(b) && size(A)==size(C)) || throw(DimensionMismatch())
355355
356356
357357 # converting between SparseMatrixCSC types
358 SparseMatrixCSC(S::SparseMatrixCSC) = copy(S)
358359 AbstractMatrix{Tv}(A::SparseMatrixCSC) where {Tv} = SparseMatrixCSC{Tv}(A)
359360 SparseMatrixCSC{Tv}(S::SparseMatrixCSC{Tv}) where {Tv} = copy(S)
360361 SparseMatrixCSC{Tv}(S::SparseMatrixCSC) where {Tv} = SparseMatrixCSC{Tv,eltype(S.colptr)}(S)
399400 end
400401 SparseMatrixCSC(M::Adjoint{<:Any,<:SparseMatrixCSC}) = copy(M)
401402 SparseMatrixCSC(M::Transpose{<:Any,<:SparseMatrixCSC}) = copy(M)
403 SparseMatrixCSC{Tv}(M::Adjoint{Tv,SparseMatrixCSC{Tv}}) where {Tv} = copy(M)
404 SparseMatrixCSC{Tv}(M::Transpose{Tv,SparseMatrixCSC{Tv}}) where {Tv} = copy(M)
405 SparseMatrixCSC{Tv,Ti}(M::Adjoint{Tv,SparseMatrixCSC{Tv,Ti}}) where {Tv,Ti} = copy(M)
406 SparseMatrixCSC{Tv,Ti}(M::Transpose{Tv,SparseMatrixCSC{Tv,Ti}}) where {Tv,Ti} = copy(M)
407
408 # converting from adjoint or transpose sparse matrices to sparse matrices with different eltype
409 SparseMatrixCSC{Tv}(M::Adjoint{<:Any,SparseMatrixCSC}) where {Tv} = SparseMatrixCSC{Tv}(copy(M))
410 SparseMatrixCSC{Tv}(M::Transpose{<:Any,SparseMatrixCSC}) where {Tv} = SparseMatrixCSC{Tv}(copy(M))
411 SparseMatrixCSC{Tv,Ti}(M::Adjoint{<:Any,SparseMatrixCSC}) where {Tv,Ti} = SparseMatrixCSC{Tv,Ti}(copy(M))
412 SparseMatrixCSC{Tv,Ti}(M::Transpose{<:Any,SparseMatrixCSC}) where {Tv,Ti} = SparseMatrixCSC{Tv,Ti}(copy(M))
402413
403414 # converting from SparseMatrixCSC to other matrix types
404415 function Matrix(S::SparseMatrixCSC{Tv}) where Tv
77 using Base.Printf: @printf
88 using Random
99 using Test: guardseed
10 using InteractiveUtils: @which
1011
1112 @testset "issparse" begin
1213 @test issparse(sparse(fill(1,5,5)))
22882289 @test adjoint(MC) == copy(adjoint(SC))
22892290 end
22902291
2292 @testset "Issue #28634" begin
2293 a = SparseMatrixCSC{Int8, Int16}([1 2; 3 4])
2294 na = SparseMatrixCSC(a)
2295 @test typeof(a) === typeof(na)
2296 end
2297
2298 #PR #29045
2299 @testset "Issue #28934" begin
2300 A = sprand(5,5,0.5)
2301 D = Diagonal(rand(5))
2302 C = copy(A)
2303 m1 = @which mul!(C,A,D)
2304 m2 = @which mul!(C,D,A)
2305 @test m1.module == SparseArrays
2306 @test m2.module == SparseArrays
2307 end
2308
22912309 end # module
247247 Compute the sample variance of a collection `v` with known mean(s) `m`,
248248 optionally over the given dimensions. `m` may contain means for each dimension of
249249 `v`. If `corrected` is `true`, then the sum is scaled with `n-1`,
250 whereas the sum is scaled with `n` if `corrected` is `false` where `n = length(x)`.
250 whereas the sum is scaled with `n` if `corrected` is `false` where `n = length(v)`.
251251
252252 !!! note
253253 If array contains `NaN` or [`missing`](@ref) values, the result is also
277277 under the assumption that each entry of `v` is an IID drawn from that generative
278278 distribution. This computation is equivalent to calculating `sum(abs2, v - mean(v)) /
279279 (length(v) - 1)`. If `corrected` is `true`, then the sum is scaled with `n-1`,
280 whereas the sum is scaled with `n` if `corrected` is `false` where `n = length(x)`.
280 whereas the sum is scaled with `n` if `corrected` is `false` where `n = length(v)`.
281281 The mean `mean` over the region may be provided.
282282
283283 !!! note
344344 distribution. This computation is equivalent to calculating `sqrt(sum((v - mean(v)).^2) /
345345 (length(v) - 1))`. A pre-computed `mean` may be provided. If `corrected` is `true`,
346346 then the sum is scaled with `n-1`, whereas the sum is scaled with `n` if `corrected` is
347 `false` where `n = length(x)`.
347 `false` where `n = length(v)`.
348348
349349 !!! note
350350 If array contains `NaN` or [`missing`](@ref) values, the result is also
375375 Compute the sample standard deviation of a vector `v`
376376 with known mean `m`. If `corrected` is `true`,
377377 then the sum is scaled with `n-1`, whereas the sum is
378 scaled with `n` if `corrected` is `false` where `n = length(x)`.
378 scaled with `n` if `corrected` is `false` where `n = length(v)`.
379379
380380 !!! note
381381 If array contains `NaN` or [`missing`](@ref) values, the result is also
881881 `itr` can be assumed to be sorted.
882882
883883 Quantiles are computed via linear interpolation between the points `((k-1)/(n-1), v[k])`,
884 for `k = 1:n` where `n = length(v)`. This corresponds to Definition 7 of Hyndman and Fan
884 for `k = 1:n` where `n = length(itr)`. This corresponds to Definition 7 of Hyndman and Fan
885885 (1996), and is the same as the R default.
886886
887887 !!! note
272272 pop!(need_to_handle_undef_sparam, first(methods(Core.Compiler.same_names)))
273273 pop!(need_to_handle_undef_sparam, which(Core.Compiler.convert, (Type{Union{Core.Compiler.Some{T}, Nothing}} where T, Core.Compiler.Some)))
274274 pop!(need_to_handle_undef_sparam, which(Core.Compiler.convert, (Type{Union{T, Nothing}} where T, Core.Compiler.Some)))
275 pop!(need_to_handle_undef_sparam, which(Core.Compiler.convert, Tuple{Type{Tuple{Vararg{Int}}}, Tuple{}}))
276 pop!(need_to_handle_undef_sparam, which(Core.Compiler.convert, Tuple{Type{Tuple{Vararg{Int}}}, Tuple{Int8}}))
275277 @test need_to_handle_undef_sparam == Set()
276278 end
277279 let need_to_handle_undef_sparam =
294296 pop!(need_to_handle_undef_sparam, which(Base.nonmissingtype, Tuple{Type{Union{Missing, T}} where T}))
295297 pop!(need_to_handle_undef_sparam, which(Base.convert, (Type{Union{Some{T}, Nothing}} where T, Some)))
296298 pop!(need_to_handle_undef_sparam, which(Base.convert, (Type{Union{T, Nothing}} where T, Some)))
299 pop!(need_to_handle_undef_sparam, which(Base.convert, Tuple{Type{Tuple{Vararg{Int}}}, Tuple{}}))
300 pop!(need_to_handle_undef_sparam, which(Base.convert, Tuple{Type{Tuple{Vararg{Int}}}, Tuple{Int8}}))
297301 @test need_to_handle_undef_sparam == Set()
298302 end
299303 end
400400
401401 # Issue #24298
402402 @test mod(BigInt(6), UInt(5)) == mod(6, 5)
403
404 @testset "cmp has values in [-1, 0, 1], issue #28780" begin
405 # _rand produces values whose log2 is better distributed than rand
406 _rand(::Type{BigInt}, n=1000) = let x = big(2)^rand(1:rand(1:n))
407 rand(-x:x)
408 end
409 _rand(F::Type{<:AbstractFloat}) = F(_rand(BigInt, round(Int, log2(floatmax(F))))) + rand(F)
410 _rand(T) = rand(T)
411 for T in (Base.BitInteger_types..., BigInt, Float64, Float32, Float16)
412 @test cmp(big(2)^130, one(T)) === 1
413 @test cmp(-big(2)^130, one(T)) === -1
414 c = cmp(_rand(BigInt), _rand(T))
415 @test c ∈ (-1, 0, 1)
416 @test c isa Int
417 (T <: Integer && T !== BigInt) || continue
418 x = rand(T)
419 @test cmp(big(2)^130, x) === cmp(x, -big(2)^130) === 1
420 @test cmp(-big(2)^130, x) === cmp(x, big(2)^130) === -1
421 @test cmp(big(x), x) === cmp(x, big(x)) === 0
422 end
423 c = cmp(_rand(BigInt), _rand(BigInt))
424 @test c ∈ (-1, 0, 1)
425 @test c isa Int
426 end
19761976 e[1]
19771977 end
19781978 @test bar28444() == 1
1979
1980 # issue #28641
1981 struct VoxelIndices{T <: Integer}
1982 voxCrnrPos::NTuple{8,NTuple{3,T}}
1983 voxEdgeCrnrs::NTuple{19, NTuple{2,T}}
1984 voxEdgeDir::NTuple{19,T}
1985 voxEdgeIx::NTuple{8,NTuple{8,T}}
1986 subTets::NTuple{6,NTuple{4,T}}
1987 tetEdgeCrnrs::NTuple{6,NTuple{2,T}}
1988 tetTri::NTuple{16,NTuple{6,T}}
1989 end
1990 f28641(x::VoxelIndices, f) = getfield(x, f)
1991 @test Base.return_types(f28641, (Any,Symbol)) == Any[Tuple]
1992
1993 # issue #29036
1994 function f29036(s, i)
1995 val, i = iterate(s, i)
1996 val
1997 end
1998 @test Base.return_types(f29036, (String, Int)) == Any[Char]
139139 # typejoin with Vararg{T,N}
140140 @test typejoin(Tuple{Vararg{Int,2}}, Tuple{Int,Int,Int}) === Tuple{Int,Int,Vararg{Int}}
141141 @test typejoin(Tuple{Vararg{Int,2}}, Tuple{Vararg{Int}}) === Tuple{Vararg{Int}}
142
143 @test typejoin(NTuple{3,Tuple}, NTuple{2,T} where T) == Tuple{Any,Any,Vararg{Tuple}}
142144
143145 # issue #26321
144146 struct T26321{N,S<:NTuple{N}}
32533255 @test forouter() == 3
32543256 end
32553257
3256 @test_throws ErrorException("syntax: no outer variable declaration exists for \"for outer\"") @eval function f()
3258 @test_throws ErrorException("syntax: no outer local variable declaration exists for \"for outer\"") @eval function f()
32573259 for outer i = 1:2
32583260 end
32593261 end
66946696 true
66956697 end
66966698 @test repackage28445()
6699
6700 # issue #28597
6701 @test_throws ErrorException Array{Int, 2}(undef, 0, -10)
6702 @test_throws ErrorException Array{Int, 2}(undef, -10, 0)
6703 @test_throws ErrorException Array{Int, 2}(undef, -1, -1)
6704
6705 # issue #29145
6706 struct T29145{A,B}
6707 function T29145()
6708 new{S,Ref{S}}() where S
6709 end
6710 end
6711 @test_throws TypeError T29145()
6712
6713 # issue #29175
6714 function f29175(tuple::T) where {T<:Tuple}
6715 prefix::Tuple{T.parameters[1:end-1]...} = tuple[1:length(T.parameters)-1]
6716 x = prefix
6717 prefix = x # force another conversion to declared type
6718 return prefix
6719 end
6720 @test f29175((1,2,3)) === (1,2)
11201120
11211121 @test docstrings_equal(@doc(A_20087()), doc"a")
11221122
1123 struct B_20087 end
1124
1125 """b"""
1126 (::B_20087)() = a
1127
1128 @test docstrings_equal(@doc(B_20087()), doc"b")
1129
11231130 # issue #27832
11241131
11251132 _last_atdoc = Core.atdoc
7676 @test Int(_neg4) === -4
7777 @test Int(_neg3) === -3
7878
79 @test_throws ArgumentError("invalid value for Enum Test1, _zerofp = 0.0=0.0; values must be integers") @macrocall(@enum Test1 _zerofp=0.0)
80 @test_throws ArgumentError("invalid value for Enum Test11, _zerofp2 = 0.5=0.5; values must be integers") @macrocall(@enum Test11 _zerofp2=0.5)
79 @test_throws ArgumentError("invalid value for Enum Test1, _zerofp = 0.0; values must be integers") @macrocall(@enum Test1 _zerofp=0.0)
80 @test_throws ArgumentError("invalid value for Enum Test11, _zerofp2 = 0.5; values must be integers") @macrocall(@enum Test11 _zerofp2=0.5)
8181 @enum Test111 _zerobi=BigInt(1)
8282 @test Integer(_zerobi) == 1
8383
106106 @test typeof(Integer(_one_Test6)) == UInt128
107107
108108 # enum values must be integers
109 @test_throws ArgumentError("invalid value for Enum Test7, _zero = \"zero\"=zero; values must be integers") @macrocall(@enum Test7 _zero="zero")
110 @test_throws ArgumentError("invalid value for Enum Test8, _zero = '0'=0; values must be integers") @macrocall(@enum Test8 _zero='0')
111 @test_throws ArgumentError("invalid value for Enum Test9, _zero = 0.5=0.5; values must be integers") @macrocall(@enum Test9 _zero=0.5)
109 @test_throws ArgumentError("invalid value for Enum Test7, _zero = \"zero\"; values must be integers") @macrocall(@enum Test7 _zero="zero")
110 @test_throws ArgumentError("invalid value for Enum Test8, _zero = '0'; values must be integers") @macrocall(@enum Test8 _zero='0')
111 @test_throws ArgumentError("invalid value for Enum Test9, _zero = 0.5; values must be integers") @macrocall(@enum Test9 _zero=0.5)
112112
113113 # test macro handles keyword arguments
114114 @enum(Test11, _zero_Test11=2,
110110 @test a[] == 1
111111 end
112112
113 # issue #29083
114 f29083(;μ,σ) = μ + σ*randn()
115 g29083() = f29083(μ=2.0,σ=0.1)
116 let c = code_typed(g29083, ())[1][1].code
117 # make sure no call to kwfunc remains
118 @test !any(e->(isa(e,Expr) && ((e.head === :invoke && e.args[1].def.name === :kwfunc) ||
119 (e.head === :foreigncall && e.args[1] === QuoteNode(:jl_get_keyword_sorter)))),
120 c)
121 end
122
113123 @testset "issue #19122: [no]inline of short func. def. with return type annotation" begin
114124 exf19122 = @macroexpand(@inline f19122()::Bool = true)
115125 exg19122 = @macroexpand(@noinline g19122()::Bool = true)
136146 (src, _) = code_typed(sum27403, Tuple{Vector{Int}})[1]
137147 @test !any(x -> x isa Expr && x.head === :invoke, src.code)
138148 end
149
150 # check that type.mutable can be fully eliminated
151 f_mutable_nothrow(s::String) = Val{typeof(s).mutable}
152 @test length(code_typed(f_mutable_nothrow, (String,))[1][1].code) == 1
138138 @test iszero([Base.ndigits0z(false, b) for b in [-20:-2;2:20]])
139139 @test all(n -> n == 1, Base.ndigits0z(true, b) for b in [-20:-2;2:20])
140140 @test all(n -> n == 1, ndigits(x, base=b) for b in [-20:-2;2:20] for x in [true, false])
141
142 # issue #29148
143 @test ndigits(typemax(UInt64), base=-2) == ndigits(big(typemax(UInt64)), base=-2)
144 for T in Base.BitInteger_types
145 n = rand(T)
146 b = -rand(2:100)
147 @test ndigits(n, base=b) == ndigits(big(n), base=b)
148 end
149
141150 end
142151 @testset "bin/oct/dec/hex/bits" begin
143152 @test string(UInt32('3'), base = 2) == "110011"
364364 @test length(flatten(zip(1:3, 4:6))) == 6
365365 @test length(flatten(1:6)) == 6
366366 @test collect(flatten(Any[])) == Any[]
367 @test collect(flatten(())) == Union{}[]
367368 @test_throws ArgumentError length(flatten(NTuple[(1,), ()])) # #16680
368369 @test_throws ArgumentError length(flatten([[1], [1]]))
369370
413413 ret %jl_value_t addrspace(10)* %obj
414414 }
415415
416 define void @vecphi(i1 %cond, <2 x %jl_value_t addrspace(10)*> *%arg) {
417 ; CHECK-LABEL: @vecphi
418 ; CHECK: %gcframe = alloca %jl_value_t addrspace(10)*, i32 4
419 top:
420 %ptls = call %jl_value_t*** @julia.ptls_states()
421 br i1 %cond, label %A, label %B
422
423 A:
424 br label %common
425
426 B:
427 %loaded = load <2 x %jl_value_t addrspace(10)*>, <2 x %jl_value_t addrspace(10)*> *%arg
428 call void @jl_safepoint()
429 br label %common
430
431 common:
432 %phi = phi <2 x %jl_value_t addrspace(10)*> [ zeroinitializer, %A ], [ %loaded, %B ]
433 call void @jl_safepoint()
434 %el1 = extractelement <2 x %jl_value_t addrspace(10)*> %phi, i32 0
435 %el2 = extractelement <2 x %jl_value_t addrspace(10)*> %phi, i32 1
436 call void @one_arg_boxed(%jl_value_t addrspace(10)* %el1)
437 call void @one_arg_boxed(%jl_value_t addrspace(10)* %el2)
438 unreachable
439 }
440
441 define i8 @phi_arrayptr(i1 %cond) {
442 ; CHECK-LABEL: @phi_arrayptr
443 ; CHECK: %gcframe = alloca %jl_value_t addrspace(10)*, i32 4
444 top:
445 %ptls = call %jl_value_t*** @julia.ptls_states()
446 br i1 %cond, label %A, label %B
447
448 A:
449 %obj1 = call %jl_value_t addrspace(10) *@alloc()
450 %obj2 = call %jl_value_t addrspace(10) *@alloc()
451 %decayed1 = addrspacecast %jl_value_t addrspace(10) *%obj1 to %jl_value_t addrspace(11) *
452 %arrayptrptr1 = bitcast %jl_value_t addrspace(11) *%decayed1 to i8 addrspace(13)* addrspace(11)*
453 %arrayptr1 = load i8 addrspace(13)*, i8 addrspace(13)* addrspace(11)* %arrayptrptr1
454 %decayed2 = addrspacecast %jl_value_t addrspace(10) *%obj2 to %jl_value_t addrspace(11) *
455 %arrayptrptr2 = bitcast %jl_value_t addrspace(11) *%decayed2 to i8 addrspace(13)* addrspace(11)*
456 %arrayptr2 = load i8 addrspace(13)*, i8 addrspace(13)* addrspace(11)* %arrayptrptr2
457 %insert1 = insertelement <2 x i8 addrspace(13)*> undef, i8 addrspace(13)* %arrayptr1, i32 0
458 %insert2 = insertelement <2 x i8 addrspace(13)*> %insert1, i8 addrspace(13)* %arrayptr2, i32 1
459 call void @jl_safepoint()
460 br label %common
461
462 B:
463 br label %common
464
465 common:
466 ; CHECK: %gclift
467 ; CHECK: %gclift1
468 ; CHECK-NOT: %gclift2
469 %phi = phi <2 x i8 addrspace(13)*> [ %insert2, %A ], [ zeroinitializer, %B ]
470 call void @jl_safepoint()
471 %el1 = extractelement <2 x i8 addrspace(13)*> %phi, i32 0
472 %el2 = extractelement <2 x i8 addrspace(13)*> %phi, i32 1
473 %l1 = load i8, i8 addrspace(13)* %el1
474 %l2 = load i8, i8 addrspace(13)* %el2
475 %add = add i8 %l1, %l2
476 ret i8 %add
477 }
478
479 define void @vecselect(i1 %cond, <2 x %jl_value_t addrspace(10)*> *%arg) {
480 ; CHECK-LABEL: @vecselect
481 ; CHECK: %gcframe = alloca %jl_value_t addrspace(10)*, i32 4
482 top:
483 %ptls = call %jl_value_t*** @julia.ptls_states()
484 %loaded = load <2 x %jl_value_t addrspace(10)*>, <2 x %jl_value_t addrspace(10)*> *%arg
485 call void @jl_safepoint()
486 %select = select i1 %cond, <2 x %jl_value_t addrspace(10)*> zeroinitializer, <2 x %jl_value_t addrspace(10)*> %loaded
487 call void @jl_safepoint()
488 %el1 = extractelement <2 x %jl_value_t addrspace(10)*> %select, i32 0
489 %el2 = extractelement <2 x %jl_value_t addrspace(10)*> %select, i32 1
490 call void @one_arg_boxed(%jl_value_t addrspace(10)* %el1)
491 call void @one_arg_boxed(%jl_value_t addrspace(10)* %el2)
492 unreachable
493 }
494
495 define i8 @select_arrayptr(i1 %cond) {
496 ; CHECK-LABEL: @select_arrayptr
497 ; CHECK: %gcframe = alloca %jl_value_t addrspace(10)*, i32 4
498 top:
499 %ptls = call %jl_value_t*** @julia.ptls_states()
500 %obj1 = call %jl_value_t addrspace(10) *@alloc()
501 %obj2 = call %jl_value_t addrspace(10) *@alloc()
502 %decayed1 = addrspacecast %jl_value_t addrspace(10) *%obj1 to %jl_value_t addrspace(11) *
503 %arrayptrptr1 = bitcast %jl_value_t addrspace(11) *%decayed1 to i8 addrspace(13)* addrspace(11)*
504 %arrayptr1 = load i8 addrspace(13)*, i8 addrspace(13)* addrspace(11)* %arrayptrptr1
505 %decayed2 = addrspacecast %jl_value_t addrspace(10) *%obj2 to %jl_value_t addrspace(11) *
506 %arrayptrptr2 = bitcast %jl_value_t addrspace(11) *%decayed2 to i8 addrspace(13)* addrspace(11)*
507 %arrayptr2 = load i8 addrspace(13)*, i8 addrspace(13)* addrspace(11)* %arrayptrptr2
508 %insert1 = insertelement <2 x i8 addrspace(13)*> undef, i8 addrspace(13)* %arrayptr1, i32 0
509 %insert2 = insertelement <2 x i8 addrspace(13)*> %insert1, i8 addrspace(13)* %arrayptr2, i32 1
510 call void @jl_safepoint()
511 %select = select i1 %cond, <2 x i8 addrspace(13)*> %insert2, <2 x i8 addrspace(13)*> zeroinitializer
512 call void @jl_safepoint()
513 %el1 = extractelement <2 x i8 addrspace(13)*> %select, i32 0
514 %el2 = extractelement <2 x i8 addrspace(13)*> %select, i32 1
515 %l1 = load i8, i8 addrspace(13)* %el1
516 %l2 = load i8, i8 addrspace(13)* %el2
517 %add = add i8 %l1, %l2
518 ret i8 %add
519 }
520
416521 !0 = !{!"jtbaa"}
417522 !1 = !{!"jtbaa_const", !0, i64 0}
418523 !2 = !{!1, !1, i64 0, i64 1}
546546 popfirst!(LOAD_PATH)
547547 end
548548
549 @testset "--project and JULIA_PROJECT paths should be absolutified" begin
550 mktempdir() do dir; cd(dir) do
551 mkdir("foo")
552 script = """
553 using Test
554 old = Base.active_project()
555 cd("foo")
556 @test Base.active_project() == old
557 """
558 @test success(`$(Base.julia_cmd()) --project=foo -e $(script)`)
559 withenv("JULIA_PROJECT" => "foo") do
560 @test success(`$(Base.julia_cmd()) -e $(script)`)
561 end
562 end; end
563 end
564
549565 ## cleanup after tests ##
550566
551567 for env in keys(envs)
677677 # Just checking that this doesn't stack overflow on construction
678678 @test Test27970Empty() == Test27970Empty()
679679 end
680
681 @testset "exports of modules" begin
682 for (_, mod) in Base.loaded_modules
683 for v in names(mod)
684 @test isdefined(mod, v)
685 end
686 end
687 end
135135 const x28297 = Result(missing)
136136
137137
138 # issue #28998
139 const x28998 = [missing, 2, missing, 6, missing,
140 missing, missing, missing,
141 missing, missing, missing,
142 missing, missing, 6]
143
138144 let some_method = which(Base.include, (String,))
139145 # global const some_method // FIXME: support for serializing a direct reference to an external Method not implemented
140146 global const some_linfo =
179185 @test Foo.abigint_x::BigInt + 1 == big"125"
180186
181187 @test Foo.x28297.result === missing
188
189 @test Foo.x28998[end] == 6
182190 end
183191
184192 cachedir = joinpath(dir, "compiled", "v$(VERSION.major).$(VERSION.minor)")
13701370 end
13711371 end
13721372 end
1373
1374 @testset "constant-valued ranges (issues #10391 and #29052)" begin
1375 for r in ((1:4), (1:1:4), (1.0:4.0))
1376 if eltype(r) === Int
1377 @test_broken @inferred(0 * r) == [0.0, 0.0, 0.0, 0.0]
1378 @test_broken @inferred(0 .* r) == [0.0, 0.0, 0.0, 0.0]
1379 @test_broken @inferred(r + (4:-1:1)) == [5.0, 5.0, 5.0, 5.0]
1380 @test_broken @inferred(r .+ (4:-1:1)) == [5.0, 5.0, 5.0, 5.0]
1381 else
1382 @test @inferred(0 * r) == [0.0, 0.0, 0.0, 0.0]
1383 @test @inferred(0 .* r) == [0.0, 0.0, 0.0, 0.0]
1384 @test @inferred(r + (4:-1:1)) == [5.0, 5.0, 5.0, 5.0]
1385 @test @inferred(r .+ (4:-1:1)) == [5.0, 5.0, 5.0, 5.0]
1386 end
1387 @test @inferred(r .+ (4.0:-1:1)) == [5.0, 5.0, 5.0, 5.0]
1388 @test @inferred(0.0 * r) == [0.0, 0.0, 0.0, 0.0]
1389 @test @inferred(0.0 .* r) == [0.0, 0.0, 0.0, 0.0]
1390 @test @inferred(r / Inf) == [0.0, 0.0, 0.0, 0.0]
1391 @test @inferred(r ./ Inf) == [0.0, 0.0, 0.0, 0.0]
1392 end
1393
1394 @test_broken @inferred(range(0, step=0, length=4)) == [0, 0, 0, 0]
1395 @test @inferred(range(0, stop=0, length=4)) == [0, 0, 0, 0]
1396 @test @inferred(range(0.0, step=0.0, length=4)) == [0.0, 0.0, 0.0, 0.0]
1397 @test @inferred(range(0.0, stop=0.0, length=4)) == [0.0, 0.0, 0.0, 0.0]
1398 @test @inferred(range(0, step=0.0, length=4)) == [0.0, 0.0, 0.0, 0.0]
1399 @test @inferred(range(0.0, step=0, length=4)) == [0.0, 0.0, 0.0, 0.0]
1400 @test @inferred(range(0, stop=0.0, length=4)) == [0.0, 0.0, 0.0, 0.0]
1401 @test @inferred(range(0.0, stop=0, length=4)) == [0.0, 0.0, 0.0, 0.0]
1402
1403 z4 = 0.0 * (1:4)
1404 @test @inferred(z4 .+ (1:4)) === 1.0:1.0:4.0
1405 @test @inferred(z4 .+ z4) === z4
1406 end
1407
1408 @testset "allocation of TwicePrecision call" begin
1409 0:286.493442:360
1410 0:286:360
1411 @test @allocated(0:286.493442:360) == 0
1412 @test @allocated(0:286:360) == 0
1413 end
774774 @test typeparam(Float64, rand(2)) == 1
775775 @test typeparam(Int, rand(Int, 2)) == 2
776776
777 # prior ambiguities (issue #28899)
778 uambig(::Union{Int,Nothing}) = 1
779 uambig(::Union{Float64,Nothing}) = 2
780 @test uambig(1) == 1
781 @test uambig(1.0) == 2
782 @test_throws MethodError uambig(nothing)
783 m = which(uambig, Tuple{Int})
784 Base.delete_method(m)
785 @test_throws MethodError uambig(1)
786 @test uambig(1.0) == 2
787 @test uambig(nothing) == 2
788
777789 end
778790
779791 # issue #26267
263263 s = Set([1,2,3,4])
264264 setdiff!(s, Set([2,4,5,6]))
265265 @test isequal(s,Set([1,3]))
266
267 # setdiff iterates the shorter set - make sure this algorithm works
268 sa, sb = Set([1,2,3,4,5,6,7]), Set([2,3,9])
269 @test Set([1,4,5,6,7]) == setdiff(sa, sb) !== sa
270 @test Set([1,4,5,6,7]) == setdiff!(sa, sb) === sa
271 sa, sb = Set([1,2,3,4,5,6,7]), Set([2,3,9])
272 @test Set([9]) == setdiff(sb, sa) !== sb
273 @test Set([9]) == setdiff!(sb, sa) === sb
266274 end
267275
268276 @testset "ordering" begin
603611 end
604612 end
605613 end
614
615 struct OpenInterval{T}
616 lower::T
617 upper::T
618 end
619 Base.in(x, i::OpenInterval) = i.lower < x < i.upper
620 Base.IteratorSize(::Type{<:OpenInterval}) = Base.SizeUnknown()
621
622 @testset "Continuous sets" begin
623 i = OpenInterval(2, 4)
624 @test 3 ∈ i
625 @test issubset(3, i)
626 end
213213
214214 @test args_morespecific(Tuple{Type{Any}, Type}, Tuple{Type{T}, Type{T}} where T)
215215 @test !args_morespecific(Tuple{Type{Any}, Type}, Tuple{Type{T}, Type{T}} where T<:Union{})
216
217 # issue #22592
218 abstract type Colorant22592{T,N} end
219 abstract type Color22592{T, N} <: Colorant22592{T,N} end
220 abstract type AbstractRGB22592{T} <: Color22592{T,3} end
221 AbstractGray22592{T} = Color22592{T,1}
222 MathTypes22592{T,C} = Union{AbstractRGB22592{T},AbstractGray22592{T}}
223 @test !args_morespecific(Tuple{MathTypes22592}, Tuple{AbstractGray22592})
224 @test !args_morespecific(Tuple{MathTypes22592, MathTypes22592}, Tuple{AbstractGray22592})
225
226 @test args_morespecific(Union{Set,Dict,Vector}, Union{Vector,AbstractSet})
3333 @test string("∀∃", "1∀∃") === "∀∃1∀∃"
3434 @test string(SubString("∀∃"), SubString("1∀∃", 2)) === "∀∃∀∃"
3535 @test string(s"123") === s"123"
36 @test string("123", 'α', SubString("1∀∃", 2), 'a', "foo") === "123α∀∃afoo"
3637 codegen_egal_of_strings(x, y) = (x===y, x!==y)
3738 @test codegen_egal_of_strings(string("ab", 'c'), "abc") === (true, false)
3839 let strs = ["", "a", "a b c", "до свидания"]
15011501 end
15021502 @test test27710() === Int64
15031503
1504 # issue #29064
1505 struct X29064
1506 X29064::Int
1507 end
1508 @test X29064(1) isa X29064
1509
15041510 # issue #27268
15051511 function f27268()
15061512 g(col::AbstractArray{<:Real}) = col
16411647 for ex in [:([x=1]), :(T{x=1})]
16421648 @test Meta.lower(@__MODULE__, ex) == Expr(:error, string("misplaced assignment statement in \"", ex, "\""))
16431649 end
1650
1651 # issue #28576
1652 @test Meta.isexpr(Meta.parse("1 == 2 ?"), :incomplete)
1653 @test Meta.isexpr(Meta.parse("1 == 2 ? 3 :"), :incomplete)
1654
1655 # issue #28991
1656 eval(Expr(:toplevel,
1657 Expr(:module, true, :Mod28991,
1658 Expr(:block,
1659 Expr(:export, :Inner),
1660 Expr(:abstract, :Inner)))))
1661 @test names(Mod28991) == Symbol[:Inner, :Mod28991]
1662
1663 # issue #28593
1664 macro a28593()
1665 quote
1666 abstract type A28593{S<:Real, V<:AbstractVector{S}} end
1667 end
1668 end
1669
1670 macro b28593()
1671 quote
1672 struct B28593{S<:Real, V<:AbstractVector{S}} end
1673 end
1674 end
1675
1676 macro c28593()
1677 quote
1678 primitive type C28593{S<:Real, V<:AbstractVector{S}} 32 end
1679 end
1680 end
1681
1682 @a28593
1683 @b28593
1684 @c28593
1685
1686 @test A28593.var.name === :S
1687 @test B28593.var.name === :S
1688 @test C28593.var.name === :S
1689
1690 # issue #25955
1691 macro noeffect25955(e)
1692 return e
1693 end
1694
1695 struct foo25955
1696 end
1697
1698 @noeffect25955 function (f::foo25955)()
1699 42
1700 end
1701
1702 @test foo25955()() == 42
1703
1704 # issue #28833
1705 macro m28833(expr)
1706 esc(:(global a28833))
1707 end
1708 @m28833 1+1
1709
1710 # issue #28900
1711 macro foo28900(x)
1712 quote
1713 $x
1714 end
1715 end
1716 f28900(; kwarg) = kwarg
1717 let g = @foo28900 f28900(kwarg = x->2x)
1718 @test g(10) == 20
1719 end
8585 end
8686
8787 @test empty((1, 2.0, "c")) === ()
88
89 # issue #28915
90 @test convert(Union{Tuple{}, Tuple{Int}}, (1,)) === (1,)
8891 end
8992
9093 @testset "size" begin