libminizinc icon indicating copy to clipboard operation
libminizinc copied to clipboard

Bug, MiniZinc: type error: ambiguous overloading on return type of function

Open CervEdin opened this issue 11 months ago • 1 comments

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)

CervEdin avatar Jan 30 '25 12:01 CervEdin

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.

a1880 avatar Jan 31 '25 12:01 a1880

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.

guidotack avatar Sep 11 '25 06:09 guidotack