Skip to content

Commit 8c32f4c

Browse files
authored
Fix #65 (#66)
* Fix #65 * test 1.10
1 parent eb63140 commit 8c32f4c

File tree

5 files changed

+24
-4
lines changed

5 files changed

+24
-4
lines changed

.github/workflows/ci.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ${{ matrix.os }}
1212
strategy:
1313
matrix:
14-
julia-version: ['1.6', '1.8', '~1.9.0-0']
14+
julia-version: ['1.6', '1.9', '~1.10.0-0']
1515
os: [ubuntu-latest, macOS-latest, windows-latest]
1616
steps:
1717
- uses: actions/checkout@v3
@@ -22,6 +22,6 @@ jobs:
2222
- uses: julia-actions/julia-buildpkg@latest
2323
- uses: julia-actions/julia-runtest@latest
2424
- uses: julia-actions/julia-uploadcodecov@latest
25-
if: ${{ matrix.julia-version == '1.6' && matrix.os =='ubuntu-latest' }}
25+
if: ${{ matrix.os =='ubuntu-latest' }}
2626
env:
2727
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

Project.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "HybridArrays"
22
uuid = "1baab800-613f-4b0a-84e4-9cd3431bfbb9"
33
authors = ["Mateusz Baran <mateuszbaran89@gmail.com>"]
4-
version = "0.4.15"
4+
version = "0.4.16"
55

66
[deps]
77
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"

src/abstractarray.jl

+8
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,14 @@ similar(::Type{<:HybridArray{S,T,N,M}},::Type{T2}) where {S,T,N,M,T2} = HybridAr
6969
similar(::Type{SA},::Type{T},s::Size{S}) where {SA<:HybridArray,T,S} = hybridarray_similar_type(T,s,StaticArrays.length_val(s))(undef)
7070
hybridarray_similar_type(::Type{T},s::Size{S},::Type{Val{D}}) where {T,S,D} = HybridArray{Tuple{S...},T,D,length(s)}
7171

72+
#disambiguation
73+
function similar(a::HybridArray, t::Type{T2}, i::Tuple{Union{Integer, Base.OneTo}, Vararg{Union{Integer, Base.OneTo}}}) where T2
74+
return invoke(similar, Tuple{AbstractArray, Type, Tuple{Union{Integer, Base.OneTo}, Vararg{Union{Integer, Base.OneTo}}}}, a, t, i)
75+
end
76+
function similar(a::HybridArray, t::Type{T2}, i::Tuple{Int64, Vararg{Int64}}) where T2
77+
return invoke(similar, Tuple{AbstractArray, Type, Tuple{Int64, Vararg{Int64}}}, a, t, i)
78+
end
79+
7280
# for internal use only (used in vcat and hcat)
7381
# TODO: try to make this less hacky
7482
# adding method to similar_type ends up being used in broadcasting for some reason?

test/abstractarray.jl

+8
Original file line numberDiff line numberDiff line change
@@ -138,4 +138,12 @@ using StaticArrays: Dynamic
138138
@test isa(M3, HybridArray{Tuple{Dynamic(),3,4},Int,3,3,Array{Int,3}})
139139
@test size(M3) === (5, 3, 4)
140140
end
141+
142+
@testset "getindex" begin
143+
A = HybridArray{Tuple{2,2,StaticArrays.Dynamic()}}(randn(2,2,100))
144+
B = A[1:2]
145+
@test B isa Vector
146+
@test A[1] == B[1]
147+
@test A[2] == B[2]
148+
end
141149
end

test/linalg.jl

+5-1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ using Test
4242
@test isa(vcat(HybridVector{2}([1, 2]), HybridVector{3}([1, 2, 3])), HybridVector{5, Int})
4343

4444
@test_throws DimensionMismatch hcat(HybridVector{2}([1, 2]), HybridVector{3}([1, 2, 3]))
45-
@test_throws ArgumentError vcat(m1, hcat(m1, m2))
45+
if VERSION < v"1.10"
46+
@test_throws ArgumentError vcat(m1, hcat(m1, m2))
47+
else
48+
@test_throws DimensionMismatch vcat(m1, hcat(m1, m2))
49+
end
4650
end
4751
end

0 commit comments

Comments
 (0)