E1085: constant index outside the array
An index that is a literal can be checked while compiling.
An index that is a literal can be checked while compiling. A literal at or above the capacity, or a negative literal, can never select a slot, so it is rejected instead of trapping when the program runs (ADR-0042). An index that is computed at run time is checked when it executes. The message names the index and the capacity. The error points at the index.
Example
actus
Fix
Use an index below the capacity. The slots of Array[Int, 4] are 0 to 3.
Raise the capacity when the program needs more slots.
actus
Run actus explain E1085 in your terminal to read this entry offline. Browse Ownership & types or all error codes.