@@ -213,16 +213,15 @@ print(io::IO, str::MaybeSub{<:Str{<:CSE}}) = (_write(UTF8CSE, io, str) ; nothing
213
213
print (io:: IO , str:: MaybeSub{T} ) where {T<: Str{<:Union{Binary_CSEs,ASCIICSE,UTF8_CSEs}} } =
214
214
(_fastwrite (io, str); nothing )
215
215
216
- function Base. sprint (f:: Function , :: Type{T} , args... ;
217
- context = nothing , sizehint :: Integer = 0 ) where {T <: Union{String, Str} }
216
+ function Base. sprint (f:: Function , :: T , args... ; context = nothing , sizehint :: Integer = 0
217
+ ) where {C <: Union{Binary_CSEs,ASCIICSE,UTF8_CSEs} ,T <: Str{C } }
218
218
s = IOBuffer (sizehint= sizehint)
219
- if context != = nothing
220
- f (IOContext (s, context), args... )
221
- S = get (context, :type , T)
222
- S (resize! (s. data, s. size))
219
+ if context != nothing
220
+ f (context isa Tuple ? IOContext (s, context... ) : IOContext (s, context), args... )
221
+ Str (get (s. dict, :type , C), resize! (s. data, s. size))
223
222
else
224
223
f (s, args... )
225
- T ( resize ! (s. data, s . size ))
224
+ String ( _unsafe_take ! (s))
226
225
end
227
226
end
228
227
0 commit comments