Skip to content

Problem with $T #65

Closed
Closed
@jnmonette

Description

@jnmonette

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions