Skip to content

Commit

Permalink
Require Julia v1.10+
Browse files Browse the repository at this point in the history
  • Loading branch information
dlfivefifty committed Dec 7, 2024
1 parent 37c1d50 commit a9af1a1
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
fail-fast: false
matrix:
version:
- '1.6'
- 'lts'
- '1'
# - 'nightly'
os:
Expand Down
3 changes: 1 addition & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down
4 changes: 0 additions & 4 deletions src/ForwardDiff.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
11 changes: 3 additions & 8 deletions src/dual.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
4 changes: 2 additions & 2 deletions test/AllocationsTest.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
11 changes: 5 additions & 6 deletions test/DualTest.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit a9af1a1

Please sign in to comment.