Skip to content

Commit 9f6bed6

Browse files
authored
Merge pull request #35846 from JuliaLang/backports-release-1.5
WIP: Backports for Julia 1.5-RC1
2 parents 0c388fc + 194ddda commit 9f6bed6

File tree

86 files changed

+230
-60
lines changed

Some content is hidden

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

86 files changed

+230
-60
lines changed

NEWS.md

Lines changed: 1 addition & 0 deletions

base/array.jl

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,15 @@ Copy `N` elements from collection `src` starting at offset `so`, to array `dest`
320320
offset `do`. Return `dest`.
321321
"""
322322
function copyto!(dest::Array, doffs::Integer, src::Array, soffs::Integer, n::Integer)
323+
return _copyto_impl!(dest, doffs, src, soffs, n)
324+
end
325+
326+
# this is only needed to avoid possible ambiguities with methods added in some packages
327+
function copyto!(dest::Array{T}, doffs::Integer, src::Array{T}, soffs::Integer, n::Integer) where T
328+
return _copyto_impl!(dest, doffs, src, soffs, n)
329+
end
330+
331+
function _copyto_impl!(dest::Array, doffs::Integer, src::Array, soffs::Integer, n::Integer)
323332
n == 0 && return dest
324333
n > 0 || _throw_argerror()
325334
if soffs < 1 || doffs < 1 || soffs+n-1 > length(src) || doffs+n-1 > length(dest)
@@ -339,6 +348,9 @@ end
339348

340349
copyto!(dest::Array, src::Array) = copyto!(dest, 1, src, 1, length(src))
341350

351+
# also to avoid ambiguities in packages
352+
copyto!(dest::Array{T}, src::Array{T}) where {T} = copyto!(dest, 1, src, 1, length(src))
353+
342354
# N.B: The generic definition in multidimensional.jl covers, this, this is just here
343355
# for bootstrapping purposes.
344356
function fill!(dest::Array{T}, x) where T
@@ -1762,8 +1774,8 @@ CartesianIndex(1, 1)
17621774
```
17631775
"""
17641776
function findnext(testf::Function, A, start)
1777+
i = oftype(first(keys(A)), start)
17651778
l = last(keys(A))
1766-
i = oftype(l, start)
17671779
i > l && return nothing
17681780
while true
17691781
testf(A[i]) && return i

base/boot.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,7 @@ _new(:QuoteNode, :Any)
370370
_new(:SSAValue, :Int)
371371
eval(Core, :(LineNumberNode(l::Int) = $(Expr(:new, :LineNumberNode, :l, nothing))))
372372
eval(Core, :(LineNumberNode(l::Int, @nospecialize(f)) = $(Expr(:new, :LineNumberNode, :l, :f))))
373+
LineNumberNode(l::Int, f::String) = LineNumberNode(l, Symbol(f))
373374
eval(Core, :(GlobalRef(m::Module, s::Symbol) = $(Expr(:new, :GlobalRef, :m, :s))))
374375
eval(Core, :(SlotNumber(n::Int) = $(Expr(:new, :SlotNumber, :n))))
375376
eval(Core, :(TypedSlot(n::Int, @nospecialize(t)) = $(Expr(:new, :TypedSlot, :n, :t))))

base/dict.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -742,7 +742,7 @@ Create a new entry in the `ImmutableDict` for a `key => value` pair
742742
ImmutableDict
743743
ImmutableDict(KV::Pair{K,V}) where {K,V} = ImmutableDict{K,V}(KV[1], KV[2])
744744
ImmutableDict(t::ImmutableDict{K,V}, KV::Pair) where {K,V} = ImmutableDict{K,V}(t, KV[1], KV[2])
745-
ImmutableDict(KV::Pair, rest::Pair...) = ImmutableDict(ImmutableDict(rest...), KV)
745+
ImmutableDict(KV::Pair, rest::Pair...) = ImmutableDict(ImmutableDict(KV), rest...)
746746

747747
function in(key_value::Pair, dict::ImmutableDict, valcmp=(==))
748748
key, value = key_value

base/math.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ end
101101
"""
102102
evalpoly(x, p)
103103
104-
Evaluate the polynomial ``\\sum_k p[k] x^{k-1}`` for the coefficients `p[1]`, `p[2]`, ...;
104+
Evaluate the polynomial ``\\sum_k x^{k-1} p[k]`` for the coefficients `p[1]`, `p[2]`, ...;
105105
that is, the coefficients are given in ascending order by power of `x`.
106106
Loops are unrolled at compile time if the number of coefficients is statically known, i.e.
107107
when `p` is a `Tuple`.
@@ -210,7 +210,7 @@ end
210210
"""
211211
@evalpoly(z, c...)
212212
213-
Evaluate the polynomial ``\\sum_k c[k] z^{k-1}`` for the coefficients `c[1]`, `c[2]`, ...;
213+
Evaluate the polynomial ``\\sum_k z^{k-1} c[k]`` for the coefficients `c[1]`, `c[2]`, ...;
214214
that is, the coefficients are given in ascending order by power of `z`. This macro expands
215215
to efficient inline code that uses either Horner's method or, for complex `z`, a more
216216
efficient Goertzel-like algorithm.

