Skip to content

Commit 117cf23

Browse files
committed
Use repr
1 parent e746203 commit 117cf23

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

src/dense.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ end
2020
mode(::AutoChainRules) = ForwardOrReverseMode() # specialized in the extension
2121

2222
function Base.show(io::IO, backend::AutoChainRules)
23-
print(io, "AutoChainRules(ruleconfig=$(backend.ruleconfig))")
23+
print(io, "AutoChainRules(ruleconfig=$(repr(backend.ruleconfig, context=io)))")
2424
end
2525

2626
"""
@@ -66,7 +66,7 @@ function Base.show(io::IO, backend::AutoEnzyme)
6666
if isnothing(backend.mode)
6767
print(io, "AutoEnzyme()")
6868
else
69-
print(io, "AutoEnzyme(mode=$(backend.mode))")
69+
print(io, "AutoEnzyme(mode=$(repr(backend.mode, context=io)))")
7070
end
7171
end
7272

@@ -113,13 +113,13 @@ mode(::AutoFiniteDiff) = ForwardMode()
113113
function Base.show(io::IO, backend::AutoFiniteDiff)
114114
s = "AutoFiniteDiff("
115115
if backend.fdtype != Val(:forward)
116-
s *= "fdtype=$(backend.fdtype), "
116+
s *= "fdtype=$(repr(backend.fdtype, context=io)), "
117117
end
118118
if backend.fdjtype != backend.fdtype
119-
s *= "fdjtype=$(backend.fdjtype), "
119+
s *= "fdjtype=$(repr(backend.fdjtype, context=io)), "
120120
end
121121
if backend.fdhtype != Val(:hcentral)
122-
s *= "fdhtype=$(backend.fdhtype), "
122+
s *= "fdhtype=$(repr(backend.fdhtype, context=io)), "
123123
end
124124
if endswith(s, ", ")
125125
s = s[1:(end - 2)]
@@ -150,7 +150,7 @@ end
150150
mode(::AutoFiniteDifferences) = ForwardMode()
151151

152152
function Base.show(io::IO, backend::AutoFiniteDifferences)
153-
print(io, "AutoFiniteDifferences(fdm=$(backend.fdm))")
153+
print(io, "AutoFiniteDifferences(fdm=$(repr(backend.fdm, context=io)))")
154154
end
155155

156156
"""
@@ -188,7 +188,7 @@ function Base.show(io::IO, backend::AutoForwardDiff{chunksize}) where {chunksize
188188
s *= "chunksize=$chunksize, "
189189
end
190190
if backend.tag !== nothing
191-
s *= "tag=$(backend.tag), "
191+
s *= "tag=$(repr(backend.tag, context=io)), "
192192
end
193193
if endswith(s, ", ")
194194
s = s[1:(end - 2)]
@@ -232,7 +232,7 @@ function Base.show(io::IO, backend::AutoPolyesterForwardDiff{chunksize}) where {
232232
s *= "chunksize=$chunksize, "
233233
end
234234
if backend.tag !== nothing
235-
s *= "tag=$(backend.tag), "
235+
s *= "tag=$(repr(backend.tag, context=io)), "
236236
end
237237
if endswith(s, ", ")
238238
s = s[1:(end - 2)]

src/sparse.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,12 +155,12 @@ function AutoSparse(
155155
end
156156

157157
function Base.show(io::IO, backend::AutoSparse)
158-
s = "AutoSparse(dense_ad=$(backend.dense_ad), "
158+
s = "AutoSparse(dense_ad=$(repr(backend.dense_ad, context=io)), "
159159
if backend.sparsity_detector != NoSparsityDetector()
160-
s *= "sparsity_detector=$(backend.sparsity_detector), "
160+
s *= "sparsity_detector=$(repr(backend.sparsity_detector, context=io)), "
161161
end
162162
if backend.coloring_algorithm != NoColoringAlgorithm()
163-
s *= "coloring_algorithm=$(backend.coloring_algorithm)), "
163+
s *= "coloring_algorithm=$(repr(backend.coloring_algorithm, context=io))), "
164164
end
165165
s = s[1:(end - 2)] * ")"
166166
print(io, s)

0 commit comments

Comments
 (0)