Skip to content

Commit

Permalink
Fix #65 (#66)
Browse files Browse the repository at this point in the history
* Fix #65

* test 1.10
  • Loading branch information
mateuszbaran authored Jul 21, 2023
1 parent eb63140 commit 8c32f4c
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
julia-version: ['1.6', '1.8', '~1.9.0-0']
julia-version: ['1.6', '1.9', '~1.10.0-0']
os: [ubuntu-latest, macOS-latest, windows-latest]
steps:
- uses: actions/checkout@v3
Expand All @@ -22,6 +22,6 @@ jobs:
- uses: julia-actions/julia-buildpkg@latest
- uses: julia-actions/julia-runtest@latest
- uses: julia-actions/julia-uploadcodecov@latest
if: ${{ matrix.julia-version == '1.6' && matrix.os =='ubuntu-latest' }}
if: ${{ matrix.os =='ubuntu-latest' }}
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "HybridArrays"
uuid = "1baab800-613f-4b0a-84e4-9cd3431bfbb9"
authors = ["Mateusz Baran <mateuszbaran89@gmail.com>"]
version = "0.4.15"
version = "0.4.16"

[deps]
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Expand Down
8 changes: 8 additions & 0 deletions src/abstractarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,14 @@ similar(::Type{<:HybridArray{S,T,N,M}},::Type{T2}) where {S,T,N,M,T2} = HybridAr
similar(::Type{SA},::Type{T},s::Size{S}) where {SA<:HybridArray,T,S} = hybridarray_similar_type(T,s,StaticArrays.length_val(s))(undef)
hybridarray_similar_type(::Type{T},s::Size{S},::Type{Val{D}}) where {T,S,D} = HybridArray{Tuple{S...},T,D,length(s)}

#disambiguation
function similar(a::HybridArray, t::Type{T2}, i::Tuple{Union{Integer, Base.OneTo}, Vararg{Union{Integer, Base.OneTo}}}) where T2
return invoke(similar, Tuple{AbstractArray, Type, Tuple{Union{Integer, Base.OneTo}, Vararg{Union{Integer, Base.OneTo}}}}, a, t, i)
end
function similar(a::HybridArray, t::Type{T2}, i::Tuple{Int64, Vararg{Int64}}) where T2
return invoke(similar, Tuple{AbstractArray, Type, Tuple{Int64, Vararg{Int64}}}, a, t, i)
end

# for internal use only (used in vcat and hcat)
# TODO: try to make this less hacky
# adding method to similar_type ends up being used in broadcasting for some reason?
Expand Down
8 changes: 8 additions & 0 deletions test/abstractarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -138,4 +138,12 @@ using StaticArrays: Dynamic
@test isa(M3, HybridArray{Tuple{Dynamic(),3,4},Int,3,3,Array{Int,3}})
@test size(M3) === (5, 3, 4)
end

@testset "getindex" begin
A = HybridArray{Tuple{2,2,StaticArrays.Dynamic()}}(randn(2,2,100))
B = A[1:2]
@test B isa Vector
@test A[1] == B[1]
@test A[2] == B[2]
end
end
6 changes: 5 additions & 1 deletion test/linalg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ using Test
@test isa(vcat(HybridVector{2}([1, 2]), HybridVector{3}([1, 2, 3])), HybridVector{5, Int})

@test_throws DimensionMismatch hcat(HybridVector{2}([1, 2]), HybridVector{3}([1, 2, 3]))
@test_throws ArgumentError vcat(m1, hcat(m1, m2))
if VERSION < v"1.10"
@test_throws ArgumentError vcat(m1, hcat(m1, m2))
else
@test_throws DimensionMismatch vcat(m1, hcat(m1, m2))
end
end
end

2 comments on commit 8c32f4c

@mateuszbaran
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

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

Registration pull request created: JuliaRegistries/General/87964

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.4.16 -m "<description of version>" 8c32f4c63ae6a3a32f2d737cd410547e79afe033
git push origin v0.4.16

Please sign in to comment.