Skip to content
Open
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
2 changes: 1 addition & 1 deletion Compiler/src/typeutils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ has_extended_info(@nospecialize x) = (!isa(x, Type) && !isvarargtype(x)) || isTy
# certain combinations of `a` and `b` where one/both isa/are `Union`/`UnionAll` type(s)s.
isnotbrokensubtype(@nospecialize(a), @nospecialize(b)) = (!iskindtype(b) || !isType(a) || hasuniquerep(a.parameters[1]) || b <: a)

function argtypes_to_type(argtypes::Array{Any,1})
function argtypes_to_type(argtypes::Vector{Any})
argtypes = anymap(@nospecialize(a) -> isvarargtype(a) ? a : widenconst(a), argtypes)
filter!(@nospecialize(x) -> !isvarargtype(x) || valid_as_lattice(unwrapva(x), true), argtypes)
all(@nospecialize(x) -> isvarargtype(x) || valid_as_lattice(x, true), argtypes) || return Bottom
Expand Down
2 changes: 1 addition & 1 deletion Compiler/src/utilities.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function contains_is(itr, @nospecialize(x))
return false
end

anymap(f::Function, a::Array{Any,1}) = Any[ f(a[i]) for i in 1:length(a) ]
anymap(f::Function, a::Vector{Any}) = Any[ f(a[i]) for i in 1:length(a) ]

############
# inlining #
Expand Down
14 changes: 7 additions & 7 deletions Compiler/test/inference.jl
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,12 @@ end

# issue #51694
@test Compiler.type_more_complex(
Base.Generator{Base.Iterators.Flatten{Array{Bool, 1}}, typeof(identity)},
Base.Generator{Array{Bool, 1}, typeof(identity)},
Base.Generator{Base.Iterators.Flatten{Vector{Bool}}, typeof(identity)},
Base.Generator{Vector{Bool}, typeof(identity)},
Core.svec(), 0, 0, 0)
@test Compiler.type_more_complex(
Base.Generator{Base.Iterators.Flatten{Base.Generator{Array{Bool, 1}, typeof(identity)}}, typeof(identity)},
Base.Generator{Array{Bool, 1}, typeof(identity)},
Base.Generator{Base.Iterators.Flatten{Base.Generator{Vector{Bool}, typeof(identity)}}, typeof(identity)},
Base.Generator{Vector{Bool}, typeof(identity)},
Core.svec(), 0, 0, 0)

let # 40336
Expand Down Expand Up @@ -419,7 +419,7 @@ end

# issue #12826
f12826(v::Vector{I}) where {I<:Integer} = v[1]
@test Base.return_types(f12826,Tuple{Array{I,1} where I<:Integer})[1] == Integer
@test Base.return_types(f12826,Tuple{Vector{I} where I<:Integer})[1] == Integer


# non-terminating inference, issue #14009
Expand Down Expand Up @@ -1465,8 +1465,8 @@ let egal_tfunc
@test egal_tfunc(Array, Array) == Bool
@test egal_tfunc(Array, AbstractArray{Int}) == Bool
@test egal_tfunc(Array{Real}, AbstractArray{Int}) === Const(false)
@test egal_tfunc(Array{Real, 2}, AbstractArray{Real, 2}) === Bool
@test egal_tfunc(Array{Real, 2}, AbstractArray{Int, 2}) === Const(false)
@test egal_tfunc(Matrix{Real}, AbstractMatrix{Real}) === Bool
@test egal_tfunc(Matrix{Real}, AbstractMatrix{Int}) === Const(false)
@test egal_tfunc(DataType, Int) === Const(false)
@test egal_tfunc(DataType, Const(Int)) === Bool
@test egal_tfunc(DataType, Const(Array)) === Const(false)
Expand Down
12 changes: 6 additions & 6 deletions base/array.jl
Original file line number Diff line number Diff line change
Expand Up @@ -399,10 +399,10 @@ end

## Constructors ##

