Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Backports for 1.1.1 #31039

Merged
merged 40 commits into from
May 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
ccc4dde
llvm: fix target triple (#30554)
vtjnash Jan 3, 2019
b087c5c
fix `lambda-optimize-vars!` with complex assignment RHSs (#30564)
JeffBezanson Jan 3, 2019
93f8202
fix typo in string search api docs (#30600)
ashleysommer Jan 6, 2019
a22e161
fix #30643, correctly propagate iterator traits through Stateful (#30…
denizyuret Jan 9, 2019
a38494d
SHA,tests: cleanup tempdir (#30655)
vtjnash Jan 11, 2019
3207490
some documentation improvements (#30697)
JeffBezanson Jan 12, 2019
a7f50dc
improve docstring of SparseMatrixCSC (#30689)
abraunst Jan 13, 2019
475fe22
fix typo in devdocs/sysimg.md (#30678)
PallHaraldsson Jan 14, 2019
6bc6e9a
doc: update "Singleton Types" section header from H4 -> H3 (#30717)
lostella Jan 15, 2019
21617e8
fix #30499, document behavior of `return` at top level (#30716)
JeffBezanson Jan 16, 2019
75f4417
fix #28647, add doc string for `Symbol` (#30747)
JeffBezanson Jan 18, 2019
9a8f5d9
Add doc string for `=` (#30745)
JeffBezanson Jan 18, 2019
4728b66
Handle :error and :invalid expressions gracefully in REPL helpmode, (…
fredrikekre Jan 19, 2019
d309c4b
Fix RemoteChannel example in parallel-computing.md
galenlynch Jan 19, 2019
8d8b0f2
fix #30792, static param constraints between positional and kw args (…
JeffBezanson Jan 23, 2019
ac67169
fix `at-everywhere using` in Distributed stdlib (#30804)
JeffBezanson Jan 23, 2019
f11d753
Fix signature of git_libgit2_opts
Keno Jan 24, 2019
cee7282
doc: indexing by different numbers of indices (#30736)
mbauman Jan 28, 2019
8051200
isapprox doc mentioned deprecated 'vecnorm' (#30884)
JeffFessler Jan 29, 2019
2fcf987
Fallback for copying views into sparse matrices (#30895)
mkborregaard Jan 31, 2019
1f87b5e
fix #30911, bug in `deepcopy` of `UnionAll` (#30930)
JeffBezanson Feb 1, 2019
8f1b9d3
fix #30679, call correct method for `invoke` calls in `jl_invoke` fal…
JeffBezanson Feb 6, 2019
294bdd7
Bump Pkg to 1.1.3.
fredrikekre Apr 15, 2019
e537199
fix #29936, precompile should not assume UnionAlls have stable addres…
JeffBezanson Feb 12, 2019
6e7a4c8
bump MPFR to 4.0.2 (#31041)
simonbyrne Feb 13, 2019
97d86aa
Fix enumerate documentation (#30398)
yurivish Feb 14, 2019
14eb3f1
allow chop to take an empty string (#31312)
bicycle1885 Mar 11, 2019
2f93b5e
Fix 29545: Implement unaliascopy for ReinterpretArray (#30296)
mbauman Mar 20, 2019
ef16e8e
fix undef var in conversion in rounding modes in MPFR (#31258)
KristofferC Mar 29, 2019
4b99196
Improve REPL completions (#30569)
pfitzseb Apr 7, 2019
349e59e
Fix show_vector for long offset arrays with :limit=true (#31642)
timholy Apr 8, 2019
f04b2db
Backport bug fix to v1.1: don't Const-prop unitialized structs (#31699)
Apr 15, 2019
ec2a819
build: LDFLAGS needed for FreeBSD build (#31586)
vtjnash Apr 2, 2019
3045a66
Pkg resolver update.
fredrikekre Apr 17, 2019
5449250
Upgrade `libssh2` version to `1.8.2` (#31776)
staticfloat Apr 20, 2019
53ff56c
Fix `-`, `conj`, and `conj!` for sparse matrices with invalid entries…
martinholters Mar 1, 2019
ca789a9
inf or nan parsing should ignore leading spaces
stevengj Apr 12, 2019
bf854e1
fix parse(ComplexF64, "inf")
stevengj Apr 4, 2019
21b640b
minor fixes in multiplication with Diagonals (#31443)
dkarrasch Apr 4, 2019
0bc6c5d
Update Mozilla CA certificate store to latest (01-23-2019) for libgit…
mikhail-j Feb 11, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions base/Enums.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ export Enum, @enum

function basetype end

"""
Enum{T<:Integer}

The abstract supertype of all enumerated types defined with [`@enum`](@ref).
"""
abstract type Enum{T<:Integer} end

(::Type{T})(x::Enum{T2}) where {T<:Integer,T2<:Integer} = T(bitcast(T2, x))::T
Expand Down
7 changes: 4 additions & 3 deletions base/arrayshow.jl
Original file line number Diff line number Diff line change
Expand Up @@ -434,10 +434,11 @@ function show_vector(io::IO, v, opn='[', cls=']')
io = IOContext(io, :typeinfo => eltype(v), :compact => get(io, :compact, true))
limited = get(io, :limit, false)
if limited && length(v) > 20
inds = axes1(v)
show_delim_array(io, v, opn, ",", "", false, inds[1], inds[1]+9)
axs1 = axes1(v)
f, l = first(axs1), last(axs1)
show_delim_array(io, v, opn, ",", "", false, f, f+9)
print(io, " … ")
show_delim_array(io, v, "", ",", cls, false, inds[end-9], inds[end])
show_delim_array(io, v, "", ",", cls, false, l-9, l)
else
show_delim_array(io, v, opn, ",", cls, false)
end
Expand Down
2 changes: 1 addition & 1 deletion base/compiler/abstractinterpretation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -910,7 +910,7 @@ function abstract_eval(@nospecialize(e), vtypes::VarTable, sv::InferenceState)
isconst = false
end
end
if isconst
if isconst && fieldcount(t) == length(e.args) - 1
t = Const(ccall(:jl_new_structv, Any, (Any, Ptr{Cvoid}, UInt32), t, args, length(args)))
end
end
Expand Down
2 changes: 1 addition & 1 deletion base/deepcopy.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ updated as appropriate before returning.
"""
deepcopy(x) = deepcopy_internal(x, IdDict())::typeof(x)

deepcopy_internal(x::Union{Symbol,Core.MethodInstance,Method,GlobalRef,DataType,Union,Task},
deepcopy_internal(x::Union{Symbol,Core.MethodInstance,Method,GlobalRef,DataType,Union,UnionAll,Task},
stackdict::IdDict) = x
deepcopy_internal(x::Tuple, stackdict::IdDict) =
ntuple(i->deepcopy_internal(x[i], stackdict), length(x))
Expand Down
204 changes: 182 additions & 22 deletions base/docs/basedocs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,13 @@ kw"primitive type"
"""
macro

`macro` defines a method to include generated code in the final body of a program. A
macro maps a tuple of arguments to a returned expression, and the resulting expression
is compiled directly rather than requiring a runtime `eval` call. Macro arguments may
include expressions, literal values, and symbols. For example:
`macro` defines a method for inserting generated code into a program.
A macro maps a sequence of argument expressions to a returned expression, and the
resulting expression is substituted directly into the program at the point where
the macro is invoked.
Macros are a way to run generated code without calling `eval`, since the generated
code instead simply becomes part of the surrounding program.
Macro arguments may include expressions, literal values, and symbols.

# Examples
```jldoctest
Expand Down Expand Up @@ -197,6 +200,91 @@ julia> z
"""
kw"global"

"""
=

`=` is the assignment operator.
* For variable `a` and expression `b`, `a = b` makes `a` refer to the value of `b`.
* For functions `f(x)`, `f(x) = x` defines a new function constant `f`, or adds a new method to `f` if `f` is already defined; this usage is equivalent to `function f(x); x; end`.
* `a[i] = v` calls [`setindex!`](@ref)`(a,v,i)`.
* `a.b = c` calls [`setproperty!`](@ref)`(a,:b,c)`.
* Inside a function call, `f(a=b)` passes `b` as the value of keyword argument `a`.
* Inside parentheses with commas, `(a=1,)` constructs a [`NamedTuple`](@ref).

# Examples
Assigning `a` to `b` does not create a copy of `b`; instead use [`copy`](@ref) or [`deepcopy`](@ref).

```jldoctest
julia> b = [1]; a = b; b[1] = 2; a
1-element Array{Int64,1}:
2

julia> b = [1]; a = copy(b); b[1] = 2; a
1-element Array{Int64,1}:
1

```
Collections passed to functions are also not copied. Functions can modify (mutate) the contents of the objects their arguments refer to. (The names of functions which do this are conventionally suffixed with '!'.)
```jldoctest
julia> function f!(x); x[:] .+= 1; end
f! (generic function with 1 method)

julia> a = [1]; f!(a); a
1-element Array{Int64,1}:
2

```
Assignment can operate on multiple variables in parallel, taking values from an iterable:
```jldoctest
julia> a, b = 4, 5
(4, 5)

julia> a, b = 1:3
1:3

julia> a, b
(1, 2)

```
Assignment can operate on multiple variables in series, and will return the value of the right-hand-most expression:
```jldoctest
julia> a = [1]; b = [2]; c = [3]; a = b = c
1-element Array{Int64,1}
3

julia> b[1] = 2; a, b, c
([2], [2], [2])

```
Assignment at out-of-bounds indices does not grow a collection. If the collection is a [`Vector`](@ref) it can instead be grown with [`push!`](@ref) or [`append!`](@ref).
```jldoctest
julia> a = [1, 1]; a[3] = 2
ERROR: BoundsError: attempt to access 2-element Array{Int64,1} at index [3]
[...]

julia> push!(a, 2, 3)
4-element Array{Int64,1}:
1
1
2
3

```
Assigning `[]` does not eliminate elements from a collection; instead use `filter!`.
```jldoctest
julia> a = collect(1:3); a[a .<= 1] = []
ERROR: DimensionMismatch("tried to assign 0 elements to 1 destinations")
[...]

julia> filter!(x -> x > 1, a) # in-place & thus more efficient than a = a[a .> 1]
2-element Array{Int64,1}:
2
3

```
"""
kw"="

"""
let

Expand Down Expand Up @@ -237,6 +325,34 @@ For other purposes, `:( ... )` and `quote .. end` blocks are treated identically
"""
kw"quote"

"""
Expr(head::Symbol, args...)

A type representing compound expressions in parsed julia code (ASTs).
Each expression consists of a `head` Symbol identifying which kind of
expression it is (e.g. a call, for loop, conditional statement, etc.),
and subexpressions (e.g. the arguments of a call).
The subexpressions are stored in a `Vector{Any}` field called `args`.

See the manual chapter on [Metaprogramming](@ref) and the developer
documentation [Julia ASTs](@ref).

# Examples
```jldoctest
julia> Expr(:call, :+, 1, 2)
:(1 + 2)

julia> dump(:(a ? b : c))
Expr
head: Symbol if
args: Array{Any}((3,))
1: Symbol a
2: Symbol b
3: Symbol c
```
"""
Expr

"""
'

Expand Down Expand Up @@ -314,7 +430,9 @@ kw"function"
"""
return

`return` can be used in function bodies to exit early and return a given value, e.g.
`return x` causes the enclosing function to exit early, passing the given value `x`
back to its caller. `return` by itself with no value is equivalent to `return nothing`
(see [`nothing`](@ref)).

```julia
function compare(a, b)
Expand All @@ -340,12 +458,15 @@ function test2(xs)
end
end
```
In the first example, the return breaks out of its enclosing function as soon as it hits
In the first example, the return breaks out of `test1` as soon as it hits
an even number, so `test1([5,6,7])` returns `12`.

You might expect the second example to behave the same way, but in fact the `return`
there only breaks out of the *inner* function (inside the `do` block) and gives a value
back to `map`. `test2([5,6,7])` then returns `[5,12,7]`.

When used in a top-level expression (i.e. outside any function), `return` causes
the entire current top-level expression to terminate early.
"""
kw"return"

Expand Down Expand Up @@ -376,7 +497,7 @@ kw"if", kw"elseif", kw"else"
"""
for

`for` loops repeatedly evaluate the body of the loop by
`for` loops repeatedly evaluate a block of statements while
iterating over a sequence of values.

# Examples
Expand All @@ -394,8 +515,8 @@ kw"for"
"""
while

`while` loops repeatedly evaluate a conditional expression, and continues evaluating the
body of the while loop so long as the expression remains `true`. If the condition
`while` loops repeatedly evaluate a conditional expression, and continue evaluating the
body of the while loop as long as the expression remains true. If the condition
expression is false when the while loop is first reached, the body is never evaluated.

# Examples
Expand Down Expand Up @@ -442,19 +563,23 @@ kw"end"
"""
try/catch

A `try`/`catch` statement allows for `Exception`s to be tested for. For example, a
customized square root function can be written to automatically call either the real or
complex square root method on demand using `Exception`s:
A `try`/`catch` statement allows intercepting errors (exceptions) thrown
by [`throw`](@ref) so that program execution can continue.
For example, the following code attempts to write a file, but warns the user
and proceeds instead of terminating execution if the file cannot be written:

```julia
f(x) = try
sqrt(x)
try
open("/danger", "w") do f
println(f, "Hello")
end
catch
sqrt(complex(x, 0))
@warn "Could not write file."
end
```

`try`/`catch` statements also allow the `Exception` to be saved in a variable, e.g. `catch y`.
The syntax `catch e` (where `e` is any variable) assigns the thrown
exception object to the given variable within the `catch` block.

The power of the `try`/`catch` construct lies in the ability to unwind a deeply
nested computation immediately to a much higher level in the stack of calling functions.
Expand Down Expand Up @@ -530,7 +655,9 @@ kw"continue"
"""
do

Create an anonymous function. For example:
Create an anonymous function and pass it as the first argument to
a function call.
For example:

```julia
map(1:10) do x
Expand Down Expand Up @@ -811,7 +938,7 @@ nothing
"""
Core.TypeofBottom

The singleton type containing only the value `Union{}`.
The singleton type containing only the value `Union{}` (which represents the empty type).
"""
Core.TypeofBottom

Expand Down Expand Up @@ -1215,7 +1342,7 @@ Unsigned
"""
Bool <: Integer

Boolean type.
Boolean type, containing the values `true` and `false`.
"""
Bool

Expand Down Expand Up @@ -1248,10 +1375,41 @@ for bit in (8, 16, 32, 64, 128)
end
end

"""
Symbol

The type of object used to represent identifiers in parsed julia code (ASTs).
Also often used as a name or label to identify an entity (e.g. as a dictionary key).
`Symbol`s can be entered using the `:` quote operator:
```jldoctest
julia> :name
:name

julia> typeof(:name)
Symbol

julia> x = 42
42

julia> eval(:x)
42
```
`Symbol`s can also be constructed from strings or other values by calling the
constructor `Symbol(x...)`.

`Symbol`s are immutable and should be compared using `===`.
The implementation re-uses the same object for all `Symbol`s with the same name,
so comparison tends to be efficient (it can just compare pointers).

Unlike strings, `Symbol`s are "atomic" or "scalar" entities that do not support
iteration over characters.
"""
Symbol

"""
Symbol(x...) -> Symbol

Create a `Symbol` by concatenating the string representations of the arguments together.
Create a [`Symbol`](@ref) by concatenating the string representations of the arguments together.

# Examples
```jldoctest
Expand All @@ -1262,7 +1420,7 @@ julia> Symbol("day", 4)
:day4
```
"""
Symbol
Symbol(x...)

"""
tuple(xs...)
Expand Down Expand Up @@ -1351,9 +1509,11 @@ typeof
isdefined(object, s::Symbol)
isdefined(object, index::Int)

Tests whether an assignable location is defined. The arguments can be a module and a symbol
Tests whether a global variable or object field is defined. The arguments can be a module and a symbol
or a composite object and field name (as a symbol) or index.

To test whether an array element is defined, use [`isassigned`](@ref) instead.

# Examples
```jldoctest
julia> isdefined(Base, :sum)
Expand Down
3 changes: 2 additions & 1 deletion base/floatfuncs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,8 @@ the square root of [`eps`](@ref) of the type of `x` or `y`, whichever is bigger
This corresponds to requiring equality of about half of the significand digits. Otherwise,
e.g. for integer arguments or if an `atol > 0` is supplied, `rtol` defaults to zero.

`x` and `y` may also be arrays of numbers, in which case `norm` defaults to `vecnorm` but
`x` and `y` may also be arrays of numbers, in which case `norm` defaults to the usual
`norm` function in LinearAlgebra, but
may be changed by passing a `norm::Function` keyword argument. (For numbers, `norm` is the
same thing as `abs`.) When `x` and `y` are arrays, if `norm(x-y)` is not finite (i.e. `±Inf`
or `NaN`), the comparison falls back to checking whether all elements of `x` and `y` are
Expand Down
6 changes: 6 additions & 0 deletions base/iostream.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@

const sizeof_ios_t = Int(ccall(:jl_sizeof_ios_t, Cint, ()))

"""
IOStream

A buffered IO stream wrapping an OS file descriptor.
Mostly used to represent files returned by [`open`](@ref).
"""
mutable struct IOStream <: IO
handle::Ptr{Cvoid}
ios::Array{UInt8,1}
Expand Down
Loading