Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
odow authored Sep 28, 2023
1 parent 892bc1f commit ad43e49
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions docs/src/developers/extensions.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,20 +200,20 @@ julia> model = Model(); @variable(model, x);
julia> function JuMP.parse_constraint_head(
_error::Function,
::Val{:},
::Val{:},
lhs,
rhs,
)
println("Rewriting as ==")
println("Rewriting as ==")
new_lhs, parse_code = MutableArithmetics.rewrite(lhs)
build_code = :(
build_constraint($(_error), $(new_lhs), MOI.EqualTo($(rhs)))
)
return false, parse_code, build_code
end
julia> @constraint(model, x + x 1.0)
Rewriting as ==
julia> @constraint(model, x + x 1.0)
Rewriting as ==
2 x = 1
```

Expand Down
4 changes: 2 additions & 2 deletions test/test_macros.jl
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ end

struct CustomType end

function JuMP.parse_constraint_head(_error::Function, ::Val{:}, lhs, rhs)
function JuMP.parse_constraint_head(_error::Function, ::Val{:}, lhs, rhs)
return false, :(), :(build_constraint($_error, $(esc(lhs)), $(esc(rhs))))
end

Expand Down Expand Up @@ -326,7 +326,7 @@ function test_extension_custom_expression_test(
)
model = ModelType()
@variable(model, x)
@constraint(model, con_ref, x CustomType())
@constraint(model, con_ref, x CustomType())
con = constraint_object(con_ref)
@test jump_function(con) == x
@test moi_set(con) isa CustomSet
Expand Down

0 comments on commit ad43e49

Please sign in to comment.