-
Notifications
You must be signed in to change notification settings - Fork 120
deprecate +
on constraints
#659
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
ec9f484
2034ff9
67e8e90
6512493
2f1e936
880b598
90016a6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -123,3 +123,35 @@ end | |
function ComplexVariable(set::Symbol, sets::Symbol...) | ||
return ComplexVariable((1, 1), set, sets...) | ||
end | ||
|
||
# `+` on constraints | ||
function warn_deprecated_constraint_concatenation() | ||
@warn( | ||
"Concatenating collections of constraints together with `+` or `+=` to produce a new list of constraints is deprecated. Instead, use `vcat` to concatenate collections of constraints.", | ||
maxlog = 1 | ||
) | ||
return | ||
end | ||
ericphanson marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
function Base.:+(x::Array{<:Constraint}, y::Array{<:Constraint}) | ||
warn_deprecated_constraint_concatenation() | ||
return vcat(x, y) | ||
end | ||
|
||
function Base.:+(x::Constraint, y::Constraint) | ||
@warn( | ||
"Adding constraints together (with `+` or `+=`) to produce a list of constraints is deprecated. Instead, construct a list of constraints via `[constraint1, constraint2]`", | ||
maxlog = 1 | ||
) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this need a separate warning? You can still use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought it might be confusing to share an error, since someone doing |
||
return [x, y] | ||
end | ||
|
||
function Base.:+(x::Constraint, y::Array{<:Constraint}) | ||
warn_deprecated_constraint_concatenation() | ||
return vcat(x, y) | ||
end | ||
|
||
function Base.:+(x::Array{<:Constraint}, y::Constraint) | ||
warn_deprecated_constraint_concatenation() | ||
return vcat(x, y) | ||
end | ||
ericphanson marked this conversation as resolved.
Show resolved
Hide resolved
|
Uh oh!
There was an error while loading. Please reload this page.