Skip to content

Commit c6eb46d

Browse files
niklasschmitzgkemlin
authored andcommitted
ForwardDiff tests: Use Val(:tag) in Dual type (JuliaMolSim#1170)
1 parent c061abf commit c6eb46d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

test/forwarddiff.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,8 @@ end
300300
end
301301

302302
# Instantiate Dual to test with perturbations
303-
ε = ForwardDiff.Dual{ForwardDiff.Tag{Nothing, Float64}}(0.0, 1.0)
303+
# We need to call the `Tag` constructor to trigger the `ForwardDiff.tagcount`
304+
ε = ForwardDiff.Dual{typeof(ForwardDiff.Tag(Val(:mytag), Float64))}(0.0, 1.0)
304305

305306
@testset "Atom movement" begin
306307
# Moving the second atom should break the transx symmetry, but not the others
@@ -388,7 +389,8 @@ end
388389
functionals=LDA(), temperature=1e-3, smearing=Smearing.Gaussian())
389390

390391
# Make silicon dual model
391-
T = typeof(ForwardDiff.Tag(:mytag, Float64))
392+
# We need to call the `Tag` constructor to trigger the `ForwardDiff.tagcount`
393+
T = typeof(ForwardDiff.Tag(Val(:mytag), Float64))
392394
x_dual = ForwardDiff.Dual{T}(1.0, 1.0)
393395
model_dual = Model(model; lattice=x_dual * model.lattice)
394396

0 commit comments

Comments
 (0)