Skip to content

Commit 4f9723c

Browse files
formatting
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 98cc02c commit 4f9723c

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

src/tangent_types/abstract_zero.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,9 @@ function zero_tangent(x::Array{P,N}) where {P,N}
169169
return y
170170
end
171171

172-
zero_tangent(::T) where {K,V,T<:AbstractDict{K,V}} = Tangent{T}(Dict{K, guess_zero_tangent_type(V)}())
172+
function zero_tangent(::T) where {K,V,T<:AbstractDict{K,V}}
173+
return Tangent{T}(Dict{K,guess_zero_tangent_type(V)}())
174+
end
173175

174176
# Sad heauristic methods we need because of unassigned values
175177
guess_zero_tangent_type(::Type{T}) where {T<:Number} = T
@@ -179,7 +181,6 @@ function guess_zero_tangent_type(::Type{<:Array{T,N}}) where {T,N}
179181
end
180182
guess_zero_tangent_type(T::Type) = Any
181183

182-
183184
# Stuff that conceptually has its own identity regardless of structual implementation and doesn't have a tangent
184185
zero_tangent(::Base.AbstractLogger) = NoTangent()
185186

test/tangent_types/abstract_zero.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,8 @@ end
183183

184184
@test zero_tangent((1.0, 2.0)) == Tangent{Tuple{Float64,Float64}}(0.0, 0.0)
185185

186-
@test zero_tangent(Dict{Int, Float64}(1=>2.4)) == Tangent{Dict{Int,Float64}}(Dict{Int, Float64}())
187-
186+
@test zero_tangent(Dict{Int,Float64}(1 => 2.4)) ==
187+
Tangent{Dict{Int,Float64}}(Dict{Int,Float64}())
188188

189189
# Higher order
190190
# StructuralTangents are valid tangents for themselves (just like Numbers)
@@ -204,7 +204,7 @@ end
204204
@test iszero(zero_tangent("abc"))
205205
@test iszero(zero_tangent(sin))
206206

207-
@test iszero(zero_tangent(:(1+1)))
207+
@test iszero(zero_tangent(:(1 + 1)))
208208
end
209209

210210
@testset "undef elements Vector" begin

0 commit comments

Comments
 (0)