Skip to content

Problems with assert in function definition #109

Description

@Alexander-Schiendorfer

Hi,

I would like to add some assertions to a function that returns "array[int,int] of int" (in reality, an adjacency matrix).

function array[int, int] of int: doSomething(array[int, int] of int: edges) =
assert(true,
"This should work",
edges);

output[ "\(doSomething([| 5, 3, 5 | 1, 2, 3 |]))" ];
solve satisfy;

which does not work and returns:

MiniZinc: type error: no function or predicate with this signature found: `assert(bool,string,array[int,int] of int)'

However, when doing the same with just an int, everything's fine:

function int: doSomething(int: e) =
assert(true,
"This should work",
e);

output[ "\(doSomething(5))" ];
solve satisfy;

Is there a workaround?

Cheers,
Alex

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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