LYR-SEM0119
a named argument that does not fit the parameters
A call's named arguments are wrong: a name no parameter has, a parameter given twice or already set by position, a positional argument or trailing block after a named one, a name for a variadic parameter, or names in a call of a function value.
Explanation
Arguments are given by position first and by name after; a name sets the parameter of that name. A name the function's parameters do not have, a parameter set twice, and a positional argument after a named one have no meaning. A trailing block is a positional argument, so it cannot follow named ones either. The variadic (params) parameter collects the rest and has no name to be given by, and a function value has no declared parameters to name at all.
Correct the name (the message lists the parameters), drop the duplicate, or put the positional arguments first.
Wrong
fn area(width: int, height: int): int { return width * height; }
fn main(): void {
let _ = area(2, 3, width: 4);
}
Right
fn area(width: int, height: int): int { return width * height; }
fn main(): void {
let _ = area(2, height: 3);
}