[JuMP] Build an empty constraint with arbitrary size


I’m trying to build named constraints over arbitrary dimensions using @constraintref e.g.

function build_empty_constraint(constraint_dimensions)
    # e.g. constraint_dimensions = [1:2, 3:4] 
    @constraintref some_constraint[i for i in constraint_dimensions] 
    return None
build_empty_constraint([1:2, 3:4])

I assume this would be the same as saying @constraintref some_constraint[1:2, 3:4] But I get the error:

Syntax error: Expected some_constraint[i for i = constraint_dimensions] to be of form var[...]

Is there any way to avoid this?