Skip to content

Commit

Permalink
Add @show_name invocations
Browse files Browse the repository at this point in the history
Also update ConstPolyRing show method
  • Loading branch information
fingolfin committed Oct 30, 2024
1 parent 475eafc commit c3c1cff
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 4 deletions.
9 changes: 7 additions & 2 deletions docs/src/ring_interface.md
Original file line number Diff line number Diff line change
Expand Up @@ -846,8 +846,13 @@ canonical_unit(f::ConstPoly) = canonical_unit(f.c)
# String I/O

function show(io::IO, R::ConstPolyRing)
print(io, "Constant polynomials over ")
show(io, base_ring(R))
@show_name(io, R)
@show_special(io, R)
print(io, "Constant polynomials")
if !is_terse(io)
io = pretty(io)
print(terse(io), "over", Lowercase(), base_ring(p))
end
end

function show(io::IO, f::ConstPoly)
Expand Down
2 changes: 2 additions & 0 deletions src/MatRing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ function show(io::IO, mime::MIME"text/plain", a::MatRing)
end

function show(io::IO, a::MatRing)
@show_name(io, a)
@show_special(io, a)
if is_terse(io)
print(io, "Matrix ring")
else
Expand Down
2 changes: 2 additions & 0 deletions src/Matrix.jl
Original file line number Diff line number Diff line change
Expand Up @@ -791,6 +791,8 @@ function show(io::IO, ::MIME"text/plain", a::MatSpace)
end

function show(io::IO, a::MatSpace)
@show_name(io, a)
@show_special(io, a)
if is_terse(io)
print(io, "Matrix space")
else
Expand Down
2 changes: 2 additions & 0 deletions test/PrettyPrinting-test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,8 @@ end
end

function Base.show(io::IO, R::NewRing)
@show_name(io, R)
@show_special(io, R)
if PrettyPrinting.is_terse(io)
# no nested printing
print(io, "terse printing of newring ")
Expand Down
9 changes: 7 additions & 2 deletions test/algorithms/GenericFunctions-test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,13 @@ canonical_unit(f::ConstPoly) = canonical_unit(f.c)
# String I/O

function show(io::IO, R::ConstPolyRing)
print(io, "Constant polynomials over ")
show(io, base_ring(R))
@show_name(io, R)
@show_special(io, R)
print(io, "Constant polynomials")
if !is_terse(io)
io = pretty(io)
print(terse(io), "over", Lowercase(), base_ring(p))
end
end

function show(io::IO, f::ConstPoly)
Expand Down

0 comments on commit c3c1cff

Please sign in to comment.