Skip to content

Commit 4b0c6d0

Browse files
handle tuples in varmap lowering
1 parent 6f0329d commit 4b0c6d0

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/utils.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,8 +277,17 @@ end
277277
function lower_mapnames(umap::AbstractArray{T},name) where {T<:Pair}
278278
T[lower_varname(value(k), name) => value(v) for (k, v) in umap]
279279
end
280+
function lower_mapnames(umap::NTuple{N,T}) where {N,T<:Pair}
281+
ntuple(i->value(umap[i][1]) => value(umap[i][2]),N)
282+
end
283+
function lower_mapnames(umap::NTuple{N,T},name) where {N,T<:Pair}
284+
ntuple(i->lower_varname(value(umap[i][1]), name) => value(umap[i][2]),N)
285+
end
286+
280287
lower_mapnames(umap::AbstractArray{<:Number}) = umap # Ambiguity
281288
lower_mapnames(umap::AbstractArray{<:Number},name) = umap
289+
lower_mapnames(umap::Tuple) = umap
290+
lower_mapnames(umap::Tuple, name) = umap
282291

283292
function flatten_differential(O::Term)
284293
@assert is_derivative(O) "invalid differential: $O"

0 commit comments

Comments
 (0)