|
84 | 84 | @test getindex(Tangent{Tuple{Float64}}(@thunk 2.0^2), 1) == 4.0 |
85 | 85 | @test getproperty(Tangent{Tuple{Float64}}(2.0), 1) == 2.0 |
86 | 86 | @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{}}()) |
89 | 87 |
|
90 | 88 | tang3 = Tangent{Tuple{Float64, String, Vector{Float64}}}(1.0, NoTangent(), @thunk [3.0] .+ 4) |
91 | 89 | @test @inferred(first(tang3)) === tang3[1] === 1.0 |
92 | 90 | @test @inferred(last(tang3)) isa Thunk |
93 | 91 | @test unthunk(last(tang3)) == [7.0] |
94 | | - @test Tuple(@inferred Base.tail(tang3))[1] === NoTangent() |
95 | | - @test Tuple(Base.tail(tang3))[end] isa Thunk |
96 | 92 |
|
97 | 93 | NT = NamedTuple{(:a, :b),Tuple{Float64,Float64}} |
98 | 94 | @test getindex(Tangent{NT}(; a=(@thunk 2.0^2)), :a) == 4.0 |
|
109 | 105 | @test unthunk(first(Tangent{NT}(; a=(@thunk 2.0^2)))) == 4.0 |
110 | 106 | @test last(Tangent{NT}(; a=(@thunk 2.0^2))) isa ZeroTangent |
111 | 107 |
|
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 | | - |
116 | 108 | # TODO: uncomment this once https://github.com/JuliaLang/julia/issues/35516 |
117 | 109 | # if VERSION >= v"1.8-" |
118 | 110 | # @test haskey(Tangent{Tuple{Float64}}(2.0), 1) == true |
|
0 commit comments