From 1ac273fb06c978bc214a6db8913effcc371c16a4 Mon Sep 17 00:00:00 2001 From: Aayush Sabharwal Date: Wed, 4 Jun 2025 13:55:47 +0530 Subject: [PATCH] fix: handle non-split systems in initial value promotion --- src/systems/nonlinear/initializesystem.jl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/systems/nonlinear/initializesystem.jl b/src/systems/nonlinear/initializesystem.jl index 8812a060ad..4b0086840a 100644 --- a/src/systems/nonlinear/initializesystem.jl +++ b/src/systems/nonlinear/initializesystem.jl @@ -603,6 +603,9 @@ promote_type_with_nothing(::Type{T}, ::SizedVector{0}) where {T} = T function promote_type_with_nothing(::Type{T}, ::AbstractArray{T2}) where {T, T2} promote_type(T, T2) end +function promote_type_with_nothing(::Type{T}, p::MTKParameters) where {T} + promote_type_with_nothing(promote_type_with_nothing(T, p.tunable), p.initials) +end promote_with_nothing(::Type, ::Nothing) = nothing promote_with_nothing(::Type, x::SizedVector{0}) = x @@ -628,8 +631,7 @@ end function promote_u0_p(u0, p, t0) T = Union{} T = promote_type_with_nothing(T, u0) - T = promote_type_with_nothing(T, p.tunable) - T = promote_type_with_nothing(T, p.initials) + T = promote_type_with_nothing(T, p) u0 = promote_with_nothing(T, u0) p = promote_with_nothing(T, p)