Skip to content
Closed
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 base/array.jl
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ function elsize(::Type{Ptr{T}}) where T
end
elsize(::Type{Union{}}, slurp...) = 0

sizeof(a::Array) = length(a) * elsize(typeof(a)) # n.b. this ignores bitsunion bytes, as a historical fact
sizeof(a::Array) = length(a)::Int * elsize(typeof(a)) # n.b. this ignores bitsunion bytes, as a historical fact

function isassigned(a::Array, i::Int...)
@inline
Expand Down
4 changes: 4 additions & 0 deletions test/arrayops.jl
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,10 @@ end
@test_throws BoundsError badpop()
end

@testset "return type inference of `sizeof(::Array)`" begin
@test isconcretetype(Base.infer_return_type(sizeof, Tuple{Array}))
end

@testset "concatenation" begin
@test isequal([fill(1.,2,2) fill(2.,2,1)], [1. 1 2; 1 1 2])
@test isequal([fill(1.,2,2); fill(2.,1,2)], [1. 1; 1 1; 2 2])
Expand Down