In the Inteligen User Guide there is a section on List Assignment. It mentions that when you have a constraint of type list1 == read_only(list2)
the size and the elements of list1
don't get generated. This is means that any constraints on list1.size()
are not enforced.
In your case you're doing kind of the same thing. Even though you don't have read_only(...)
explicitly written, {}
is a constant, so you're basically assigning the empty list to m
. The generator doesn't enforce the last constraint, as the user guide says. To see that this is the case, you can remove the soft
modifier from both constraints and you'll see that you don't get any contradiction error.
If you change the initial constraint (soft m == {}
) to soft m.size() == 0
you get the expected behavior, i.e. the list has 3 elements. This is because you don't do list assignment anymore, so constraints on m.size()
will get enforced.