Lyricdev
GitHub

LYR-RT0008

panic called by the program

panic ยท spec 06-errors

The program called panic(message), or a function of the standard library did on a broken precondition (a negative capacity, a radix outside 2 to 36, a format string with a brace left open). The message is printed as written, with the backtrace; the process exits with 101, or a task ends with the panic as its status.

Program

fn check(n: int): int {
    if (n < 0) {
        panic("negative input");
    }
    return n;
}

fn main(): void {
    assert(check(-1) == 0);
}