libminizinc icon indicating copy to clipboard operation
libminizinc copied to clipboard

Overloading functions causes collision when using record Type-inst

Open CervEdin opened this issue 1 year ago • 1 comments

Take the following simple model.

% Works
test valid(record(int:x): x) = true;
test valid(record(int:y): x) = true;

% Doesn't work
type rx = record(int:x);
type ry = record(int:y);
test valid_tr(ry: x) = true;
test valid_tr(rx: x) = true;

Using type-inst it's not possible to overload a function for different record types.

Behavior seen in 2.7.6 and by the looks of it, also in latest/development.

Here's an example in the MiniZinc playground

CervEdin avatar Mar 11 '24 15:03 CervEdin

Fails with

Playground.mzn:9.1-27:

MiniZinc:
type error: function with the same type already defined in /minizinc/Playground.mzn:8.1-27

Process finished with non-zero exit code 1.

CervEdin avatar Mar 11 '24 15:03 CervEdin