Skip to content

Problems with assert in function definition #109

Closed
@Alexander-Schiendorfer

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

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