The following is a list of exceptions that may be generated by the predicates described in FlatZinc Exported Predicates and in MiniZinc Exported Predicates when there is an error in the FlatZinc or MiniZinc input.
array[1..2] of int a = [1, 2];
generates the following error (since there must be a colon between
int
and a
):
! Item ending on line 1: ! Syntax error ! expected `:' but found `ident(a)'
The line number indicates the ending line of the item containing the error. Note that this means that the error may be on a preceding line, if the item occupies several lines.
bool : b = false; bool : b = true;
generates the following error:
! Item ending on line 2: ! Consistency error: `b' is already defined ! previous definition of b was `bool : b = false' ! cannot redefine b to `bool : b = true'
bool : b = a;
may generate the following error:
! Item ending on line 2: ! Existence error ! `a' is not defined
Another example, the FlatZinc code:
var int : a; var int : b; constraint distance(a, b, 1);
may generate the following error:
! Item ending on line 4: ! Existence error ! `distance/3' is not defined
var float : f;
generates the following error (since only finite domain integer variables are supported):
! Item ending on line 2: ! Type error ! `f' must be a member of `int'
Another example, the FlatZinc code:
array[1..2] of float : a = [2.1, 3];
generates the following error (since an array of floats cannot contain integers):
! Item ending on line 2: ! Type error ! `3' must be a member of `float'
A type error also occurs when an array index is out of bounds. For example, the FlatZinc code:
array[1..2] of int : a = [1, 2]; int : i = a[3];
generates the following error:
! Item ending on line 3: ! Type error in array index ! index evaluates to 3 but must be in 1..2