@@ -213,16 +213,15 @@ print(io::IO, str::MaybeSub{<:Str{<:CSE}}) = (_write(UTF8CSE, io, str) ; nothing
213213print (io:: IO , str:: MaybeSub{T} ) where {T<: Str{<:Union{Binary_CSEs,ASCIICSE,UTF8_CSEs}} } =
214214 (_fastwrite (io, str); nothing )
215215
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 } }
218218 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))
223222 else
224223 f (s, args... )
225- T ( resize ! (s. data, s . size ))
224+ String ( _unsafe_take ! (s))
226225 end
227226end
228227
0 commit comments