similar(a::Array{T,1}) where {T} = Vector{T}(undef, size(a,1))
similar(a::Array{T,2}) where {T} = Matrix{T}(undef, size(a,1), size(a,2))
similar(a::Array{T,1}, S::Type) where {T} = Vector{S}(undef, size(a,1))
similar(a::Array{T,2}, S::Type) where {T} = Matrix{S}(undef, size(a,1), size(a,2))
similar(a::Vector{T}) where {T} = Vector{T}(undef, size(a,1))
similar(a::Matrix{T}) where {T} = Matrix{T}(undef, size(a,1), size(a,2))
similar(a::Vector{T}, S::Type) where {T} = Vector{S}(undef, size(a,1))
similar(a::Matrix{T}, S::Type) where {T} = Matrix{S}(undef, size(a,1), size(a,2))
similar(a::Array{T}, m::Int) where {T} = Vector{T}(undef, m)
similar(a::Array, T::Type, dims::Dims{N}) where {N} = Array{T,N}(undef, dims)
similar(a::Array{T}, dims::Dims{N}) where {T,N} = Array{T,N}(undef, dims)
Expand Down Expand Up @@ -1832,12 +1832,12 @@ julia> insert!(Any[1:6;], 3, "here")
6
```
"""
function insert!(a::Array{T,1}, i::Integer, item) where T
function insert!(a::Vector{T}, i::Integer, item) where T
@_propagate_inbounds_meta
item = item isa T ? item : convert(T, item)::T
return _insert!(a, i, item)
end
function _insert!(a::Array{T,1}, i::Integer, item::T) where T
function _insert!(a::Vector{T}, i::Integer, item::T) where T
@_noub_meta
# Throw convert error before changing the shape of the array
_growat!(a, i, 1)
Expand Down
6 changes: 3 additions & 3 deletions base/iostream.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ Mostly used to represent files returned by [`open`](@ref).
"""
mutable struct IOStream <: IO
handle::Ptr{Cvoid}
ios::Array{UInt8,1}
ios::Vector{UInt8}
name::String
mark::Int64
lock::ReentrantLock
_dolock::Bool

IOStream(name::AbstractString, buf::Array{UInt8,1}) = new(pointer(buf), buf, name, -1, ReentrantLock(), true)
IOStream(name::AbstractString, buf::Vector{UInt8}) = new(pointer(buf), buf, name, -1, ReentrantLock(), true)
end

function IOStream(name::AbstractString, finalize::Bool)
Expand Down Expand Up @@ -470,7 +470,7 @@ take!(s::IOStream) =
@_lock_ios s ccall(:jl_take_buffer, Vector{UInt8}, (Ptr{Cvoid},), s.ios)

function readuntil(s::IOStream, delim::UInt8; keep::Bool=false)
@_lock_ios s ccall(:jl_readuntil, Array{UInt8,1}, (Ptr{Cvoid}, UInt8, UInt8, UInt8), s.ios, delim, 0, !keep)
@_lock_ios s ccall(:jl_readuntil, Vector{UInt8}, (Ptr{Cvoid}, UInt8, UInt8, UInt8), s.ios, delim, 0, !keep)
end

# like readuntil, above, but returns a String without requiring a copy
Expand Down
2 changes: 1 addition & 1 deletion base/libdl.jl
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ if (Sys.islinux() || Sys.isbsd()) && !Sys.isapple()

# This callback function called by dl_iterate_phdr() on Linux and BSD's
# DL_ITERATE_PHDR(3) on freebsd
function dl_phdr_info_callback(di::dl_phdr_info, size::Csize_t, dynamic_libraries::Array{String,1})
function dl_phdr_info_callback(di::dl_phdr_info, size::Csize_t, dynamic_libraries::Vector{String})
name = unsafe_string(di.name)
push!(dynamic_libraries, name)
return Cint(0)
Expand Down
4 changes: 2 additions & 2 deletions doc/src/manual/interfaces.md
Original file line number Diff line number Diff line change
Expand Up @@ -255,10 +255,10 @@ library module, only supports two dimensions, so it just defines
`getindex(A::SparseMatrixCSC, i::Int, j::Int)`. The same holds for [`setindex!`](@ref).

Returning to the sequence of squares from above, we could instead define it as a subtype of an
`AbstractArray{Int, 1}`:
`AbstractVector{Int}`:

```jldoctest squarevectype
julia> struct SquaresVector <: AbstractArray{Int, 1}
julia> struct SquaresVector <: AbstractVector{Int}
count::Int
end
Expand Down
2 changes: 1 addition & 1 deletion doc/src/manual/performance-tips.md
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ of type `Array{Any}`). But, if you're using one of these structures and happen t
of an element, it helps to share this knowledge with the compiler:

