diff --git a/base/array.jl b/base/array.jl index 7ec05e443ee88..d52997bf7af53 100644 --- a/base/array.jl +++ b/base/array.jl @@ -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) @@ -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 @@ -1762,8 +1774,8 @@ CartesianIndex(1, 1) ``` """ function findnext(testf::Function, A, start) + i = oftype(first(keys(A)), start) l = last(keys(A)) - i = oftype(l, start) i > l && return nothing while true testf(A[i]) && return i diff --git a/base/boot.jl b/base/boot.jl index 17a777a7a26e6..034ca642c459a 100644 --- a/base/boot.jl +++ b/base/boot.jl @@ -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))))