base/reduce.jl

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -306,25 +306,29 @@ with reduction `op` over an empty array with element type of `T`.
306306
307307
If not defined, this will throw an `ArgumentError`.
308308
"""
309-
reduce_empty(op, T) = _empty_reduce_error()
310-
reduce_empty(::typeof(+), T) = zero(T)
309+
reduce_empty(op, ::Type{T}) where {T} = _empty_reduce_error()
310+
reduce_empty(::typeof(+), ::Type{Union{}}) = _empty_reduce_error()
311+
reduce_empty(::typeof(+), ::Type{T}) where {T} = zero(T)
311312
reduce_empty(::typeof(+), ::Type{Bool}) = zero(Int)
312-
reduce_empty(::typeof(*), T) = one(T)
313+
reduce_empty(::typeof(*), ::Type{Union{}}) = _empty_reduce_error()
314+
reduce_empty(::typeof(*), ::Type{T}) where {T} = one(T)
313315
reduce_empty(::typeof(*), ::Type{<:AbstractChar}) = ""
314316
reduce_empty(::typeof(&), ::Type{Bool}) = true
315317
reduce_empty(::typeof(|), ::Type{Bool}) = false
316318

317-
reduce_empty(::typeof(add_sum), T) = reduce_empty(+, T)
319+
reduce_empty(::typeof(add_sum), ::Type{Union{}}) = _empty_reduce_error()
320+
reduce_empty(::typeof(add_sum), ::Type{T}) where {T} = reduce_empty(+, T)
318321
reduce_empty(::typeof(add_sum), ::Type{T}) where {T<:SmallSigned} = zero(Int)
319322
reduce_empty(::typeof(add_sum), ::Type{T}) where {T<:SmallUnsigned} = zero(UInt)
320-
reduce_empty(::typeof(mul_prod), T) = reduce_empty(*, T)
323+
reduce_empty(::typeof(mul_prod), ::Type{Union{}}) = _empty_reduce_error()
324+
reduce_empty(::typeof(mul_prod), ::Type{T}) where {T} = reduce_empty(*, T)
321325
reduce_empty(::typeof(mul_prod), ::Type{T}) where {T<:SmallSigned} = one(Int)
322326
reduce_empty(::typeof(mul_prod), ::Type{T}) where {T<:SmallUnsigned} = one(UInt)
323327

324-
reduce_empty(op::BottomRF, T) = reduce_empty(op.rf, T)
325-
reduce_empty(op::MappingRF, T) = mapreduce_empty(op.f, op.rf, T)
326-
reduce_empty(op::FilteringRF, T) = reduce_empty(op.rf, T)
327-
reduce_empty(op::FlipArgs, T) = reduce_empty(op.f, T)
328+
reduce_empty(op::BottomRF, ::Type{T}) where {T} = reduce_empty(op.rf, T)
329+
reduce_empty(op::MappingRF, ::Type{T}) where {T} = mapreduce_empty(op.f, op.rf, T)
330+
reduce_empty(op::FilteringRF, ::Type{T}) where {T} = reduce_empty(op.rf, T)
331+
reduce_empty(op::FlipArgs, ::Type{T}) where {T} = reduce_empty(op.f, T)
328332

329333
"""
330334
Base.mapreduce_empty(f, op, T)

base/subarray.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ size(V::SubArray) = (@_inline_meta; map(n->Int(unsafe_length(n)), axes(V)))
6464

6565
similar(V::SubArray, T::Type, dims::Dims) = similar(V.parent, T, dims)
6666

67-
sizeof(V::SubArray) = length(V) * sizeof(eltype(V))
67+
sizeof(V::SubArray) = length(V) * elsize(V.parent)
6868

6969
copy(V::SubArray) = V.parent[V.indices...]
7070

base/weakkeydict.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ function WeakKeyDict(kv)
6969
end
7070
end
7171

72+
sizehint!(d::WeakKeyDict, newsz) = sizehint!(d.ht, newsz)
7273
empty(d::WeakKeyDict, ::Type{K}, ::Type{V}) where {K, V} = WeakKeyDict{K, V}()
7374

7475
islocked(wkh::WeakKeyDict) = islocked(wkh.lock)

deps/Versions.make

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ LIBUV_BB_REL = 0
3333
OBJCONV_VER = 2.49.0
3434
OBJCONV_BB_REL = 0
3535
ZLIB_VER = 1.2.11
36-
ZLIB_BB_REL = 6
36+
ZLIB_BB_REL = 10
3737
P7ZIP_VER = 16.2.0
3838
P7ZIP_BB_REL = 1
3939

deps/checksums/Pkg-eb3726d8f9c68bb91707a5c0e9809c95f1c1eee7.tar.gz/md5

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)