Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "FiniteDifferences"
uuid = "26cc04aa-876d-5657-8c51-4c34ba976000"
version = "0.12.11"
version = "0.12.12"

[deps]
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
Expand Down
3 changes: 3 additions & 0 deletions src/rand_tangent.jl
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,6 @@ function rand_tangent(rng::AbstractRNG, x::T) where {T}
Tangent{T}(; NamedTuple{field_names}(tangents)...)
end
end

rand_tangent(rng::AbstractRNG, ::Type) = NoTangent()
rand_tangent(rng::AbstractRNG, ::Module) = NoTangent()
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is needed to work on Julia 1.0

9 changes: 9 additions & 0 deletions test/rand_tangent.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@ using FiniteDifferences: rand_tangent
(:a, NoTangent),
(true, NoTangent),
(4, NoTangent),
(FiniteDifferences, NoTangent), # Module object
# Types (not instances of type)
(Foo, NoTangent),
(Union{Int, Foo}, NoTangent),
(Union{Int, Foo}, NoTangent),
(Vector, NoTangent),
(Vector{Float64}, NoTangent),
(Integer, NoTangent),
(Type{<:Real}, NoTangent),

# Numbers.
(5.0, Float64),
Expand Down