Skip to content

Commit cdc2635

Browse files
fix oop return
1 parent 23ead7d commit cdc2635

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/utils.jl

+4-2
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,10 @@ function build_function(rhss, vs, ps, args = (), conv = simplified_expr; constru
5555
end
5656
function $fname(u,p,$(args...))
5757
X = $let_expr
58-
T = $(constructor === nothing ? :(u isa ModelingToolkit.StaticArrays.StaticArray ? ModelingToolkit.StaticArrays.similar_type(typeof(u), eltype(X)) : x->(du=similar(u, eltype(X)); du .= x)) : constructor)
59-
T(X)
58+
T = promote_type(map(typeof,X)...)
59+
convert.(T,X)
60+
construct = $(constructor === nothing ? :(u isa ModelingToolkit.StaticArrays.StaticArray ? ModelingToolkit.StaticArrays.similar_type(typeof(u), eltype(X)) : x->(du=similar(u, T, $(size(rhss)...)); vec(du) .= x; du)) : constructor)
61+
construct(X)
6062
end
6163
end
6264
end

0 commit comments

Comments
 (0)