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

fix some 1.5 compatibility issues #35965

Merged
merged 1 commit into from
May 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
14 changes: 13 additions & 1 deletion base/array.jl
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,15 @@ Copy `N` elements from collection `src` starting at offset `so`, to array `dest`
offset `do`. Return `dest`.
"""
function copyto!(dest::Array, doffs::Integer, src::Array, soffs::Integer, n::Integer)
return _copyto_impl!(dest, doffs, src, soffs, n)
end

# this is only needed to avoid possible ambiguities with methods added in some packages
function copyto!(dest::Array{T}, doffs::Integer, src::Array{T}, soffs::Integer, n::Integer) where T
return _copyto_impl!(dest, doffs, src, soffs, n)
end

function _copyto_impl!(dest::Array, doffs::Integer, src::Array, soffs::Integer, n::Integer)
n == 0 && return dest
n > 0 || _throw_argerror()
if soffs < 1 || doffs < 1 || soffs+n-1 > length(src) || doffs+n-1 > length(dest)
Expand All @@ -339,6 +348,9 @@ end

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

# also to avoid ambiguities in packages
copyto!(dest::Array{T}, src::Array{T}) where {T} = copyto!(dest, 1, src, 1, length(src))

# N.B: The generic definition in multidimensional.jl covers, this, this is just here
# for bootstrapping purposes.
function fill!(dest::Array{T}, x) where T
Expand Down Expand Up @@ -1762,8 +1774,8 @@ CartesianIndex(1, 1)
```
"""
function findnext(testf::Function, A, start)
i = oftype(first(keys(A)), start)
Copy link
Contributor

@goretkin goretkin Aug 7, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably prompted by

https://github.com/JuliaCI/NanosoldierReports/blob/18bb6d85b20e25f1a9f2f312963f4b8b4fe7082e/pkgeval/by_hash/a340bf1_vs_3c50b7f/logs/ApproxFun/1.5.0-DEV-fc8aa8666a.log#L260-L288

Periodic: Error During Test at /home/pkgeval/.julia/packages/ApproxFun/IC3js/test/ReadmeTest.jl:75
  Got exception outside of a @test
  MethodError: no method matching InfiniteArrays.Infinity(::Int64)
  Closest candidates are:
    InfiniteArrays.Infinity(::T) where T<:Number at boot.jl:715
    InfiniteArrays.Infinity() at /home/pkgeval/.julia/packages/InfiniteArrays/aQOI9/src/Infinity.jl:15
    InfiniteArrays.Infinity(!Matched::Float16) where T<:Integer at float.jl:71
    ...
  Stacktrace:
   [1] convert(::Type{InfiniteArrays.Infinity}, ::Int64) at ./number.jl:7
   [2] oftype(::InfiniteArrays.Infinity, ::Int64) at ./essentials.jl:367
   [3] findnext(::ApproxFunBase.var"#286#287"{Int64}, ::InfiniteArrays.InfStepRange{Int64,Int64}, ::Int64) at ./array.jl:1766
   [4] findfirst(::Function, ::InfiniteArrays.InfStepRange{Int64,Int64}) at ./array.jl:1820
   [5] block(::ApproxFunBase.SumSpace{Tuple{CosSpace{PeriodicSegment{Float64},Float64},SinSpace{PeriodicSegment{Float64},Float64}},PeriodicSegment{Float64},Float64}, ::Int64) at /home/pkgeval/.julia/packages/ApproxFunBase/Jv4NR/src/Spaces/SumSpace.jl:35
   [6] default_Fun(::ApproxFunBase.DFunction, ::ApproxFunBase.SumSpace{Tuple{CosSpace{PeriodicSegment{Float64},Float64},SinSpace{PeriodicSegment{Float64},Float64}},PeriodicSegment{Float64},Float64}) at /home/pkgeval/.julia/packages/ApproxFunBase/Jv4NR/src/constructors.jl:127
   [7] Fun(::Function, ::ApproxFunBase.SumSpace{Tuple{CosSpace{PeriodicSegment{Float64},Float64},SinSpace{PeriodicSegment{Float64},Float64}},PeriodicSegment{Float64},Float64}) at /home/pkgeval/.julia/packages/ApproxFunBase/Jv4NR/src/constructors.jl:177
   [8] top-level scope at /home/pkgeval/.julia/packages/ApproxFun/IC3js/test/ReadmeTest.jl:76
   [9] top-level scope at /workspace/srcdir/usr/share/julia/stdlib/v1.5/Test/src/Test.jl:1114
   [10] top-level scope at /home/pkgeval/.julia/packages/ApproxFun/IC3js/test/ReadmeTest.jl:76
   [11] top-level scope at /workspace/srcdir/usr/share/julia/stdlib/v1.5/Test/src/Test.jl:1114
   [12] top-level scope at /home/pkgeval/.julia/packages/ApproxFun/IC3js/test/ReadmeTest.jl:5
   [13] include(::String) at ./client.jl:457
   [14] top-level scope at ./timing.jl:174 [inlined]
   [15] top-level scope at /home/pkgeval/.julia/packages/ApproxFun/IC3js/test/runtests.jl:0
   [16] include(::String) at ./client.jl:457
   [17] top-level scope at none:6
   [18] eval(::Module, ::Any) at ./boot.jl:331
   [19] exec_options(::Base.JLOptions) at ./client.jl:272
   [20] _start() at ./client.jl:506

to permit e.g. findfirst(>(5), 1:InfiniteArrays.Infinity()) to work

l = last(keys(A))
i = oftype(l, start)
i > l && return nothing
while true
testf(A[i]) && return i
Expand Down
1 change: 1 addition & 0 deletions base/boot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,7 @@ _new(:QuoteNode, :Any)
_new(:SSAValue, :Int)
eval(Core, :(LineNumberNode(l::Int) = $(Expr(:new, :LineNumberNode, :l, nothing))))
eval(Core, :(LineNumberNode(l::Int, @nospecialize(f)) = $(Expr(:new, :LineNumberNode, :l, :f))))
LineNumberNode(l::Int, f::String) = LineNumberNode(l, Symbol(f))
eval(Core, :(GlobalRef(m::Module, s::Symbol) = $(Expr(:new, :GlobalRef, :m, :s))))
eval(Core, :(SlotNumber(n::Int) = $(Expr(:new, :SlotNumber, :n))))
eval(Core, :(TypedSlot(n::Int, @nospecialize(t)) = $(Expr(:new, :TypedSlot, :n, :t))))
Expand Down