From d6fddc547ac1a611306b33ce07941ad0b5cb85d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Legat?= Date: Sun, 15 Nov 2026 10:53:18 +0100 Subject: [PATCH] [FileFormats.MOF] assert the type of the options of MOF.Model The options are stored in a `Dict{Symbol,Any}` so `get_options` is inferred to return `Any` and every access to an option is dynamically dispatched. Since `write` always calls `get_options`, it is always traced so this isn't needed with tracing but it's an easy fix. --- src/FileFormats/MOF/MOF.jl | 2 +- test/FileFormats/MOF/test_MOF.jl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/FileFormats/MOF/MOF.jl b/src/FileFormats/MOF/MOF.jl index a3e621dae4..2b51c54567 100644 --- a/src/FileFormats/MOF/MOF.jl +++ b/src/FileFormats/MOF/MOF.jl @@ -148,7 +148,7 @@ function Options(; ) end -get_options(m::Model) = get(m.model.ext, :MOF_OPTIONS, Options()) +get_options(m::Model) = get(m.model.ext, :MOF_OPTIONS, Options())::Options """ Model(; diff --git a/test/FileFormats/MOF/test_MOF.jl b/test/FileFormats/MOF/test_MOF.jl index 1c7422ec1e..4303e0f6cc 100644 --- a/test/FileFormats/MOF/test_MOF.jl +++ b/test/FileFormats/MOF/test_MOF.jl @@ -332,7 +332,7 @@ function test_nonempty_model() model, joinpath(@__DIR__, "empty_model.mof.json"), ) - options = MOF.get_options(model) + options = @inferred MOF.get_options(model) @test options.warn MOI.empty!(model) @test MOI.is_empty(model)