Skip to content

Commit c1c9cfc

Browse files
committed
Given we require the AbstractDicts to be backed by DIcts we must make that constructable
1 parent 4f9723c commit c1c9cfc

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

src/tangent_types/structural_tangent.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ function Tangent{P}() where {P<:Tuple}
340340
return Tangent{P,typeof(backing)}(backing)
341341
end
342342

343-
function Tangent{P}(d::Dict) where {P<:Dict}
343+
function Tangent{P}(d::Dict) where {P<:AbstractDict}
344344
return Tangent{P,typeof(d)}(d)
345345
end
346346

test/tangent_types/abstract_zero.jl

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,15 @@ 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)) ==
187-
Tangent{Dict{Int,Float64}}(Dict{Int,Float64}())
186+
@test ==(
187+
zero_tangent(Dict{Int, Float64}(1=>2.4)),
188+
Tangent{Dict{Int,Float64}}(Dict{Int, Float64}())
189+
)
190+
@test ==(
191+
zero_tangent(Base.PersistentDict(1=>2.4)),
192+
Tangent{Base.PersistentDict{Int,Float64}}(Dict{Int, Float64}())
193+
)
194+
188195

189196
# Higher order
190197
# StructuralTangents are valid tangents for themselves (just like Numbers)

0 commit comments

Comments
 (0)