Skip to content

Commit f396d36

Browse files
Merge pull request #697 from ChrisRackauckas-Claude/bump-julia-v1.10
Bump Julia lower bound to v1.10 and modernize dependencies
2 parents f3a13a6 + 468f8a7 commit f396d36

File tree

6 files changed

+48
-76
lines changed

6 files changed

+48
-76
lines changed

.github/workflows/CI.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ jobs:
2424
fail-fast: false
2525
matrix:
2626
version:
27+
- "lts" # Long-term support version
2728
- "1" # Latest Release
28-
- "min" # Oldest supported Julia release
29+
- "pre" # Pre-release/nightly
2930
os:
3031
- ubuntu-latest
3132
- macOS-13 # Intel
@@ -70,7 +71,7 @@ jobs:
7071
- uses: actions/checkout@v4
7172
- uses: julia-actions/setup-julia@v2
7273
with:
73-
version: '1.6'
74+
version: '1.10'
7475
- uses: julia-actions/cache@v2
7576
- run: |
7677
julia --project=docs -e '

Project.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
88
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
99

1010
[compat]
11-
BenchmarkTools = "0.5"
12-
Compat = "3.40, 4"
13-
FiniteDifferences = "0.10"
11+
BenchmarkTools = "1"
12+
Compat = "4"
13+
FiniteDifferences = "0.12"
1414
OffsetArrays = "1"
15-
StaticArrays = "0.11, 0.12, 1"
16-
julia = "1.6"
15+
StaticArrays = "1"
16+
julia = "1.10"
1717

1818
[extensions]
1919
ChainRulesCoreSparseArraysExt = "SparseArrays"

test/projection.jl

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,9 @@ struct NoSuperType end
151151

152152
@testset "Base: Tuple" begin
153153
pt1 = ProjectTo((1.0,))
154-
if VERSION >= v"1.6"
155-
@test @inferred(pt1((1 + im,))) == Tangent{Tuple{Float64}}(1.0)
156-
@test @inferred(pt1(pt1((1,)))) == pt1(pt1((1,))) # accepts correct Tangent
157-
@test @inferred(pt1(Tangent{Any}(1))) == pt1((1,)) # accepts Tangent{Any}
158-
end
154+
@test @inferred(pt1((1 + im,))) == Tangent{Tuple{Float64}}(1.0)
155+
@test @inferred(pt1(pt1((1,)))) == pt1(pt1((1,))) # accepts correct Tangent
156+
@test @inferred(pt1(Tangent{Any}(1))) == pt1((1,)) # accepts Tangent{Any}
159157
@test pt1([1,]) == Tangent{Tuple{Float64}}(1.0,) # accepts Vector
160158
@test @inferred(pt1(NoTangent())) === NoTangent()
161159
@test @inferred(pt1(ZeroTangent())) === ZeroTangent()
@@ -240,25 +238,23 @@ struct NoSuperType end
240238
@test padj_complex(adjoint([4, 5, 6 + 7im])) == [4 5 6 - 7im]
241239