```julia
function foo(a::Array{Any,1})
function foo(a::Vector{Any})
x = a[1]::Int32
b = x+1
...
Expand Down
14 changes: 7 additions & 7 deletions test/core.jl
Original file line number Diff line number Diff line change
Expand Up @@ -462,12 +462,12 @@ end
mutable struct A3890{T1}
x::Matrix{Complex{T1}}
end
@test A3890{Float64}.types[1] === Array{ComplexF64,2}
@test A3890{Float64}.types[1] === Matrix{ComplexF64}
# make sure the field type Matrix{Complex{T1}} isn't cached
mutable struct B3890{T2}
x::Matrix{Complex{T2}}
end
@test B3890{Float64}.types[1] === Array{ComplexF64,2}
@test B3890{Float64}.types[1] === Matrix{ComplexF64}

# issue #786
mutable struct Node{T}
Expand Down Expand Up @@ -3894,14 +3894,14 @@ f12092(x::Int, y::Int...) = 2

# issue #12063
# NOTE: should have > MAX_TUPLETYPE_LEN arguments
f12063(tt, g, p, c, b, v, cu::T, d::AbstractArray{T, 2}, ve) where {T} = 1
f12063(tt, g, p, c, b, v, cu::T, d::AbstractMatrix{T}, ve) where {T} = 1
f12063(args...) = 2
g12063() = f12063(0, 0, 0, 0, 0, 0, 0.0, zeros(0,0), Int[])
@test g12063() == 1

# issue #11587
mutable struct Sampler11587{N}
clampedpos::Array{Int,2}
clampedpos::Matrix{Int}
buf::Array{Float64,N}
end
function Sampler11587()
Expand Down Expand Up @@ -7435,9 +7435,9 @@ end
@test repackage28445()

# issue #28597
@test_throws ArgumentError Array{Int, 2}(undef, 0, -10)
@test_throws ArgumentError Array{Int, 2}(undef, -10, 0)
@test_throws ArgumentError Array{Int, 2}(undef, -1, -1)
@test_throws ArgumentError Matrix{Int}(undef, 0, -10)
@test_throws ArgumentError Matrix{Int}(undef, -10, 0)
@test_throws ArgumentError Matrix{Int}(undef, -1, -1)

# issue #54244
# test that zero sized array doesn't throw even with large axes
Expand Down
10 changes: 5 additions & 5 deletions test/offsetarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -247,17 +247,17 @@ PV = view(P, 2:3, :)

# Similar
B = similar(A, Float32)
@test isa(B, OffsetArray{Float32,2})
@test isa(B, OffsetMatrix{Float32})
@test axes(B) === axes(A)
B = similar(A, (3,4))
@test isa(B, Array{Int,2})
@test isa(B, Matrix{Int})
@test size(B) == (3,4)
@test axes(B) === (Base.OneTo(3), Base.OneTo(4))
B = similar(A, (-3:3,1:4))
@test isa(B, OffsetArray{Int,2})
@test isa(B, OffsetMatrix{Int})
@test axes(B) === (OffsetArrays.IdOffsetRange(Base.OneTo(7), -4), OffsetArrays.IdOffsetRange(Base.OneTo(4)))
B = similar(parent(A), (-3:3,1:4))
@test isa(B, OffsetArray{Int,2})
@test isa(B, OffsetMatrix{Int})
@test axes(B) === (OffsetArrays.IdOffsetRange(Base.OneTo(7), -4), OffsetArrays.IdOffsetRange(Base.OneTo(4)))

# Indexing with OffsetArray indices
Expand Down Expand Up @@ -923,7 +923,7 @@ end
@test axes(A) == Base.IdentityUnitRange.((2:3, 4:5))

B = reshape(A0, -10:-9, 9:10)
@test isa(B, OffsetArray{Int,2})
@test isa(B, OffsetMatrix{Int})
@test parent(B) == A0
@test axes(B) == Base.IdentityUnitRange.((-10:-9, 9:10))
end
2 changes: 1 addition & 1 deletion test/specificity.jl
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ let A = Tuple{Ref, Tuple{T}} where T,
end

# issue #22339
let A = Tuple{T, Array{T, 1}} where T,
let A = Tuple{T, Vector{T}} where T,
B = Tuple{T} where T,
C = Tuple{T} where T<:AbstractFloat
@test args_morespecific(B, A)
Expand Down
2 changes: 1 addition & 1 deletion test/strings/basic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ end
end
# test AbstractString functions at beginning of string.jl
struct tstStringType <: AbstractString
data::Array{UInt8,1}
data::Vector{UInt8}
end
@testset "AbstractString functions" begin
tstr = tstStringType(unsafe_wrap(Vector{UInt8},"12"))
Expand Down
Loading