Lyricdev
GitHub

LYR-SEM0073

an unreachable statement

warning · spec 07-statements · lint unreachable-code, group unused, warn unless said

A statement follows one that always leaves the block (return, throw, break, continue, a panic) and can never run; reported once per block.

Explanation

Code after a statement that always leaves its block never runs, which usually means the leaving statement or the code after it is in the wrong place.

Remove the dead statements, or move them before the statement that leaves.

Wrong

import std.io { println };

fn main(): void {
    return;
    println("never");
}
import std.io { println };

fn main(): void {
    println("always");
}