Skip to content

Commit

Permalink
fix ambiguity by splitting union
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisRackauckas committed Dec 31, 2023
1 parent cc1960c commit 11ec603
Showing 1 changed file with 24 additions and 3 deletions.
27 changes: 24 additions & 3 deletions ext/PreallocationToolsSymbolicsExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,42 @@ using PreallocationTools
import PreallocationTools: _restructure, get_tmp
using Symbolics, ForwardDiff

function get_tmp(dc::Union{FixedSizeDiffCache,DiffCache}, u::Type{X}) where {T,N, X<: ForwardDiff.Dual{T, Num, N}}
function get_tmp(dc::DiffCache, u::Type{X}) where {T,N, X<: ForwardDiff.Dual{T, Num, N}}
if length(dc.du) > length(dc.any_du)
resize!(dc.any_du, length(dc.du))

Check warning on line 9 in ext/PreallocationToolsSymbolicsExt.jl

View check run for this annotation

Codecov / codecov/patch

ext/PreallocationToolsSymbolicsExt.jl#L7-L9

Added lines #L7 - L9 were not covered by tests
end
_restructure(dc.du, dc.any_du)

Check warning on line 11 in ext/PreallocationToolsSymbolicsExt.jl

View check run for this annotation

Codecov / codecov/patch

ext/PreallocationToolsSymbolicsExt.jl#L11

Added line #L11 was not covered by tests
end

function get_tmp(dc::Union{FixedSizeDiffCache,DiffCache}, u::X) where {T,N, X<: ForwardDiff.Dual{T, Num, N}}
function get_tmp(dc::DiffCache, u::X) where {T,N, X<: ForwardDiff.Dual{T, Num, N}}
if length(dc.du) > length(dc.any_du)
resize!(dc.any_du, length(dc.du))

Check warning on line 16 in ext/PreallocationToolsSymbolicsExt.jl

View check run for this annotation

Codecov / codecov/patch

ext/PreallocationToolsSymbolicsExt.jl#L14-L16

Added lines #L14 - L16 were not covered by tests
end
_restructure(dc.du, dc.any_du)

Check warning on line 18 in ext/PreallocationToolsSymbolicsExt.jl

View check run for this annotation

Codecov / codecov/patch

ext/PreallocationToolsSymbolicsExt.jl#L18

Added line #L18 was not covered by tests
end

function get_tmp(dc::Union{FixedSizeDiffCache,DiffCache}, u::AbstractArray{X}) where {T,N, X<: ForwardDiff.Dual{T, Num, N}}
function get_tmp(dc::DiffCache, u::AbstractArray{X}) where {T,N, X<: ForwardDiff.Dual{T, Num, N}}
if length(dc.du) > length(dc.any_du)
resize!(dc.any_du, length(dc.du))
end
_restructure(dc.du, dc.any_du)
end

function get_tmp(dc::FixedSizeDiffCache, u::Type{X}) where {T,N, X<: ForwardDiff.Dual{T, Num, N}}
if length(dc.du) > length(dc.any_du)
resize!(dc.any_du, length(dc.du))

Check warning on line 30 in ext/PreallocationToolsSymbolicsExt.jl

View check run for this annotation

Codecov / codecov/patch

ext/PreallocationToolsSymbolicsExt.jl#L28-L30

Added lines #L28 - L30 were not covered by tests
end
_restructure(dc.du, dc.any_du)

Check warning on line 32 in ext/PreallocationToolsSymbolicsExt.jl

View check run for this annotation

Codecov / codecov/patch

ext/PreallocationToolsSymbolicsExt.jl#L32

Added line #L32 was not covered by tests
end

function get_tmp(dc::FixedSizeDiffCache, u::X) where {T,N, X<: ForwardDiff.Dual{T, Num, N}}
if length(dc.du) > length(dc.any_du)
resize!(dc.any_du, length(dc.du))

Check warning on line 37 in ext/PreallocationToolsSymbolicsExt.jl

View check run for this annotation

Codecov / codecov/patch

ext/PreallocationToolsSymbolicsExt.jl#L35-L37

Added lines #L35 - L37 were not covered by tests
end
_restructure(dc.du, dc.any_du)

Check warning on line 39 in ext/PreallocationToolsSymbolicsExt.jl

View check run for this annotation

Codecov / codecov/patch

ext/PreallocationToolsSymbolicsExt.jl#L39

Added line #L39 was not covered by tests
end

function get_tmp(dc::FixedSizeDiffCache, u::AbstractArray{X}) where {T,N, X<: ForwardDiff.Dual{T, Num, N}}
if length(dc.du) > length(dc.any_du)
resize!(dc.any_du, length(dc.du))

Check warning on line 44 in ext/PreallocationToolsSymbolicsExt.jl

View check run for this annotation

Codecov / codecov/patch

ext/PreallocationToolsSymbolicsExt.jl#L42-L44

Added lines #L42 - L44 were not covered by tests
end
Expand Down

0 comments on commit 11ec603

Please sign in to comment.