Skip to content

Commit 79ff5d0

Browse files
authored
[FileFormats.LP] fix type stability of LP reader (#2843)
1 parent a73c331 commit 79ff5d0

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/FileFormats/LP/read.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -248,8 +248,8 @@ struct _Token
248248
end
249249

250250
"""
251-
mutable struct _LexerState
252-
io::IO
251+
mutable struct _LexerState{O<:IO}
252+
io::O
253253
line::Int
254254
peek_char::Union{Nothing,Char}
255255
peek_tokens::Vector{_Token}
@@ -263,12 +263,12 @@ A struct that is used to manage state when lexing. It stores:
263263
* `peek_char`: the next `Char` in the `io`
264264
* `peek_tokens`: the list of upcoming tokens that we have already peeked
265265
"""
266-
mutable struct _LexerState
267-
io::IO
266+
mutable struct _LexerState{O<:IO}
267+
io::O
268268
line::Int
269269
peek_char::Union{Nothing,Char}
270270
peek_tokens::Vector{_Token}
271-
_LexerState(io::IO) = new(io, 1, nothing, _Token[])
271+
_LexerState(io::IO) = new{typeof(io)}(io, 1, nothing, _Token[])
272272
end
273273

274274
"""

0 commit comments

Comments
 (0)