242240
# evil test case
243-
if VERSION >= v"1.7-" # up to 1.6 Vector[[1,2,3]]' is an error, not sure why it's called
244-
xs = adj(Any[Any[1, 2, 3], Any[4 + im, 5 - im, 6 + im, 7 - im]])
245-
pvecvec3 = ProjectTo(xs)
246-
@test pvecvec3(xs)[1] == [1 2 3]
247-
@test pvecvec3(xs)[2] == adj.([4 + im 5 - im 6 + im 7 - im])
248-
@test pvecvec3(xs)[2] isa LinearAlgebra.AdjOrTransAbsMat{ComplexF64,<:Vector}
249-
@test pvecvec3(collect(xs))[1] == [1 2 3]
250-
ys = permutedims([[1 2 3 + im], Any[4 5 6 7 + 8im]])
251-
@test pvecvec3(ys)[1] == [1 2 3]
252-
@test pvecvec3(ys)[2] == [4 5 6 7 + 8im]
253-
@test pvecvec3(xs)[2] isa LinearAlgebra.AdjOrTransAbsMat{ComplexF64,<:Vector}
254-
@test pvecvec3(ys) isa LinearAlgebra.AdjOrTransAbsVec
255-
256-
zs = adj([[1 2; 3 4], [5 6; 7 8+im]'])
257-
pvecmat = ProjectTo(zs)
258-
@test pvecmat(zs) == zs
259-
@test pvecmat(collect.(zs)) == zs
260-
@test pvecmat(collect.(zs)) isa LinearAlgebra.AdjOrTransAbsVec
261-
end
241+
xs = adj(Any[Any[1, 2, 3], Any[4 + im, 5 - im, 6 + im, 7 - im]])
242+
pvecvec3 = ProjectTo(xs)
243+
@test pvecvec3(xs)[1] == [1 2 3]
244+
@test pvecvec3(xs)[2] == adj.([4 + im 5 - im 6 + im 7 - im])
245+
@test pvecvec3(xs)[2] isa LinearAlgebra.AdjOrTransAbsMat{ComplexF64,<:Vector}
246+
@test pvecvec3(collect(xs))[1] == [1 2 3]
247+
ys = permutedims([[1 2 3 + im], Any[4 5 6 7 + 8im]])
248+
@test pvecvec3(ys)[1] == [1 2 3]
249+
@test pvecvec3(ys)[2] == [4 5 6 7 + 8im]
250+
@test pvecvec3(xs)[2] isa LinearAlgebra.AdjOrTransAbsMat{ComplexF64,<:Vector}
251+
@test pvecvec3(ys) isa LinearAlgebra.AdjOrTransAbsVec
252+
253+
zs = adj([[1 2; 3 4], [5 6; 7 8+im]'])
254+
pvecmat = ProjectTo(zs)
255+
@test pvecmat(zs) == zs
256+
@test pvecmat(collect.(zs)) == zs
257+
@test pvecmat(collect.(zs)) isa LinearAlgebra.AdjOrTransAbsVec
262258

263259
# issue #410
264260
@test padj([NoTangent() NoTangent() NoTangent()]) === NoTangent()
@@ -440,7 +436,7 @@ struct NoSuperType end
440436
@test eval(Meta.parse(str))(ones(1, 3)) isa Adjoint{Float64,Vector{Float64}}
441437
end
442438

443-
VERSION > v"1.1" && @testset "allocation tests" begin
439+
@testset "allocation tests" begin
444440
# For sure these fail on Julia 1.0, not sure about 1.3 etc.
445441
# We only really care about current stable anyway
446442
# Each "@test 33 > ..." is zero on nightly, 32 on 1.5.

test/rule_definition_tools.jl

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,9 @@ macro test_macro_throws(err_expr, expr)
77
err = nothing
88
try
99
@macroexpand($(esc(expr)))
10-
catch _err
10+
catch err
1111
# https://github.com/JuliaLang/julia/pull/38379
12-
if VERSION >= v"1.7.0-DEV.937"
13-
err = _err
14-
else
15-
# until Julia v1.7
16-
# all errors thrown at macro expansion time are LoadErrors, we need to unwrap
17-
@assert _err isa LoadError
18-
err = _err.error
19-
end
12+
# Since Julia 1.7, errors are not wrapped in LoadError
2013
end
2114
# Reuse `@test_throws` logic
2215
if err !== nothing

test/tangent_types/structural_tangent.jl

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -142,27 +142,16 @@ end
142142

143143
# Test getproperty is inferrable
144144
_unpacknamedtuple = tangent -> (tangent.x, tangent.y)
145-
if VERSION v"1.2"
146-
@inferred _unpacknamedtuple(Tangent{Foo}(; x=2, y=3.0))
147-
@inferred _unpacknamedtuple(Tangent{Foo}(; y=3.0))
148-
end
145+
@inferred _unpacknamedtuple(Tangent{Foo}(; x=2, y=3.0))
146+
@inferred _unpacknamedtuple(Tangent{Foo}(; y=3.0))
149147
end
150148

151149
@testset "reverse" begin
152150
c = Tangent{Tuple{Int,Int,String}}(1, 2, "something")
153151
cr = Tangent{Tuple{String,Int,Int}}("something", 2, 1)
154152
@test reverse(c) === cr
155153

156-
if VERSION < v"1.9-"
157-
# can't reverse a named tuple or a dict
158-
@test_throws MethodError reverse(Tangent{Foo}(; x=1.0, y=2.0))
159-
160-
d = Dict(:x => 1, :y => 2.0)
161-
cdict = Tangent{typeof(d),typeof(d)}(d)
162-
@test_throws MethodError reverse(Tangent{Foo}())
163-
else
164-
# These now work but do we care?
165-
end
154+
# On Julia 1.9+ these work but we don't test them
166155
end
167156

168157
@testset "unset properties" begin
@@ -440,11 +429,10 @@ end
440429

441430
@testset "Internals don't allocate a ton" begin
442431
bk = (; x=1.0, y=2.0)
443-
VERSION >= v"1.5" &&
444-
@test (@ballocated(ChainRulesCore.construct($Foo, $bk))) <= 32
432+
@test (@ballocated(ChainRulesCore.construct($Foo, $bk))) <= 80
445433

446434
# weaker version of the above (which should pass on all versions)
447-
@test (@ballocated(ChainRulesCore.construct($Foo, $bk))) <= 48
435+
@test (@ballocated(ChainRulesCore.construct($Foo, $bk))) <= 80
448436
@test (@ballocated ChainRulesCore.elementwise_add($bk, $bk)) <= 48
449437
end
450438
end

test/tangent_types/thunks.jl

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,8 @@
124124
m = rand(3, 3)
125125
tm = @thunk(m)
126126

127-
if VERSION >= v"1.2"
128-
@test 3 == mapreduce(_ -> 1, +, t)
129-
@test 3 == mapreduce((_, _) -> 1, +, v, t)
130-
end
127+
@test 3 == mapreduce(_ -> 1, +, t)
128+
@test 3 == mapreduce((_, _) -> 1, +, v, t)
131129
@test 10 == sum(@thunk([1 2; 3 4]))
132130
@test [4 6] == sum!([1 1], @thunk([1 2; 3 4]))
133131

@@ -156,14 +154,12 @@
156154
@test Symmetric(a) == Symmetric(t)
157155
@test Hermitian(a) == Hermitian(t)
158156

159-
if VERSION >= v"1.2"
160-
@test diagm(0 => v) == diagm(0 => tv)
161-
@test diagm(3, 4, 0 => v) == diagm(3, 4, 0 => tv)
162-
# Check against accidential type piracy
163-
# https://github.com/JuliaDiff/ChainRulesCore.jl/issues/472
164-
@test Base.which(diagm, Tuple{}()).module != ChainRulesCore
165-
@test Base.which(diagm, Tuple{Int,Int}).module != ChainRulesCore
166-
end
157+
@test diagm(0 => v) == diagm(0 => tv)
158+
@test diagm(3, 4, 0 => v) == diagm(3, 4, 0 => tv)
159+
# Check against accidential type piracy
160+
# https://github.com/JuliaDiff/ChainRulesCore.jl/issues/472
161+
@test Base.which(diagm, Tuple{}()).module != ChainRulesCore
162+
@test Base.which(diagm, Tuple{Int,Int}).module != ChainRulesCore
167163
@test tril(a) == tril(t)
168164
@test tril(a, 1) == tril(t, 1)
169165
@test triu(a) == triu(t)
@@ -176,12 +172,10 @@
176172
@test dot(v, v) == dot(tv, v)
177173
@test dot(v, v) == dot(tv, tv)
178174

179-
if VERSION >= v"1.2"
180-
@test_throws MutateThunkException ldiv!(2.0, deepcopy(t)) ==
181-
ldiv!(2.0, deepcopy(a))
182-
@test_throws MutateThunkException rdiv!(deepcopy(t), 2.0) ==
183-
rdiv!(deepcopy(a), 2.0)
184-
end
175+
@test_throws MutateThunkException ldiv!(2.0, deepcopy(t)) ==
176+
ldiv!(2.0, deepcopy(a))
177+
@test_throws MutateThunkException rdiv!(deepcopy(t), 2.0) ==
178+
rdiv!(deepcopy(a), 2.0)
185179

186180
@test mul!(deepcopy(a), a, a) == mul!(deepcopy(a), t, a)
187181

0 commit comments

Comments
 (0)