Skip to content

Commit

Permalink
Merge pull request #1100 from SciML/forwardidff_emptykwargs
Browse files Browse the repository at this point in the history
Handle empty Kwargs case in forwarddiff detection
  • Loading branch information
ChrisRackauckas authored Oct 28, 2024
2 parents c99ae4b + 67d2c8f commit 9de748d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/forwarddiff.jl
Original file line number Diff line number Diff line change
Expand Up @@ -363,11 +363,14 @@ function anyeltypedual(x::NamedTuple, ::Type{Val{counter}} = Val{0}) where {coun
anyeltypedual(values(x))
end

function DiffEqBase.anyeltypedual(
function anyeltypedual(
f::SciMLBase.AbstractSciMLFunction, ::Type{Val{counter}}) where {counter}
Any
end

anyeltypedual(::@Kwargs{}, ::Type{Val{counter}} = Val{0}) where {counter} = Any
anyeltypedual(::Type{@Kwargs{}}, ::Type{Val{counter}} = Val{0}) where {counter} = Any

@inline promote_u0(::Nothing, p, t0) = nothing

@inline function promote_u0(u0, p, t0)
Expand Down
2 changes: 1 addition & 1 deletion test/forwarddiff_dual_detection.jl
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ for p in p_possibilities_missed
end

p_possibilities_notdual = [
(), (;), [2.0], [2.0, 2], [2.0, (2.0)], [2.0, MyStruct(2.0, 2.0f0)]
(), (;), [2.0], [2.0, 2], [2.0, (2.0)], [2.0, MyStruct(2.0, 2.0f0)], pairs((;))
]

for p in p_possibilities_notdual
Expand Down

0 comments on commit 9de748d

Please sign in to comment.