Lyricdev
GitHub

LYR-PAR0031

a parameter or field without ':' before its type

error ยท spec 02-grammar

A function's parameter or a field of a struct, class or variant is named, and no : follows before its type.

Explanation

A parameter and a field are written name: Type. The type is never inferred there, so the colon and the type always stand.

Write : between the name and the type.

Wrong

fn twice(n int): int {
    return n * 2;
}

fn main(): void {
}
fn twice(n: int): int {
    return n * 2;
}

fn main(): void {
    let _ = twice(2);
}