Skip to content

Commit bcafec7

Browse files
authored
Prep for v1.0 release and drop support for pre Julia 1.6 versions (#150)
1 parent 549f25b commit bcafec7

File tree

10 files changed

+53
-91
lines changed

10 files changed

+53
-91
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ jobs:
1414
# MutableArithmetics doesn't have any binary dependencies, so just test
1515
# on Linux, LTS and current release, 64-bit and 32-bit.
1616
include:
17-
- version: '1.0'
17+
- version: '1.6'
1818
os: ubuntu-latest
1919
arch: x86
20-
- version: '1.0'
20+
- version: '1.6'
2121
os: ubuntu-latest
2222
arch: x64
2323
- version: '1'

.github/workflows/documentation.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ jobs:
1212
- uses: actions/checkout@v2
1313
- uses: julia-actions/setup-julia@latest
1414
with:
15-
# Build documentation on Julia 1.0
16-
version: '1.0'
15+
version: '1.6'
1716
- name: Install dependencies
1817
run: julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()'
1918
- name: Build and deploy

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "MutableArithmetics"
22
uuid = "d8a4904e-b15c-11e9-3269-09a3773c0cb0"
33
authors = ["Gilles Peiffer", "Benoît Legat", "Sascha Timme"]
4-
version = "0.3.3"
4+
version = "1.0.0"
55

66
[deps]
77
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
@@ -10,7 +10,7 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
1010

1111
[compat]
1212
OffsetArrays = "1"
13-
julia = "1"
13+
julia = "1.6"
1414

1515
[extras]
1616
OffsetArrays = "6fe1bfb0-de20-5000-8ca7-80f57d26f881"

src/Test/array.jl

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -268,9 +268,7 @@ function non_array_test(x, x2)
268268
@test_throws AssertionError diagm(x2)
269269
else
270270
@test MA.isequal_canonical(diagm(0 => x), diagm(0 => x2))
271-
if VERSION >= v"1.2"
272-
@test MA.isequal_canonical(diagm(x), diagm(x2))
273-
end
271+
@test MA.isequal_canonical(diagm(x), diagm(x2))
274272
end
275273
end
276274
end
@@ -295,10 +293,8 @@ function dot_test(x)
295293
@test_rewrite dot(A, x)
296294
@test_rewrite dot(x, A)
297295

298-
if VERSION >= v"1.1"
299-
y = repeat(x, outer = (one.(size(x))..., size(x, 1)))
300-
@test_rewrite dot(x, _constant(x)) - dot(y, _constant(y))
301-
end
296+
y = repeat(x, outer = (one.(size(x))..., size(x, 1)))
297+
@test_rewrite dot(x, _constant(x)) - dot(y, _constant(y))
302298
end
303299

304300
function sum_test(matrix)

src/dispatch.jl

Lines changed: 24 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -26,25 +26,23 @@ end
2626

2727
# TODO: LinearAlgebra should have a documented function so that we don't have to
2828
# overload an internal function
29-
if VERSION >= v"1.5.0-rc1.23"
30-
function LinearAlgebra._dot_nonrecursive(
31-
lhs::AbstractArray{<:AbstractMutable},
32-
rhs::AbstractArray,
33-
)
34-
return fused_map_reduce(add_mul, lhs, rhs)
35-
end
36-
function LinearAlgebra._dot_nonrecursive(
37-
lhs::AbstractArray,
38-
rhs::AbstractArray{<:AbstractMutable},
39-
)
40-
return fused_map_reduce(add_mul, lhs, rhs)
41-
end
42-
function LinearAlgebra._dot_nonrecursive(
43-
lhs::AbstractArray{<:AbstractMutable},
44-
rhs::AbstractArray{<:AbstractMutable},
45-
)
46-
return fused_map_reduce(add_mul, lhs, rhs)
47-
end
29+
function LinearAlgebra._dot_nonrecursive(
30+
lhs::AbstractArray{<:AbstractMutable},
31+
rhs::AbstractArray,
32+
)
33+
return fused_map_reduce(add_mul, lhs, rhs)
34+
end
35+
function LinearAlgebra._dot_nonrecursive(
36+
lhs::AbstractArray,
37+
rhs::AbstractArray{<:AbstractMutable},
38+
)
39+
return fused_map_reduce(add_mul, lhs, rhs)
40+
end
41+
function LinearAlgebra._dot_nonrecursive(
42+
lhs::AbstractArray{<:AbstractMutable},
43+
rhs::AbstractArray{<:AbstractMutable},
44+
)
45+
return fused_map_reduce(add_mul, lhs, rhs)
4846
end
4947

5048
function LinearAlgebra.dot(
@@ -72,24 +70,13 @@ end
7270
# fill!(::Array{AbstractVariableRef}, zero(GenericAffExpr{Float64,eltype(x)}))
7371
_one_indexed(A) = all(x -> isa(x, Base.OneTo), axes(A))
7472

75-
if VERSION <= v"1.2"
76-
function LinearAlgebra.diagm_container(
77-
kv::Pair{<:Integer,<:AbstractVector{<:AbstractMutable}}...,
78-
)
79-
T = promote_type(map(x -> eltype(x.second), kv)...)
80-
U = promote_type(T, promote_operation(zero, T))
81-
n = mapreduce(x -> length(x.second) + abs(x.first), max, kv)
82-
return zeros(U, n, n)
83-
end
84-
else
85-
function LinearAlgebra.diagm_container(
86-
size,
87-
kv::Pair{<:Integer,<:AbstractVector{<:AbstractMutable}}...,
88-
)
89-
T = promote_type(map(x -> promote_type(eltype(x.second)), kv)...)
90-
U = promote_type(T, promote_operation(zero, T))
91-
return zeros(U, LinearAlgebra.diagm_size(size, kv...)...)
92-
end
73+
function LinearAlgebra.diagm_container(
74+
size,
75+
kv::Pair{<:Integer,<:AbstractVector{<:AbstractMutable}}...,
76+
)
77+
T = promote_type(map(x -> promote_type(eltype(x.second)), kv)...)
78+
U = promote_type(T, promote_operation(zero, T))
79+
return zeros(U, LinearAlgebra.diagm_size(size, kv...)...)
9380
end
9481

9582
function LinearAlgebra.diagm(x::AbstractVector{<:AbstractMutable})

src/implementations/BigFloat.jl

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,7 @@ function mutable_copy(x::BigFloat)
1111
return Base.MPFR._BigFloat(x.prec, x.sign, x.exp, d′)
1212
end
1313

14-
@static if VERSION >= v"1.1.0-DEV.683"
15-
const _MPFRRoundingMode = Base.MPFR.MPFRRoundingMode
16-
else
17-
const _MPFRRoundingMode = Int32
18-
end
14+
const _MPFRRoundingMode = Base.MPFR.MPFRRoundingMode
1915

2016
# zero
2117

test/big.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ end
2020
allocation_test(*, T, MA.mul!!, MA.mul_to!!, T <: Rational ? 240 : 0)
2121
# Requires https://github.com/JuliaLang/julia/commit/3f92832df042198b2daefc1f7ca609db38cb8173
2222
# for `gcd` to be defined on `Rational`.
23-
if T == BigInt || (T == Rational{BigInt} && VERSION >= v"1.4.0-DEV.606")
23+
if T == BigInt || T == Rational{BigInt}
2424
allocation_test(gcd, T, MA.gcd!!, MA.gcd_to!!, 0)
2525
allocation_test(lcm, T, MA.lcm!!, MA.lcm_to!!, 0)
2626
end

test/broadcast.jl

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,8 @@ const MA = MutableArithmetics
1010
@test a == [4, 5]
1111
# Need to have immutable structs that contain references to be allocated on
1212
# the stack: https://github.com/JuliaLang/julia/pull/33886
13-
if VERSION >= v"1.5"
14-
alloc_test(() -> MA.broadcast!!(+, a, b), 0)
15-
alloc_test(() -> MA.broadcast!!(+, a, c), 0)
16-
end
13+
alloc_test(() -> MA.broadcast!!(+, a, b), 0)
14+
alloc_test(() -> MA.broadcast!!(+, a, c), 0)
1715
end
1816
@testset "BigInt" begin
1917
x = BigInt(1)
@@ -25,10 +23,8 @@ end
2523
@test a == [4, 5]
2624
@test x == 4
2725
@test y == 5
28-
if VERSION >= v"1.5"
29-
# FIXME This should not allocate but I couldn't figure out where these
30-
# 240 come from.
31-
alloc_test(() -> MA.broadcast!!(+, a, b), 240)
32-
alloc_test(() -> MA.broadcast!!(+, a, c), 0)
33-
end
26+
# FIXME This should not allocate but I couldn't figure out where these
27+
# 240 come from.
28+
alloc_test(() -> MA.broadcast!!(+, a, b), 30 * sizeof(Int))
29+
alloc_test(() -> MA.broadcast!!(+, a, c), 0)
3430
end

test/dispatch.jl

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@ end
2020

2121
@testset "Dispatch tests" begin
2222
dispatch_tests(BigInt)
23-
if VERSION >= v"1.5"
24-
# On `DummyBigInt` allocates more on previous releases of Julia
25-
# as it's dynamically allocated
26-
dispatch_tests(DummyBigInt)
27-
end
23+
# On `DummyBigInt` allocates more on previous releases of Julia
24+
# as it's dynamically allocated
25+
dispatch_tests(DummyBigInt)
2826
end

test/matmul.jl

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -63,21 +63,16 @@ const EXPECTED_ERROR = string(
6363
"`Matrix{NoProdMutable}` because the sum of the product of a ",
6464
"`NoProdMutable` and a `NoProdMutable` could not be inferred so a ",
6565
"`Matrix{Union{}}` allocated to store the output of the ",
66-
"multiplication instead of a `Matrix{Int64}`.",
66+
"multiplication instead of a `Matrix{$(Int)}`.",
6767
)
6868

6969
struct NoProdMutable <: MA.AbstractMutable end
70-
@static if VERSION < v"1.6"
71-
# Hack for making the test work on old Julia versions
72-
Base.:*(::NoProdMutable, ::NoProdMutable) = error(EXPECTED_ERROR)
73-
else
74-
function MA.promote_operation(
75-
::typeof(*),
76-
::Type{NoProdMutable},
77-
::Type{NoProdMutable},
78-
)
79-
return Int # Dummy result just to test error message
80-
end
70+
function MA.promote_operation(
71+
::typeof(*),
72+
::Type{NoProdMutable},
73+
::Type{NoProdMutable},
74+
)
75+
return Int # Dummy result just to test error message
8176
end
8277

8378
function unsupported_product()
@@ -99,14 +94,9 @@ end
9994
@testset "Dimension mismatch" begin
10095
A = zeros(1, 1)
10196
B = zeros(2, 2)
102-
# Changed by https://github.com/JuliaLang/julia/pull/33567
103-
if VERSION >= v"1.4.0-DEV.307"
104-
err = DimensionMismatch(
105-
"dimensions must match: a has dims (Base.OneTo(1), Base.OneTo(1)), b has dims (Base.OneTo(2), Base.OneTo(2)), mismatch at 1",
106-
)
107-
else
108-
err = DimensionMismatch("dimensions must match")
109-
end
97+
err = DimensionMismatch(
98+
"dimensions must match: a has dims (Base.OneTo(1), Base.OneTo(1)), b has dims (Base.OneTo(2), Base.OneTo(2)), mismatch at 1",
99+
)
110100
@test_throws err MA.@rewrite A + B
111101
x = ones(1)
112102
y = ones(2)

0 commit comments

Comments
 (0)