Lyricdev
GitHub

LYR-PAR0008

a parenthesis is missing

error · spec 02-grammar

A ( or ) the construct needs is missing: a call, a grouping, a tuple, a parameter list, a function type, the condition of if or while, a for header, a catch binding, a pattern.

Explanation

Every ( is closed by its ), and the forms that take parentheses — a call, if (…), fn(…) -> T — take both.

Close the parenthesis where its list or condition ends.

Wrong

fn add(a: int, b: int): int {
    return a + b;
}

fn main(): void {
    let n = add(1, 2;
}
fn add(a: int, b: int): int {
    return a + b;
}

fn main(): void {
    let _ = add(1, 2);
}