From e963131746464a18ad5b9dd86181f02e206698af Mon Sep 17 00:00:00 2001 From: Oscar Dowson Date: Fri, 12 Sep 2025 12:23:38 +1200 Subject: [PATCH] [FileFormats.LP] fix type stability of LP reader --- src/FileFormats/LP/read.jl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/FileFormats/LP/read.jl b/src/FileFormats/LP/read.jl index 950d6561b6..1b8e228618 100644 --- a/src/FileFormats/LP/read.jl +++ b/src/FileFormats/LP/read.jl @@ -242,8 +242,8 @@ struct _Token end """ - mutable struct _LexerState - io::IO + mutable struct _LexerState{O<:IO} + io::O line::Int peek_char::Union{Nothing,Char} peek_tokens::Vector{_Token} @@ -257,12 +257,12 @@ A struct that is used to manage state when lexing. It stores: * `peek_char`: the next `Char` in the `io` * `peek_tokens`: the list of upcoming tokens that we have already peeked """ -mutable struct _LexerState - io::IO +mutable struct _LexerState{O<:IO} + io::O line::Int peek_char::Union{Nothing,Char} peek_tokens::Vector{_Token} - _LexerState(io::IO) = new(io, 1, nothing, _Token[]) + _LexerState(io::IO) = new{typeof(io)}(io, 1, nothing, _Token[]) end """