Lyricdev
GitHub

LYR-RT0012

unreachable reached

panic · spec 06-errors

Control reached unreachable() or unreachable(message) — a place the program's author held unreachable. The message starts with the word unreachable, followed by the program's own message.

Program

fn name(n: int): string {
    if (n == 0) {
        return "zero";
    }
    if (n == 1) {
        return "one";
    }
    unreachable("n is 0 or 1");
}

fn main(): void {
    assert(name(2) == "two");
}