8484 @test getindex (Tangent {Tuple{Float64}} (@thunk 2.0 ^ 2 ), 1 ) == 4.0
8585 @test getproperty (Tangent {Tuple{Float64}} (2.0 ), 1 ) == 2.0
8686 @test getproperty (Tangent {Tuple{Float64}} (@thunk 2.0 ^ 2 ), 1 ) == 4.0
87- @test NoTangent () === @inferred Base. tail (tang1)
88- @test NoTangent () === @inferred Base. tail (Tangent {Tuple{}} ())
8987
9088 tang3 = Tangent {Tuple{Float64, String, Vector{Float64}}} (1.0 , NoTangent (), @thunk [3.0 ] .+ 4 )
9189 @test @inferred (first (tang3)) === tang3[1 ] === 1.0
9290 @test @inferred (last (tang3)) isa Thunk
9391 @test unthunk (last (tang3)) == [7.0 ]
94- @test Tuple (@inferred Base. tail (tang3))[1 ] === NoTangent ()
95- @test Tuple (Base. tail (tang3))[end ] isa Thunk
9692
9793 NT = NamedTuple{(:a , :b ),Tuple{Float64,Float64}}
9894 @test getindex (Tangent {NT} (; a= (@thunk 2.0 ^ 2 )), :a ) == 4.0
109105 @test unthunk (first (Tangent {NT} (; a= (@thunk 2.0 ^ 2 )))) == 4.0
110106 @test last (Tangent {NT} (; a= (@thunk 2.0 ^ 2 ))) isa ZeroTangent
111107
112- ntang1 = @inferred Base. tail (Tangent {NT} (; b= (@thunk 2.0 ^ 2 )))
113- @test ntang1 isa Tangent{<: NamedTuple{(:b,)} }
114- @test NoTangent () === @inferred Base. tail (ntang1)
115-
116108 # TODO : uncomment this once https://github.com/JuliaLang/julia/issues/35516
117109 # if VERSION >= v"1.8-"
118110 # @test haskey(Tangent{Tuple{Float64}}(2.0), 1) == true
515507 @test ∂foo2 == MutableTangent {MFoo} (; x= 3.0 , y= [1.0 , 2.0 ])
516508 end
517509 end
518- end
510+ end
0 commit comments