Skip to content

Commit

Permalink
Fix NamedTuple access for Julia nightly (#64)
Browse files Browse the repository at this point in the history
  • Loading branch information
blegat authored May 28, 2021
1 parent 75a833b commit 15786e2
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/constraint.jl
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,12 @@ function JuMP.build_constraint(_error::Function, p::AbstractPolynomialLike,
# to go to `JuMP.add_constraint`.

# We need to recreate the full list of keyword arguments. `kws` is a
# `Iterators.Pairs, `kws.data` is a `NamedTuple` and `kws.itr` is a
# `Iterators.Pairs, `values(kws)` is a `NamedTuple` and `keys(kws.itr)` is a
# `Tuple`.
all_kws = Iterators.Pairs(merge((domain=domain,), kws.data),
(:domain, kws.itr...))
all_kws = Iterators.Pairs(
merge((domain=domain,), values(kws)),
(:domain, values(kws)...),
)
return Constraint(_error, p, s, all_kws)
else
set = JuMP.moi_set(s, monos; domain=domain, kws...)
Expand Down

0 comments on commit 15786e2

Please sign in to comment.