From d2c757004d9f3cbd4c36fbda11986fa5459b5ce6 Mon Sep 17 00:00:00 2001 From: Aayush Sabharwal Date: Mon, 22 Jul 2024 09:10:13 +0200 Subject: [PATCH] fix: fix `@reset` changing specialization of `ODEFunction` --- src/remake.jl | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/remake.jl b/src/remake.jl index b74697d42..ed227a3a2 100644 --- a/src/remake.jl +++ b/src/remake.jl @@ -125,8 +125,20 @@ function remake(prob::ODEProblem; f = missing, end else _f = prob.f - @reset _f.initializeprob = initializeprob - @reset _f.initializeprobmap = initializeprobmap + if __has_initializeprob(_f) + props = getproperties(_f) + @reset props.initializeprob = initializeprob + props = values(props) + _f = parameterless_type(_f){ + iip, specialization(_f), map(typeof, props)...}(props...) + end + if __has_initializeprobmap(_f) + props = getproperties(_f) + @reset props.initializeprobmap = initializeprobmap + props = values(props) + _f = parameterless_type(_f){ + iip, specialization(_f), map(typeof, props)...}(props...) + end end elseif f isa AbstractODEFunction _f = f