Skip to content

Commit

Permalink
Merge pull request #241 from KristofferC/kc/show_type
Browse files Browse the repository at this point in the history
stop overloading `show` on `Type`s
  • Loading branch information
staticfloat committed Nov 17, 2023
2 parents 871dea0 + 66a37f9 commit 29057e2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/tangent.jl
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,8 @@ wrapper_name(::Type{<:ZeroBundle}) = "ZeroBundle"
wrapper_name(::Type{<:DNEBundle}) = "DNEBundle"
wrapper_name(::Type{<:AbstractZeroBundle}) = "AbstractZeroBundle"

#=
# These methods cause too many invalidations to be feasible
function Base.show(io::IO, T::Type{<:AbstractZeroBundle{N, B}}) where {N,B}
print(io, wrapper_name(T))
print(io, @isdefined(N) ? "{$N, " : "{N, ")
Expand All @@ -315,6 +317,7 @@ function Base.show(io::IO, T::Type{<:AbstractZeroBundle{N}}) where {N}
print(io, wrapper_name(T))
@isdefined(N) && print(io, "{$N}")
end
=#

function Base.show(io::IO, t::AbstractZeroBundle{N}) where N
print(io, wrapper_name(typeof(t)))
Expand Down
3 changes: 3 additions & 0 deletions test/tangent.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ using Test

@testset "Display" begin
@test repr(ZeroBundle{1}(2.0)) == "ZeroBundle{1}(2.0)"
#=
Overloading of Type printing is disabled for now
@test repr(DNEBundle{1}(getfield)) == "DNEBundle{1}(getfield)"
@test repr(ZeroBundle{1}) == "ZeroBundle{1}"
Expand All @@ -24,6 +26,7 @@ using Test
@test repr((ZeroBundle{N, Float64} where N).body) == "ZeroBundle{N, Float64}"
@test repr(typeof(DNEBundle{1}(getfield))) == "DNEBundle{1, typeof(getfield)}"
=#
end
end

Expand Down

0 comments on commit 29057e2

Please sign in to comment.