Lyricdev
GitHub

LYR-SEM0173

a binding or parameter holds a 'void'

warning · spec 03-types · lint void-binding, group correctness, warn unless said

A local binding is initialized with a void value, or a parameter is declared with type void. Not reported for _, nor in generic code where a type parameter happens to be void.

Explanation

void may be written as a type — it has one value, and ?void, void[] or T = void need it — but a name for that value says nothing.

Call the function for its effect, without the binding; drop a void parameter.

Wrong

fn nothing(): void {
}

fn main(): void {
    let x = nothing();
    return x;
}
fn nothing(): void {
}

fn main(): void {
    nothing();
}