Lyricdev
GitHub

LYR-SEM0014

a call with the wrong number of arguments

error ยท spec 08-expressions

A call gives fewer arguments than the function's required parameters or more than it takes, or a call with named arguments leaves out a parameter that has no default.

Explanation

Every parameter without a default is given an argument; a variadic parameter takes any number of further ones. Named arguments may be reordered, but none of the required parameters may be missing.

Give the missing argument, drop the extra one, or give the parameter a default.

Wrong

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

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

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