diff --git a/Project.toml b/Project.toml index af3c612..07a6b4d 100644 --- a/Project.toml +++ b/Project.toml @@ -8,6 +8,7 @@ MATLAB = "10e44e05-a98a-55b3-a45b-ba969058deb6" ModelingToolkit = "961ee093-0014-501f-94e3-6117800e7a78" PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a" Reexport = "189a3867-3050-52da-a836-e630ba90ab69" +SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462" [compat] DiffEqBase = "6.122, 7" @@ -17,6 +18,7 @@ ParameterizedFunctions = "5" PrecompileTools = "1.1" Reexport = "0.2, 1.0" SafeTestsets = "0.1, 1" +SciMLBase = "3.27" SciMLTesting = "1" Test = "<0.0.1, 1" julia = "1.10" diff --git a/src/MATLABDiffEq.jl b/src/MATLABDiffEq.jl index 12c0c96..120dba5 100644 --- a/src/MATLABDiffEq.jl +++ b/src/MATLABDiffEq.jl @@ -4,6 +4,7 @@ using Reexport @reexport using DiffEqBase using MATLAB, ModelingToolkit using PrecompileTools +import SciMLBase # MATLAB only supports Float64 arrays. Check if a type is MATLAB-compatible. # Note: We specifically accept standard Julia integer types that MATLAB can convert, @@ -52,7 +53,7 @@ else const mtk_states = ModelingToolkit.states end -abstract type MATLABAlgorithm <: DiffEqBase.AbstractODEAlgorithm end +abstract type MATLABAlgorithm <: SciMLBase.AbstractODEAlgorithm end struct ode23 <: MATLABAlgorithm end struct ode45 <: MATLABAlgorithm end struct ode113 <: MATLABAlgorithm end @@ -63,7 +64,7 @@ struct ode15s <: MATLABAlgorithm end struct ode15i <: MATLABAlgorithm end function DiffEqBase.__solve( - prob::DiffEqBase.AbstractODEProblem{uType, tupType, isinplace}, + prob::SciMLBase.AbstractODEProblem{uType, tupType, isinplace}, alg::AlgType, timeseries = [], ts = [], @@ -151,7 +152,7 @@ function DiffEqBase.__solve( stats = buildDEStats(solstats) - return DiffEqBase.build_solution( + return SciMLBase.build_solution( prob, alg, ts, @@ -162,15 +163,15 @@ function DiffEqBase.__solve( end """ - buildDEStats(solverstats::Dict{String, <:Any}) -> DiffEqBase.Stats + buildDEStats(solverstats::Dict{String, <:Any}) -> SciMLBase.DEStats -Convert MATLAB ODE solver statistics dictionary to DiffEqBase.Stats. +Convert MATLAB ODE solver statistics dictionary to SciMLBase.DEStats. The function extracts statistics from the MATLAB solver output and maps them -to the corresponding fields in DiffEqBase.Stats. Missing keys default to 0. +to the corresponding fields in SciMLBase.DEStats. Missing keys default to 0. """ -function buildDEStats(solverstats::Dict{String, <:Any})::DiffEqBase.Stats - destats = DiffEqBase.Stats(0) +function buildDEStats(solverstats::Dict{String, <:Any})::SciMLBase.DEStats + destats = SciMLBase.DEStats(0) destats.nf = Int(get(solverstats, "nfevals", 0)) destats.nreject = Int(get(solverstats, "nfailed", 0)) destats.naccept = Int(get(solverstats, "nsteps", 0)) diff --git a/test/qa/Project.toml b/test/qa/Project.toml index 820e95a..29ce1d4 100644 --- a/test/qa/Project.toml +++ b/test/qa/Project.toml @@ -13,6 +13,6 @@ MATLABDiffEq = {path = "../.."} Aqua = "0.8" JET = "0.9, 0.10, 0.11" SafeTestsets = "0.1, 1" -SciMLTesting = "1" +SciMLTesting = "1.7" Test = "<0.0.1, 1" julia = "1.10" diff --git a/test/qa/qa.jl b/test/qa/qa.jl index a91975a..42e0e84 100644 --- a/test/qa/qa.jl +++ b/test/qa/qa.jl @@ -1,12 +1,29 @@ -using SafeTestsets +using SciMLTesting, MATLABDiffEq, JET, Test -@safetestset "Aqua" begin - using MATLABDiffEq, Aqua - Aqua.test_all(MATLABDiffEq) -end - -@safetestset "JET static analysis" begin - using MATLABDiffEq, JET, Test - rep = JET.report_package(MATLABDiffEq; target_modules = (MATLABDiffEq,)) - @test length(JET.get_reports(rep)) == 0 -end +run_qa( + MATLABDiffEq; + explicit_imports = true, + ei_kwargs = (; + # DiffEqBase.__solve (SciMLBase-owned) is the documented solver extension + # point re-exported by DiffEqBase, and the Symbolics-owned MATLABTarget is + # reached through ModelingToolkit; both are accessed through a re-exporter + # that is not the owner. + all_qualified_accesses_via_owners = (; + ignore = ( + :__solve, :MATLABTarget, + ), + ), + # Still non-public upstream: __solve (SciMLBase) and MATLABTarget + # (Symbolics). Drop once they are declared public. + all_qualified_accesses_are_public = (; + ignore = ( + :__solve, :MATLABTarget, + ), + ), + ), + # no_implicit_imports: the module deliberately `@reexport using DiffEqBase` + # and `using MATLAB`/`ModelingToolkit`/`PrecompileTools`; making every name + # explicit is a large, risky refactor against heavy deps. Tracked in + # https://github.com/SciML/MATLABDiffEq.jl/issues/85 + ei_broken = (:no_implicit_imports,), +)