diff --git a/Project.toml b/Project.toml index 20984db45..93ac93294 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "ChainRulesCore" uuid = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" -version = "1.16.0" +version = "1.17.0" [deps] Compat = "34da2185-b29b-5c13-b0c7-acf172513d20" diff --git a/src/tangent_types/abstract_zero.jl b/src/tangent_types/abstract_zero.jl index 986fc9854..bc1a4239b 100644 --- a/src/tangent_types/abstract_zero.jl +++ b/src/tangent_types/abstract_zero.jl @@ -35,6 +35,8 @@ Base.convert(::Type{T}, x::AbstractZero) where {T<:Number} = zero(T) (::Type{Complex})(x::Real, y::AbstractZero) = Complex(x, false) Base.getindex(z::AbstractZero, args...) = z +Base.getproperty(z::AbstractZero, name::Symbol) = z + Base.view(z::AbstractZero, ind...) = z Base.sum(z::AbstractZero; dims=:) = z diff --git a/test/tangent_types/abstract_zero.jl b/test/tangent_types/abstract_zero.jl index e3d8642e4..390b4887b 100644 --- a/test/tangent_types/abstract_zero.jl +++ b/test/tangent_types/abstract_zero.jl @@ -86,6 +86,8 @@ @test z[1:3] === z @test z[1, 2] === z @test getindex(z) === z + + @test z.foo === z @test first(z) === z @test last(z) === z @@ -134,6 +136,7 @@ @test dne[1:3] === dne @test dne[1, 2] === dne @test getindex(dne) === dne + @test dne.foo === dne end @testset "ambiguities" begin