P0002

Index out of bounds: List.at was given an index below 0 or not below the list's length. Spans the call.

Machine-applicable fix: none.

Example

This program fails with P0002.

fn main() {
    let xs: List<Int> = List.new()
    let first = xs.at(0)
}

Fixed

The same program, fixed.

fn main() {
    let xs: List<Int> = List.new()
    let first = xs.get(0)
}

Listed in the runtime notes. oskac explain P0002 prints this entry offline.

All error codes