Skip to content

Commit

Permalink
misc fixes for 0.7
Browse files Browse the repository at this point in the history
  • Loading branch information
mlubin committed Apr 26, 2018
1 parent e252c35 commit 94d39ad
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
9 changes: 7 additions & 2 deletions src/macros.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1078,8 +1078,13 @@ macro variable(args...)
isexpr(_rng, :escape) ||
_error("Internal error 1")
rng = _rng.args[1] # undo escaping
(isexpr(rng,:(:)) && rng.args[1] == 1 && length(rng.args) == 2) ||
_error("Index sets for SDP variables must be ranges of the form 1:N")
if VERSION >= v"0.7-"
(isexpr(rng,:call) && length(rng.args) == 3 && rng.args[1] == :(:) && rng.args[2] == 1) ||
_error("Index sets for SDP variables must be ranges of the form 1:N")
else
(isexpr(rng,:(:)) && rng.args[1] == 1 && length(rng.args) == 2) ||
_error("Index sets for SDP variables must be ranges of the form 1:N")
end
end

if !(lb == -Inf && ub == Inf)
Expand Down
4 changes: 3 additions & 1 deletion src/operators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,9 @@ end
const op_hint = "Are you trying to build a nonlinear problem? Make sure you use @NLconstraint/@NLobjective."
for (func,_) in Calculus.symbolic_derivatives_1arg(), typ in [:Variable,:AffExpr,:QuadExpr]
errstr = "$func is not defined for type $typ. $op_hint"
@eval Base.$(func)(::$typ) = error($errstr)
if isdefined(Base, func)
@eval Base.$(func)(::$typ) = error($errstr)
end
end

*(::T,::S) where {T<:QuadExpr,S<:Union{Variable,AffExpr,QuadExpr}} =
Expand Down

0 comments on commit 94d39ad

Please sign in to comment.