Closed
Description
The following piece of code cannot be flattened.
include "globals.mzn";
function array[int] of $T: my_row(array [int,int] of $T: x, int: r) =
%function array[int] of int: my_row(array [int,int] of int: x, int: r) =
[x[r,i] | i in index_set_2of2(x)];
constraint all_different(my_row([|1,2|2,3|],1));
solve satisfy;
The error message is
in call 'all_different'
cannot find matching declaration
There is no problem if replacing the "my_row" declaration by the commented line (i.e. instanciating the "$T" to "int").
Note that the problem happens also with the original "row" function.
Note also that the problem happens even if the result of my_row is put in a local array of the proper (int) type inside a let statement.
Metadata
Metadata
Assignees
Labels
No labels