Skip to content

Commit 9de748d

Browse files
Merge pull request #1100 from SciML/forwardidff_emptykwargs
Handle empty Kwargs case in forwarddiff detection
2 parents c99ae4b + 67d2c8f commit 9de748d

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/forwarddiff.jl

+4-1
Original file line numberDiff line numberDiff line change
@@ -363,11 +363,14 @@ function anyeltypedual(x::NamedTuple, ::Type{Val{counter}} = Val{0}) where {coun
363363
anyeltypedual(values(x))
364364
end
365365

366-
function DiffEqBase.anyeltypedual(
366+
function anyeltypedual(
367367
f::SciMLBase.AbstractSciMLFunction, ::Type{Val{counter}}) where {counter}
368368
Any
369369
end
370370

371+
anyeltypedual(::@Kwargs{}, ::Type{Val{counter}} = Val{0}) where {counter} = Any
372+
anyeltypedual(::Type{@Kwargs{}}, ::Type{Val{counter}} = Val{0}) where {counter} = Any
373+
371374
@inline promote_u0(::Nothing, p, t0) = nothing
372375

373376
@inline function promote_u0(u0, p, t0)

test/forwarddiff_dual_detection.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ for p in p_possibilities_missed
162162
end
163163

164164
p_possibilities_notdual = [
165-
(), (;), [2.0], [2.0, 2], [2.0, (2.0)], [2.0, MyStruct(2.0, 2.0f0)]
165+
(), (;), [2.0], [2.0, 2], [2.0, (2.0)], [2.0, MyStruct(2.0, 2.0f0)], pairs((;))
166166
]
167167

168168
for p in p_possibilities_notdual

0 commit comments

Comments
 (0)