E1087: stored value does not fit the element type

View source

Storing into values[i] writes a value of the element type of the array.

Storing into values[i] writes a value of the element type of the array. A value of another type is rejected, because Actus has no implicit conversion. An integer literal is accepted for any integer element type. The message names the element type that the array holds and the type that was found. The error points at the stored value.

Example

actus
verb main() {
    erg values: Array[Int, 4] = Array[Int, 4]();
    values[0] = true;
}

Fix

Store a value of the element type, or change the element type of the array.

actus
verb main() {
    erg values: Array[Int, 4] = Array[Int, 4]();
    values[0] = 1;
}
actus
verb main() {
    erg flags: Array[Bool, 4] = Array[Bool, 4]();
    flags[0] = true;
}

Run actus explain E1087 in your terminal to read this entry offline. Browse Ownership & types or all error codes.