Skip to content

Commit 5d19855

Browse files
authored
Merge pull request #30309 from JuliaLang/backport-1.1.0
Backports for 1.1.0
2 parents 6329be9 + 7cd0d20 commit 5d19855

Some content is hidden

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

77 files changed

+931
-462
lines changed

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,9 +340,10 @@ ifeq ($(BUNDLE_DEBUG_LIBS),1)
340340
$(INSTALL_M) $(build_bindir)/julia-debug $(DESTDIR)$(bindir)/
341341
endif
342342
ifeq ($(OS),WINNT)
343-
-$(INSTALL_M) $(build_bindir)/*.dll $(DESTDIR)$(bindir)/
343+
-$(INSTALL_M) $(filter-out $(build_bindir)/libjulia-debug.dll,$(wildcard $(build_bindir)/*.dll)) $(DESTDIR)$(bindir)/
344344
-$(INSTALL_M) $(build_libdir)/libjulia.dll.a $(DESTDIR)$(libdir)/
345345
ifeq ($(BUNDLE_DEBUG_LIBS),1)
346+
-$(INSTALL_M) $(build_bindir)/libjulia-debug.dll $(DESTDIR)$(bindir)/
346347
-$(INSTALL_M) $(build_libdir)/libjulia-debug.dll.a $(DESTDIR)$(libdir)/
347348
endif
348349
-$(INSTALL_M) $(build_bindir)/libopenlibm.dll.a $(DESTDIR)$(libdir)/

NEWS.md

Lines changed: 31 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
Julia v1.1 Release Notes
2-
==========================
2+
========================
33

44
New language features
55
---------------------
66

7-
* An *exception stack* is maintained on each task to make exception handling more robust and enable root cause analysis using `catch_stack` ([#28878]).
7+
* An *exception stack* is maintained on each task to make exception handling
8+
more robust and enable root cause analysis. The stack may be accessed using
9+
the experimental function `Base.catch_stack` ([#28878]).
810
* The experimental macro `Base.@locals` returns a dictionary of current local variable names
911
and values ([#29733]).
12+
* Binary `~` can now be dotted, as in `x .~ y` ([#30341]).
1013

1114
Language changes
1215
----------------
@@ -25,13 +28,14 @@ Language changes
2528
the old behavior, or `CartesianIndices(a)[findall(in(b), a)]` to get the new behavior
2629
on previous Julia versions ([#30226]).
2730
* `findmin(::BitArray)` and `findmax(::BitArray)` now return a `CartesianIndex` when `a` is a matrix
28-
or a higher-dimensional array, for consistency with for other array types.
31+
or a higher-dimensional array, for consistency with other array types.
2932
Use `LinearIndices(a)[findmin(a)[2]]` to get the old behavior, or `CartesianIndices(a)[findmin(a)[2]]`
3033
to get the new behavior on previous Julia versions ([#30102]).
3134
* Method signatures such as
3235
`f(::Type{T}, ::T) where {T <: X}` and
3336
`f(::Type{X}, ::Any)`
34-
are now considered ambiguous. Previously a bug caused the first one to be considered more specific ([#30160]).
37+
are now considered ambiguous. Previously a bug caused the first one to be considered more specific in
38+
some cases ([#30160]).
3539

3640
Command-line option changes
3741
---------------------------
@@ -45,13 +49,14 @@ Command-line option changes
4549
New library functions
4650
---------------------
4751

48-
* `splitpath(p::String)` function, which is the opposite of `joinpath(parts...)`: it splits a filepath into its components ([#28156]).
49-
* `isnothing(::Any)` function, to check whether something is a `Nothing`, returns a `Bool` ([#29679]).
52+
* `splitpath(p::String)` function, which is the opposite of `joinpath(parts...)`: it splits a filepath
53+
into its components ([#28156]).
54+
* `isnothing(::Any)` predicate, to check whether the argument is `nothing`. ([#29679]).
5055
* `getpid(::Process)` method ([#24064]).
5156
* `eachrow`, `eachcol` and `eachslice` functions provide efficient iterators over slices of arrays ([#29749]).
52-
* `fieldtypes(T::Type)` which return the declared types of the field in type T ([#29600]).
57+
* `fieldtypes(T::Type)` which returns the declared types of the field in type T ([#29600]).
5358
* `uuid5` has been added to the `UUIDs` standard library ([#28761]).
54-
* Predicate functions `Sys.isfreebsd`, `Sys.isopenbsd`, `Sys.isnetbsd`, and `Sys.isdragonfly` for
59+
* Predicates `Sys.isfreebsd`, `Sys.isopenbsd`, `Sys.isnetbsd`, and `Sys.isdragonfly` for
5560
detecting BSD systems have been added ([#30249]).
5661
* Internal `Base.disable_library_threading` that sets libraries to use one thread.
5762
It executes function hooks that have been registered with
@@ -72,7 +77,7 @@ Standard library changes
7277
argument ([#29157]).
7378
* The use of scientific notation when printing `BigFloat` values is now consistent with other floating point
7479
types ([#29211]).
75-
* `Regex` now behave like a scalar when used in broadcasting ([#29913]).
80+
* `Regex` now behaves like a scalar when used in broadcasting ([#29913]).
7681
* `Char` now behaves like a read-only 0-dimensional array ([#29819]).
7782
* `parse` now allows strings representing integer 0 and 1 for type `Bool` ([#29980]).
7883
* `Base.tail` now works on named tuples ([#29595]).
@@ -81,24 +86,21 @@ Standard library changes
8186
* `Base.julia_cmd` now propagates the `--inline=(yes|no)` flag ([#29858]).
8287
* `Base.@kwdef` can now be used for parametric structs, and for structs with supertypes ([#29316]).
8388
* `merge(::NamedTuple, ::NamedTuple...)` can now be used with more than 2 `NamedTuple`s ([#29259]).
84-
* `Future.copy!` has been moved to `Base` ([#29178]).
8589
* New `ncodeunits(c::Char)` method as a fast equivalent to `ncodeunits(string(c))` ([#29153]).
8690
* New `sort!(::AbstractArray; dims)` method that can sort the array along the `dims` dimension ([#28902]).
87-
* `range` now accept `stop` as a positional argument ([#28708]).
88-
* `get(A::AbstractArray, (), default)` now returns the result of `A[]` if it can instead of always
89-
returning an empty array ([#30270]).
91+
* `range` now accepts `stop` as a positional argument ([#28708]).
92+
* `get(A::AbstractArray, (), default)` now returns `A[]` instead of an empty array ([#30270]).
9093
* `parse(Bool, str)` is now supported ([#29997]).
91-
* `copyto!(::AbstractMatrix, ::UniformScaling)` supports rectangular matrices now ([#28790]).
92-
* In `put!(c::Channel{T}, v)`, `v` now gets converted to `T` as `put!` is being called ([#29092]).
94+
* `copyto!(::AbstractMatrix, ::UniformScaling)` now supports rectangular matrices ([#28790]).
9395
* `current_project()` now searches the parent directories of a Git repository for a `Project.toml` file.
9496
This also affects the behavior of the `--project` command line option when using the default
9597
`--project=@.` ([#29108]).
96-
* The `spawn` API is now more flexible and supports taking IOBuffer directly as a I/O stream,
98+
* The `spawn` API is now more flexible and supports taking IOBuffer directly as an I/O stream,
9799
converting to a system pipe as needed ([#30278]).
98100

99101
#### Dates
100102
* New `DateTime(::Date, ::Time)` constructor ([#29754]).
101-
* `TimeZone` now behave like a scalar when used in broadcasting ([#30159]).
103+
* `TimeZone` now behaves like a scalar when used in broadcasting ([#30159]).
102104

103105
#### InteractiveUtils
104106
* `edit` can now be called on a module to edit the file that defines it ([#29636]).
@@ -110,7 +112,8 @@ Standard library changes
110112
* `isdiag` and `isposdef` for `Diagonal` and `UniformScaling` ([#29638]).
111113
* `mul!`, `rmul!` and `lmul!` methods for `UniformScaling` ([#29506]).
112114
* `Symmetric` and `Hermitian` matrices now preserve the wrapper when scaled with a number ([#29469]).
113-
* Exponentiation operator `^` now supports raising a `Irrational` to an `AbstractMatrix` power ([#29782]).
115+
* Exponentiation operator `^` now supports raising an `Irrational` to an `AbstractMatrix` power ([#29782]).
116+
* Added keyword arguments `rtol`, `atol` to `pinv`, `nullspace` and `rank` ([#29998], [#29926]).
114117

115118
#### Random
116119
* `randperm` and `randcycle` now use the type of their argument to determine the element type of
@@ -122,7 +125,7 @@ Standard library changes
122125
* `sprandn` now supports specifying the output element type ([#30083]).
123126

124127
#### Statistics
125-
* `mean` and `var` now handles the empty case ([#29033]).
128+
* `mean` and `var` now handle more kinds of empty inputs ([#29033]).
126129

127130
External dependencies
128131
---------------------
@@ -133,6 +136,7 @@ External dependencies
133136
* The source code for Pkg is no longer included in JuliaLang/julia. Pkg is instead
134137
downloaded during the build process ([#29615]).
135138
* LLVM has been upgraded to 6.0.1 and support for LLVM < 6.0 has been dropped ([#28745], [#28696]).
139+
* Pkg has been upgraded to version 1.1 ([#30342]).
136140

137141
Deprecated or removed
138142
---------------------
@@ -165,7 +169,6 @@ Deprecated or removed
165169
[#29153]: https://github.com/JuliaLang/julia/issues/29153
166170
[#29157]: https://github.com/JuliaLang/julia/issues/29157
167171
[#29173]: https://github.com/JuliaLang/julia/issues/29173
168-
[#29178]: https://github.com/JuliaLang/julia/issues/29178
169172
[#29211]: https://github.com/JuliaLang/julia/issues/29211
170173
[#29259]: https://github.com/JuliaLang/julia/issues/29259
171174
[#29316]: https://github.com/JuliaLang/julia/issues/29316
@@ -200,8 +203,16 @@ Deprecated or removed
200203
[#29978]: https://github.com/JuliaLang/julia/issues/29978
201204
[#29980]: https://github.com/JuliaLang/julia/issues/29980
202205
[#29997]: https://github.com/JuliaLang/julia/issues/29997
206+
[#30004]: https://github.com/JuliaLang/julia/issues/30004
203207
[#30022]: https://github.com/JuliaLang/julia/issues/30022
204208
[#30035]: https://github.com/JuliaLang/julia/issues/30035
205209
[#30083]: https://github.com/JuliaLang/julia/issues/30083
210+
[#30102]: https://github.com/JuliaLang/julia/issues/30102
211+
[#30151]: https://github.com/JuliaLang/julia/issues/30151
206212
[#30159]: https://github.com/JuliaLang/julia/issues/30159
213+
[#30160]: https://github.com/JuliaLang/julia/issues/30160
214+
[#30226]: https://github.com/JuliaLang/julia/issues/30226
207215
[#30249]: https://github.com/JuliaLang/julia/issues/30249
216+
[#30270]: https://github.com/JuliaLang/julia/issues/30270
217+
[#30278]: https://github.com/JuliaLang/julia/issues/30278
218+
[#30342]: https://github.com/JuliaLang/julia/issues/30342

base/Makefile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,15 @@ endif
200200
endif # WINNT
201201

202202
symlink_libLLVM: $(build_private_libdir)/libLLVM.dylib
203+
ifneq ($(USE_SYSTEM_LLVM),0)
204+
LLVM_CONFIG_HOST_LIBS := $(shell $(LLVM_CONFIG_HOST) --libfiles)
205+
# HACK: llvm-config doesn't correctly point to shared libs on all platforms
206+
# https://github.com/JuliaLang/julia/issues/29981
207+
else
208+
LLVM_CONFIG_HOST_LIBS := $(shell $(LLVM_CONFIG_HOST) --libdir)/libLLVM.$(SHLIB_EXT)
209+
endif
203210
$(build_private_libdir)/libLLVM.dylib:
204-
REALPATH=`$(LLVM_CONFIG_HOST) --libfiles` && \
211+
REALPATH=$(LLVM_CONFIG_HOST_LIBS) && \
205212
$(call resolve_path,REALPATH) && \
206213
[ -e "$$REALPATH" ] && \
207214
([ ! -e "$@" ] || rm "$@") && \

base/abstractset.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,11 @@ function union!(s::AbstractSet, sets...)
6969
end
7070

7171
max_values(::Type) = typemax(Int)
72-
max_values(T::Type{<:Union{Nothing,BitIntegerSmall}}) = 1 << (8*sizeof(T))
73-
max_values(T::Union) = max(max_values(T.a), max_values(T.b))
72+
max_values(T::Union{map(X -> Type{X}, BitIntegerSmall_types)...}) = 1 << (8*sizeof(T))
73+
# saturated addition to prevent overflow with typemax(Int)
74+
max_values(T::Union) = max(max_values(T.a), max_values(T.b), max_values(T.a) + max_values(T.b))
7475
max_values(::Type{Bool}) = 2
76+
max_values(::Type{Nothing}) = 1
7577

7678
function union!(s::AbstractSet{T}, itr) where T
7779
haslength(itr) && sizehint!(s, length(s) + length(itr))

base/array.jl

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -512,10 +512,12 @@ function _collect(::Type{T}, itr, isz::SizeUnknown) where T
512512
end
513513

514514
# make a collection similar to `c` and appropriate for collecting `itr`
515-
_similar_for(c::AbstractArray, T, itr, ::SizeUnknown) = similar(c, T, 0)
516-
_similar_for(c::AbstractArray, T, itr, ::HasLength) = similar(c, T, Int(length(itr)::Integer))
517-
_similar_for(c::AbstractArray, T, itr, ::HasShape) = similar(c, T, axes(itr))
518-
_similar_for(c, T, itr, isz) = similar(c, T)
515+
_similar_for(c::AbstractArray, ::Type{T}, itr, ::SizeUnknown) where {T} = similar(c, T, 0)
516+
_similar_for(c::AbstractArray, ::Type{T}, itr, ::HasLength) where {T} =
517+
similar(c, T, Int(length(itr)::Integer))
518+
_similar_for(c::AbstractArray, ::Type{T}, itr, ::HasShape) where {T} =
519+
similar(c, T, axes(itr))
520+
_similar_for(c, ::Type{T}, itr, isz) where {T} = similar(c, T)
519521

520522
"""
521523
collect(collection)
@@ -2333,7 +2335,7 @@ function filter!(f, a::AbstractVector)
23332335

23342336
for acurr in a
23352337
if f(acurr)
2336-
a[i] = acurr
2338+
@inbounds a[i] = acurr
23372339
y = iterate(idx, state)
23382340
y === nothing && (i += 1; break)
23392341
i, state = y

base/bitarray.jl

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,16 @@
55
# notes: bits are stored in contiguous chunks
66
# unused bits must always be set to 0
77
"""
8-
BitArray{N} <: DenseArray{Bool, N}
8+
BitArray{N} <: AbstractArray{Bool, N}
99
10-
Space-efficient `N`-dimensional boolean array, which stores one bit per boolean value.
10+
Space-efficient `N`-dimensional boolean array, using just one bit for each boolean value.
11+
12+
`BitArray`s pack up to 64 values into every 8 bytes, resulting in an 8x space efficiency
13+
over `Array{Bool, N}` and allowing some operations to work on 64 values at once.
14+
15+
By default, Julia returns `BitArrays` from [broadcasting](@ref Broadcasting) operations
16+
that generate boolean elements (including dotted-comparisons like `.==`) as well as from
17+
the functions [`trues`](@ref) and [`falses`](@ref).
1118
"""
1219
mutable struct BitArray{N} <: AbstractArray{Bool, N}
1320
chunks::Vector{UInt64}

base/boot.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,7 @@ toInt8(x::UInt16) = checked_trunc_sint(Int8, check_top_bit(x))
624624
toInt8(x::UInt32) = checked_trunc_sint(Int8, check_top_bit(x))
625625
toInt8(x::UInt64) = checked_trunc_sint(Int8, check_top_bit(x))
626626
toInt8(x::UInt128) = checked_trunc_sint(Int8, check_top_bit(x))
627-
toInt8(x::Bool) = and_int(zext_int(Int8, x), Int8(1))
627+
toInt8(x::Bool) = and_int(bitcast(Int8, x), Int8(1))
628628
toInt16(x::Int8) = sext_int(Int16, x)
629629
toInt16(x::Int16) = x
630630
toInt16(x::Int32) = checked_trunc_sint(Int16, x)
@@ -679,7 +679,7 @@ toUInt8(x::UInt16) = checked_trunc_uint(UInt8, x)
679679
toUInt8(x::UInt32) = checked_trunc_uint(UInt8, x)
680680
toUInt8(x::UInt64) = checked_trunc_uint(UInt8, x)
681681
toUInt8(x::UInt128) = checked_trunc_uint(UInt8, x)
682-
toUInt8(x::Bool) = and_int(zext_int(UInt8, x), UInt8(1))
682+
toUInt8(x::Bool) = and_int(bitcast(UInt8, x), UInt8(1))
683683
toUInt16(x::Int8) = sext_int(UInt16, check_top_bit(x))
684684
toUInt16(x::Int16) = bitcast(UInt16, check_top_bit(x))
685685
toUInt16(x::Int32) = checked_trunc_uint(UInt16, x)

base/broadcast.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ BroadcastStyle(a::AbstractArrayStyle, ::Style{Tuple}) = a
137137
BroadcastStyle(::A, ::A) where A<:ArrayStyle = A()
138138
BroadcastStyle(::ArrayStyle, ::ArrayStyle) = Unknown()
139139
BroadcastStyle(::A, ::A) where A<:AbstractArrayStyle = A()
140-
function BroadcastStyle(a::A, b::B) where {A<:AbstractArrayStyle{M},B<:AbstractArrayStyle{N}} where {M,N}
140+
Base.@pure function BroadcastStyle(a::A, b::B) where {A<:AbstractArrayStyle{M},B<:AbstractArrayStyle{N}} where {M,N}
141141
if Base.typename(A) === Base.typename(B)
142142
return A(Val(max(M, N)))
143143
end

base/channels.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# This file is a part of Julia. License is MIT: https://julialang.org/license
22

3+
"""
4+
AbstractChannel{T}
5+
6+
Representation of a channel passing objects of type `T`.
7+
"""
38
abstract type AbstractChannel{T} end
49

510
"""

base/compiler/abstractinterpretation.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ function abstract_call_gf_by_type(@nospecialize(f), argtypes::Vector{Any}, @nosp
104104
# if there's a possibility we could constant-propagate a better result
105105
# (hopefully without doing too much work), try to do that now
106106
# TODO: it feels like this could be better integrated into abstract_call_method / typeinf_edge
107-
const_rettype = abstract_call_method_with_const_args(f, argtypes, applicable[nonbot]::SimpleVector, sv)
107+
const_rettype = abstract_call_method_with_const_args(rettype, f, argtypes, applicable[nonbot]::SimpleVector, sv)
108108
if const_rettype rettype
109109
# use the better result, if it's a refinement of rettype
110110
rettype = const_rettype
@@ -142,7 +142,7 @@ function abstract_call_gf_by_type(@nospecialize(f), argtypes::Vector{Any}, @nosp
142142
return rettype
143143
end
144144

145-
function abstract_call_method_with_const_args(@nospecialize(f), argtypes::Vector{Any}, match::SimpleVector, sv::InferenceState)
145+
function abstract_call_method_with_const_args(@nospecialize(rettype), @nospecialize(f), argtypes::Vector{Any}, match::SimpleVector, sv::InferenceState)
146146
method = match[3]::Method
147147
nargs::Int = method.nargs
148148
method.isva && (nargs -= 1)
@@ -159,7 +159,7 @@ function abstract_call_method_with_const_args(@nospecialize(f), argtypes::Vector
159159
end
160160
end
161161
end
162-
haveconst || return Any
162+
haveconst || improvable_via_constant_propagation(rettype) || return Any
163163
sig = match[1]
164164
sparams = match[2]::SimpleVector
165165
code = code_for_method(method, sig, sparams, sv.params.world)
@@ -1060,7 +1060,7 @@ function typeinf_local(frame::InferenceState)
10601060
elseif hd === :return
10611061
pc´ = n + 1
10621062
rt = widenconditional(abstract_eval(stmt.args[1], s[pc], frame))
1063-
if !isa(rt, Const) && !isa(rt, Type) && (!isa(rt, PartialTuple) || frame.cached)
1063+
if !isa(rt, Const) && !isa(rt, Type) && !isa(rt, PartialTuple)
10641064
# only propagate information we know we can store
10651065
# and is valid inter-procedurally
10661066
rt = widenconst(rt)

0 commit comments

Comments
 (0)