Skip to content

Commit 3cf5b8a

Browse files
authored
Merge pull request #320 from devmotion/patch-1
Only define rules for SpecialFunctions if needed
2 parents eb10848 + 889ed20 commit 3cf5b8a

File tree

4 files changed

+12
-5
lines changed

4 files changed

+12
-5
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "ChainRules"
22
uuid = "082447d4-558c-5d27-93f4-14fc19e9eca2"
3-
version = "0.7.36"
3+
version = "0.7.37"
44

55
[deps]
66
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"

src/ChainRules.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,12 @@ function __init__()
5858
include("rulesets/packages/NaNMath.jl")
5959
end
6060

61+
# Note: drop SpecialFunctions dependency in next breaking release
62+
# https://github.com/JuliaDiff/ChainRules.jl/issues/319
6163
@require SpecialFunctions="276daf66-3868-5448-9aa4-cd146d93841b" begin
62-
include("rulesets/packages/SpecialFunctions.jl")
64+
if !isdefined(SpecialFunctions, :ChainRulesCore)
65+
include("rulesets/packages/SpecialFunctions.jl")
66+
end
6367
end
6468
end
6569

test/rulesets/packages/SpecialFunctions.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
using SpecialFunctions
2-
31
@testset "SpecialFunctions" for x in (1.0, -1.0, 0.0, 0.5, 10.0, -17.1, 1.5 + 0.7im)
42
test_scalar(SpecialFunctions.erf, x)
53
test_scalar(SpecialFunctions.erfc, x)

test/runtests.jl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ using ChainRulesTestUtils: rand_tangent, _fdm
66
using Compat: only
77
using FiniteDifferences
88
using FiniteDifferences: rand_tangent
9+
using SpecialFunctions
910
using LinearAlgebra
1011
using LinearAlgebra.BLAS
1112
using LinearAlgebra: dot
@@ -56,7 +57,11 @@ println("Testing ChainRules.jl")
5657

5758
@testset "packages" begin
5859
include_test("rulesets/packages/NaNMath.jl")
59-
include_test("rulesets/packages/SpecialFunctions.jl")
60+
# Note: drop SpecialFunctions dependency in next breaking release
61+
# https://github.com/JuliaDiff/ChainRules.jl/issues/319
62+
if !isdefined(SpecialFunctions, :ChainRulesCore)
63+
include_test("rulesets/packages/SpecialFunctions.jl")
64+
end
6065
end
6166
println()
6267
end

0 commit comments

Comments
 (0)