Skip to content

Commit 9844d85

Browse files
KristofferCKristofferC
and
KristofferC
authored
make Base.ANSIIterator have a concrete field (#56088)
Avoids the invalidation ``` backedges: 1: superseding sizeof(s::AbstractString) @ Base strings/basic.jl:177 with MethodInstance for sizeof(::AbstractString) (75 children) ``` shown in #56080 (comment). Co-authored-by: KristofferC <[email protected]>
1 parent 1438b15 commit 9844d85

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

base/show.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,13 @@ ncodeunits(c::ANSIDelimiter) = ncodeunits(c.del)
7272
textwidth(::ANSIDelimiter) = 0
7373

7474
# An iterator similar to `pairs(::String)` but whose values are Char or ANSIDelimiter
75-
struct ANSIIterator
76-
captures::RegexMatchIterator
75+
struct ANSIIterator{S}
76+
captures::RegexMatchIterator{S}
7777
end
7878
ANSIIterator(s::AbstractString) = ANSIIterator(eachmatch(ansi_regex, s))
7979

80-
IteratorSize(::Type{ANSIIterator}) = SizeUnknown()
81-
eltype(::Type{ANSIIterator}) = Pair{Int, Union{Char,ANSIDelimiter}}
80+
IteratorSize(::Type{<:ANSIIterator}) = SizeUnknown()
81+
eltype(::Type{<:ANSIIterator}) = Pair{Int, Union{Char,ANSIDelimiter}}
8282
function iterate(I::ANSIIterator, (i, m_st)=(1, iterate(I.captures)))
8383
m_st === nothing && return nothing
8484
m, (j, new_m_st) = m_st

0 commit comments

Comments
 (0)