diff --git a/src/remake.jl b/src/remake.jl index 25a02ec98..d14b9d195 100644 --- a/src/remake.jl +++ b/src/remake.jl @@ -229,7 +229,7 @@ function remake(prob::ODEProblem; f = missing, iip = isinplace(prob) - if build_initializeprob == Val{true} || build_initializeprob == true + if build_initializeprob isa Val{true} || build_initializeprob == true if f !== missing && has_initialization_data(f) initialization_data = remake_initialization_data( prob.f.sys, f, u0, tspan[1], p, newu0, newp) diff --git a/test/downstream/initialization.jl b/test/downstream/initialization.jl index c5bbb2a44..6776ccb61 100644 --- a/test/downstream/initialization.jl +++ b/test/downstream/initialization.jl @@ -78,7 +78,6 @@ end @test occursin("Initialization status: OVERDETERMINED", sprint(summary, prob)) end - @testset "CheckInit" begin @testset "ODEProblem" begin function rhs(u, p, t) diff --git a/test/downstream/solution_interface.jl b/test/downstream/solution_interface.jl index b59424dd2..f7b3d6c22 100644 --- a/test/downstream/solution_interface.jl +++ b/test/downstream/solution_interface.jl @@ -349,3 +349,17 @@ end sol = solve(prob) @test sol(0.6, idxs = y) ≈ 2.0 end + +@testset "Type stability of MTK workflow" begin + @variables x(t) + @mtkbuild sys = ODESystem([D(x) ~ 0.0], t; defaults = [x => 0.0]) + prob = ODEProblem(sys, [], (0.0, 1.0)) + @test_nowarn @inferred solve(prob, Tsit5()) + + @parameters α=1 β=1 γ=1 δ=1 + @variables x(t)=1 y(t)=1 + eqs = [D(x) ~ α * x - β * x * y, D(y) ~ -δ * y + γ * x * y] + @named sys = ODESystem(eqs, t) + prob = ODEProblem(complete(sys), [], (0.0, 1)) + @test_nowarn @inferred remake(prob, u0 = prob.u0, p = prob.p) # was Any +end