libminizinc
libminizinc copied to clipboard
Bug, MiniZinc: type error: ambiguous overloading on return type of function
I think this might be a bug
set of int: X = {1,3,5} diff (2..5 union 1..0);
set of int: Y = {1,3,5} diff (2..5 union {});
output show([X,Y]);
Playground.mzn:2.42-43:
MiniZinc:
type error: ambiguous overloading on return type of function
On playground
Both on edge and latest (2.8.7)
This variant works on Playground:
set of int: emptySet = {};
set of int: X = {1,3,5} diff (2..5 union 1..0);
set of int: Y = {1,3,5} diff (2..5 union emptySet);
output show([X,Y]);
I doubt that 1..0 should be digested as empty set without warning.
This has now been fixed (the fix will be available in the next release). The treatment of 1..0 as the empty set is however completely standard. The a..b operator can be seen as { i | i >= a /\ i <= b}, so it's the empty set whenever a>b.