diff --git a/src/sd.jl b/src/sd.jl index 179fc175239..dae7be1a2c0 100644 --- a/src/sd.jl +++ b/src/sd.jl @@ -814,7 +814,7 @@ function build_constraint( ) return error_fn( "The tuple function $(typeof(f)) is not supported for a set of type " * - "$(typeof(set)). Try concatenating the elements into a vector instead.", + "$(typeof(set)).", ) end diff --git a/src/sets.jl b/src/sets.jl index e16f59c339a..a283cd7a782 100644 --- a/src/sets.jl +++ b/src/sets.jl @@ -51,13 +51,6 @@ function build_constraint( return VectorConstraint(args, moi_set(set, length(args)), shape) end -function build_constraint(error_fn::Function, f::Tuple, set::AbstractVectorSet) - return error_fn( - "The tuple function $(typeof(f)) is not supported for a set of type " * - "$(typeof(set)). Try concatenating the elements into a vector instead.", - ) -end - """ build_constraint( _error::Function, diff --git a/test/test_constraint.jl b/test/test_constraint.jl index 2a57d0da111..055875fa962 100644 --- a/test/test_constraint.jl +++ b/test/test_constraint.jl @@ -1779,14 +1779,23 @@ end function test_tuple_shape_unsupported_error() model = Model() - @variable(model, X[1:2, 1:2]) + @variable(model, t) + @variable(model, x[1:2]) + err = ErrorException( + "In ` @constraint(model, (t,) in MOI.ZeroOne())`: " * + "The tuple function $(Tuple{VariableRef}) is not supported for " * + "a set of type $(MOI.ZeroOne).", + ) + @test_throws_strip err @constraint(model, (t,) in MOI.ZeroOne()) err = ErrorException( - "In `@constraint(model, (X,) in PSDCone())`: " * - "The tuple function Tuple{Matrix{VariableRef}} is not supported for " * - "a set of type PSDCone. Try concatenating the elements into a " * - "vector instead.", + "In `@constraint(model, ((x[1], x[2]),) in MOI.SOS1([1.0, 2.0]))`: " * + "The tuple function $(Tuple{Tuple{VariableRef, VariableRef}}) is not " * + "supported for a set of type $(MOI.SOS1{Float64}).", + ) + @test_throws_strip( + err, + @constraint(model, ((x[1], x[2]),) in MOI.SOS1([1.0, 2.0])), ) - @test_throws_strip err @constraint(model, (X,) in PSDCone()) return end