Sorry, I thought by “implemented my own type of sets” you meant a MOI.AbstractSet. Note that JuMP does not intercept Base.in, nor does it rewrite in SecondOrderCone to be something different. It just calls moi_set(SecondOrderCone(), dim) to get the correct MOI set to pass to the solver.
Can you give an actual minimal working example of the set you want to add?
Why is this not sufficient:
add_constraint.(model, x in X)
or even
function add_my_constraint(model, x, set::MyAbstractSetType)
return @constraint(model, x .<= set.x_max)
end
add_my_constraint(model, x, set)
I’d recommend that you don’t (ab)use JuMP’s macro code when writing your own function is simpler to implement and maintain.