Skip to content

Commit

Permalink
Make all tests pass.
Browse files Browse the repository at this point in the history
  • Loading branch information
dourouc05 committed Sep 7, 2019
1 parent c3099f9 commit 9e31bc9
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/macros.jl
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ function parse_ternary_constraint(_error::Function, args...)
_error("Only two-sided rows of the form lb <= expr <= ub or ub >= expr >= lb are supported.")
end

function parse_constraint(_error::Function, ::Val{:comparison}, lb, lsign::Symbol, aff, rsign::Symbol, ub)
function parse_constraint(_error::Function, zer::Val{:comparison}, lb, lsign::Symbol, aff, rsign::Symbol, ub)
(lsign, lvectorized) = _check_vectorized(Val(lsign))
(rsign, rvectorized) = _check_vectorized(Val(rsign))
((vectorized = lvectorized) == rvectorized) || _error("Signs are inconsistently vectorized")
Expand Down Expand Up @@ -627,8 +627,12 @@ function _constraint_macro(args, macro_name::Symbol, parsefun::Function)
if x.head == :(:=)
vectorized = false
parsecode, buildcall = parse_reification_constraint(_error, x)
else
elseif x.head == :comparison
# First dispatch on head, to deal with lb <= x <= ub specifically.
# Do not wrap the first argument in Val, as it is a part of the comparison
# (unlike the normal case, :call:, where it is an operator/function).
vectorized, parsecode, buildcall = parsefun(_error, Val(x.head), x.args...)
else
vectorized, parsecode, buildcall = parsefun(_error, Val(x.head), Val(x.args[1]), x.args[2:end]...)
end

Expand Down

0 comments on commit 9e31bc9

Please sign in to comment.