Skip to content

Commit 97517dd

Browse files
add a big warning on mutation of ODEProblem
1 parent bb384b3 commit 97517dd

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/problems/ode_problems.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,16 @@ mutable struct ODEProblem{uType, tType, isinplace, P, F, K, PT} <:
162162
end
163163
TruncatedStacktraces.@truncate_stacktrace ODEProblem 3 1 2
164164

165+
function Base.setproperty!(prob::ODEProblem, s::Symbol, v)
166+
@warn "Mutation of ODEProblem detected. SciMLBase v2.0 has made ODEProblem temporarily mutable in order to allow for interfacing with EnzymeRules due to a current limitation in the rule system. This change is only intended to be temporary and ODEProblem will return to being a struct in a later non-breaking release. Do not rely on this behavior, use with caution."
167+
Base.setfield!(prob, s, v)
168+
end
169+
170+
function Base.setproperty!(prob::ODEProblem, s::Symbol, v, order::Symbol)
171+
@warn "Mutation of ODEProblem detected. SciMLBase v2.0 has made ODEProblem temporarily mutable in order to allow for interfacing with EnzymeRules due to a current limitation in the rule system. This change is only intended to be temporary and ODEProblem will return to being a struct in a later non-breaking release. Do not rely on this behavior, use with caution."
172+
Base.setfield!(prob, s, v, order)
173+
end
174+
165175
"""
166176
ODEProblem(f::ODEFunction,u0,tspan,p=NullParameters(),callback=CallbackSet())
167177

0 commit comments

Comments
 (0)