diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ddfd15231ae00..9930a56ffe929 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -184,6 +184,21 @@ A doctest needs to match an interactive REPL including the `julia>` prompt. To r For new functionality and other substantial changes, add a brief summary to `NEWS.md`. The news item should cross reference the pull request (PR) parenthetically, in the form `([#pr])`; after adding this, run `./julia doc/NEWS-update.jl` from the `julia` directory to update the cross-reference links. To add the PR reference number, first create the PR, then push an additional commit updating `NEWS.md` with the PR reference number. +#### Annotations for new features, deprecations and behavior changes + +API additions and deprecations, and minor behavior changes are allowed in minor version releases. +For documented features that are part of the public API, a compatibility note should be added into +the manual or the docstring. It should state the Julia minor version that made changed the behavior +and have a brief message describing the change. + +At the moment, this should always be done with the following `compat` admonition +(so that it would be possible to programmatically find the annotations in the future): + + ``` + !!! compat "Julia 1.X" + This method was added in Julia 1.X. + ``` + ### Contributing to core functionality or base libraries *By contributing code to Julia, you are agreeing to release it under the [MIT License](https://github.com/JuliaLang/julia/tree/master/LICENSE.md).* diff --git a/NEWS.md b/NEWS.md index b058b87c60f7d..f7d9348292c9f 100644 --- a/NEWS.md +++ b/NEWS.md @@ -39,6 +39,8 @@ New library functions * `isnothing(::Any)` function, to check whether something is a `Nothing`, returns a `Bool` ([#29679]). * `getpid(::Process)` method ([#24064]). * `eachrow`, `eachcol` and `eachslice` functions provide efficient iterators over slices of arrays ([#29749]). + * `fieldtypes(T::Type)` which return the declared types of the field in type T ([#29600]). + * `uuid5` has been added to the `UUIDs` standard library ([#28761]). Standard library changes ------------------------ @@ -50,7 +52,7 @@ Standard library changes * `range` can accept the stop value as a positional argument, e.g. `range(1,10,step=2)` ([#28708]). * `edit` can now be called on a module to edit the file that defines it ([#29636]). * `diff` now supports arrays of arbitrary dimensionality and can operate over any dimension ([#29827]). - * `sprandn` now supports result types like `ComplexF64` or `Float32` ([#30083]). + * `sprandn` now supports specifying the output element type ([#30083]). * All compiler-reflection tools (i.e. the `code_` class of functions and macros) now print accurate line number and inlining information in a common style, and take an optional parameter (debuginfo=:default) to control the verbosity of the metadata shown ([#29893]). @@ -66,11 +68,42 @@ Standard library changes * `Base.tail` now works on named tuples ([#29595]). * `randperm` and `randcycle` now use the type of their argument to determine the element type of the returned array ([#29670]). + * The process id is appended to malloc log files in order to track memory allocations of + multiple processes ([#29969]). + * `Base.julia_cmd` now propagates the `--inline=(yes|no)` flag ([#29858]). + * New `DateTime(::Date, ::Time)` constructor ([#29754]). + * `isdiag` and `isposdef` for `Diagonal` and `UniformScaling` ([#29638]). + * `mul!`, `rmul!` and `lmul!` methods for `UniformScaling` ([#29506]). + * `Symmetric` and `Hermitian` matrices now preserve the wrapper when scaled with a number ([#29469]). + * New `edit(m::Module)` method which opens the main source file for module `m` ([#29636]). + * `Base.@kwdef` can now be used for parametric structs, and for structs with supertypes ([#29316]). + * `merge(::NamedTuple, ::NamedTuple...)` can now be used with more than 2 `NamedTuple`s ([#29259]). + * `Future.copy!` has been moved to `Base` ([#29178]). + * New `ncodeunits(c::Char)` method as a fast equivalent to `ncodeunits(string(c))` ([#29153]). + * `mean` and `var` now handles the empty case ([#29033]). + * New `sort!(::AbstractArray; dims)` method that can sort the array along the `dims` dimension ([#28902]). + * `range` now accept `stop` as a positional argument ([#28708]). + * `parse(Bool, str)` is now supported ([#29997]). + * `copyto!(::AbstractMatrix, ::UniformScaling)` supports rectangular matrices now ([#28790]). + * In `put!(c::Channel{T}, v)`, `v` now gets converted to `T` as `put!` is being called ([#29092]). + * `current_project()` now searches the parent directories of a Git repository for a `Project.toml` file. + This also affects the behavior of the `--project` command line option when using the default + `--project=@.` ([#29108]). + * Exponentiation operator `^` now supports raising a `Irrational` to an `AbstractMatrix` power ([#29782]). * A new method `rand(::Tuple)` implements sampling from the values of a tuple ([#25278]). Compiler/Runtime improvements ----------------------------- +External dependencies +--------------------- + + * 7zip (bundled with Julia on Windows) has been upgraded from version 16.04 to 18.05 ([#30035]). + * Busybox is no longer bundled with Julia on Windows ([#30022]). + * OpenBLAS has been upgraded from 0.3.2 to 0.3.3 ([#29845]). + * The source code for Pkg is no longer included in JuliaLang/julia. Pkg is instead + downloaded during the build process ([#29615]). + * LLVM has been upgraded to 6.0.1 and support for LLVM < 6.0 has been dropped ([#28745], [#28696]). Deprecated or removed --------------------- @@ -80,9 +113,65 @@ Deprecated or removed to get an appropriate task-local buffer and pass it to `grisu()` instead ([#29907]). * The internal function `Base._default_type(T)` has been removed. Calls to it should be replaced with just the argument `T` ([#29739]). + * `peakflops` has been scheduled to move from `InteractiveUtils` to `LinearAlgebra` + but is already now available as `LinearAlgebra.peakflops` ([#29978]). +[#21233]: https://github.com/JuliaLang/julia/issues/21233 +[#24064]: https://github.com/JuliaLang/julia/issues/24064 +[#25278]: https://github.com/JuliaLang/julia/issues/25278 [#28156]: https://github.com/JuliaLang/julia/issues/28156 +[#28506]: https://github.com/JuliaLang/julia/issues/28506 +[#28696]: https://github.com/JuliaLang/julia/issues/28696 +[#28708]: https://github.com/JuliaLang/julia/issues/28708 +[#28745]: https://github.com/JuliaLang/julia/issues/28745 +[#28761]: https://github.com/JuliaLang/julia/issues/28761 +[#28790]: https://github.com/JuliaLang/julia/issues/28790 [#28878]: https://github.com/JuliaLang/julia/issues/28878 +[#28902]: https://github.com/JuliaLang/julia/issues/28902 +[#29033]: https://github.com/JuliaLang/julia/issues/29033 +[#29092]: https://github.com/JuliaLang/julia/issues/29092 +[#29108]: https://github.com/JuliaLang/julia/issues/29108 +[#29127]: https://github.com/JuliaLang/julia/issues/29127 +[#29153]: https://github.com/JuliaLang/julia/issues/29153 +[#29157]: https://github.com/JuliaLang/julia/issues/29157 +[#29173]: https://github.com/JuliaLang/julia/issues/29173 +[#29178]: https://github.com/JuliaLang/julia/issues/29178 +[#29211]: https://github.com/JuliaLang/julia/issues/29211 +[#29259]: https://github.com/JuliaLang/julia/issues/29259 +[#29316]: https://github.com/JuliaLang/julia/issues/29316 +[#29429]: https://github.com/JuliaLang/julia/issues/29429 [#29440]: https://github.com/JuliaLang/julia/issues/29440 [#29442]: https://github.com/JuliaLang/julia/issues/29442 +[#29469]: https://github.com/JuliaLang/julia/issues/29469 +[#29506]: https://github.com/JuliaLang/julia/issues/29506 +[#29595]: https://github.com/JuliaLang/julia/issues/29595 +[#29600]: https://github.com/JuliaLang/julia/issues/29600 +[#29615]: https://github.com/JuliaLang/julia/issues/29615 +[#29636]: https://github.com/JuliaLang/julia/issues/29636 +[#29638]: https://github.com/JuliaLang/julia/issues/29638 +[#29670]: https://github.com/JuliaLang/julia/issues/29670 +[#29679]: https://github.com/JuliaLang/julia/issues/29679 +[#29733]: https://github.com/JuliaLang/julia/issues/29733 +[#29739]: https://github.com/JuliaLang/julia/issues/29739 +[#29749]: https://github.com/JuliaLang/julia/issues/29749 +[#29754]: https://github.com/JuliaLang/julia/issues/29754 +[#29781]: https://github.com/JuliaLang/julia/issues/29781 +[#29782]: https://github.com/JuliaLang/julia/issues/29782 +[#29819]: https://github.com/JuliaLang/julia/issues/29819 +[#29827]: https://github.com/JuliaLang/julia/issues/29827 +[#29845]: https://github.com/JuliaLang/julia/issues/29845 +[#29858]: https://github.com/JuliaLang/julia/issues/29858 +[#29890]: https://github.com/JuliaLang/julia/issues/29890 +[#29893]: https://github.com/JuliaLang/julia/issues/29893 +[#29907]: https://github.com/JuliaLang/julia/issues/29907 +[#29913]: https://github.com/JuliaLang/julia/issues/29913 +[#29968]: https://github.com/JuliaLang/julia/issues/29968 +[#29969]: https://github.com/JuliaLang/julia/issues/29969 +[#29978]: https://github.com/JuliaLang/julia/issues/29978 +[#29980]: https://github.com/JuliaLang/julia/issues/29980 +[#29997]: https://github.com/JuliaLang/julia/issues/29997 +[#30022]: https://github.com/JuliaLang/julia/issues/30022 +[#30035]: https://github.com/JuliaLang/julia/issues/30035 +[#30083]: https://github.com/JuliaLang/julia/issues/30083 +[#30159]: https://github.com/JuliaLang/julia/issues/30159 diff --git a/base/abstractarray.jl b/base/abstractarray.jl index 2a1d434641a23..7fb898a6d215b 100644 --- a/base/abstractarray.jl +++ b/base/abstractarray.jl @@ -647,6 +647,10 @@ If `dst` and `src` are of the same type, `dst == src` should hold after the call. If `dst` and `src` are multidimensional arrays, they must have equal [`axes`](@ref). See also [`copyto!`](@ref). + +!!! compat "Julia 1.1" + This method requires at least Julia 1.1. In Julia 1.0 this method + is available from the `Future` standard library as `Future.copy!`. """ copy!(dst::AbstractVector, src::AbstractVector) = append!(empty!(dst), src) diff --git a/base/channels.jl b/base/channels.jl index f43d74f75c921..090fad3ad877f 100644 --- a/base/channels.jl +++ b/base/channels.jl @@ -245,6 +245,9 @@ Append an item `v` to the channel `c`. Blocks if the channel is full. For unbuffered channels, blocks until a [`take!`](@ref) is performed by a different task. + +!!! compat "Julia 1.1" + `v` now gets converted to the channel's type with [`convert`](@ref) as `put!` is called. """ function put!(c::Channel{T}, v) where T check_channel_state(c) diff --git a/base/char.jl b/base/char.jl index 43eb92f0470d1..3f9d60380212b 100644 --- a/base/char.jl +++ b/base/char.jl @@ -56,6 +56,10 @@ Char Return the number of code units required to encode a character as UTF-8. This is the number of bytes which will be printed if the character is written to an output stream, or `ncodeunits(string(c))` but computed efficiently. + +!!! compat "Julia 1.1" + This method requires at least Julia 1.1. In Julia 1.0 consider + using `ncodeunits(string(c))`. """ ncodeunits(c::Char) = write(devnull, c) # this is surprisingly efficient diff --git a/base/error.jl b/base/error.jl index bd912fb743559..488ddc6867386 100644 --- a/base/error.jl +++ b/base/error.jl @@ -103,6 +103,9 @@ false. Explicitly passing `task` will return the current exception stack on an arbitrary task. This is useful for inspecting tasks which have failed due to uncaught exceptions. + +!!! compat "Julia 1.1" + This function requires at least Julia 1.1. """ function catch_stack(task=current_task(); include_bt=true) raw = ccall(:jl_get_excstack, Any, (Any,Cint,Cint), task, include_bt, typemax(Cint)) diff --git a/base/locks.jl b/base/locks.jl index 425785b910fda..78454f3d38779 100644 --- a/base/locks.jl +++ b/base/locks.jl @@ -246,6 +246,9 @@ Create a level-triggered event source. Tasks that call [`wait`](@ref) on an `Event` are suspended and queued until `notify` is called on the `Event`. After `notify` is called, the `Event` remains in a signaled state and tasks will no longer block when waiting for it. + +!!! compat "Julia 1.1" + This functionality requires at least Julia 1.1. """ mutable struct Event lock::Mutex diff --git a/base/mpfr.jl b/base/mpfr.jl index c459f3738454f..aaf3e9783bf62 100644 --- a/base/mpfr.jl +++ b/base/mpfr.jl @@ -151,6 +151,11 @@ global precision; `convert` will always return `x`. convenience since decimal literals are converted to `Float64` when parsed, so `BigFloat(2.1)` may not yield what you expect. +!!! compat "Julia 1.1" + `precision` as a keyword argument requires at least Julia 1.1. + In Julia 1.0 `precision` is the second positional argument (`BigFloat(x, precision)`). + +# Examples ```jldoctest julia> BigFloat(2.1) # 2.1 here is a Float64 2.100000000000000088817841970012523233890533447265625 diff --git a/base/multidimensional.jl b/base/multidimensional.jl index 3c353fa649cd7..9d98c5776a305 100644 --- a/base/multidimensional.jl +++ b/base/multidimensional.jl @@ -211,6 +211,28 @@ module IteratorsMD CartesianIndex(1, 2) ``` + ## Broadcasting + + `CartesianIndices` support broadcasting arithmetic (+ and -) with a `CartesianIndex`. + + !!! compat "Julia 1.1" + Broadcasting of CartesianIndices requires at least Julia 1.1. + + ```jldoctest + julia> CIs = CartesianIndices((2:3, 5:6)) + 2×2 CartesianIndices{2,Tuple{UnitRange{Int64},UnitRange{Int64}}}: + CartesianIndex(2, 5) CartesianIndex(2, 6) + CartesianIndex(3, 5) CartesianIndex(3, 6) + + julia> CI = CartesianIndex(3, 4) + CartesianIndex(3, 4) + + julia> CIs .+ CI + 2×2 CartesianIndices{2,Tuple{UnitRange{Int64},UnitRange{Int64}}}: + CartesianIndex(5, 9) CartesianIndex(5, 10) + CartesianIndex(6, 9) CartesianIndex(6, 10) + ``` + For cartesian to linear index conversion, see [`LinearIndices`](@ref). """ struct CartesianIndices{N,R<:NTuple{N,AbstractUnitRange{Int}}} <: AbstractArray{CartesianIndex{N},N} @@ -228,6 +250,26 @@ module IteratorsMD CartesianIndices(A::AbstractArray) = CartesianIndices(axes(A)) + """ + (:)(I::CartesianIndex, J::CartesianIndex) + + Construct [`CartesianIndices`](@ref) from two `CartesianIndex`. + + !!! compat "Julia 1.1" + This method requires at least Julia 1.1. + + # Examples + ```jldoctest + julia> I = CartesianIndex(2,1); + + julia> J = CartesianIndex(3,3); + + julia> I:J + 2×3 CartesianIndices{2,Tuple{UnitRange{Int64},UnitRange{Int64}}}: + CartesianIndex(2, 1) CartesianIndex(2, 2) CartesianIndex(2, 3) + CartesianIndex(3, 1) CartesianIndex(3, 2) CartesianIndex(3, 3) + ``` + """ (:)(I::CartesianIndex{N}, J::CartesianIndex{N}) where N = CartesianIndices(map((i,j) -> i:j, Tuple(I), Tuple(J))) @@ -672,6 +714,9 @@ Finite difference operator on a vector or a multidimensional array `A`. In the latter case the dimension to operate on needs to be specified with the `dims` keyword argument. +!!! compat "Julia 1.1" + `diff` for arrays with dimension higher than 2 requires at least Julia 1.1. + # Examples ```jldoctest julia> a = [2 4; 6 16] diff --git a/base/namedtuple.jl b/base/namedtuple.jl index 8b0d777feab81..66f5a18774b27 100644 --- a/base/namedtuple.jl +++ b/base/namedtuple.jl @@ -223,6 +223,10 @@ contains that field. Fields present in only the rightmost named tuple of a pair A fallback is implemented for when only a single named tuple is supplied, with signature `merge(a::NamedTuple)`. +!!! compat "Julia 1.1" + Merging 3 or more `NamedTuple` requires at least Julia 1.1. + +# Examples ```jldoctest julia> merge((a=1, b=2, c=3), (b=4, d=5)) (a = 1, b = 4, c = 3, d = 5) diff --git a/base/parse.jl b/base/parse.jl index 15edab83c33d8..b21d85f7faf99 100644 --- a/base/parse.jl +++ b/base/parse.jl @@ -14,6 +14,9 @@ of the form `"R±Iim"` as a `Complex(R,I)` of the requested type; `"i"` or `"j"` used instead of `"im"`, and `"R"` or `"Iim"` are also permitted. If the string does not contain a valid number, an error is raised. +!!! compat "Julia 1.1" + `parse(Bool, str)` requires at least Julia 1.1. + # Examples ```jldoctest julia> parse(Int, "1234") diff --git a/base/path.jl b/base/path.jl index 21d5085bff95a..a0c6cf2716344 100644 --- a/base/path.jl +++ b/base/path.jl @@ -210,6 +210,9 @@ Split a file path into all its path components. This is the opposite of `joinpath`. Returns an array of substrings, one for each directory or file in the path, including the root directory if present. +!!! compat "Julia 1.1" + This function requires at least Julia 1.1. + # Examples ```jldoctest julia> splitpath("/home/myuser/example.jl") diff --git a/base/process.jl b/base/process.jl index 0c703eacdd312..a61046d6fdd63 100644 --- a/base/process.jl +++ b/base/process.jl @@ -749,6 +749,9 @@ kill(p::Process) = kill(p, SIGTERM) getpid(process) -> Int32 Get the child process ID, if it still exists. + +!!! compat "Julia 1.1" + This function requires at least Julia 1.1. """ function Libc.getpid(p::Process) ppid = Int32(0) diff --git a/base/range.jl b/base/range.jl index fe8097f4bd573..785ade602f6bf 100644 --- a/base/range.jl +++ b/base/range.jl @@ -60,6 +60,9 @@ automatically such that the elements are `step` spaced (a [`StepRange`](@ref)). `stop` may be specified as either a positional or keyword argument. +!!! compat "Julia 1.1" + `stop` as a positional argument requires at least Julia 1.1. + # Examples ```jldoctest julia> range(1, length=100) diff --git a/base/reflection.jl b/base/reflection.jl index 8d20f9b67a4f7..6191ea4e031e7 100644 --- a/base/reflection.jl +++ b/base/reflection.jl @@ -256,6 +256,9 @@ end Construct a dictionary of the names (as symbols) and values of all local variables defined as of the call site. +!!! compat "Julia 1.1" + This macro requires at least Julia 1.1. + # Examples ```jldoctest julia> let x = 1, y = 2 @@ -664,6 +667,9 @@ end The declared types of all fields in a composite DataType `T` as a tuple. +!!! compat "Julia 1.1" + This function requires at least Julia 1.1. + # Examples ```jldoctest julia> struct Foo diff --git a/base/some.jl b/base/some.jl index 73e65ac6399b5..b63f1ab3016ed 100644 --- a/base/some.jl +++ b/base/some.jl @@ -45,6 +45,9 @@ notnothing(::Nothing) = throw(ArgumentError("nothing passed to notnothing")) isnothing(x) Return `true` if `x === nothing`, and return `false` if not. + +!!! compat "Julia 1.1" + This function requires at least Julia 1.1. """ isnothing(::Any) = false isnothing(::Nothing) = true diff --git a/base/sort.jl b/base/sort.jl index 3c7105de94452..9391db27fa4b1 100644 --- a/base/sort.jl +++ b/base/sort.jl @@ -992,6 +992,9 @@ See [`sort!`](@ref) for a description of possible keyword arguments. To sort slices of an array, refer to [`sortslices`](@ref). +!!! compat "Julia 1.1" + This function requires at least Julia 1.1. + # Examples ```jldoctest julia> A = [4 3; 1 2] diff --git a/base/util.jl b/base/util.jl index 10527c8d9caa1..479062c058161 100644 --- a/base/util.jl +++ b/base/util.jl @@ -399,7 +399,16 @@ printstyled(io::IO, msg...; bold::Bool=false, color::Union{Int,Symbol}=:normal) with_output_color(print, color, io, msg...; bold=bold) printstyled(msg...; bold::Bool=false, color::Union{Int,Symbol}=:normal) = printstyled(stdout, msg...; bold=bold, color=color) +""" + Base.julia_cmd(juliapath=joinpath(Sys.BINDIR::String, julia_exename())) + +Return a julia command similar to the one of the running process. +Propagates the `--cpu-target`, `--sysimage`, --compile `, `--depwarn` +and `--inline` command line arguments. +!!! compat "Julia 1.1" + The `--inline` flag is only propagated in Julia 1.1 and later. +""" function julia_cmd(julia=joinpath(Sys.BINDIR::String, julia_exename())) opts = JLOptions() cpu_target = unsafe_string(opts.cpu_target) @@ -642,6 +651,10 @@ Inner constructors can still be defined, but at least one should accept argument same form as the default inner constructor (i.e. one positional argument per field) in order to function correctly with the keyword outer constructor. +!!! compat "Julia 1.1" + `Base.@kwdef` for parametric structs, and structs with supertypes + requires at least Julia 1.1. + # Examples ```jldoctest julia> Base.@kwdef struct Foo diff --git a/doc/src/assets/julia-manual.css b/doc/src/assets/julia-manual.css index 00772f32cc0de..f303c67749797 100644 --- a/doc/src/assets/julia-manual.css +++ b/doc/src/assets/julia-manual.css @@ -1,3 +1,11 @@ nav.toc h1 { display: none; } + +.admonition.compat > .admonition-title { + background-color: hsla(90, 60%, 50%, 1); +} + +.admonition.compat { + background-color: hsla(90, 70%, 90%, 1); +} diff --git a/doc/src/devdocs/ast.md b/doc/src/devdocs/ast.md index 699a2b00d8d17..a30bdd15b304e 100644 --- a/doc/src/devdocs/ast.md +++ b/doc/src/devdocs/ast.md @@ -158,6 +158,9 @@ These symbols appear in the `head` field of `Expr`s in lowered form. Pop the stack of current exceptions back to the state at the associated `enter` when leaving a catch block. `args[1]` contains the token from the associated `enter`. + !!! compat "Julia 1.1" + `pop_exception` is new in Julia 1.1. + * `inbounds` Controls turning bounds checks on or off. A stack is maintained; if the first argument of this diff --git a/doc/src/manual/getting-started.md b/doc/src/manual/getting-started.md index 9e5d55afc665c..f6fa6226d3c01 100644 --- a/doc/src/manual/getting-started.md +++ b/doc/src/manual/getting-started.md @@ -125,6 +125,11 @@ julia [switches] -- [programfile] [args...] |`--track-allocation={none\|user\|all}` |Count bytes allocated by each source line| |`--track-allocation` |equivalent to `--track-allocation=user`| +!!! compat "Julia 1.1" + In Julia 1.0, the default `--project=@.` option did not search up from the root + directory of a Git repository for the `Project.toml` file. From Julia 1.1 forward, it + does. + ## Resources A curated list of useful learning resources to help new users get started can be found on the [learning](https://julialang.org/learning/) page of the main Julia web site. diff --git a/doc/src/manual/stacktraces.md b/doc/src/manual/stacktraces.md index a7da7a6464cd7..01a3417d33031 100644 --- a/doc/src/manual/stacktraces.md +++ b/doc/src/manual/stacktraces.md @@ -189,6 +189,9 @@ ERROR: Whoops! ## Exception stacks and [`catch_stack`](@ref) +!!! compat "Julia 1.1" + Exception stacks requires at least Julia 1.1. + While handling an exception further exceptions may be thrown. It can be useful to inspect all these exceptions to identify the root cause of a problem. The julia runtime supports this by pushing each exception onto an internal *exception stack* as it occurs. When the code exits a `catch` normally, any exceptions which were pushed onto the stack diff --git a/stdlib/Dates/src/types.jl b/stdlib/Dates/src/types.jl index 24b3a6ebad1dc..a16091022c4c0 100644 --- a/stdlib/Dates/src/types.jl +++ b/stdlib/Dates/src/types.jl @@ -318,6 +318,9 @@ Construct a `DateTime` type by `Date` and `Time`. Non-zero microseconds or nanoseconds in the `Time` type will result in an `InexactError`. +!!! compat "Julia 1.1" + This function requires at least Julia 1.1. + ```jldoctest julia> d = Date(2018, 1, 1) 2018-01-01 diff --git a/stdlib/Future/src/Future.jl b/stdlib/Future/src/Future.jl index c49c0e444b376..1d70dba7c84de 100644 --- a/stdlib/Future/src/Future.jl +++ b/stdlib/Future/src/Future.jl @@ -15,7 +15,10 @@ using Random Future.copy!(dst, src) -> dst Copy `src` into `dst`. -This function has now been moved into `Base`, consider using `copy!(dst, src)` instead. + +!!! compat "Julia 1.1" + This function has moved to `Base` with Julia 1.1, consider using `copy!(dst, src)` instead. + `Future.copy!` will be deprecated in the future. """ copy!(dst::AbstractSet, src::AbstractSet) = Base.copy!(dst, src) copy!(dst::AbstractDict, src::AbstractDict) = Base.copy!(dst, src) diff --git a/stdlib/InteractiveUtils/src/InteractiveUtils.jl b/stdlib/InteractiveUtils/src/InteractiveUtils.jl index b85403f581e1b..2653dc410c85f 100644 --- a/stdlib/InteractiveUtils/src/InteractiveUtils.jl +++ b/stdlib/InteractiveUtils/src/InteractiveUtils.jl @@ -316,9 +316,9 @@ export peakflops [`gemm!`](@ref LinearAlgebra.BLAS.gemm!). For more information see [`LinearAlgebra.peakflops`](@ref). -!!! note - This function will move to the `LinearAlgebra` standard library in the - future, and is already available as `LinearAlgebra.peakflops`. +!!! compat "Julia 1.1" + This function will be moved from `InteractiveUtils` to `LinearAlgebra` in the + future. In Julia 1.1 and later it is available as `LinearAlgebra.peakflops`. """ function peakflops(n::Integer=2000; parallel::Bool=false) # Base.depwarn("`peakflop`s have moved to the LinearAlgebra module, " * diff --git a/stdlib/InteractiveUtils/src/editless.jl b/stdlib/InteractiveUtils/src/editless.jl index d929a35a840f1..c8ea1662400bb 100644 --- a/stdlib/InteractiveUtils/src/editless.jl +++ b/stdlib/InteractiveUtils/src/editless.jl @@ -87,10 +87,11 @@ end edit(module) Edit the definition of a function, optionally specifying a tuple of types to indicate which -method to edit. +method to edit. For modules, open the main source file. The module needs to be loaded with +`using` or `import` first. -For modules, open the main source file. The module needs to be loaded with `using` or -`import` first. +!!! compat "Julia 1.1" + `edit` on modules requires at least Julia 1.1. The editor can be changed by setting `JULIA_EDITOR`, `VISUAL` or `EDITOR` as an environment variable. diff --git a/stdlib/LinearAlgebra/docs/src/index.md b/stdlib/LinearAlgebra/docs/src/index.md index e941069c13e01..0b245a5143716 100644 --- a/stdlib/LinearAlgebra/docs/src/index.md +++ b/stdlib/LinearAlgebra/docs/src/index.md @@ -371,6 +371,8 @@ LinearAlgebra.pinv LinearAlgebra.nullspace Base.kron LinearAlgebra.exp(::StridedMatrix{<:LinearAlgebra.BlasFloat}) +Base.:^(::AbstractMatrix, ::Number) +Base.:^(::Number, ::AbstractMatrix) LinearAlgebra.log(::StridedMatrix) LinearAlgebra.sqrt(::StridedMatrix{<:Real}) LinearAlgebra.cos(::StridedMatrix{<:Real}) diff --git a/stdlib/LinearAlgebra/src/LinearAlgebra.jl b/stdlib/LinearAlgebra/src/LinearAlgebra.jl index 57b48b424c70c..e4bc35dab03e2 100644 --- a/stdlib/LinearAlgebra/src/LinearAlgebra.jl +++ b/stdlib/LinearAlgebra/src/LinearAlgebra.jl @@ -392,6 +392,10 @@ If the keyword argument `parallel` is set to `true`, `peakflops` is run in paral the worker processors. The flop rate of the entire parallel computer is returned. When running in parallel, only 1 BLAS thread is used. The argument `n` still refers to the size of the problem that is solved on each processor. + +!!! compat "Julia 1.1" + This function requires at least Julia 1.1. In Julia 1.0 it is available from + the standard library `InteractiveUtils`. """ function peakflops(n::Integer=2000; parallel::Bool=false) a = fill(1.,100,100) diff --git a/stdlib/LinearAlgebra/src/dense.jl b/stdlib/LinearAlgebra/src/dense.jl index 7c81625d37984..14b9ddec25d83 100644 --- a/stdlib/LinearAlgebra/src/dense.jl +++ b/stdlib/LinearAlgebra/src/dense.jl @@ -433,6 +433,20 @@ function (^)(A::AbstractMatrix{T}, p::Real) where T # Otherwise, use Schur decomposition return schurpow(A, p) end + +""" + ^(A::AbstractMatrix, p::Number) + +Matrix power, equivalent to ``\\exp(p\\log(A))`` + +# Examples +```jldoctest +julia> [1 2; 0 3]^3 +2×2 Array{Int64,2}: + 1 26 + 0 27 +``` +""" (^)(A::AbstractMatrix, p::Number) = exp(p*log(A)) # Matrix exponential @@ -467,6 +481,28 @@ julia> exp(A) exp(A::StridedMatrix{<:BlasFloat}) = exp!(copy(A)) exp(A::StridedMatrix{<:Union{Integer,Complex{<:Integer}}}) = exp!(float.(A)) +""" + ^(b::Number, A::AbstractMatrix) + +Matrix exponential, equivalent to ``\\exp(\\log(b)A)``. + +!!! compat "Julia 1.1" + Support for raising `Irrational` numbers (like `ℯ`) + to a matrix was added in Julia 1.1. + +# Examples +```jldoctest +julia> 2^[1 2; 0 3] +2×2 Array{Float64,2}: + 2.0 6.0 + 0.0 8.0 + +julia> ℯ^[1 2; 0 3] +2×2 Array{Float64,2}: + 2.71828 17.3673 + 0.0 20.0855 +``` +""" Base.:^(b::Number, A::AbstractMatrix) = exp!(log(b)*A) # method for ℯ to explicitly elide the log(b) multiplication Base.:^(::Irrational{:ℯ}, A::AbstractMatrix) = exp(A) diff --git a/stdlib/LinearAlgebra/src/uniformscaling.jl b/stdlib/LinearAlgebra/src/uniformscaling.jl index fc082764c6f4f..fd46e6c1a2fce 100644 --- a/stdlib/LinearAlgebra/src/uniformscaling.jl +++ b/stdlib/LinearAlgebra/src/uniformscaling.jl @@ -212,6 +212,15 @@ function isapprox(J::UniformScaling, A::AbstractMatrix; end isapprox(A::AbstractMatrix, J::UniformScaling; kwargs...) = isapprox(J, A; kwargs...) +""" + copyto!(dest::AbstractMatrix, src::UniformScaling) + +Copies a [`UniformScaling`](@ref) onto a matrix. + +!!! compat "Julia 1.1" + In Julia 1.0 this method only supported a square destination matrix. Julia 1.1. added + support for a rectangular matrix. +""" function copyto!(A::AbstractMatrix, J::UniformScaling) @assert !has_offset_axes(A) fill!(A, 0) diff --git a/stdlib/Random/src/Random.jl b/stdlib/Random/src/Random.jl index 54d01ceeddf90..4f9ecbdd5a4f1 100644 --- a/stdlib/Random/src/Random.jl +++ b/stdlib/Random/src/Random.jl @@ -289,8 +289,10 @@ Pick a random element or array of random elements from the set of values specifi integers (this is not applicable to [`BigInt`](@ref)), and to ``[0, 1)`` for floating point numbers; -`S` defaults to [`Float64`](@ref) -(except when `dims` is a tuple of integers, in which case `S` must be specified). +`S` defaults to [`Float64`](@ref). + +!!! compat "Julia 1.1" + Support for `S` as a tuple requires at least Julia 1.1. # Examples ```julia-repl diff --git a/stdlib/Random/src/misc.jl b/stdlib/Random/src/misc.jl index 19689613d387f..1922c5c066b62 100644 --- a/stdlib/Random/src/misc.jl +++ b/stdlib/Random/src/misc.jl @@ -262,6 +262,10 @@ of `n`. To randomly permute an arbitrary vector, see [`shuffle`](@ref) or [`shuffle!`](@ref). +!!! compat "Julia 1.1" + In Julia 1.1 `randperm` returns a vector `v` with `eltype(v) == typeof(n)` + while in Julia 1.0 `eltype(v) == Int`. + # Examples ```jldoctest julia> randperm(MersenneTwister(1234), 4) @@ -322,6 +326,10 @@ Construct a random cyclic permutation of length `n`. The optional `rng` argument specifies a random number generator, see [Random Numbers](@ref). The element type of the result is the same as the type of `n`. +!!! compat "Julia 1.1" + In Julia 1.1 `randcycle` returns a vector `v` with `eltype(v) == typeof(n)` + while in Julia 1.0 `eltype(v) == Int`. + # Examples ```jldoctest julia> randcycle(MersenneTwister(1234), 6) diff --git a/stdlib/SparseArrays/src/sparsematrix.jl b/stdlib/SparseArrays/src/sparsematrix.jl index 572b6daa2eeef..c4b335701400d 100644 --- a/stdlib/SparseArrays/src/sparsematrix.jl +++ b/stdlib/SparseArrays/src/sparsematrix.jl @@ -1478,6 +1478,9 @@ with the specified (independent) probability `p` of any entry being nonzero, where nonzero values are sampled from the normal distribution. The optional `rng` argument specifies a random number generator, see [Random Numbers](@ref). +!!! compat "Julia 1.1" + Specifying the output element type `Type` requires at least Julia 1.1. + # Examples ```jldoctest; setup = :(using Random; Random.seed!(0)) julia> sprandn(2, 2, 0.75) diff --git a/stdlib/Statistics/src/Statistics.jl b/stdlib/Statistics/src/Statistics.jl index efb518f82625f..d85169e0656f4 100644 --- a/stdlib/Statistics/src/Statistics.jl +++ b/stdlib/Statistics/src/Statistics.jl @@ -109,6 +109,9 @@ end Compute the mean of an array over the given dimensions. +!!! compat "Julia 1.1" + `mean` for empty arrays requires at least Julia 1.1. + # Examples ```jldoctest julia> A = [1 2; 3 4] diff --git a/stdlib/UUIDs/src/UUIDs.jl b/stdlib/UUIDs/src/UUIDs.jl index 6a5e0adb79102..bd8abe032c505 100644 --- a/stdlib/UUIDs/src/UUIDs.jl +++ b/stdlib/UUIDs/src/UUIDs.jl @@ -96,6 +96,9 @@ end Generates a version 5 (namespace and domain-based) universally unique identifier (UUID), as specified by RFC 4122. +!!! compat "Julia 1.1" + This function requires at least Julia 1.1. + # Examples ```jldoctest julia> rng = MersenneTwister(1234);