From 004d0e385cb97eb010413d74216e960546e1a688 Mon Sep 17 00:00:00 2001 From: kragol Date: Fri, 28 Jul 2023 17:38:15 +0200 Subject: [PATCH 1/5] fixed bug with empty constructors fixes #85 --- src/PooledArrays.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/PooledArrays.jl b/src/PooledArrays.jl index 1058f13..2d08f52 100644 --- a/src/PooledArrays.jl +++ b/src/PooledArrays.jl @@ -199,8 +199,8 @@ end PooledArray{T}(d, signed=signed, compress=compress) # Construct an empty PooledVector of a specific type -@inline PooledArray(t::Type) = PooledArray(Array(t,0)) -@inline PooledArray(t::Type, r::Type) = PooledArray(Array(t,0), r) +@inline PooledArray(t::Type) = PooledArray(Array{t}(undef,0)) +@inline PooledArray(t::Type, r::Type) = PooledArray(Array{t}(undef,0), r) ############################################################################## ## From 086df6c3d22db46a45c68c4fe72088eee5fd9e44 Mon Sep 17 00:00:00 2001 From: kragol Date: Fri, 28 Jul 2023 18:01:22 +0200 Subject: [PATCH 2/5] added tests for empty constructors --- test/runtests.jl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/runtests.jl b/test/runtests.jl index f205d73..218f944 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -15,6 +15,9 @@ end @testset "PooledArrays" begin @test eltype(PooledArray(Int[])) === Int + @test PooledArray(Int) == Int[] + @test PooledArray(Int,UInt64) == Int[] + a = rand(10) b = rand(10,10) c = rand(1:10, 1000) From c92e61b846fac89152e6791821b5fdc358263ed1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bogumi=C5=82=20Kami=C5=84ski?= Date: Fri, 28 Jul 2023 18:07:02 +0200 Subject: [PATCH 3/5] Update test/runtests.jl --- test/runtests.jl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/runtests.jl b/test/runtests.jl index 218f944..ceb6087 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -16,7 +16,9 @@ end @test eltype(PooledArray(Int[])) === Int @test PooledArray(Int) == Int[] - @test PooledArray(Int,UInt64) == Int[] + @test PooledArray(Int)) <: PooledVector{Int, UInt32} + @test PooledArray(Int, UInt64) == Int[] + @test PooledArray(Int, UInt64)) <: PooledVector{Int, UInt64} a = rand(10) b = rand(10,10) From e53664c1c2287e71a0dbaebad12ba1a92e76557d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bogumi=C5=82=20Kami=C5=84ski?= Date: Fri, 28 Jul 2023 18:08:57 +0200 Subject: [PATCH 4/5] Update test/runtests.jl --- test/runtests.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/runtests.jl b/test/runtests.jl index ceb6087..a182efe 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -16,9 +16,9 @@ end @test eltype(PooledArray(Int[])) === Int @test PooledArray(Int) == Int[] - @test PooledArray(Int)) <: PooledVector{Int, UInt32} + @test PooledArray(Int) <: PooledVector{Int, UInt32} @test PooledArray(Int, UInt64) == Int[] - @test PooledArray(Int, UInt64)) <: PooledVector{Int, UInt64} + @test PooledArray(Int, UInt64) <: PooledVector{Int, UInt64} a = rand(10) b = rand(10,10) From fe23cfd665470b3e3b10ac3c2c61087a31a9cbd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bogumi=C5=82=20Kami=C5=84ski?= Date: Fri, 28 Jul 2023 18:11:44 +0200 Subject: [PATCH 5/5] Update test/runtests.jl --- test/runtests.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/runtests.jl b/test/runtests.jl index a182efe..7ceadd4 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -16,9 +16,9 @@ end @test eltype(PooledArray(Int[])) === Int @test PooledArray(Int) == Int[] - @test PooledArray(Int) <: PooledVector{Int, UInt32} + @test PooledArray(Int) isa PooledVector{Int, UInt32} @test PooledArray(Int, UInt64) == Int[] - @test PooledArray(Int, UInt64) <: PooledVector{Int, UInt64} + @test PooledArray(Int, UInt64) isa PooledVector{Int, UInt64} a = rand(10) b = rand(10,10)