Skip to content

Commit f36bd64

Browse files
authored
Drop support for versions of Julia lower than v1.6 (#985)
1 parent 81f6c7c commit f36bd64

20 files changed

+104
-198
lines changed

.github/workflows/benchmark.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
- uses: actions/checkout@v2
1111
- uses: julia-actions/setup-julia@latest
1212
with:
13-
version: 1.4
13+
version: 1.6
1414
- name: Install dependencies
1515
run: julia -e 'using Pkg; pkg"add PkgBenchmark BenchmarkCI@0.1"'
1616
- name: Run benchmarks

.github/workflows/ci.yml

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,8 @@ jobs:
1313
strategy:
1414
matrix:
1515
version:
16+
- '1.6'
1617
- '1'
17-
- '1.0'
18-
- '1.1'
19-
- '1.2'
20-
- '1.3'
21-
- '1.4'
2218
- 'nightly'
2319
os:
2420
- ubuntu-latest
@@ -32,13 +28,6 @@ jobs:
3228
# See https://github.com/marketplace/actions/setup-julia-environment
3329
# MacOS not available on x86
3430
- {os: 'macOS-latest', arch: 'x86'}
35-
# Don't test on all versions
36-
- {os: 'macOS-latest', version: '1.1'}
37-
- {os: 'macOS-latest', version: '1.2'}
38-
- {os: 'macOS-latest', version: '1.3'}
39-
- {os: 'windows-latest', version: '1.1'}
40-
- {os: 'windows-latest', version: '1.2'}
41-
- {os: 'windows-latest', version: '1.3'}
4231
steps:
4332
- uses: actions/checkout@v1
4433
- uses: julia-actions/setup-julia@latest
@@ -57,7 +46,7 @@ jobs:
5746
- uses: actions/checkout@v1
5847
- uses: julia-actions/setup-julia@latest
5948
with:
60-
version: '1.4'
49+
version: '1.6'
6150
- run: julia --project=docs -e '
6251
using Pkg;
6352
Pkg.develop(PackageSpec(; path=pwd()));

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
name = "StaticArrays"
22
uuid = "90137ffa-7385-5640-81b9-e52037218182"
3-
version = "1.3.6"
3+
version = "1.4.0"
44

55
[deps]
66
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
77
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
88
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
99

1010
[compat]
11-
julia = "1"
11+
julia = "1.6"
1212

1313
[extras]
1414
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"

benchmark/bench_matrix_ops.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ using StaticArrays
77

88
const suite = BenchmarkGroup()
99
const matrix_sizes = if haskey(ENV, "GITHUB_EVENT_PATH")
10-
(1, 2, 3, 4, 10, 20)
10+
(1, 2, 3, 4, 10)
1111
else
12-
1:20
12+
1:10
1313
end
1414

1515
# Use same arrays across processes (at least with the same Julia version):

docs/src/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
*Statically sized arrays for Julia*
33

44
**StaticArrays** provides a framework for implementing statically sized arrays
5-
in Julia (≥ 0.5), using the abstract type `StaticArray{Size,T,N} <: AbstractArray{T,N}`.
5+
in Julia, using the abstract type `StaticArray{Size,T,N} <: AbstractArray{T,N}`.
66
Subtypes of [`StaticArray`](@ref) will provide fast implementations of common array and
77
linear algebra operations. Note that here "statically sized" means that the
88
size can be determined from the *type*, and "static" does **not** necessarily

src/SizedArray.jl

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,7 @@ struct SizedArray{S<:Tuple,T,N,M,TData<:AbstractArray{T,M}} <: StaticArray{S,T,N
3333
end
3434

3535
# Julia v1.0 has some weird bug that prevents this from working
36-
@static if VERSION >= v"1.1"
37-
@inline SizedArray(a::StaticArray{S,T,N}) where {S<:Tuple,T,N} = SizedArray{S,T,N}(a)
38-
end
36+
@inline SizedArray(a::StaticArray{S,T,N}) where {S<:Tuple,T,N} = SizedArray{S,T,N}(a)
3937
@inline function SizedArray{S,T,N}(
4038
a::TData,
4139
) where {S,T,N,M,TData<:AbstractArray{T,M}}
@@ -151,10 +149,7 @@ end
151149

152150
const SizedMatrix{S1,S2,T} = SizedArray{Tuple{S1,S2},T,2}
153151

154-
# Julia v1.0 has some weird bug that prevents this from working
155-
@static if VERSION >= v"1.1"
156-
SizedMatrix(a::StaticMatrix{N,M,T}) where {N,M,T} = SizedMatrix{N,M,T}(a)
157-
end
152+
SizedMatrix(a::StaticMatrix{N,M,T}) where {N,M,T} = SizedMatrix{N,M,T}(a)
158153
@inline function SizedMatrix{S1,S2}(
159154
a::TData,
160155
) where {S1,S2,T,M,TData<:AbstractArray{T,M}}

src/StaticArrays.jl

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,7 @@ include("deque.jl")
144144
include("flatten.jl")
145145
include("io.jl")
146146

147-
if Base.VERSION >= v"1.4.2"
148-
include("precompile.jl")
149-
_precompile_()
150-
end
147+
include("precompile.jl")
148+
_precompile_()
151149

152150
end # module

src/abstractarray.jl

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -306,13 +306,11 @@ end
306306
end
307307
end
308308

309-
if VERSION >= v"1.6.0-DEV.1334"
310-
# FIXME: This always assumes one-based linear indexing and that subtypes of StaticArray
311-
# don't overload iterate
312-
@inline function Base.rest(a::StaticArray{S}, (_, i) = (nothing, 0)) where {S}
313-
newlen = tuple_prod(S) - i
314-
return similar_type(typeof(a), Size(newlen))(Base.rest(Tuple(a), i + 1))
315-
end
309+
# FIXME: This always assumes one-based linear indexing and that subtypes of StaticArray
310+
# don't overload iterate
311+
@inline function Base.rest(a::StaticArray{S}, (_, i) = (nothing, 0)) where {S}
312+
newlen = tuple_prod(S) - i
313+
return similar_type(typeof(a), Size(newlen))(Base.rest(Tuple(a), i + 1))
316314
end
317315

318316
# SArrays may avoid the SubArray wrapper and consequently an additional level of indirection

test/SHermitianCompact.jl

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,6 @@ end
4040

4141
fill3(x) = fill(3, x)
4242

43-
# @allocated behaves differently on 1.4, but the differences appear spurious in
44-
# practice. See
45-
# https://github.com/JuliaArrays/StaticArrays.jl/issues/710
46-
allocated_workaround = VERSION >= v"1.4-DEV"
47-
4843
@testset "SHermitianCompact" begin
4944
@testset "Inner Constructor" begin
5045
for (N, L) in ((3, 6), (4, 10), (6, 21))
@@ -164,9 +159,6 @@ allocated_workaround = VERSION >= v"1.4-DEV"
164159
let a = a
165160
@test -a == -SMatrix(a)
166161
@test -a isa SHermitianCompact{3, Int, 6}
167-
if !allocated_workaround
168-
@test_noalloc -a
169-
end
170162
end
171163
for (x, y) in ((a, b), (a, c), (c, a))
172164
@eval begin
@@ -210,15 +202,9 @@ allocated_workaround = VERSION >= v"1.4-DEV"
210202
let a = SHermitianCompact(SVector{21, Int}(1 : 21))
211203
@test a + 3I == SMatrix(a) + 3I
212204
@test a + 3I isa typeof(a)
213-
if !allocated_workaround
214-
@test_noalloc a + 3I
215-
end
216205

217206
@test a - 4I == SMatrix(a) - 4I
218207
@test a - 4I isa typeof(a)
219-
if !allocated_workaround
220-
@test_noalloc a - 4I
221-
end
222208

223209
@test a * 3I === a * 3
224210
@test 3I * a === 3 * a

test/SizedArray.jl

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,7 @@
4141
@test size(SizedArray{Tuple{4,5},Int}(undef).data) == (4, 5)
4242

4343
# 0-element constructor
44-
if VERSION >= v"1.1"
45-
@test (@inferred SizedArray(MMatrix{0,0,Float64}()))::SizedMatrix{0,0,Float64} == SizedMatrix{0,0,Float64}()
46-
end
44+
@test (@inferred SizedArray(MMatrix{0,0,Float64}()))::SizedMatrix{0,0,Float64} == SizedMatrix{0,0,Float64}()
4745

4846
# From Tuple
4947
@test @inferred(SizedArray{Tuple{2},Float64,1,1}((1,2)))::SizedArray{Tuple{2},Float64,1,1,Vector{Float64}} == [1.0, 2.0]
@@ -82,9 +80,7 @@
8280
@test convert(Matrix, SizedMatrix{2,2}([1 2;3 4])) == [1 2; 3 4]
8381

8482
# 0-element constructor
85-
if VERSION >= v"1.1"
86-
@test (@inferred SizedMatrix(MMatrix{0,0,Float64}()))::SizedMatrix{0,0,Float64} == SizedMatrix{0,0,Float64}()
87-
end
83+
@test (@inferred SizedMatrix(MMatrix{0,0,Float64}()))::SizedMatrix{0,0,Float64} == SizedMatrix{0,0,Float64}()
8884
end
8985

9086
# setindex
@@ -98,15 +94,14 @@
9894
# pointer
9995
@testset "pointer" begin
10096
@test pointer(sa) === pointer(sa.data)
101-
if VERSION v"1.5"
102-
A = MMatrix{32,3,Float64}(undef);
103-
av1 = view(A, 1, :);
104-
av2 = view(A, :, 1);
105-
@test pointer(A) == pointer(av1) == pointer(av2)
106-
@test pointer(A, LinearIndices(A)[1,2]) == pointer(av1, 2)
107-
@test pointer(A, LinearIndices(A)[2,1]) == pointer(av2, 2)
108-
@test pointer(A, LinearIndices(A)[4,3]) == pointer(view(A, :, 3), 4) == pointer(view(A, 4, :), 3)
109-
end
97+
98+
A = MMatrix{32,3,Float64}(undef);
99+
av1 = view(A, 1, :);
100+
av2 = view(A, :, 1);
101+
@test pointer(A) == pointer(av1) == pointer(av2)
102+
@test pointer(A, LinearIndices(A)[1,2]) == pointer(av1, 2)
103+
@test pointer(A, LinearIndices(A)[2,1]) == pointer(av2, 2)
104+
@test pointer(A, LinearIndices(A)[4,3]) == pointer(view(A, :, 3), 4) == pointer(view(A, 4, :), 3)
110105
end
111106

112107
@testset "vec" begin

test/abstractarray.jl

Lines changed: 24 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -327,38 +327,36 @@ end
327327
@test @inferred(hcat(SA[1 2 3])) === SA[1 2 3]
328328
end
329329

330-
@static if VERSION >= v"1.6.0-DEV.1334"
331-
@testset "Base.rest" begin
332-
x = SA[1, 2, 3]
330+
@testset "Base.rest" begin
331+
x = SA[1, 2, 3]
332+
@test Base.rest(x) == x
333+
a, b... = x
334+
@test b == SA[2, 3]
335+
336+
x = SA[1 2; 3 4]
337+
@test Base.rest(x) == vec(x)
338+
a, b... = x
339+
@test b == SA[3, 2, 4]
340+
341+
a, b... = SA[1]
342+
@test b == []
343+
@test b isa SVector{0}
344+
345+
for (Vec, Mat) in [(MVector, MMatrix), (SizedVector, SizedMatrix)]
346+
x = Vec(1, 2, 3)
333347
@test Base.rest(x) == x
348+
@test pointer(Base.rest(x)) != pointer(x)
334349
a, b... = x
335-
@test b == SA[2, 3]
350+
@test b == Vec(2, 3)
336351

337-
x = SA[1 2; 3 4]
352+
x = Mat{2,2}(1, 2, 3, 4)
338353
@test Base.rest(x) == vec(x)
354+
@test pointer(Base.rest(x)) != pointer(x)
339355
a, b... = x
340-
@test b == SA[3, 2, 4]
356+
@test b == Vec(2, 3, 4)
341357

342-
a, b... = SA[1]
358+
a, b... = Vec(1)
343359
@test b == []
344-
@test b isa SVector{0}
345-
346-
for (Vec, Mat) in [(MVector, MMatrix), (SizedVector, SizedMatrix)]
347-
x = Vec(1, 2, 3)
348-
@test Base.rest(x) == x
349-
@test pointer(Base.rest(x)) != pointer(x)
350-
a, b... = x
351-
@test b == Vec(2, 3)
352-
353-
x = Mat{2,2}(1, 2, 3, 4)
354-
@test Base.rest(x) == vec(x)
355-
@test pointer(Base.rest(x)) != pointer(x)
356-
a, b... = x
357-
@test b == Vec(2, 3, 4)
358-
359-
a, b... = Vec(1)
360-
@test b == []
361-
@test b isa Vec{0}
362-
end
360+
@test b isa Vec{0}
363361
end
364362
end

test/accumulate.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ using StaticArrays, Test
3333
]
3434
@test cumsum(a; dims = 2) == cumsum(collect(a); dims = 2)
3535
@test cumsum(a; dims = 2) isa similar_type(a)
36-
v"1.1" <= VERSION < v"1.2" && continue
3736
@inferred cumsum(a; dims = Val(2))
3837
end
3938
end
@@ -43,7 +42,6 @@ using StaticArrays, Test
4342
a = similar_type(SArray, Int, Size(shape))(1:prod(shape))
4443
@test cumsum(a; dims = i) == cumsum(collect(a); dims = i)
4544
@test cumsum(a; dims = i) isa SArray
46-
v"1.1" <= VERSION < v"1.2" && continue
4745
@inferred cumsum(a; dims = Val(i))
4846
end
4947

test/ambiguities.jl

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,11 @@
1-
21
# Allow no new ambiguities (see #18), unless you fix some old ones first!
32

4-
const allowable_ambiguities =
5-
if VERSION < v"1.1"
6-
3
7-
elseif VERSION < v"1.2"
8-
1
9-
else
10-
0
11-
end
3+
const allowable_ambiguities = VERSION v"1.7" ? 60 :
4+
VERSION v"1.6" ? 61 : error("version must be ≥1.6")
125

13-
if VERSION v"1.6.0"
14-
# TODO: Revisit and fix. See
15-
# https://github.com/JuliaLang/julia/pull/36962
16-
# https://github.com/JuliaLang/julia/issues/36951
17-
@test_broken length(detect_ambiguities(#=LinearAlgebra, =#StaticArrays)) <= allowable_ambiguities
18-
else
19-
@test length(detect_ambiguities(Base, LinearAlgebra, StaticArrays)) <= allowable_ambiguities
20-
end
6+
# TODO: Revisit and fix. See
7+
# https://github.com/JuliaLang/julia/pull/36962
8+
# https://github.com/JuliaLang/julia/issues/36951
9+
# Let's not allow new ambiguities. If any change makes the ambiguity count decrease, the
10+
# change should decrement `allowable_ambiguities` accordingly
11+
@test length(detect_ambiguities(#=LinearAlgebra, =#StaticArrays)) == allowable_ambiguities

test/chol.jl

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,10 @@ using LinearAlgebra: PosDefException
7474
@test (@inferred c \ Symmetric(d)) isa SMatrix{3,3,elty}
7575
@test c \ Symmetric(d) c_a \ Symmetric(d_a)
7676

77-
if VERSION >= v"1.3"
78-
# on earlier versions of Julia d_a / c_a fails
79-
@test (@inferred d / c) isa SMatrix{3,3,elty}
80-
@test d / c d_a / c_a
81-
@test (@inferred Symmetric(d) / c) isa SMatrix{3,3,elty}
82-
@test Symmetric(d) / c Symmetric(d_a) / c_a
83-
end
77+
@test (@inferred d / c) isa SMatrix{3,3,elty}
78+
@test d / c d_a / c_a
79+
@test (@inferred Symmetric(d) / c) isa SMatrix{3,3,elty}
80+
@test Symmetric(d) / c Symmetric(d_a) / c_a
8481

8582
v_a = randn(elty, 3)
8683
v = SVector{3}(v_a)

test/core.jl

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,7 @@
1919
@testset "Type parameter errors" begin
2020
# (not sure what type of exception these should be?)
2121
@test_throws Exception SVector{1.0,Int}((1,))
22-
@static if VERSION < v"1.6-"
23-
@test_throws DimensionMismatch("No precise constructor for SArray{Tuple{2},$Int,1,2} found. Length of input was 1.") SVector{2,Int}((1,))
24-
else
25-
@test_throws DimensionMismatch("No precise constructor for SVector{2, $Int} found. Length of input was 1.") SVector{2,Int}((1,))
26-
end
22+
@test_throws DimensionMismatch("No precise constructor for SVector{2, $Int} found. Length of input was 1.") SVector{2,Int}((1,))
2723
@test_throws Exception SVector{1,3}((1,))
2824

2925
@test_throws Exception SMatrix{1.0,1,Int,1}((1,))

test/eigen.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ using StaticArrays, Test, LinearAlgebra
8989
m2_a = randn(2,2)
9090
m2_a = m2_a*m2_a'
9191
m2 = SMatrix{2,2}(m2_a)
92-
@test (@inferred_maybe_allow SVector{2,ComplexF64} eigvals(m1, m2)) eigvals(m1_a, m2_a)
93-
@test (@inferred_maybe_allow SVector{2,ComplexF64} eigvals(Symmetric(m1), Symmetric(m2))) eigvals(Symmetric(m1_a), Symmetric(m2_a))
92+
@test (@inferred SVector{2,ComplexF64} eigvals(m1, m2)) eigvals(m1_a, m2_a)
93+
@test (@inferred SVector{2,ComplexF64} eigvals(Symmetric(m1), Symmetric(m2))) eigvals(Symmetric(m1_a), Symmetric(m2_a))
9494
end
9595

9696
@test_throws DimensionMismatch eigvals(SA[1 2 3; 4 5 6], SA[1 2 3; 4 5 5])
@@ -131,7 +131,7 @@ using StaticArrays, Test, LinearAlgebra
131131
m2_a = randn(3,3)
132132
m2_a = m2_a*m2_a'
133133
m2 = SMatrix{3,3}(m2_a)
134-
@test (@inferred_maybe_allow SVector{3,ComplexF64} eigvals(m1, m2)) eigvals(m1_a, m2_a)
134+
@test (@inferred SVector{3,ComplexF64} eigvals(m1, m2)) eigvals(m1_a, m2_a)
135135
end
136136

137137
@testset "3×3 complex" begin
@@ -265,7 +265,7 @@ using StaticArrays, Test, LinearAlgebra
265265

266266
# Test that general eigen() gives a small union of concrete types
267267
SEigen{T} = Eigen{T, T, SArray{Tuple{n,n},T,2,n*n}, SArray{Tuple{n},T,1,n}}
268-
@inferred_maybe_allow Union{SEigen{ComplexF64},SEigen{Float64}} eigen(m)
268+
@inferred Union{SEigen{ComplexF64},SEigen{Float64}} eigen(m)
269269

270270
mc = @SMatrix randn(ComplexF64, n, n)
271271
@inferred eigen(Hermitian(mc + mc'))

0 commit comments

Comments
 (0)