Skip to content

Commit e963131

Browse files
committed
[FileFormats.LP] fix type stability of LP reader
1 parent 0fd8ca7 commit e963131

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
@@ -242,8 +242,8 @@ struct _Token
242242
end
243243

244244
"""
245-
mutable struct _LexerState
246-
io::IO
245+
mutable struct _LexerState{O<:IO}
246+
io::O
247247
line::Int
248248
peek_char::Union{Nothing,Char}
249249
peek_tokens::Vector{_Token}
@@ -257,12 +257,12 @@ A struct that is used to manage state when lexing. It stores:
257257
* `peek_char`: the next `Char` in the `io`
258258
* `peek_tokens`: the list of upcoming tokens that we have already peeked
259259
"""
260-
mutable struct _LexerState
261-
io::IO
260+
mutable struct _LexerState{O<:IO}
261+
io::O
262262
line::Int
263263
peek_char::Union{Nothing,Char}
264264
peek_tokens::Vector{_Token}
265-
_LexerState(io::IO) = new(io, 1, nothing, _Token[])
265+
_LexerState(io::IO) = new{typeof(io)}(io, 1, nothing, _Token[])
266266
end
267267

268268
"""

0 commit comments

Comments
 (0)