Lyricdev
GitHub

LYR-PAR0013

a lambda parameter without a name

error · spec 08-expressions

Where a lambda's parameter name belongs stands something else — a literal, or a reserved word, which is then read as the name it was meant to be.

Explanation

A lambda parameter is a name, with its type after : where it cannot be inferred, or a pattern in parentheses. A reserved word (match, in, type…) is no name.

Write a name that is not a keyword.

Wrong

fn main(): void {
    let f = (match: int) => 1;
}
fn main(): void {
    let f = (m: int) => m;
    let _ = f(1);
}