From a9af1a1b9da252f76ca76a7dd4d76cb1b5cf46a6 Mon Sep 17 00:00:00 2001 From: Sheehan Olver Date: Sat, 7 Dec 2024 08:13:20 +0000 Subject: [PATCH] Require Julia v1.10+ --- .github/workflows/ci.yml | 2 +- Project.toml | 3 +-- src/ForwardDiff.jl | 4 ---- src/dual.jl | 11 +++-------- test/AllocationsTest.jl | 4 ++-- test/DualTest.jl | 11 +++++------ 6 files changed, 12 insertions(+), 23 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0155850f..6e4874fe 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,7 +17,7 @@ jobs: fail-fast: false matrix: version: - - '1.6' + - 'lts' - '1' # - 'nightly' os: diff --git a/Project.toml b/Project.toml index 45782afe..64a338aa 100644 --- a/Project.toml +++ b/Project.toml @@ -13,7 +13,6 @@ Preferences = "21216c6a-2e73-6563-6e65-726566657250" Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b" -StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" [weakdeps] StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" @@ -33,7 +32,7 @@ NaNMath = "1" Preferences = "1" SpecialFunctions = "1, 2" StaticArrays = "1.5" -julia = "1.6" +julia = "1.10" [extras] Calculus = "49dc2e85-a5d0-5ad3-a950-438e2897f1b9" diff --git a/src/ForwardDiff.jl b/src/ForwardDiff.jl index fdfcd560..b16b986b 100644 --- a/src/ForwardDiff.jl +++ b/src/ForwardDiff.jl @@ -22,10 +22,6 @@ include("gradient.jl") include("jacobian.jl") include("hessian.jl") -if !isdefined(Base, :get_extension) - include("../ext/ForwardDiffStaticArraysExt.jl") -end - export DiffResults end # module diff --git a/src/dual.jl b/src/dual.jl index 7e8ec110..179c48d3 100644 --- a/src/dual.jl +++ b/src/dual.jl @@ -300,14 +300,9 @@ Base.eps(::Type{D}) where {D<:Dual} = eps(valtype(D)) # The `base` keyword was added in Julia 1.8: # https://github.com/JuliaLang/julia/pull/42428 -if VERSION < v"1.8.0-DEV.725" - Base.precision(d::Dual) = precision(value(d)) - Base.precision(::Type{D}) where {D<:Dual} = precision(valtype(D)) -else - Base.precision(d::Dual; base::Integer=2) = precision(value(d); base=base) - function Base.precision(::Type{D}; base::Integer=2) where {D<:Dual} - precision(valtype(D); base=base) - end +Base.precision(d::Dual; base::Integer=2) = precision(value(d); base=base) +function Base.precision(::Type{D}; base::Integer=2) where {D<:Dual} + precision(valtype(D); base=base) end function Base.nextfloat(d::ForwardDiff.Dual{T,V,N}) where {T,V,N} diff --git a/test/AllocationsTest.jl b/test/AllocationsTest.jl index ad1832d0..905b15b6 100644 --- a/test/AllocationsTest.jl +++ b/test/AllocationsTest.jl @@ -24,7 +24,7 @@ convert_test_574() = convert(ForwardDiff.Dual{Nothing,ForwardDiff.Dual{Nothing,F index = 1 alloc = @allocated ForwardDiff.seed!(duals, x, index, seeds) alloc = @allocated ForwardDiff.seed!(duals, x, index, seeds) - if VERSION < v"1.9" || VERSION >= v"1.11" + if VERSION >= v"1.11" @test alloc == 0 else @test_broken alloc == 0 @@ -33,7 +33,7 @@ convert_test_574() = convert(ForwardDiff.Dual{Nothing,ForwardDiff.Dual{Nothing,F index = 1 alloc = @allocated ForwardDiff.seed!(duals, x, index, seed) alloc = @allocated ForwardDiff.seed!(duals, x, index, seed) - if VERSION < v"1.9" || VERSION >= v"1.11" + if VERSION >= v"1.11" @test alloc == 0 else @test_broken alloc == 0 diff --git a/test/DualTest.jl b/test/DualTest.jl index 6d0bf85f..bd50c37c 100644 --- a/test/DualTest.jl +++ b/test/DualTest.jl @@ -118,12 +118,11 @@ ForwardDiff.:≺(::Type{OuterTestTag}, ::Type{TestTag}) = false @test precision(typeof(FDNUM)) === precision(V) @test precision(NESTED_FDNUM) === precision(PRIMAL) @test precision(typeof(NESTED_FDNUM)) === precision(V) - if VERSION >= v"1.8.0-DEV.725" # https://github.com/JuliaLang/julia/pull/42428 - @test precision(FDNUM; base=10) === precision(PRIMAL; base=10) - @test precision(typeof(FDNUM); base=10) === precision(V; base=10) - @test precision(NESTED_FDNUM; base=10) === precision(PRIMAL; base=10) - @test precision(typeof(NESTED_FDNUM); base=10) === precision(V; base=10) - end + + @test precision(FDNUM; base=10) === precision(PRIMAL; base=10) + @test precision(typeof(FDNUM); base=10) === precision(V; base=10) + @test precision(NESTED_FDNUM; base=10) === precision(PRIMAL; base=10) + @test precision(typeof(NESTED_FDNUM); base=10) === precision(V; base=10) @test floor(Int, FDNUM) === floor(Int, PRIMAL) @test floor(Int, FDNUM2) === floor(Int, PRIMAL2)